Browse Source

Fix camellia_keysize() to not change the keysize if it is correct.

It was rounding 32 down to 24, 24 down to 16, and claiming 16 was invalid.
Patrick Pelletier 14 years ago
parent
commit
65254f65bf
1 changed files with 3 additions and 3 deletions
  1. 3 3
      src/ciphers/camellia.c

+ 3 - 3
src/ciphers/camellia.c

@@ -711,9 +711,9 @@ void camellia_done(symmetric_key *skey) {}
 
 int camellia_keysize(int *keysize)
 {
-   if (*keysize > 32) { *keysize = 32; }
-   else if (*keysize > 24) { *keysize = 24; }
-   else if (*keysize > 16) { *keysize = 16; }
+   if (*keysize >= 32) { *keysize = 32; }
+   else if (*keysize >= 24) { *keysize = 24; }
+   else if (*keysize >= 16) { *keysize = 16; }
    else return CRYPT_INVALID_KEYSIZE;
    return CRYPT_OK;
 }