From 344620a0e74775fde51c57e76b5cd315b35c12d1 Mon Sep 17 00:00:00 2001 From: Karel Miko Date: Tue, 21 Feb 2017 20:23:10 +0100 Subject: [PATCH] fixes #135 RC2 min keylen 40bit (was 64bit) --- crypt.tex | 2 +- src/ciphers/rc2.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crypt.tex b/crypt.tex index 7e854a7..041baac 100644 --- a/crypt.tex +++ b/crypt.tex @@ -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 \\ diff --git a/src/ciphers/rc2.c b/src/ciphers/rc2.c index a778535..2520b83 100644 --- a/src/ciphers/rc2.c +++ b/src/ciphers/rc2.c @@ -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;