summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Polyakov <appro@openssl.org>2008-10-28 12:13:52 +0000
committerAndy Polyakov <appro@openssl.org>2008-10-28 12:13:52 +0000
commit436bdcff4ec96d086b9f4e80accb314e4a4514e1 (patch)
treec03fcc73723f5a2e3955ef1b122c3bb47b8e0694
parent27f864e8acd4c495f94363af3074861576af303f (diff)
Harmonize Camellia API with version 1.x.
-rw-r--r--crypto/camellia/camellia.c18
-rw-r--r--crypto/camellia/cmll_locl.h8
-rw-r--r--crypto/camellia/cmll_misc.c4
3 files changed, 23 insertions, 7 deletions
diff --git a/crypto/camellia/camellia.c b/crypto/camellia/camellia.c
index 4d9346ae28..a690f6114c 100644
--- a/crypto/camellia/camellia.c
+++ b/crypto/camellia/camellia.c
@@ -292,7 +292,7 @@ static const u32 Camellia_SBOX[][256] = {
};
/* Key generation constants */
-const u32 SIGMA[] = {
+static const u32 SIGMA[] = {
0xa09e667f, 0x3bcc908b, 0xb67ae858, 0x4caa73b2, 0xc6ef372f, 0xe94f82be,
0x54ff53a5, 0xf1d36f1c, 0x10e527fa, 0xde682d1d, 0xb05688c2, 0xb3e6c1fd
};
@@ -462,7 +462,7 @@ int Camellia_Ekeygen(int keyBitLength, const u8 *rawKey, KEY_TABLE_TYPE k)
*/
}
-void Camellia_EncryptBlock(int grandRounds, const u8 plaintext[],
+void Camellia_EncryptBlock_Rounds(int grandRounds, const u8 plaintext[],
const KEY_TABLE_TYPE keyTable, u8 ciphertext[])
{
register u32 s0,s1,s2,s3;
@@ -504,8 +504,14 @@ void Camellia_EncryptBlock(int grandRounds, const u8 plaintext[],
PUTU32(ciphertext+8, s0);
PUTU32(ciphertext+12,s1);
}
+void Camellia_EncryptBlock(int keyBitLength, const u8 plaintext[],
+ const KEY_TABLE_TYPE keyTable, u8 ciphertext[])
+ {
+ Camellia_EncryptBlock_Rounds(keyBitLength==128?3:4,
+ plaintext,keyTable,ciphertext);
+ }
-void Camellia_DecryptBlock(int grandRounds, const u8 ciphertext[],
+void Camellia_DecryptBlock_Rounds(int grandRounds, const u8 ciphertext[],
const KEY_TABLE_TYPE keyTable, u8 plaintext[])
{
u32 s0,s1,s2,s3;
@@ -547,3 +553,9 @@ void Camellia_DecryptBlock(int grandRounds, const u8 ciphertext[],
PUTU32(plaintext+8, s0);
PUTU32(plaintext+12,s1);
}
+void Camellia_DecryptBlock(int keyBitLength, const u8 plaintext[],
+ const KEY_TABLE_TYPE keyTable, u8 ciphertext[])
+ {
+ Camellia_DecryptBlock_Rounds(keyBitLength==128?3:4,
+ plaintext,keyTable,ciphertext);
+ }
diff --git a/crypto/camellia/cmll_locl.h b/crypto/camellia/cmll_locl.h
index 4ece8763d4..6892a6232a 100644
--- a/crypto/camellia/cmll_locl.h
+++ b/crypto/camellia/cmll_locl.h
@@ -96,8 +96,12 @@ typedef unsigned char u8;
#endif
int Camellia_Ekeygen(int keyBitLength, const u8 *rawKey, KEY_TABLE_TYPE keyTable);
-void Camellia_EncryptBlock(int grandRounds, const u8 plaintext[],
+void Camellia_EncryptBlock_Rounds(int grandRounds, const u8 plaintext[],
const KEY_TABLE_TYPE keyTable, u8 ciphertext[]);
-void Camellia_DecryptBlock(int grandRounds, const u8 ciphertext[],
+void Camellia_DecryptBlock_Rounds(int grandRounds, const u8 ciphertext[],
+ const KEY_TABLE_TYPE keyTable, u8 plaintext[]);
+void Camellia_EncryptBlock(int keyBitLength, const u8 plaintext[],
+ const KEY_TABLE_TYPE keyTable, u8 ciphertext[]);
+void Camellia_DecryptBlock(int keyBitLength, const u8 ciphertext[],
const KEY_TABLE_TYPE keyTable, u8 plaintext[]);
#endif /* #ifndef HEADER_CAMELLIA_LOCL_H */
diff --git a/crypto/camellia/cmll_misc.c b/crypto/camellia/cmll_misc.c
index 9d4dc2a971..f44689124b 100644
--- a/crypto/camellia/cmll_misc.c
+++ b/crypto/camellia/cmll_misc.c
@@ -69,11 +69,11 @@ int Camellia_set_key(const unsigned char *userKey, const int bits,
void Camellia_encrypt(const unsigned char *in, unsigned char *out,
const CAMELLIA_KEY *key)
{
- Camellia_EncryptBlock(key->grand_rounds, in , key->u.rd_key , out);
+ Camellia_EncryptBlock_Rounds(key->grand_rounds, in , key->u.rd_key , out);
}
void Camellia_decrypt(const unsigned char *in, unsigned char *out,
const CAMELLIA_KEY *key)
{
- Camellia_DecryptBlock(key->grand_rounds, in , key->u.rd_key , out);
+ Camellia_DecryptBlock_Rounds(key->grand_rounds, in , key->u.rd_key , out);
}