summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/evp/e_rc2.c
diff options
context:
space:
mode:
authorjsing <>2022-09-10 17:39:47 +0000
committerjsing <>2022-09-10 17:39:47 +0000
commitde6c106921914263e126f0a65ff53578716ce425 (patch)
tree80e430face99f2837d3b687cded293385ab116a5 /src/lib/libcrypto/evp/e_rc2.c
parentc74f413bd1f193fdb7e8e0864816c61d07d7f523 (diff)
downloadopenbsd-de6c106921914263e126f0a65ff53578716ce425.tar.gz
openbsd-de6c106921914263e126f0a65ff53578716ce425.tar.bz2
openbsd-de6c106921914263e126f0a65ff53578716ce425.zip
Use correct length for EVP CFB mode ciphers.
The BLOCK_CIPHER_* macros contained a bug where the total length is passed to the underlying cipher implementation, rather than the length of the current chunk. Correct this and use the chunk length instead. Should address the remaining issues reported by Coverity. ok tb@
Diffstat (limited to 'src/lib/libcrypto/evp/e_rc2.c')
-rw-r--r--src/lib/libcrypto/evp/e_rc2.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/libcrypto/evp/e_rc2.c b/src/lib/libcrypto/evp/e_rc2.c
index 72e582d5e0..4f92365e7e 100644
--- a/src/lib/libcrypto/evp/e_rc2.c
+++ b/src/lib/libcrypto/evp/e_rc2.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: e_rc2.c,v 1.17 2022/09/04 15:45:25 jsing Exp $ */ 1/* $OpenBSD: e_rc2.c,v 1.18 2022/09/10 17:39:47 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -116,7 +116,7 @@ rc2_cfb64_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *i
116 chunk = inl; 116 chunk = inl;
117 117
118 while (inl && inl >= chunk) { 118 while (inl && inl >= chunk) {
119 RC2_cfb64_encrypt(in, out, (long)inl, &((EVP_RC2_KEY *)ctx->cipher_data)->ks, ctx->iv, &ctx->num, ctx->encrypt); 119 RC2_cfb64_encrypt(in, out, (long)chunk, &((EVP_RC2_KEY *)ctx->cipher_data)->ks, ctx->iv, &ctx->num, ctx->encrypt);
120 inl -= chunk; 120 inl -= chunk;
121 in += chunk; 121 in += chunk;
122 out += chunk; 122 out += chunk;