fixes #135 RC2 min keylen 40bit (was 64bit)

This commit is contained in:
Karel Miko 2017-02-21 20:23:10 +01:00
parent e96a895d0d
commit 344620a0e7
2 changed files with 3 additions and 3 deletions

View File

@ -609,7 +609,7 @@ As of this release the current cipher\_descriptors elements are the following:
\hline \textbf{Name} & \textbf{Descriptor Name} & \textbf{Block Size} & \textbf{Key Range} & \textbf{Rounds} \\
\hline Blowfish & blowfish\_desc & 8 & 8 $\ldots$ 56 & 16 \\
\hline X-Tea & xtea\_desc & 8 & 16 & 32 \\
\hline RC2 & rc2\_desc & 8 & 8 $\ldots$ 128 & 16 \\
\hline RC2 & rc2\_desc & 8 & 5 $\ldots$ 128 & 16 \\
\hline RC5-32/12/b & rc5\_desc & 8 & 8 $\ldots$ 128 & 12 $\ldots$ 24 \\
\hline RC6-32/20/b & rc6\_desc & 16 & 8 $\ldots$ 128 & 20 \\
\hline SAFER+ & saferp\_desc &16 & 16, 24, 32 & 8, 12, 16 \\

View File

@ -77,7 +77,7 @@ int rc2_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_ke
LTC_ARGCHK(key != NULL);
LTC_ARGCHK(skey != NULL);
if (keylen < 8 || keylen > 128) {
if (keylen < 5 || keylen > 128) {
return CRYPT_INVALID_KEYSIZE;
}
@ -345,7 +345,7 @@ void rc2_done(symmetric_key *skey)
int rc2_keysize(int *keysize)
{
LTC_ARGCHK(keysize != NULL);
if (*keysize < 8) {
if (*keysize < 5) {
return CRYPT_INVALID_KEYSIZE;
} else if (*keysize > 128) {
*keysize = 128;