summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2019-04-19 16:48:09 +0100
committerMatt Caswell <matt@openssl.org>2019-04-23 10:48:59 +0100
commit33b40a1027bfa6c400f24938093e80579c37586c (patch)
tree38e47643ee85213c660d0ce946210c466ef6129d
parent361ecb1d1a4d6d113a6a9cedcc272d3b09c485bd (diff)
If key or iv is NULL set the respective length to 0
[extended tests] Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de> (Merged from https://github.com/openssl/openssl/pull/8794)
-rw-r--r--crypto/evp/evp_enc.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/crypto/evp/evp_enc.c b/crypto/evp/evp_enc.c
index c2411f496c..676eaabbc4 100644
--- a/crypto/evp/evp_enc.c
+++ b/crypto/evp/evp_enc.c
@@ -243,9 +243,11 @@ int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
return ctx->cipher->einit(ctx->provctx,
key,
- EVP_CIPHER_CTX_key_length(ctx),
+ key == NULL ? 0
+ : EVP_CIPHER_CTX_key_length(ctx),
iv,
- EVP_CIPHER_CTX_iv_length(ctx));
+ iv == NULL ? 0
+ : EVP_CIPHER_CTX_iv_length(ctx));
}
if (ctx->cipher->dinit == NULL) {
@@ -255,9 +257,11 @@ int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
return ctx->cipher->dinit(ctx->provctx,
key,
- EVP_CIPHER_CTX_key_length(ctx),
+ key == NULL ? 0
+ : EVP_CIPHER_CTX_key_length(ctx),
iv,
- EVP_CIPHER_CTX_iv_length(ctx));
+ iv == NULL ? 0
+ : EVP_CIPHER_CTX_iv_length(ctx));
/* TODO(3.0): Remove legacy code below */
legacy: