diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/evp/evp_cipher.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/lib/libcrypto/evp/evp_cipher.c b/src/lib/libcrypto/evp/evp_cipher.c index c3e2cd45f3..81e3f637f5 100644 --- a/src/lib/libcrypto/evp/evp_cipher.c +++ b/src/lib/libcrypto/evp/evp_cipher.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: evp_cipher.c,v 1.14 2024/01/03 09:13:32 tb Exp $ */ | 1 | /* $OpenBSD: evp_cipher.c,v 1.15 2024/01/04 09:47:54 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 | * |
@@ -204,7 +204,8 @@ EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *engine, | |||
204 | 204 | ||
205 | case EVP_CIPH_CBC_MODE: | 205 | case EVP_CIPH_CBC_MODE: |
206 | iv_len = EVP_CIPHER_CTX_iv_length(ctx); | 206 | iv_len = EVP_CIPHER_CTX_iv_length(ctx); |
207 | if (iv_len < 0 || iv_len > sizeof(ctx->oiv)) { | 207 | if (iv_len < 0 || iv_len > sizeof(ctx->oiv) || |
208 | iv_len > sizeof(ctx->iv)) { | ||
208 | EVPerror(EVP_R_IV_TOO_LARGE); | 209 | EVPerror(EVP_R_IV_TOO_LARGE); |
209 | return 0; | 210 | return 0; |
210 | } | 211 | } |
@@ -906,7 +907,7 @@ EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type) | |||
906 | 907 | ||
907 | if (type != NULL) { | 908 | if (type != NULL) { |
908 | l = EVP_CIPHER_CTX_iv_length(ctx); | 909 | l = EVP_CIPHER_CTX_iv_length(ctx); |
909 | if (l < 0 || l > sizeof(ctx->iv)) { | 910 | if (l < 0 || l > sizeof(ctx->oiv) || l > sizeof(ctx->iv)) { |
910 | EVPerror(EVP_R_IV_TOO_LARGE); | 911 | EVPerror(EVP_R_IV_TOO_LARGE); |
911 | return 0; | 912 | return 0; |
912 | } | 913 | } |
@@ -939,7 +940,7 @@ EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type) | |||
939 | 940 | ||
940 | if (type != NULL) { | 941 | if (type != NULL) { |
941 | j = EVP_CIPHER_CTX_iv_length(ctx); | 942 | j = EVP_CIPHER_CTX_iv_length(ctx); |
942 | if (j < 0 || j > sizeof(ctx->iv)) { | 943 | if (j < 0 || j > sizeof(ctx->oiv)) { |
943 | EVPerror(EVP_R_IV_TOO_LARGE); | 944 | EVPerror(EVP_R_IV_TOO_LARGE); |
944 | return 0; | 945 | return 0; |
945 | } | 946 | } |