diff options
author | Richard Levitte <levitte@openssl.org> | 2015-12-02 00:49:35 +0100 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2015-12-07 17:40:20 +0100 |
commit | bfb0641f932490c2e7fb5f9f7cb4a88017a5abfa (patch) | |
tree | 6b6b0a9dfe55b4b3a2e5961ed1778dd156128f35 /crypto | |
parent | 959ed5316c84d0e12ad18acfd40cefe15603ddfb (diff) |
Cleanup: fix all sources that used EVP_MD_CTX_(create|init|destroy)
Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/asn1/a_sign.c | 10 | ||||
-rw-r--r-- | crypto/asn1/a_verify.c | 8 | ||||
-rw-r--r-- | crypto/cms/cms_asn1.c | 2 | ||||
-rw-r--r-- | crypto/cms/cms_dd.c | 4 | ||||
-rw-r--r-- | crypto/cms/cms_sd.c | 20 | ||||
-rw-r--r-- | crypto/dh/dh_kdf.c | 4 | ||||
-rw-r--r-- | crypto/dsa/dsa_gen.c | 4 | ||||
-rw-r--r-- | crypto/ecdh/ech_kdf.c | 4 | ||||
-rw-r--r-- | crypto/evp/bio_md.c | 4 | ||||
-rw-r--r-- | crypto/evp/bio_ok.c | 4 | ||||
-rw-r--r-- | crypto/evp/digest.c | 4 | ||||
-rw-r--r-- | crypto/evp/evp_key.c | 4 | ||||
-rw-r--r-- | crypto/evp/m_sigver.c | 8 | ||||
-rw-r--r-- | crypto/evp/p5_crpt.c | 4 | ||||
-rw-r--r-- | crypto/evp/p_sign.c | 4 | ||||
-rw-r--r-- | crypto/evp/p_verify.c | 4 | ||||
-rw-r--r-- | crypto/hmac/hmac.c | 18 | ||||
-rw-r--r-- | crypto/pem/pem_seal.c | 4 | ||||
-rw-r--r-- | crypto/pem/pvkfmt.c | 4 | ||||
-rw-r--r-- | crypto/pkcs12/p12_key.c | 4 | ||||
-rw-r--r-- | crypto/pkcs7/pk7_doit.c | 14 | ||||
-rw-r--r-- | crypto/rand/md_rand.c | 12 | ||||
-rw-r--r-- | crypto/rsa/rsa_oaep.c | 4 | ||||
-rw-r--r-- | crypto/rsa/rsa_pss.c | 8 | ||||
-rw-r--r-- | crypto/srp/srp_lib.c | 12 | ||||
-rw-r--r-- | crypto/srp/srp_vfy.c | 6 | ||||
-rw-r--r-- | crypto/ts/ts_rsp_verify.c | 6 | ||||
-rw-r--r-- | crypto/x509/x509_cmp.c | 8 |
28 files changed, 96 insertions, 96 deletions
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); - ctx->md = EVP_MD_CTX_create(); + ctx->md = EVP_MD_CTX_new(); if (!EVP_SignInit(ctx->md, md_type)) goto err; @@ -178,7 +178,7 @@ int PEM_SealFinal(PEM_ENCODE_SEAL_CTX *ctx, unsigned char *sig, int *sigl, ret = 1; err: - EVP_MD_CTX_destroy(ctx->md); + EVP_MD_CTX_free(ctx->md); EVP_CIPHER_CTX_cleanup(&ctx->cipher); OPENSSL_free(s); return (ret); diff --git a/crypto/pem/pvkfmt.c b/crypto/pem/pvkfmt.c index f062728932..c95967cae1 100644 --- a/crypto/pem/pvkfmt.c +++ b/crypto/pem/pvkfmt.c @@ -650,7 +650,7 @@ static int derive_pvk_key(unsigned char *key, const unsigned char *salt, unsigned int saltlen, const unsigned char *pass, int passlen) { - EVP_MD_CTX *mctx = EVP_MD_CTX_create();; + EVP_MD_CTX *mctx = EVP_MD_CTX_new();; int rv = 1; if (mctx == NULL || !EVP_DigestInit_ex(mctx, EVP_sha1(), NULL) @@ -659,7 +659,7 @@ static int derive_pvk_key(unsigned char *key, || !EVP_DigestFinal_ex(mctx, key, NULL)) rv = 0; - EVP_MD_CTX_destroy(mctx); + EVP_MD_CTX_free(mctx); return rv; } diff --git a/crypto/pkcs12/p12_key.c b/crypto/pkcs12/p12_key.c index a561d16198..3efdd4a5c4 100644 --- a/crypto/pkcs12/p12_key.c +++ b/crypto/pkcs12/p12_key.c @@ -115,7 +115,7 @@ int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt, int tmpn = n; #endif - ctx = EVP_MD_CTX_create(); + ctx = EVP_MD_CTX_new(); if (ctx == NULL) goto err; @@ -218,7 +218,7 @@ int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt, OPENSSL_free(I); BN_free(Ij); BN_free(Bpl1); - EVP_MD_CTX_destroy(ctx); + EVP_MD_CTX_free(ctx); return ret; } diff --git a/crypto/pkcs7/pk7_doit.c b/crypto/pkcs7/pk7_doit.c index c5ac2fac90..91864dceae 100644 --- a/crypto/pkcs7/pk7_doit.c +++ b/crypto/pkcs7/pk7_doit.c @@ -707,7 +707,7 @@ int PKCS7_dataFinal(PKCS7 *p7, BIO *bio) return 0; } - ctx_tmp = EVP_MD_CTX_create(); + ctx_tmp = EVP_MD_CTX_new(); if (ctx_tmp == NULL) { PKCS7err(PKCS7_F_PKCS7_DATAFINAL, ERR_R_MALLOC_FAILURE); return 0; @@ -854,7 +854,7 @@ int PKCS7_dataFinal(PKCS7 *p7, BIO *bio) } ret = 1; err: - EVP_MD_CTX_destroy(ctx_tmp); + EVP_MD_CTX_free(ctx_tmp); return (ret); } @@ -871,7 +871,7 @@ int PKCS7_SIGNER_INFO_sign(PKCS7_SIGNER_INFO *si) if (md == NULL) return 0; - mctx = EVP_MD_CTX_create(); + mctx = EVP_MD_CTX_new(); if (mctx == NULL) { PKCS7err(PKCS7_F_PKCS7_SIGNER_INFO_SIGN, ERR_R_MALLOC_FAILURE); goto err; @@ -908,7 +908,7 @@ int PKCS7_SIGNER_INFO_sign(PKCS7_SIGNER_INFO *si) goto err; } - EVP_MD_CTX_destroy(mctx); + EVP_MD_CTX_free(mctx); ASN1_STRING_set0(si->enc_digest, abuf, siglen); @@ -916,7 +916,7 @@ int PKCS7_SIGNER_INFO_sign(PKCS7_SIGNER_INFO *si) err: OPENSSL_free(abuf); - EVP_MD_CTX_destroy(mctx); + EVP_MD_CTX_free(mctx); return 0; } @@ -989,7 +989,7 @@ int PKCS7_signatureVerify(BIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si, BIO *btmp; EVP_PKEY *pkey; - mdc_tmp = EVP_MD_CTX_create(); + mdc_tmp = EVP_MD_CTX_new(); if (mdc_tmp == NULL) { PKCS7err(PKCS7_F_PKCS7_SIGNATUREVERIFY, ERR_R_MALLOC_FAILURE); goto err; @@ -1087,7 +1087,7 @@ int PKCS7_signatureVerify(BIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si, } ret = 1; err: - EVP_MD_CTX_destroy(mdc_tmp); + EVP_MD_CTX_free(mdc_tmp); return (ret); } diff --git a/crypto/rand/md_rand.c b/crypto/rand/md_rand.c index ec42fc29f0..c2dfce419a 100644 --- a/crypto/rand/md_rand.c +++ b/crypto/rand/md_rand.c @@ -234,7 +234,7 @@ static int rand_add(const void *buf, int num, double add) * hash function. */ - m = EVP_MD_CTX_create(); + m = EVP_MD_CTX_new(); if (m == NULL) goto err; @@ -355,7 +355,7 @@ static int rand_add(const void *buf, int num, double add) #endif rv = 1; err: - EVP_MD_CTX_destroy(m); + EVP_MD_CTX_free(m); return rv; } @@ -412,7 +412,7 @@ static int rand_bytes(unsigned char *buf, int num, int pseudo) if (num <= 0) return 1; - m = EVP_MD_CTX_create(); + m = EVP_MD_CTX_new(); if (m == NULL) goto err_mem; @@ -600,7 +600,7 @@ static int rand_bytes(unsigned char *buf, int num, int pseudo) ASYNC_unblock_pause(); CRYPTO_w_unlock(CRYPTO_LOCK_RAND); - EVP_MD_CTX_destroy(m); + EVP_MD_CTX_free(m); if (ok) return (1); else if (pseudo) @@ -613,11 +613,11 @@ static int rand_bytes(unsigned char *buf, int num, int pseudo) } err: RANDerr(RAND_F_RAND_BYTES, ERR_R_EVP_LIB); - EVP_MD_CTX_destroy(m); + EVP_MD_CTX_free(m); return 0; err_mem: RANDerr(RAND_F_RAND_BYTES, ERR_R_MALLOC_FAILURE); - EVP_MD_CTX_destroy(m); + EVP_MD_CTX_free(m); return 0; } diff --git a/crypto/rsa/rsa_oaep.c b/crypto/rsa/rsa_oaep.c index 0f742f9969..0ad1ef3208 100644 --- a/crypto/rsa/rsa_oaep.c +++ b/crypto/rsa/rsa_oaep.c @@ -242,7 +242,7 @@ int PKCS1_MGF1(unsigned char *mask, long len, { long i, outlen = 0; unsigned char cnt[4]; - EVP_MD_CTX *c = EVP_MD_CTX_create(); + EVP_MD_CTX *c = EVP_MD_CTX_new(); unsigned char md[EVP_MAX_MD_SIZE]; int mdlen; int rv = -1; @@ -274,6 +274,6 @@ int PKCS1_MGF1(unsigned char *mask, long len, } rv = 0; err: - EVP_MD_CTX_destroy(c); + EVP_MD_CTX_free(c); return rv; } diff --git a/crypto/rsa/rsa_pss.c b/crypto/rsa/rsa_pss.c index 0a41ae99b1..5f44dd3ee3 100644 --- a/crypto/rsa/rsa_pss.c +++ b/crypto/rsa/rsa_pss.c @@ -88,7 +88,7 @@ int RSA_verify_PKCS1_PSS_mgf1(RSA *rsa, const unsigned char *mHash, int hLen, maskedDBLen, MSBits, emLen; const unsigned char *H; unsigned char *DB = NULL; - EVP_MD_CTX *ctx = EVP_MD_CTX_create(); + EVP_MD_CTX *ctx = EVP_MD_CTX_new(); unsigned char H_[EVP_MAX_MD_SIZE]; @@ -174,7 +174,7 @@ int RSA_verify_PKCS1_PSS_mgf1(RSA *rsa, const unsigned char *mHash, err: OPENSSL_free(DB); - EVP_MD_CTX_destroy(ctx); + EVP_MD_CTX_free(ctx); return ret; @@ -244,7 +244,7 @@ int RSA_padding_add_PKCS1_PSS_mgf1(RSA *rsa, unsigned char *EM, } maskedDBLen = emLen - hLen - 1; H = EM + maskedDBLen; - ctx = EVP_MD_CTX_create(); + ctx = EVP_MD_CTX_new(); if (ctx == NULL) goto err; if (!EVP_DigestInit_ex(ctx, Hash, NULL) @@ -282,7 +282,7 @@ int RSA_padding_add_PKCS1_PSS_mgf1(RSA *rsa, unsigned char *EM, ret = 1; err: - EVP_MD_CTX_destroy(ctx); + EVP_MD_CTX_free(ctx); OPENSSL_free(salt); return ret; diff --git a/crypto/srp/srp_lib.c b/crypto/srp/srp_lib.c index 649d2b5a66..0a073b61e0 100644 --- a/crypto/srp/srp_lib.c< |