summaryrefslogtreecommitdiff
path: root/lib/libssl
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2021-12-09 17:45:50 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2021-12-09 17:45:50 +0000
commitd4a1741980180dbb41e5f1204df90be658261861 (patch)
treeaeab3206a1bab90d52efad8123fcd8d9307a4b7d /lib/libssl
parentcc54c90045969c5de8d3e7e150001f88af965ebc (diff)
Convert s3_cbc.c to opaque EVP_MD_CTX.
ok inoguchi jsing
Diffstat (limited to 'lib/libssl')
-rw-r--r--lib/libssl/s3_cbc.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/lib/libssl/s3_cbc.c b/lib/libssl/s3_cbc.c
index 1c0286f0875..e0289d894b5 100644
--- a/lib/libssl/s3_cbc.c
+++ b/lib/libssl/s3_cbc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: s3_cbc.c,v 1.24 2021/05/16 14:10:43 jsing Exp $ */
+/* $OpenBSD: s3_cbc.c,v 1.25 2021/12/09 17:45:49 tb Exp $ */
/* ====================================================================
* Copyright (c) 2012 The OpenSSL Project. All rights reserved.
*
@@ -404,7 +404,7 @@ ssl3_cbc_digest_record(const EVP_MD_CTX *ctx, unsigned char* md_out,
unsigned char first_block[MAX_HASH_BLOCK_SIZE];
unsigned char mac_out[EVP_MAX_MD_SIZE];
unsigned int i, j, md_out_size_u;
- EVP_MD_CTX md_ctx;
+ EVP_MD_CTX *md_ctx;
/* mdLengthSize is the number of bytes in the length field that terminates
* the hash. */
unsigned int md_length_size = 8;
@@ -605,9 +605,10 @@ ssl3_cbc_digest_record(const EVP_MD_CTX *ctx, unsigned char* md_out,
mac_out[j] |= block[j]&is_block_b;
}
- EVP_MD_CTX_init(&md_ctx);
- if (!EVP_DigestInit_ex(&md_ctx, ctx->digest, NULL /* engine */)) {
- EVP_MD_CTX_cleanup(&md_ctx);
+ if ((md_ctx = EVP_MD_CTX_new()) == NULL)
+ return 0;
+ if (!EVP_DigestInit_ex(md_ctx, EVP_MD_CTX_md(ctx), NULL /* engine */)) {
+ EVP_MD_CTX_free(md_ctx);
return 0;
}
@@ -615,13 +616,13 @@ ssl3_cbc_digest_record(const EVP_MD_CTX *ctx, unsigned char* md_out,
for (i = 0; i < md_block_size; i++)
hmac_pad[i] ^= 0x6a;
- EVP_DigestUpdate(&md_ctx, hmac_pad, md_block_size);
- EVP_DigestUpdate(&md_ctx, mac_out, md_size);
+ EVP_DigestUpdate(md_ctx, hmac_pad, md_block_size);
+ EVP_DigestUpdate(md_ctx, mac_out, md_size);
- EVP_DigestFinal(&md_ctx, md_out, &md_out_size_u);
+ EVP_DigestFinal(md_ctx, md_out, &md_out_size_u);
if (md_out_size)
*md_out_size = md_out_size_u;
- EVP_MD_CTX_cleanup(&md_ctx);
+ EVP_MD_CTX_free(md_ctx);
return 1;
}