summaryrefslogtreecommitdiffstats
path: root/crypto/evp/evp_enc.c
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2020-01-08 16:16:22 +0000
committerMatt Caswell <matt@openssl.org>2020-01-20 15:28:39 +0000
commit068489a27f74c5f5a779aef4618e68e46db746d4 (patch)
tree2649e390c4689b560c912ba67b7587d88a331ae1 /crypto/evp/evp_enc.c
parent993ebac9ed38481e4d3795c437d4e98b985c68ce (diff)
Implement the NULL cipher in the default provider
Libssl uses the null cipher in certain situations. It should be converted to a provided cipher. Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/10865)
Diffstat (limited to 'crypto/evp/evp_enc.c')
-rw-r--r--crypto/evp/evp_enc.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/crypto/evp/evp_enc.c b/crypto/evp/evp_enc.c
index 35feec17f6..4687a2b8e4 100644
--- a/crypto/evp/evp_enc.c
+++ b/crypto/evp/evp_enc.c
@@ -142,6 +142,7 @@ int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
if (tmpcipher->prov == NULL) {
switch(tmpcipher->nid) {
+ case NID_undef:
case NID_aes_256_ecb:
case NID_aes_192_ecb:
case NID_aes_128_ecb:
@@ -326,7 +327,10 @@ int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
return 0;
#else
EVP_CIPHER *provciph =
- EVP_CIPHER_fetch(NULL, OBJ_nid2sn(cipher->nid), "");
+ EVP_CIPHER_fetch(NULL,
+ cipher->nid == NID_undef ? "NULL"
+ : OBJ_nid2sn(cipher->nid),
+ "");
if (provciph == NULL) {
EVPerr(EVP_F_EVP_CIPHERINIT_EX, EVP_R_INITIALIZATION_ERROR);