as we encrypt every bit separately we need to loop through the number
authorNils Larsch <nils@openssl.org>
Thu, 20 Apr 2006 13:11:52 +0000 (13:11 +0000)
committerNils Larsch <nils@openssl.org>
Thu, 20 Apr 2006 13:11:52 +0000 (13:11 +0000)
of bits; thanks to Michael McDougall <mmcdouga@saul.cis.upenn.edu>

PR: 1318

crypto/aes/aes_cfb.c
crypto/evp/e_des.c

index 49f0411010c371a0285ca22280a7f1ff1f609fb4..294f746f660eea53f0565329c9065c654a9e58a7 100644 (file)
@@ -202,7 +202,7 @@ void AES_cfb1_encrypt(const unsigned char *in, unsigned char *out,
     assert(*num == 0);
 
     memset(out,0,(length+7)/8);
-    for(n=0 ; n < length ; ++n)
+    for(n=0 ; n < length * 8; ++n)
        {
        c[0]=(in[n/8]&(1 << (7-n%8))) ? 0x80 : 0;
        AES_cfbr_encrypt_block(c,d,1,key,ivec,enc);
index 856323648cd4c69ab3a9cfe66c87db824a7d8827..4136af4bd1fc56cd9f4f6d9d3aab41355893f91f 100644 (file)
@@ -110,7 +110,7 @@ static int des_cfb1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
     unsigned int n;
     unsigned char c[1],d[1];
 
-    for(n=0 ; n < inl ; ++n)
+    for(n=0 ; n < inl * 8; ++n)
        {
        c[0]=(in[n/8]&(1 << (7-n%8))) ? 0x80 : 0;
        DES_cfb_encrypt(c,d,1,1,ctx->cipher_data,(DES_cblock *)ctx->iv,