summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/evp/evp_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/evp/evp_lib.c')
-rw-r--r--src/lib/libcrypto/evp/evp_lib.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/lib/libcrypto/evp/evp_lib.c b/src/lib/libcrypto/evp/evp_lib.c
index 24ce1963df..f4e46aea41 100644
--- a/src/lib/libcrypto/evp/evp_lib.c
+++ b/src/lib/libcrypto/evp/evp_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: evp_lib.c,v 1.27 2023/07/07 19:37:53 beck Exp $ */ 1/* $OpenBSD: evp_lib.c,v 1.28 2023/09/28 11:29:10 tb 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 *
@@ -266,7 +266,20 @@ EVP_CIPHER_iv_length(const EVP_CIPHER *cipher)
266int 266int
267EVP_CIPHER_CTX_iv_length(const EVP_CIPHER_CTX *ctx) 267EVP_CIPHER_CTX_iv_length(const EVP_CIPHER_CTX *ctx)
268{ 268{
269 return ctx->cipher->iv_len; 269 int iv_length = 0;
270
271 if ((ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_IV_LENGTH) == 0)
272 return ctx->cipher->iv_len;
273
274 /*
275 * XXX - sanity would suggest to pass the size of the pointer along,
276 * but unfortunately we have to match the other crowd.
277 */
278 if (EVP_CIPHER_CTX_ctrl((EVP_CIPHER_CTX *)ctx, EVP_CTRL_GET_IVLEN, 0,
279 &iv_length) != 1)
280 return -1;
281
282 return iv_length;
270} 283}
271 284
272unsigned char * 285unsigned char *