summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorjsing <>2026-06-14 15:51:17 +0000
committerjsing <>2026-06-14 15:51:17 +0000
commit0f6d779c7005d183ee4dd8269ef00b8a12fc120e (patch)
tree4b5b90b46bed4890c1a1c88d044520a70455d800 /src/lib
parentdee584b26ef1d6d2b7fd71a8f0ec127398b3e27f (diff)
downloadopenbsd-0f6d779c7005d183ee4dd8269ef00b8a12fc120e.tar.gz
openbsd-0f6d779c7005d183ee4dd8269ef00b8a12fc120e.tar.bz2
openbsd-0f6d779c7005d183ee4dd8269ef00b8a12fc120e.zip
Correct secondary key share handling for HelloRetryRequests.
With the introduction of a secondary key share, we fail to ensure that the HelloRetryRequest does not specify the group that was used for the secondary key share. We also fail to free the secondary key share early in this case, meaning that it lingers in memory until the SSL is reset or freed. Fix both of these issues. ok tb@
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libssl/tls13_client.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/lib/libssl/tls13_client.c b/src/lib/libssl/tls13_client.c
index d650717856..fec3e825fe 100644
--- a/src/lib/libssl/tls13_client.c
+++ b/src/lib/libssl/tls13_client.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls13_client.c,v 1.107 2026/06/14 14:53:07 jsing Exp $ */ 1/* $OpenBSD: tls13_client.c,v 1.108 2026/06/14 15:51:17 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -460,9 +460,19 @@ tls13_client_hello_retry_send(struct tls13_ctx *ctx, CBB *cbb)
460 ctx->alert = TLS13_ALERT_ILLEGAL_PARAMETER; 460 ctx->alert = TLS13_ALERT_ILLEGAL_PARAMETER;
461 return 0; 461 return 0;
462 } 462 }
463 if (ctx->hs->tls13.key_share != NULL &&
464 ctx->hs->tls13.server_group == tls_key_share_group(ctx->hs->tls13.key_share)) {
465 ctx->alert = TLS13_ALERT_ILLEGAL_PARAMETER;
466 return 0;
467 }
463 468
464 /* Switch to new key share. */ 469 /* Free original key shares. */
465 tls_key_share_free(ctx->hs->key_share); 470 tls_key_share_free(ctx->hs->key_share);
471 ctx->hs->key_share = NULL;
472 tls_key_share_free(ctx->hs->tls13.key_share);
473 ctx->hs->tls13.key_share = NULL;
474
475 /* Create new key share for server selected group. */
466 if ((ctx->hs->key_share = 476 if ((ctx->hs->key_share =
467 tls_key_share_new(ctx->hs->tls13.server_group)) == NULL) 477 tls_key_share_new(ctx->hs->tls13.server_group)) == NULL)
468 return 0; 478 return 0;