提交 606a417f 编写于 作者: R Rich Salz 提交者: Dmitry Belyavskiy

Fetch and free cipher and md's

Reviewed-by: NRichard Levitte <levitte@openssl.org>
Reviewed-by: NDmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/14219)
上级 c39352e4
......@@ -270,7 +270,7 @@ int ca_main(int argc, char **argv)
STACK_OF(OPENSSL_STRING) *sigopts = NULL, *vfyopts = NULL;
STACK_OF(X509) *cert_sk = NULL;
X509_CRL *crl = NULL;
const EVP_MD *dgst = NULL;
EVP_MD *dgst = NULL;
char *configfile = default_config_file, *section = NULL;
char *md = NULL, *policy = NULL, *keyfile = NULL;
char *certfile = NULL, *crl_ext = NULL, *crlnumberfile = NULL;
......@@ -795,7 +795,7 @@ end_of_options:
*/
if (def_ret == 2 && def_nid == NID_undef) {
/* The signing algorithm requires there to be no digest */
dgst = EVP_md_null();
dgst = (EVP_MD *)EVP_md_null();
} else if (md == NULL
&& (md = lookup_conf(conf, section, ENV_DEFAULT_MD)) == NULL) {
goto end;
......@@ -1330,6 +1330,7 @@ end_of_options:
sk_OPENSSL_STRING_free(sigopts);
sk_OPENSSL_STRING_free(vfyopts);
EVP_PKEY_free(pkey);
EVP_MD_free(dgst);
X509_free(x509);
X509_CRL_free(crl);
NCONF_free(conf);
......
......@@ -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);
......
......@@ -82,7 +82,7 @@ int crl_main(int argc, char **argv)
X509_LOOKUP *lookup = NULL;
X509_OBJECT *xobj = NULL;
EVP_PKEY *pkey;
const EVP_MD *digest = EVP_sha1();
EVP_MD *digest = (EVP_MD *)EVP_sha1();
char *infile = NULL, *outfile = NULL, *crldiff = NULL, *keyfile = NULL;
char *digestname = NULL;
const char *CAfile = NULL, *CApath = NULL, *CAstore = NULL, *prog;
......@@ -381,6 +381,7 @@ int crl_main(int argc, char **argv)
if (ret != 0)
ERR_print_errors(bio_err);
BIO_free_all(out);
EVP_MD_free(digest);
X509_CRL_free(x);
X509_STORE_CTX_free(ctx);
X509_STORE_free(store);
......
......@@ -99,7 +99,7 @@ int dgst_main(int argc, char **argv)
char *hmac_key = NULL;
char *mac_name = NULL, *digestname = NULL;
char *passinarg = NULL, *passin = NULL;
const EVP_MD *md = NULL;
EVP_MD *md = NULL;
const char *outfile = NULL, *keyfile = NULL, *prog = NULL;
const char *sigfile = NULL;
const char *md_name = NULL;
......@@ -112,7 +112,7 @@ int dgst_main(int argc, char **argv)
struct doall_dgst_digests dec;
buf = app_malloc(BUFSIZE, "I/O buffer");
md = EVP_get_digestbyname(argv[0]);
md = (EVP_MD *)EVP_get_digestbyname(argv[0]);
prog = opt_init(argc, argv, dgst_options);
while ((o = opt_next()) != OPT_EOF) {
......@@ -375,7 +375,7 @@ int dgst_main(int argc, char **argv)
goto end;
}
if (md == NULL)
md = EVP_sha256();
md = (EVP_MD *)EVP_sha256();
if (!EVP_DigestInit_ex(mctx, md, impl)) {
BIO_printf(bio_err, "Error setting digest\n");
ERR_print_errors(bio_err);
......@@ -404,8 +404,9 @@ int dgst_main(int argc, char **argv)
if (md == NULL) {
EVP_MD_CTX *tctx;
BIO_get_md_ctx(bmd, &tctx);
md = EVP_MD_CTX_get0_md(tctx);
md = EVP_MD_CTX_get1_md(tctx);
}
if (md != NULL)
md_name = EVP_MD_name(md);
......@@ -452,6 +453,7 @@ int dgst_main(int argc, char **argv)
BIO_free(in);
OPENSSL_free(passin);
BIO_free_all(out);
EVP_MD_free(md);
EVP_PKEY_free(sigkey);
sk_OPENSSL_STRING_free(sigopts);
sk_OPENSSL_STRING_free(macopts);
......
......@@ -79,7 +79,7 @@ int dsa_main(int argc, char **argv)
BIO *out = NULL;
ENGINE *e = NULL;
EVP_PKEY *pkey = NULL;
const EVP_CIPHER *enc = NULL;
EVP_CIPHER *enc = NULL;
char *infile = NULL, *outfile = NULL, *prog;
char *passin = NULL, *passout = NULL, *passinarg = NULL, *passoutarg = NULL;
OPTION_CHOICE o;
......@@ -289,6 +289,7 @@ int dsa_main(int argc, char **argv)
OSSL_ENCODER_CTX_free(ectx);
BIO_free_all(out);
EVP_PKEY_free(pkey);
EVP_CIPHER_free(enc);
release_engine(e);
OPENSSL_free(passin);
OPENSSL_free(passout);
......
......@@ -69,7 +69,7 @@ int ec_main(int argc, char **argv)
EVP_PKEY *eckey = NULL;
BIO *in = NULL, *out = NULL;
ENGINE *e = NULL;
const EVP_CIPHER *enc = NULL;
EVP_CIPHER *enc = NULL;
char *infile = NULL, *outfile = NULL, *ciphername = NULL, *prog;
char *passin = NULL, *passout = NULL, *passinarg = NULL, *passoutarg = NULL;
OPTION_CHOICE o;
......@@ -279,6 +279,7 @@ end:
BIO_free(in);
BIO_free_all(out);
EVP_PKEY_free(eckey);
EVP_CIPHER_free(enc);
OSSL_ENCODER_CTX_free(ectx);
OSSL_DECODER_CTX_free(dctx);
EVP_PKEY_CTX_free(pctx);
......
......@@ -109,8 +109,8 @@ int enc_main(int argc, char **argv)
BIO *in = NULL, *out = NULL, *b64 = NULL, *benc = NULL, *rbio =
NULL, *wbio = NULL;
EVP_CIPHER_CTX *ctx = NULL;
const EVP_CIPHER *cipher = NULL;
const EVP_MD *dgst = NULL;
EVP_CIPHER *cipher = NULL;
EVP_MD *dgst = NULL;
const char *digestname = NULL;
char *hkey = NULL, *hiv = NULL, *hsalt = NULL, *p;
char *infile = NULL, *outfile = NULL, *prog;
......@@ -314,7 +314,7 @@ int enc_main(int argc, char **argv)
goto opthelp;
}
if (dgst == NULL)
dgst = EVP_sha256();
dgst = (EVP_MD *)EVP_sha256();
if (iter == 0)
iter = 1;
......@@ -633,6 +633,8 @@ int enc_main(int argc, char **argv)
BIO_free_all(out);
BIO_free(benc);
BIO_free(b64);
EVP_MD_free(dgst);
EVP_CIPHER_free(cipher);
#ifdef ZLIB
BIO_free(bzl);
#endif
......
......@@ -56,7 +56,7 @@ int gendsa_main(int argc, char **argv)
BIO *out = NULL, *in = NULL;
EVP_PKEY *pkey = NULL;
EVP_PKEY_CTX *ctx = NULL;
const EVP_CIPHER *enc = NULL;
EVP_CIPHER *enc = NULL;
char *dsaparams = NULL, *ciphername = NULL;
char *outfile = NULL, *passoutarg = NULL, *passout = NULL, *prog;
OPTION_CHOICE o;
......@@ -166,6 +166,7 @@ int gendsa_main(int argc, char **argv)
BIO_free_all(out);
EVP_PKEY_free(pkey);
EVP_PKEY_CTX_free(ctx);
EVP_CIPHER_free(enc);
release_engine(e);
OPENSSL_free(passout);
return ret;
......
......@@ -64,7 +64,7 @@ int genpkey_main(int argc, char **argv)
EVP_PKEY_CTX *ctx = NULL;
char *outfile = NULL, *passarg = NULL, *pass = NULL, *prog, *p;
const char *ciphername = NULL, *paramfile = NULL, *algname = NULL;
const EVP_CIPHER *cipher = NULL;
EVP_CIPHER *cipher = NULL;
OPTION_CHOICE o;
int outformat = FORMAT_PEM, text = 0, ret = 1, rv, do_param = 0;
int private = 0, i, m;
......@@ -234,6 +234,7 @@ int genpkey_main(int argc, char **argv)
sk_OPENSSL_STRING_free(keyopt);
EVP_PKEY_free(pkey);
EVP_PKEY_CTX_free(ctx);
EVP_CIPHER_free(cipher);
BIO_free_all(out);
BIO_free(in);
release_engine(e);
......
......@@ -82,7 +82,7 @@ int genrsa_main(int argc, char **argv)
BIO *out = NULL;
EVP_PKEY *pkey = NULL;
EVP_PKEY_CTX *ctx = NULL;
const EVP_CIPHER *enc = NULL;
EVP_CIPHER *enc = NULL;
int ret = 1, num = DEFBITS, private = 0, primes = DEFPRIMES;
unsigned long f4 = RSA_F4;
char *outfile = NULL, *passoutarg = NULL, *passout = NULL;
......@@ -243,6 +243,7 @@ opthelp:
BN_GENCB_free(cb);
EVP_PKEY_CTX_free(ctx);
EVP_PKEY_free(pkey);
EVP_CIPHER_free(enc);
BIO_free_all(out);
release_engine(eng);
OPENSSL_free(passout);
......
......@@ -366,8 +366,8 @@ int opt_umax(const char *arg, uintmax_t *result);
#endif
int opt_pair(const char *arg, const OPT_PAIR * pairs, int *result);
int opt_string(const char *name, const char **options);
int opt_cipher(const char *name, const EVP_CIPHER **cipherp);
int opt_md(const char *name, const EVP_MD **mdp);
int opt_cipher(const char *name, EVP_CIPHER **cipherp);
int opt_md(const char *name, EVP_MD **mdp);
char *opt_arg(void);
char *opt_flag(void);
char *opt_unknown(void);
......
......@@ -356,9 +356,12 @@ void print_format_error(int format, unsigned long flags)
}
/* Parse a cipher name, put it in *EVP_CIPHER; return 0 on failure, else 1. */
int opt_cipher(const char *name, const EVP_CIPHER **cipherp)
int opt_cipher(const char *name, EVP_CIPHER **cipherp)
{
*cipherp = EVP_get_cipherbyname(name);
*cipherp = EVP_CIPHER_fetch(NULL, name, NULL);
if (*cipherp != NULL)
return 1;
*cipherp = (EVP_CIPHER *)EVP_get_cipherbyname(name);
if (*cipherp != NULL)
return 1;
opt_printf_stderr("%s: Unknown cipher: %s\n", prog, name);
......@@ -368,9 +371,12 @@ int opt_cipher(const char *name, const EVP_CIPHER **cipherp)
/*
* Parse message digest name, put it in *EVP_MD; return 0 on failure, else 1.
*/
int opt_md(const char *name, const EVP_MD **mdp)
int opt_md(const char *name, EVP_MD **mdp)
{
*mdp = EVP_get_digestbyname(name);
*mdp = (EVP_MD *)EVP_get_digestbyname(name);
if (*mdp != NULL)
return 1;
*mdp = EVP_MD_fetch(NULL, name, NULL);
if (*mdp != NULL)
return 1;
opt_printf_stderr("%s: Unknown option or message digest: %s\n", prog,
......
......@@ -203,7 +203,7 @@ const OPTIONS ocsp_options[] = {
int ocsp_main(int argc, char **argv)
{
BIO *acbio = NULL, *cbio = NULL, *derbio = NULL, *out = NULL;
const EVP_MD *cert_id_md = NULL, *rsign_md = NULL;
EVP_MD *cert_id_md = NULL, *rsign_md = NULL;
STACK_OF(OPENSSL_STRING) *rsign_sigopts = NULL;
int trailing_md = 0;
CA_DB *rdb = NULL;
......@@ -218,7 +218,7 @@ int ocsp_main(int argc, char **argv)
STACK_OF(X509) *issuers = NULL;
X509 *issuer = NULL, *cert = NULL;
STACK_OF(X509) *rca_cert = NULL;
const EVP_MD *resp_certid_md = NULL;
EVP_MD *resp_certid_md = NULL;
X509 *signer = NULL, *rsigner = NULL;
X509_STORE *store = NULL;
X509_VERIFY_PARAM *vpm = NULL;
......@@ -418,7 +418,7 @@ int ocsp_main(int argc, char **argv)
if (cert == NULL)
goto end;
if (cert_id_md == NULL)
cert_id_md = EVP_sha1();
cert_id_md = (EVP_MD *)EVP_sha1();
if (!add_ocsp_cert(&req, cert, cert_id_md, issuer, ids))
goto end;
if (!sk_OPENSSL_STRING_push(reqnames, opt_arg()))
......@@ -427,7 +427,7 @@ int ocsp_main(int argc, char **argv)
break;
case OPT_SERIAL:
if (cert_id_md == NULL)
cert_id_md = EVP_sha1();
cert_id_md = (EVP_MD *)EVP_sha1();
if (!add_ocsp_serial(&req, opt_arg(), cert_id_md, issuer, ids))
goto end;
if (!sk_OPENSSL_STRING_push(reqnames, opt_arg()))
......@@ -485,8 +485,7 @@ int ocsp_main(int argc, char **argv)
goto end;
break;
case OPT_RCID:
resp_certid_md = EVP_get_digestbyname(opt_arg());
if (resp_certid_md == NULL)
if (!opt_md(opt_arg(), &resp_certid_md))
goto opthelp;
break;
case OPT_MD:
......@@ -827,6 +826,9 @@ redo_accept:
sk_OPENSSL_STRING_free(rsign_sigopts);
EVP_PKEY_free(key);
EVP_PKEY_free(rkey);
EVP_MD_free(cert_id_md);
EVP_MD_free(rsign_md);
EVP_MD_free(resp_certid_md);
X509_free(cert);
sk_X509_pop_free(issuers, X509_free);
X509_free(rsigner);
......
......@@ -165,8 +165,8 @@ int pkcs12_main(int argc, char **argv)
BIO *in = NULL, *out = NULL;
PKCS12 *p12 = NULL;
STACK_OF(OPENSSL_STRING) *canames = NULL;
const EVP_CIPHER *const default_enc = EVP_aes_256_cbc();
const EVP_CIPHER *enc = default_enc;
EVP_CIPHER *default_enc = (EVP_CIPHER *)EVP_aes_256_cbc();
EVP_CIPHER *enc = (EVP_CIPHER *)default_enc;
OPTION_CHOICE o;
prog = opt_init(argc, argv, pkcs12_options);
......@@ -433,7 +433,7 @@ int pkcs12_main(int argc, char **argv)
if (key_pbe == NID_undef)
key_pbe = NID_pbe_WithSHA1And3_Key_TripleDES_CBC;
if (enc == default_enc)
enc = EVP_des_ede3_cbc();
enc = (EVP_CIPHER *)EVP_des_ede3_cbc();
if (macalg == NULL)
macalg = "sha1";
}
......@@ -501,7 +501,7 @@ int pkcs12_main(int argc, char **argv)
X509 *ee_cert = NULL, *x = NULL;
STACK_OF(X509) *certs = NULL;
STACK_OF(X509) *untrusted_certs = NULL;
const EVP_MD *macmd = NULL;
EVP_MD *macmd = NULL;
unsigned char *catmp = NULL;
int i;
......@@ -679,6 +679,7 @@ int pkcs12_main(int argc, char **argv)
export_end:
EVP_PKEY_free(key);
EVP_MD_free(macmd);
sk_X509_pop_free(certs, X509_free);
sk_X509_pop_free(untrusted_certs, X509_free);
X509_free(ee_cert);
......
......@@ -74,7 +74,7 @@ int pkcs8_main(int argc, char **argv)
EVP_PKEY *pkey = NULL;
PKCS8_PRIV_KEY_INFO *p8inf = NULL;
X509_SIG *p8 = NULL;
const EVP_CIPHER *cipher = NULL;
EVP_CIPHER *cipher = NULL;
char *infile = NULL, *outfile = NULL, *ciphername = NULL;
char *passinarg = NULL, *passoutarg = NULL, *prog;
#ifndef OPENSSL_NO_UI_CONSOLE
......@@ -154,7 +154,7 @@ int pkcs8_main(int argc, char **argv)
goto opthelp;
}
if (cipher == NULL)
cipher = EVP_aes_256_cbc();
cipher = (EVP_CIPHER *)EVP_aes_256_cbc();
break;
case OPT_ITER:
if (!opt_int(opt_arg(), &iter))
......@@ -175,7 +175,7 @@ int pkcs8_main(int argc, char **argv)
scrypt_r = 8;
scrypt_p = 1;
if (cipher == NULL)
cipher = EVP_aes_256_cbc();
cipher = (EVP_CIPHER *)EVP_aes_256_cbc();
break;
case OPT_SCRYPT_N:
if (!opt_long(opt_arg(), &scrypt_N) || scrypt_N <= 0)
......@@ -213,7 +213,7 @@ int pkcs8_main(int argc, char **argv)
}
if ((pbe_nid == -1) && cipher == NULL)
cipher = EVP_aes_256_cbc();
cipher = (EVP_CIPHER *)EVP_aes_256_cbc();
in = bio_open_default(infile, 'r', informat);
if (in == NULL)
......@@ -370,6 +370,7 @@ int pkcs8_main(int argc, char **argv)
X509_SIG_free(p8);
PKCS8_PRIV_KEY_INFO_free(p8inf);
EVP_PKEY_free(pkey);
EVP_CIPHER_free(cipher);
release_engine(e);
BIO_free_all(out);
BIO_free(in);
......
......@@ -71,7 +71,7 @@ int pkey_main(int argc, char **argv)
ENGINE *e = NULL;
EVP_PKEY *pkey = NULL;
EVP_PKEY_CTX *ctx = NULL;
const EVP_CIPHER *cipher = NULL;
EVP_CIPHER *cipher = NULL;
char *infile = NULL, *outfile = NULL, *passin = NULL, *passout = NULL;
char *passinarg = NULL, *passoutarg = NULL, *ciphername = NULL, *prog;
OPTION_CHOICE o;
......@@ -318,6 +318,7 @@ int pkey_main(int argc, char **argv)
ERR_print_errors(bio_err);
EVP_PKEY_CTX_free(ctx);
EVP_PKEY_free(pkey);
EVP_CIPHER_free(cipher);
release_engine(e);
BIO_free_all(out);
BIO_free(in);
......
......@@ -124,6 +124,7 @@ int pkeyutl_main(int argc, char **argv)
STACK_OF(OPENSSL_STRING) *pkeyopts_passin = NULL;
int rawin = 0;
EVP_MD_CTX *mctx = NULL;
EVP_MD *md = NULL;
int filesize = -1;
OSSL_LIB_CTX *libctx = app_get0_libctx();
......@@ -507,6 +508,7 @@ int pkeyutl_main(int argc, char **argv)
end:
EVP_MD_CTX_free(mctx);
EVP_PKEY_CTX_free(ctx);
EVP_MD_free(md);
release_engine(e);
BIO_free(in);
BIO_free_all(out);
......
......@@ -239,8 +239,8 @@ int req_main(int argc, char **argv)
LHASH_OF(OPENSSL_STRING) *addexts = NULL;
X509 *new_x509 = NULL, *CAcert = NULL;
X509_REQ *req = NULL;
const EVP_CIPHER *cipher = NULL;
const EVP_MD *md_alg = NULL, *digest = NULL;
EVP_CIPHER *cipher = NULL;
EVP_MD *md_alg = NULL, *digest = NULL;
int ext_copy = EXT_COPY_UNSET;
BIO *addext_bio = NULL;
char *extensions = NULL;
......@@ -264,7 +264,7 @@ int req_main(int argc, char **argv)
unsigned long chtype = MBSTRING_ASC, reqflag = 0;
#ifndef OPENSSL_NO_DES
cipher = EVP_des_ede3_cbc();
cipher = (EVP_CIPHER *)EVP_des_ede3_cbc();
#endif
prog = opt_init(argc, argv, req_options);
......@@ -1058,6 +1058,8 @@ int req_main(int argc, char **argv)
BIO_free(addext_bio);
BIO_free_all(out);
EVP_PKEY_free(pkey);
EVP_MD_free(md_alg);
EVP_MD_free(digest);
EVP_PKEY_CTX_free(genctx);
sk_OPENSSL_STRING_free(pkeyopts);
sk_OPENSSL_STRING_free(sigopts);
......
......@@ -92,7 +92,7 @@ int rsa_main(int argc, char **argv)
BIO *out = NULL;
EVP_PKEY *pkey = NULL;
EVP_PKEY_CTX *pctx;
const EVP_CIPHER *enc = NULL;
EVP_CIPHER *enc = NULL;
char *infile = NULL, *outfile = NULL, *ciphername = NULL, *prog;
char *passin = NULL, *passout = NULL, *passinarg = NULL, *passoutarg = NULL;
int private = 0;
......@@ -357,6 +357,7 @@ int rsa_main(int argc, char **argv)
release_engine(e);
BIO_free_all(out);
EVP_PKEY_free(pkey);
EVP_CIPHER_free(enc);
OPENSSL_free(passin);
OPENSSL_free(passout);
return ret;
......
......@@ -140,8 +140,8 @@ int smime_main(int argc, char **argv)
X509 *cert = NULL, *recip = NULL, *signer = NULL;
X509_STORE *store = NULL;
X509_VERIFY_PARAM *vpm = NULL;
const EVP_CIPHER *cipher = NULL;
const EVP_MD *sign_md = NULL;
EVP_CIPHER *cipher = NULL;
EVP_MD *sign_md = NULL;
const char *CAfile = NULL, *CApath = NULL, *CAstore = NULL, *prog = NULL;
char *certfile = NULL, *keyfile = NULL, *contfile = NULL;
char *infile = NULL, *outfile = NULL, *signerfile = NULL, *recipfile = NULL;
......@@ -439,7 +439,7 @@ int smime_main(int argc, char **argv)
if (operation == SMIME_ENCRYPT) {
if (cipher == NULL) {
#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;
......@@ -662,6 +662,8 @@ int smime_main(int argc, char **argv)
X509_free(recip);
X509_free(signer);
EVP_PKEY_free(key);
EVP_MD_free(sign_md);
EVP_CIPHER_free(cipher);
PKCS7_free(p7);
release_engine(e);
BIO_free(in);
......
......@@ -83,7 +83,7 @@ int storeutl_main(int argc, char *argv[])
size_t fingerprintlen = 0;
char *alias = NULL, *digestname = NULL;
OSSL_STORE_SEARCH *search = NULL;
const EVP_MD *digest = NULL;
EVP_MD *digest = NULL;
OSSL_LIB_CTX *libctx = app_get0_libctx();
while ((o = opt_next()) != OPT_EOF) {
......@@ -322,6 +322,7 @@ int storeutl_main(int argc, char *argv[])
text, noout, recursive, 0, out, prog, libctx);
end:
EVP_MD_free(digest);
OPENSSL_free(fingerprint);
OPENSSL_free(alias);
ASN1_INTEGER_free(serial);
......
......@@ -168,7 +168,7 @@ int ts_main(int argc, char **argv)
char *in = NULL, *out = NULL, *queryfile = NULL, *passin = NULL;
char *inkey = NULL, *signer = NULL, *chain = NULL, *CApath = NULL;
char *CAstore = NULL;
const EVP_MD *md = NULL;
EVP_MD *md = NULL;
OPTION_CHOICE o, mode = OPT_ERR;
int ret = 1, no_nonce = 0, cert = 0, text = 0;
int vpmtouched = 0;
......@@ -343,6 +343,7 @@ int ts_main(int argc, char **argv)
end:
X509_VERIFY_PARAM_free(vpm);
EVP_MD_free(md);
NCONF_free(conf);
OPENSSL_free(password);
return ret;
......
......@@ -258,7 +258,7 @@ int x509_main(int argc, char **argv)
X509 *x = NULL, *xca = NULL, *issuer_cert;
X509_REQ *req = NULL, *rq = NULL;
X509_STORE *ctx = NULL;
const EVP_MD *digest = NULL;
EVP_MD *digest = NULL;
char *CAkeyfile = NULL, *CAserial = NULL, *pubkeyfile = NULL, *alias = NULL;
char *checkhost = NULL, *checkemail = NULL, *checkip = NULL;
char *ext_names = NULL;
......@@ -1038,6 +1038,7 @@ int x509_main(int argc, char **argv)
EVP_PKEY_free(privkey);
EVP_PKEY_free(CAkey);
EVP_PKEY_free(pubkey);
EVP_MD_free(digest);
sk_OPENSSL_STRING_free(sigopts);
sk_OPENSSL_STRING_free(vfyopts);
X509_REQ_free(rq);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册