diff options
author | Rich Salz <rsalz@akamai.com> | 2021-02-17 22:15:27 +0100 |
---|---|---|
committer | Dmitry Belyavskiy <beldmit@gmail.com> | 2021-04-20 10:12:29 +0200 |
commit | 606a417fb2b6ce5d1d112f2f3f710c8085744627 (patch) | |
tree | 332af9e08a75b5f628f6786300d6ee43a816e964 /apps/cms.c | |
parent | Fix compile errors on s390. (diff) | |
download | openssl-606a417fb2b6ce5d1d112f2f3f710c8085744627.tar.xz openssl-606a417fb2b6ce5d1d112f2f3f710c8085744627.zip |
Fetch and free cipher and md's
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/14219)
Diffstat (limited to 'apps/cms.c')
-rw-r--r-- | apps/cms.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/apps/cms.c b/apps/cms.c index 56f0b37bbf..b55e0063dd 100644 --- a/apps/cms.c +++ b/apps/cms.c @@ -276,8 +276,8 @@ int cms_main(int argc, char **argv) CMS_ReceiptRequest *rr = NULL; ENGINE *e = NULL; EVP_PKEY *key = NULL; - const EVP_CIPHER *cipher = NULL, *wrap_cipher = NULL; - const EVP_MD *sign_md = NULL; + EVP_CIPHER *cipher = NULL, *wrap_cipher = NULL; + EVP_MD *sign_md = NULL; STACK_OF(OPENSSL_STRING) *rr_to = NULL, *rr_from = NULL; STACK_OF(OPENSSL_STRING) *sksigners = NULL, *skkeys = NULL; STACK_OF(X509) *encerts = NULL, *other = NULL; @@ -679,17 +679,17 @@ int cms_main(int argc, char **argv) break; case OPT_3DES_WRAP: # ifndef OPENSSL_NO_DES - wrap_cipher = EVP_des_ede3_wrap(); + wrap_cipher = (EVP_CIPHER *)EVP_des_ede3_wrap(); # endif break; case OPT_AES128_WRAP: - wrap_cipher = EVP_aes_128_wrap(); + wrap_cipher = (EVP_CIPHER *)EVP_aes_128_wrap(); break; case OPT_AES192_WRAP: - wrap_cipher = EVP_aes_192_wrap(); + wrap_cipher = (EVP_CIPHER *)EVP_aes_192_wrap(); break; case OPT_AES256_WRAP: - wrap_cipher = EVP_aes_256_wrap(); + wrap_cipher = (EVP_CIPHER *)EVP_aes_256_wrap(); break; case OPT_WRAP: if (!opt_cipher(opt_unknown(), &wrap_cipher)) @@ -803,7 +803,7 @@ int cms_main(int argc, char **argv) if (operation == SMIME_ENCRYPT) { if (!cipher) { # ifndef OPENSSL_NO_DES - cipher = EVP_des_ede3_cbc(); + cipher = (EVP_CIPHER *)EVP_des_ede3_cbc(); # else BIO_printf(bio_err, "No cipher selected\n"); goto end; @@ -1249,6 +1249,9 @@ int cms_main(int argc, char **argv) X509_free(recip); X509_free(signer); EVP_PKEY_free(key); + EVP_CIPHER_free(cipher); + EVP_CIPHER_free(wrap_cipher); + EVP_MD_free(sign_md); CMS_ContentInfo_free(cms); CMS_ContentInfo_free(rcms); release_engine(e); |