From f8296228f1f7d30e8fd7c9188dc90b0211ad8514 Mon Sep 17 00:00:00 2001 From: Nils Larsch Date: Thu, 20 Apr 2006 13:11:52 +0000 Subject: [PATCH] as we encrypt every bit separately we need to loop through the number of bits; thanks to Michael McDougall PR: 1318 --- crypto/aes/aes_cfb.c | 2 +- crypto/evp/e_des.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crypto/aes/aes_cfb.c b/crypto/aes/aes_cfb.c index 49f0411010..294f746f66 100644 --- a/crypto/aes/aes_cfb.c +++ b/crypto/aes/aes_cfb.c @@ -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); diff --git a/crypto/evp/e_des.c b/crypto/evp/e_des.c index 856323648c..4136af4bd1 100644 --- a/crypto/evp/e_des.c +++ b/crypto/evp/e_des.c @@ -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, -- 2.25.1