summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortb <>2021-01-05 17:47:35 +0000
committertb <>2021-01-05 17:47:35 +0000
commit212445dd1cb5612d11be53e5175a2eb21157f374 (patch)
tree4c30ad2ee72f4b70aab1bad8c1b9c67dedad59d2
parentb06820c37e8f7ca5331f032fba3020acc103b009 (diff)
downloadopenbsd-212445dd1cb5612d11be53e5175a2eb21157f374.tar.gz
openbsd-212445dd1cb5612d11be53e5175a2eb21157f374.tar.bz2
openbsd-212445dd1cb5612d11be53e5175a2eb21157f374.zip
Convert tls13_exporter() to tls13_secret_{init,cleanup}()
ok jsing
-rw-r--r--src/lib/libssl/tls13_lib.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/lib/libssl/tls13_lib.c b/src/lib/libssl/tls13_lib.c
index 6b6ddce4d6..72c7708d91 100644
--- a/src/lib/libssl/tls13_lib.c
+++ b/src/lib/libssl/tls13_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls13_lib.c,v 1.55 2020/11/16 18:55:15 jsing Exp $ */ 1/* $OpenBSD: tls13_lib.c,v 1.56 2021/01/05 17:47:35 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org>
4 * Copyright (c) 2019 Bob Beck <beck@openbsd.org> 4 * Copyright (c) 2019 Bob Beck <beck@openbsd.org>
@@ -608,13 +608,10 @@ tls13_exporter(struct tls13_ctx *ctx, const uint8_t *label, size_t label_len,
608 if (md_len <= 0 || md_len > EVP_MAX_MD_SIZE) 608 if (md_len <= 0 || md_len > EVP_MAX_MD_SIZE)
609 goto err; 609 goto err;
610 610
611 if ((export_secret.data = calloc(1, md_len)) == NULL) 611 if (!tls13_secret_init(&export_secret, md_len))
612 goto err; 612 goto err;
613 export_secret.len = md_len; 613 if (!tls13_secret_init(&context, md_len))
614
615 if ((context.data = calloc(1, md_len)) == NULL)
616 goto err; 614 goto err;
617 context.len = md_len;
618 615
619 /* In TLSv1.3 no context is equivalent to an empty context. */ 616 /* In TLSv1.3 no context is equivalent to an empty context. */
620 if (context_value == NULL) { 617 if (context_value == NULL) {
@@ -646,8 +643,8 @@ tls13_exporter(struct tls13_ctx *ctx, const uint8_t *label, size_t label_len,
646 643
647 err: 644 err:
648 EVP_MD_CTX_free(md_ctx); 645 EVP_MD_CTX_free(md_ctx);
649 freezero(context.data, context.len); 646 tls13_secret_cleanup(&context);
650 freezero(export_secret.data, export_secret.len); 647 tls13_secret_cleanup(&export_secret);
651 648
652 return ret; 649 return ret;
653} 650}