summaryrefslogtreecommitdiffstats
path: root/ssl/ssl_lib.c
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2015-11-27 14:02:12 +0100
committerRichard Levitte <levitte@openssl.org>2015-12-07 17:39:23 +0100
commit6e59a892db781658c050e5217127c4147c116ac9 (patch)
treeeec9e79e1c71f9c2897f49b29084bf42a66e96db /ssl/ssl_lib.c
parent9b6c00707eae2cbce79479f4b1a5dc11019abca0 (diff)
Adjust all accesses to EVP_MD_CTX to use accessor functions.
Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'ssl/ssl_lib.c')
-rw-r--r--ssl/ssl_lib.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c
index d51c6b7850..adbb7bb95a 100644
--- a/ssl/ssl_lib.c
+++ b/ssl/ssl_lib.c
@@ -3197,19 +3197,23 @@ void ssl_clear_hash_ctx(EVP_MD_CTX **hash)
/* Retrieve handshake hashes */
int ssl_handshake_hash(SSL *s, unsigned char *out, int outlen)
{
- EVP_MD_CTX ctx;
+ EVP_MD_CTX *ctx = NULL;
EVP_MD_CTX *hdgst = s->s3->handshake_dgst;
int ret = EVP_MD_CTX_size(hdgst);
- EVP_MD_CTX_init(&ctx);
if (ret < 0 || ret > outlen) {
ret = 0;
goto err;
}
- if (!EVP_MD_CTX_copy_ex(&ctx, hdgst)
- || EVP_DigestFinal_ex(&ctx, out, NULL) <= 0)
+ ctx = EVP_MD_CTX_create();
+ if (ctx == NULL) {
+ ret = 0;
+ goto err;
+ }
+ if (!EVP_MD_CTX_copy_ex(ctx, hdgst)
+ || EVP_DigestFinal_ex(ctx, out, NULL) <= 0)
ret = 0;
err:
- EVP_MD_CTX_cleanup(&ctx);
+ EVP_MD_CTX_destroy(ctx);
return ret;
}