summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2015-11-30 23:43:27 +0100
committerRichard Levitte <levitte@openssl.org>2015-12-07 17:39:23 +0100
commiteda34e4bef33a3b8f1e207bf04769007c70cbd1e (patch)
tree25124fceef881c491a3c175eadd02e021da49ac7
parentRemove HMAC_CTX_cleanup and combine its functionality into EVP_MD_CTX_init (diff)
downloadopenssl-eda34e4bef33a3b8f1e207bf04769007c70cbd1e.tar.xz
openssl-eda34e4bef33a3b8f1e207bf04769007c70cbd1e.zip
Adapt the rest of the source to the removal of (EVP_MD_CTX|HMAC_CTX)_cleanup
Reviewed-by: Rich Salz <rsalz@openssl.org>
-rw-r--r--crypto/cms/cms_sd.c6
-rw-r--r--crypto/evp/p5_crpt2.c4
-rw-r--r--ssl/record/ssl3_record.c2
-rw-r--r--ssl/s3_enc.c2
-rw-r--r--test/hmactest.c2
-rw-r--r--test/sha512t.c2
6 files changed, 8 insertions, 10 deletions
diff --git a/crypto/cms/cms_sd.c b/crypto/cms/cms_sd.c
index 46a7876d94..1570fb6fe5 100644
--- a/crypto/cms/cms_sd.c
+++ b/crypto/cms/cms_sd.c
@@ -728,7 +728,7 @@ int CMS_SignerInfo_sign(CMS_SignerInfo *si)
goto err;
}
- EVP_MD_CTX_cleanup(mctx);
+ EVP_MD_CTX_init(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_cleanup(mctx);
+ EVP_MD_CTX_init(mctx);
return 0;
}
@@ -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_cleanup(mctx);
+ EVP_MD_CTX_init(mctx);
return r;
}
diff --git a/crypto/evp/p5_crpt2.c b/crypto/evp/p5_crpt2.c
index b84e99ede3..9df07d67d0 100644
--- a/crypto/evp/p5_crpt2.c
+++ b/crypto/evp/p5_crpt2.c
@@ -134,7 +134,7 @@ int PKCS5_PBKDF2_HMAC(const char *pass, int passlen,
HMAC_CTX_free(hctx_tpl);
return 0;
}
- HMAC_CTX_cleanup(hctx);
+ HMAC_CTX_init(hctx);
memcpy(p, digtmp, cplen);
for (j = 1; j < iter; j++) {
if (!HMAC_CTX_copy(hctx, hctx_tpl)) {
@@ -148,7 +148,7 @@ int PKCS5_PBKDF2_HMAC(const char *pass, int passlen,
HMAC_CTX_free(hctx_tpl);
return 0;
}
- HMAC_CTX_cleanup(hctx);
+ HMAC_CTX_init(hctx);
for (k = 0; k < cplen; k++)
p[k] ^= digtmp[k];
}
diff --git a/ssl/record/ssl3_record.c b/ssl/record/ssl3_record.c
index 04b6aaed8a..02424f1f68 100644
--- a/ssl/record/ssl3_record.c
+++ b/ssl/record/ssl3_record.c
@@ -875,7 +875,7 @@ int n_ssl3_mac(SSL *ssl, unsigned char *md, int send)
|| EVP_DigestUpdate(md_ctx, ssl3_pad_2, npad) <= 0
|| EVP_DigestUpdate(md_ctx, md, md_size) <= 0
|| EVP_DigestFinal_ex(md_ctx, md, &md_size_u) <= 0) {
- EVP_MD_CTX_cleanup(md_ctx);
+ EVP_MD_CTX_init(md_ctx);
return -1;
}
md_size = md_size_u;
diff --git a/ssl/s3_enc.c b/ssl/s3_enc.c
index dc884c5466..026f2c8395 100644
--- a/ssl/s3_enc.c
+++ b/ssl/s3_enc.c
@@ -518,7 +518,7 @@ int ssl3_final_finish_mac(SSL *s, const char *sender, int len, unsigned char *p)
ret = EVP_MD_CTX_size(ctx);
if (ret < 0) {
- EVP_MD_CTX_cleanup(ctx);
+ EVP_MD_CTX_init(ctx);
return 0;
}
diff --git a/test/hmactest.c b/test/hmactest.c
index 0e0e017895..fc168de581 100644
--- a/test/hmactest.c
+++ b/test/hmactest.c
@@ -193,7 +193,6 @@ int main(int argc, char *argv[])
}
printf("test 4 ok\n");
test5:
- HMAC_CTX_cleanup(ctx);
HMAC_CTX_init(ctx);
if (HMAC_Init_ex(ctx, test[4].key, test[4].key_len, NULL, NULL)) {
printf("Should fail to initialise HMAC with empty MD (test 5)\n");
@@ -283,7 +282,6 @@ test5:
printf("test 5 ok\n");
}
test6:
- HMAC_CTX_cleanup(ctx);
HMAC_CTX_init(ctx);
ctx2 = HMAC_CTX_new();
if (ctx2 == NULL) {
diff --git a/test/sha512t.c b/test/sha512t.c
index 215a71fd0f..dff19aaa57 100644
--- a/test/sha512t.c
+++ b/test/sha512t.c
@@ -132,7 +132,7 @@ int main(int argc, char **argv)
"aaaaaaaa" "aaaaaaaa" "aaaaaaaa" "aaaaaaaa",
(1000000 - i) < 288 ? 1000000 - i : 288);
EVP_DigestFinal_ex(evp, md, NULL);
- EVP_MD_CTX_cleanup(evp);
+ EVP_MD_CTX_init(evp);
if (memcmp(md, app_c3, sizeof(app_c3))) {
fflush(stdout);