From: Bernd Edlinger Date: Wed, 21 Feb 2018 14:48:02 +0000 (+0100) Subject: Fix some bugs with the cfb1 bitsize handling X-Git-Tag: OpenSSL_1_0_2o~11 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=c03db40dcfa8b9e0d71837fcc70d1af6b9994cf1;p=oweals%2Fopenssl.git Fix some bugs with the cfb1 bitsize handling Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/5450) --- diff --git a/crypto/evp/e_aes.c b/crypto/evp/e_aes.c index b45b364466..febfe324a3 100644 --- a/crypto/evp/e_aes.c +++ b/crypto/evp/e_aes.c @@ -1089,6 +1089,8 @@ static int aes_cfb1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, CRYPTO_cfb128_1_encrypt(in, out, MAXBITCHUNK * 8, &dat->ks, ctx->iv, &ctx->num, ctx->encrypt, dat->block); len -= MAXBITCHUNK; + out += MAXBITCHUNK; + in += MAXBITCHUNK; } if (len) CRYPTO_cfb128_1_encrypt(in, out, len * 8, &dat->ks, diff --git a/crypto/evp/e_camellia.c b/crypto/evp/e_camellia.c index f273f9c947..ba8fd06df4 100644 --- a/crypto/evp/e_camellia.c +++ b/crypto/evp/e_camellia.c @@ -356,6 +356,8 @@ static int camellia_cfb1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, CRYPTO_cfb128_1_encrypt(in, out, MAXBITCHUNK * 8, &dat->ks, ctx->iv, &ctx->num, ctx->encrypt, dat->block); len -= MAXBITCHUNK; + out += MAXBITCHUNK; + in += MAXBITCHUNK; } if (len) CRYPTO_cfb128_1_encrypt(in, out, len * 8, &dat->ks, diff --git a/crypto/evp/evp_locl.h b/crypto/evp/evp_locl.h index 2bb709a065..003b1e42af 100644 --- a/crypto/evp/evp_locl.h +++ b/crypto/evp/evp_locl.h @@ -116,7 +116,7 @@ static int cname##_cfb##cbits##_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, if (inl=chunk)\ {\ - cprefix##_cfb##cbits##_encrypt(in, out, (long)((cbits==1) && !(ctx->flags & EVP_CIPH_FLAG_LENGTH_BITS) ?inl*8:inl), &((kstruct *)ctx->cipher_data)->ksched, ctx->iv, &ctx->num, ctx->encrypt);\ + cprefix##_cfb##cbits##_encrypt(in, out, (long)((cbits==1) && !(ctx->flags & EVP_CIPH_FLAG_LENGTH_BITS) ?chunk*8:chunk), &((kstruct *)ctx->cipher_data)->ksched, ctx->iv, &ctx->num, ctx->encrypt);\ inl-=chunk;\ in +=chunk;\ out+=chunk;\