浏览代码

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

Karel Miko 8 年之前
父节点
当前提交
344620a0e7
共有 2 个文件被更改,包括 3 次插入3 次删除
  1. 1 1
      crypt.tex
  2. 2 2
      src/ciphers/rc2.c

+ 1 - 1
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 \\

+ 2 - 2
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;