diff options
47 files changed, 181 insertions, 182 deletions
diff --git a/apps/passwd.c b/apps/passwd.c index 70ecb874ef..2a32111e9d 100644 --- a/apps/passwd.c +++ b/apps/passwd.c @@ -322,7 +322,7 @@ static char *md5crypt(const char *passwd, const char *magic, const char *salt) salt_len = strlen(salt_out); assert(salt_len <= 8); - md = EVP_MD_CTX_create(); + md = EVP_MD_CTX_new(); if (md == NULL) return NULL; EVP_DigestInit_ex(md, EVP_md5(), NULL); @@ -332,7 +332,7 @@ static char *md5crypt(const char *passwd, const char *magic, const char *salt) EVP_DigestUpdate(md, "$", 1); EVP_DigestUpdate(md, salt_out, salt_len); - md2 = EVP_MD_CTX_create(); + md2 = EVP_MD_CTX_new(); if (md2 == NULL) return NULL; EVP_DigestInit_ex(md2, EVP_md5(), NULL); @@ -364,8 +364,8 @@ static char *md5crypt(const char *passwd, const char *magic, const char *salt) (i & 1) ? sizeof buf : passwd_len); EVP_DigestFinal_ex(md2, buf, NULL); } - EVP_MD_CTX_destroy(md2); - EVP_MD_CTX_destroy(md); + EVP_MD_CTX_free(md2); + EVP_MD_CTX_free(md); { /* transform buf into output string */ diff --git a/apps/req.c b/apps/req.c index 267a0a025a..c275763932 100644 --- a/apps/req.c +++ b/apps/req.c @@ -1511,7 +1511,7 @@ int do_X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md, STACK_OF(OPENSSL_STRING) *sigopts) { int rv; - EVP_MD_CTX *mctx = EVP_MD_CTX_create(); + EVP_MD_CTX *mctx = EVP_MD_CTX_new(); rv = do_sign_init(mctx, pkey, md, sigopts); /* Note: X509_sign_ctx() calls ASN1_item_sign_ctx(), which destroys @@ -1520,7 +1520,7 @@ int do_X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md, if (rv > 0) rv = X509_sign_ctx(x, mctx); else - EVP_MD_CTX_destroy(mctx); + EVP_MD_CTX_free(mctx); return rv > 0 ? 1 : 0; } @@ -1528,7 +1528,7 @@ int do_X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *md, STACK_OF(OPENSSL_STRING) *sigopts) { int rv; - EVP_MD_CTX *mctx = EVP_MD_CTX_create(); + EVP_MD_CTX *mctx = EVP_MD_CTX_new(); rv = do_sign_init(mctx, pkey, md, sigopts); /* Note: X509_REQ_sign_ctx() calls ASN1_item_sign_ctx(), which destroys * the EVP_MD_CTX we send it, so only destroy it here if the former @@ -1536,7 +1536,7 @@ int do_X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *md, if (rv > 0) rv = X509_REQ_sign_ctx(x, mctx); else - EVP_MD_CTX_destroy(mctx); + EVP_MD_CTX_free(mctx); return rv > 0 ? 1 : 0; } @@ -1544,7 +1544,7 @@ int do_X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md, STACK_OF(OPENSSL_STRING) *sigopts) { int rv; - EVP_MD_CTX *mctx = EVP_MD_CTX_create(); + EVP_MD_CTX *mctx = EVP_MD_CTX_new(); rv = do_sign_init(mctx, pkey, md, sigopts); /* Note: X509_CRL_sign_ctx() calls ASN1_item_sign_ctx(), which destroys * the EVP_MD_CTX we send it, so only destroy it here if the former @@ -1552,6 +1552,6 @@ int do_X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md, if (rv > 0) rv = X509_CRL_sign_ctx(x, mctx); else - EVP_MD_CTX_destroy(mctx); + EVP_MD_CTX_free(mctx); return rv > 0 ? 1 : 0; } @@ -523,7 +523,7 @@ static int create_digest(BIO *input, char *digest, const EVP_MD *md, return 0; if (input) { - EVP_MD_CTX *md_ctx = EVP_MD_CTX_create(); + EVP_MD_CTX *md_ctx = EVP_MD_CTX_new(); unsigned char buffer[4096]; int length; @@ -535,10 +535,10 @@ static int create_digest(BIO *input, char *digest, const EVP_MD *md, EVP_DigestUpdate(md_ctx, buffer, length); } if (!EVP_DigestFinal(md_ctx, *md_value, NULL)) { - EVP_MD_CTX_destroy(md_ctx); + EVP_MD_CTX_free(md_ctx); return 0; } - EVP_MD_CTX_destroy(md_ctx); + EVP_MD_CTX_free(md_ctx); } else { long digest_len; *md_value = string_to_hex(digest, &digest_len); diff --git a/crypto/asn1/a_sign.c b/crypto/asn1/a_sign.c index ee9f66c396..5b5d5b7afc 100644 --- a/crypto/asn1/a_sign.c +++ b/crypto/asn1/a_sign.c @@ -132,7 +132,7 @@ int ASN1_sign(i2d_of_void *i2d, X509_ALGOR *algor1, X509_ALGOR *algor2, ASN1_BIT_STRING *signature, char *data, EVP_PKEY *pkey, const EVP_MD *type) { - EVP_MD_CTX *ctx = EVP_MD_CTX_create(); + EVP_MD_CTX *ctx = EVP_MD_CTX_new(); unsigned char *p, *buf_in = NULL, *buf_out = NULL; int i, inl = 0, outl = 0, outll = 0; X509_ALGOR *a; @@ -205,7 +205,7 @@ int ASN1_sign(i2d_of_void *i2d, X509_ALGOR *algor1, X509_ALGOR *algor2, signature->flags &= ~(ASN1_STRING_FLAG_BITS_LEFT | 0x07); signature->flags |= ASN1_STRING_FLAG_BITS_LEFT; err: - EVP_MD_CTX_destroy(ctx); + EVP_MD_CTX_free(ctx); OPENSSL_clear_free((char *)buf_in, (unsigned int)inl); OPENSSL_clear_free((char *)buf_out, outll); return (outl); @@ -217,14 +217,14 @@ int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2, ASN1_BIT_STRING *signature, void *asn, EVP_PKEY *pkey, const EVP_MD *type) { - EVP_MD_CTX *ctx = EVP_MD_CTX_create(); + EVP_MD_CTX *ctx = EVP_MD_CTX_new(); if (ctx == NULL) { ASN1err(ASN1_F_ASN1_ITEM_SIGN, ERR_R_MALLOC_FAILURE); return 0; } if (!EVP_DigestSignInit(ctx, NULL, type, NULL, pkey)) { - EVP_MD_CTX_destroy(ctx); + EVP_MD_CTX_free(ctx); return 0; } return ASN1_item_sign_ctx(it, algor1, algor2, signature, asn, ctx); @@ -315,7 +315,7 @@ int ASN1_item_sign_ctx(const ASN1_ITEM *it, signature->flags &= ~(ASN1_STRING_FLAG_BITS_LEFT | 0x07); signature->flags |= ASN1_STRING_FLAG_BITS_LEFT; err: - EVP_MD_CTX_destroy(ctx); + EVP_MD_CTX_free(ctx); OPENSSL_clear_free((char *)buf_in, (unsigned int)inl); OPENSSL_clear_free((char *)buf_out, outll); return (outl); diff --git a/crypto/asn1/a_verify.c b/crypto/asn1/a_verify.c index e958cdec87..4acee3eb84 100644 --- a/crypto/asn1/a_verify.c +++ b/crypto/asn1/a_verify.c @@ -77,7 +77,7 @@ int ASN1_verify(i2d_of_void *i2d, X509_ALGOR *a, ASN1_BIT_STRING *signature, char *data, EVP_PKEY *pkey) { - EVP_MD_CTX *ctx = EVP_MD_CTX_create(); + EVP_MD_CTX *ctx = EVP_MD_CTX_new(); const EVP_MD *type; unsigned char *p, *buf_in = NULL; int ret = -1, i, inl; @@ -126,7 +126,7 @@ int ASN1_verify(i2d_of_void *i2d, X509_ALGOR *a, ASN1_BIT_STRING *signature, } ret = 1; err: - EVP_MD_CTX_destroy(ctx); + EVP_MD_CTX_free(ctx); return (ret); } @@ -151,7 +151,7 @@ int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *a, return -1; } - ctx = EVP_MD_CTX_create(); + ctx = EVP_MD_CTX_new(); if (ctx == NULL) { ASN1err(ASN1_F_ASN1_ITEM_VERIFY, ERR_R_MALLOC_FAILURE); goto err; @@ -225,6 +225,6 @@ int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *a, } ret = 1; err: - EVP_MD_CTX_destroy(ctx); + EVP_MD_CTX_free(ctx); return (ret); } diff --git a/crypto/cms/cms_asn1.c b/crypto/cms/cms_asn1.c index 7aafc8dab0..3b9f7b5c5e 100644 --- a/crypto/cms/cms_asn1.c +++ b/crypto/cms/cms_asn1.c @@ -95,7 +95,7 @@ static int cms_si_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, CMS_SignerInfo *si = (CMS_SignerInfo *)*pval; EVP_PKEY_free(si->pkey); X509_free(si->signer); - EVP_MD_CTX_destroy(si->mctx); + EVP_MD_CTX_free(si->mctx); } return 1; } diff --git a/crypto/cms/cms_dd.c b/crypto/cms/cms_dd.c index dcbd5788fa..9ac45b53e2 100644 --- a/crypto/cms/cms_dd.c +++ b/crypto/cms/cms_dd.c @@ -99,7 +99,7 @@ BIO *cms_DigestedData_init_bio(CMS_ContentInfo *cms) int cms_DigestedData_do_final(CMS_ContentInfo *cms, BIO *chain, int verify) { - EVP_MD_CTX *mctx = EVP_MD_CTX_create(); + EVP_MD_CTX *mctx = EVP_MD_CTX_new(); unsigned char md[EVP_MAX_MD_SIZE]; unsigned int mdlen; int r = 0; @@ -137,7 +137,7 @@ int cms_DigestedData_do_final(CMS_ContentInfo *cms, BIO *chain, int verify) } err: - EVP_MD_CTX_destroy(mctx); + EVP_MD_CTX_free(mctx); return r; diff --git a/crypto/cms/cms_sd.c b/crypto/cms/cms_sd.c index 1570fb6fe5..5c39746b3c 100644 --- a/crypto/cms/cms_sd.c +++ b/crypto/cms/cms_sd.c @@ -287,7 +287,7 @@ CMS_SignerInfo *CMS_add1_signer(CMS_ContentInfo *cms, si->pkey = pk; si->signer = signer; - si->mctx = EVP_MD_CTX_create(); + si->mctx = EVP_MD_CTX_new(); si->pctx = NULL; if (si->mctx == NULL) { @@ -576,7 +576,7 @@ ASN1_OCTET_STRING *CMS_SignerInfo_get0_signature(CMS_SignerInfo *si) static int cms_SignerInfo_content_sign(CMS_ContentInfo *cms, CMS_SignerInfo *si, BIO *chain) { - EVP_MD_CTX *mctx = EVP_MD_CTX_create(); + EVP_MD_CTX *mctx = EVP_MD_CTX_new(); int r = 0; EVP_PKEY_CTX *pctx = NULL; @@ -654,7 +654,7 @@ static int cms_SignerInfo_content_sign(CMS_ContentInfo *cms, r = 1; err: - EVP_MD_CTX_destroy(mctx); + EVP_MD_CTX_free(mctx); EVP_PKEY_CTX_free(pctx); return r; @@ -696,7 +696,7 @@ int CMS_SignerInfo_sign(CMS_SignerInfo *si) if (si->pctx) pctx = si->pctx; else { - EVP_MD_CTX_init(mctx); + EVP_MD_CTX_reset(mctx); if (EVP_DigestSignInit(mctx, &pctx, md, NULL, si->pkey) <= 0) goto err; } @@ -728,7 +728,7 @@ int CMS_SignerInfo_sign(CMS_SignerInfo *si) goto err; } - EVP_MD_CTX_init(mctx); + EVP_MD_CTX_reset(mctx); ASN1_STRING_set0(si->signature, abuf, siglen); @@ -736,7 +736,7 @@ int CMS_SignerInfo_sign(CMS_SignerInfo *si) err: OPENSSL_free(abuf); - EVP_MD_CTX_init(mctx); + EVP_MD_CTX_reset(mctx); return 0; } @@ -757,7 +757,7 @@ int CMS_SignerInfo_verify(CMS_SignerInfo *si) if (md == NULL) return -1; if (si->mctx == NULL) - si->mctx = EVP_MD_CTX_create(); + si->mctx = EVP_MD_CTX_new(); mctx = si->mctx; if (EVP_DigestVerifyInit(mctx, &si->pctx, md, NULL, si->pkey) <= 0) goto err; @@ -780,7 +780,7 @@ int CMS_SignerInfo_verify(CMS_SignerInfo *si) if (r <= 0) CMSerr(CMS_F_CMS_SIGNERINFO_VERIFY, CMS_R_VERIFICATION_FAILURE); err: - EVP_MD_CTX_init(mctx); + EVP_MD_CTX_reset(mctx); return r; } @@ -817,7 +817,7 @@ BIO *cms_SignedData_init_bio(CMS_ContentInfo *cms) int CMS_SignerInfo_verify_content(CMS_SignerInfo *si, BIO *chain) { ASN1_OCTET_STRING *os = NULL; - EVP_MD_CTX *mctx = EVP_MD_CTX_create(); + EVP_MD_CTX *mctx = EVP_MD_CTX_new(); EVP_PKEY_CTX *pkctx = NULL; int r = -1; unsigned char mval[EVP_MAX_MD_SIZE]; @@ -886,7 +886,7 @@ int CMS_SignerInfo_verify_content(CMS_SignerInfo *si, BIO *chain) err: EVP_PKEY_CTX_free(pkctx); - EVP_MD_CTX_destroy(mctx); + EVP_MD_CTX_free(mctx); return r; } diff --git a/crypto/dh/dh_kdf.c b/crypto/dh/dh_kdf.c index 35a40bd759..8ce849896c 100644 --- a/crypto/dh/dh_kdf.c +++ b/crypto/dh/dh_kdf.c @@ -152,7 +152,7 @@ int DH_KDF_X9_42(unsigned char *out, size_t outlen, int derlen; if (Zlen > DH_KDF_MAX) return 0; - mctx = EVP_MD_CTX_create(); + mctx = EVP_MD_CTX_new(); if (mctx == NULL) return 0; mdlen = EVP_MD_size(md); @@ -188,7 +188,7 @@ int DH_KDF_X9_42(unsigned char *out, size_t outlen, rv = 1; err: OPENSSL_free(der); - EVP_MD_CTX_destroy(mctx); + EVP_MD_CTX_free(mctx); return rv; } #endif diff --git a/crypto/dsa/dsa_gen.c b/crypto/dsa/dsa_gen.c index f659d081db..d6e36149c7 100644 --- a/crypto/dsa/dsa_gen.c +++ b/crypto/dsa/dsa_gen.c @@ -360,7 +360,7 @@ int dsa_builtin_paramgen2(DSA *ret, size_t L, size_t N, int counter = 0; int r = 0; BN_CTX *ctx = NULL; - EVP_MD_CTX *mctx = EVP_MD_CTX_create(); + EVP_MD_CTX *mctx = EVP_MD_CTX_new(); unsigned int h = 2; if (mctx == NULL) @@ -640,7 +640,7 @@ int dsa_builtin_paramgen2(DSA *ret, size_t L, size_t N, BN_CTX_end(ctx); BN_CTX_free(ctx); BN_MONT_CTX_free(mont); - EVP_MD_CTX_destroy(mctx); + EVP_MD_CTX_free(mctx); return ok; } diff --git a/crypto/ecdh/ech_kdf.c b/crypto/ecdh/ech_kdf.c index d856b7f5ed..cbcbfd9ea4 100644 --- a/crypto/ecdh/ech_kdf.c +++ b/crypto/ecdh/ech_kdf.c @@ -72,7 +72,7 @@ int ECDH_KDF_X9_62(unsigned char *out, size_t outlen, if (sinfolen > ECDH_KDF_MAX || outlen > ECDH_KDF_MAX || Zlen > ECDH_KDF_MAX) return 0; - mctx = EVP_MD_CTX_create(); + mctx = EVP_MD_CTX_new(); if (mctx == NULL) return 0; mdlen = EVP_MD_size(md); @@ -106,6 +106,6 @@ int ECDH_KDF_X9_62(unsigned char *out, size_t outlen, } rv = 1; err: - EVP_MD_CTX_destroy(mctx); + EVP_MD_CTX_free(mctx); return rv; } diff --git a/crypto/evp/bio_md.c b/crypto/evp/bio_md.c index 381ca599a7..24c7dc3bea 100644 --- a/crypto/evp/bio_md.c +++ b/crypto/evp/bio_md.c @@ -100,7 +100,7 @@ static int md_new(BIO *bi) { EVP_MD_CTX *ctx; - ctx = EVP_MD_CTX_create(); + ctx = EVP_MD_CTX_new(); if (ctx == NULL) return (0); @@ -114,7 +114,7 @@ static int md_free(BIO *a) { if (a == NULL) return (0); - EVP_MD_CTX_destroy(a->ptr); + EVP_MD_CTX_free(a->ptr); a->ptr = NULL; a->init = 0; a->flags = 0; diff --git a/crypto/evp/bio_ok.c b/crypto/evp/bio_ok.c index 49105bd83c..5f3f2dea9f 100644 --- a/crypto/evp/bio_ok.c +++ b/crypto/evp/bio_ok.c @@ -183,7 +183,7 @@ static int ok_new(BIO *bi) ctx->cont = 1; ctx->sigio = 1; - ctx->md = EVP_MD_CTX_create(); + ctx->md = EVP_MD_CTX_new(); bi->init = 0; bi->ptr = (char *)ctx; bi->flags = 0; @@ -194,7 +194,7 @@ static int ok_free(BIO *a) { if (a == NULL) return (0); - EVP_MD_CTX_destroy(((BIO_OK_CTX *)a->ptr)->md); + EVP_MD_CTX_free(((BIO_OK_CTX *)a->ptr)->md); OPENSSL_clear_free(a->ptr, sizeof(BIO_OK_CTX)); a->ptr = NULL; a->init = 0; diff --git a/crypto/evp/digest.c b/crypto/evp/digest.c index 0b1af6f3c6..5da0e01039 100644 --- a/crypto/evp/digest.c +++ b/crypto/evp/digest.c @@ -345,7 +345,7 @@ int EVP_Digest(const void *data, size_t count, unsigned char *md, unsigned int *size, const EVP_MD *type, ENGINE *impl) { - EVP_MD_CTX *ctx = EVP_MD_CTX_create(); + EVP_MD_CTX *ctx = EVP_MD_CTX_new(); int ret; if (ctx == NULL) @@ -354,7 +354,7 @@ int EVP_Digest(const void *data, size_t count, ret = EVP_DigestInit_ex(ctx, type, impl) && EVP_DigestUpdate(ctx, data, count) && EVP_DigestFinal_ex(ctx, md, size); - EVP_MD_CTX_destroy(ctx); + EVP_MD_CTX_free(ctx); return ret; } diff --git a/crypto/evp/evp_key.c b/crypto/evp/evp_key.c index 231c06b86e..65f038138e 100644 --- a/crypto/evp/evp_key.c +++ b/crypto/evp/evp_key.c @@ -136,7 +136,7 @@ int EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md, if (data == NULL) return (nkey); - c = EVP_MD_CTX_create(); + c = EVP_MD_CTX_new(); if (c == NULL) goto err; for (;;) { @@ -191,7 +191,7 @@ int EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md, } rv = type->key_len; err: - EVP_MD_CTX_destroy(c); + EVP_MD_CTX_free(c); OPENSSL_cleanse(md_buf, sizeof(md_buf)); return rv; } diff --git a/crypto/evp/m_sigver.c b/crypto/evp/m_sigver.c index b21000f864..067d330144 100644 --- a/crypto/evp/m_sigver.c +++ b/crypto/evp/m_sigver.c @@ -158,7 +158,7 @@ int EVP_DigestSignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, else r = EVP_DigestFinal_ex(ctx, md, &mdlen); } else { - EVP_MD_CTX *tmp_ctx = EVP_MD_CTX_create(); + EVP_MD_CTX *tmp_ctx = EVP_MD_CTX_new(); if (tmp_ctx == NULL || !EVP_MD_CTX_copy_ex(tmp_ctx, ctx)) return 0; if (sctx) @@ -166,7 +166,7 @@ int EVP_DigestSignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, sigret, siglen, tmp_ctx); else r = EVP_DigestFinal_ex(tmp_ctx, md, &mdlen); - EVP_MD_CTX_destroy(tmp_ctx); + EVP_MD_CTX_free(tmp_ctx); } if (sctx || !r) return r; @@ -203,7 +203,7 @@ int EVP_DigestVerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sig, } else r = EVP_DigestFinal_ex(ctx, md, &mdlen); } else { - EVP_MD_CTX *tmp_ctx = EVP_MD_CTX_create(); + EVP_MD_CTX *tmp_ctx = EVP_MD_CTX_new(); if (tmp_ctx == NULL || !EVP_MD_CTX_copy_ex(tmp_ctx, ctx)) return -1; if (vctx) { @@ -211,7 +211,7 @@ int EVP_DigestVerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sig, sig, siglen, tmp_ctx); } else r = EVP_DigestFinal_ex(tmp_ctx, md, &mdlen); - EVP_MD_CTX_destroy(tmp_ctx); + EVP_MD_CTX_free(tmp_ctx); } if (vctx || !r) return r; diff --git a/crypto/evp/p5_crpt.c b/crypto/evp/p5_crpt.c index 26bf048989..d27d83f7ee 100644 --- a/crypto/evp/p5_crpt.c +++ b/crypto/evp/p5_crpt.c @@ -110,7 +110,7 @@ int PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *cctx, const char *pass, int passlen, else if (passlen == -1) passlen = strlen(pass); - ctx = EVP_MD_CTX_create(); + ctx = EVP_MD_CTX_new(); if (ctx == NULL) { EVPerr(EVP_F_PKCS5_PBE_KEYIVGEN, ERR_R_MALLOC_FAILURE); goto err; @@ -148,6 +148,6 @@ int PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *cctx, const char *pass, int passlen, OPENSSL_cleanse(iv, EVP_MAX_IV_LENGTH); rv = 1; err: - EVP_MD_CTX_destroy(ctx); + EVP_MD_CTX_free(ctx); return rv; } diff --git a/crypto/evp/p_sign.c b/crypto/evp/p_sign.c index 8ddb89f69e..c5e479e8bd 100644 --- a/crypto/evp/p_sign.c +++ b/crypto/evp/p_sign.c @@ -78,7 +78,7 @@ int EVP_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, goto err; } else { int rv = 0; - EVP_MD_CTX *tmp_ctx = EVP_MD_CTX_create(); + EVP_MD_CTX *tmp_ctx = EVP_MD_CTX_new(); if (tmp_ctx == NULL) { EVPerr(EVP_F_EVP_SIGNFINAL, ERR_R_MALLOC_FAILURE); return 0; @@ -86,7 +86,7 @@ int EVP_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, rv = EVP_MD_CTX_copy_ex(tmp_ctx, ctx); if (rv) rv = EVP_DigestFinal_ex(tmp_ctx, m, &m_len); - EVP_MD_CTX_destroy(tmp_ctx); + EVP_MD_CTX_free(tmp_ctx); if (!rv) return 0; } diff --git a/crypto/evp/p_verify.c b/crypto/evp/p_verify.c index c2328f2293..32ec0de121 100644 --- a/crypto/evp/p_verify.c +++ b/crypto/evp/p_verify.c @@ -76,7 +76,7 @@ int EVP_VerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sigbuf, goto err; } else { int rv = 0; - EVP_MD_CTX *tmp_ctx = EVP_MD_CTX_create(); + EVP_MD_CTX *tmp_ctx = EVP_MD_CTX_new(); if (tmp_ctx == NULL) { EVPerr(EVP_F_EVP_VERIFYFINAL, ERR_R_MALLOC_FAILURE); return 0; @@ -84,7 +84,7 @@ int EVP_VerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sigbuf, rv = EVP_MD_CTX_copy_ex(tmp_ctx, ctx); if (rv) rv = EVP_DigestFinal_ex(tmp_ctx, m, &m_len); - EVP_MD_CTX_destroy(tmp_ctx); + EVP_MD_CTX_free(tmp_ctx); if (!rv) return 0; } diff --git a/crypto/hmac/hmac.c b/crypto/hmac/hmac.c index 6d1aaf845f..2fe5119385 100644 --- a/crypto/hmac/hmac.c +++ b/crypto/hmac/hmac.c @@ -182,9 +182,9 @@ HMAC_CTX *HMAC_CTX_new(void) static void hmac_ctx_cleanup(HMAC_CTX *ctx) { - EVP_MD_CTX_init(ctx->i_ctx); - EVP_MD_CTX_init(ctx->o_ctx); - EVP_MD_CTX_init(ctx->md_ctx); + EVP_MD_CTX_reset(ctx->i_ctx); + EVP_MD_CTX_reset(ctx->o_ctx); + EVP_MD_CTX_reset(ctx->md_ctx); ctx->md = NULL; ctx->key_length = 0; memset(ctx->key, 0, sizeof(HMAC_MAX_MD_CBLOCK)); @@ -194,9 +194,9 @@ void HMAC_CTX_free(HMAC_CTX *ctx) { if (ctx != NULL) { hmac_ctx_cleanup(ctx); - EVP_MD_CTX_destroy(ctx->i_ctx); - EVP_MD_CTX_destroy(ctx->o_ctx); - EVP_MD_CTX_destroy(ctx->md_ctx); + EVP_MD_CTX_free(ctx->i_ctx); + EVP_MD_CTX_free(ctx->o_ctx); + EVP_MD_CTX_free(ctx->md_ctx); OPENSSL_free(ctx); } } @@ -205,15 +205,15 @@ int HMAC_CTX_init(HMAC_CTX *ctx) { hmac_ctx_cleanup(ctx); if (ctx->i_ctx == NULL) - ctx->i_ctx = EVP_MD_CTX_create(); + ctx->i_ctx = EVP_MD_CTX_new(); if (ctx->i_ctx == NULL) goto err; if (ctx->o_ctx == NULL) - ctx->o_ctx = EVP_MD_CTX_create(); + ctx->o_ctx = EVP_MD_CTX_new(); if (ctx->o_ctx == NULL) goto err; if (ctx->md_ctx == NULL) - ctx->md_ctx = EVP_MD_CTX_create(); + ctx->md_ctx = EVP_MD_CTX_new(); if (ctx->md_ctx == NULL) goto err; ctx->md = NULL; diff --git a/crypto/pem/pem_seal.c b/crypto/pem/pem_seal.c index 5d9c5975fe..d0db777832 100644 --- a/crypto/pem/pem_seal.c +++ b/crypto/pem/pem_seal.c @@ -93,7 +93,7 @@ int PEM_SealInit(PEM_ENCODE_SEAL_CTX *ctx, EVP_CIPHER *type, EVP_MD *md_type, EVP_EncodeInit(&ctx->encode); |