summaryrefslogtreecommitdiff
path: root/lib/libcrypto/evp/e_cast.c
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2022-09-10 17:39:48 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2022-09-10 17:39:48 +0000
commite9abc577442a31d502290ecaa43c56cda942d780 (patch)
treecfef5b47027b268f14031991aaab976458b071b9 /lib/libcrypto/evp/e_cast.c
parentc17c9e0ede20475e4356366fc3d28e12bd8e2d2a (diff)
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 'lib/libcrypto/evp/e_cast.c')
-rw-r--r--lib/libcrypto/evp/e_cast.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libcrypto/evp/e_cast.c b/lib/libcrypto/evp/e_cast.c
index e654962c756..f5654d9f3e1 100644
--- a/lib/libcrypto/evp/e_cast.c
+++ b/lib/libcrypto/evp/e_cast.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: e_cast.c,v 1.11 2022/09/04 15:45:25 jsing Exp $ */
+/* $OpenBSD: e_cast.c,v 1.12 2022/09/10 17:39:47 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -114,7 +114,7 @@ cast5_cfb64_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char
chunk = inl;
while (inl && inl >= chunk) {
- CAST_cfb64_encrypt(in, out, (long)inl, &((EVP_CAST_KEY *)ctx->cipher_data)->ks, ctx->iv, &ctx->num, ctx->encrypt);
+ CAST_cfb64_encrypt(in, out, (long)chunk, &((EVP_CAST_KEY *)ctx->cipher_data)->ks, ctx->iv, &ctx->num, ctx->encrypt);
inl -= chunk;
in += chunk;
out += chunk;