From 0082029c94f389e60159881e94e1ebe019aabe87 Mon Sep 17 00:00:00 2001 From: Joel Sing Date: Tue, 11 Jan 2022 18:22:17 +0000 Subject: Simplify tlsext_keyshare_server_parse() SSL_AD_DECODE_ERROR is the default alert for a TLS extension parsing failure - remove the various gotos and simply return 0 instead. ok tb@ --- lib/libssl/ssl_tlsext.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'lib/libssl/ssl_tlsext.c') diff --git a/lib/libssl/ssl_tlsext.c b/lib/libssl/ssl_tlsext.c index 71955d92952..857527d9434 100644 --- a/lib/libssl/ssl_tlsext.c +++ b/lib/libssl/ssl_tlsext.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssl_tlsext.c,v 1.105 2022/01/06 18:23:56 jsing Exp $ */ +/* $OpenBSD: ssl_tlsext.c,v 1.106 2022/01/11 18:22:16 jsing Exp $ */ /* * Copyright (c) 2016, 2017, 2019 Joel Sing * Copyright (c) 2017 Doug Hogan @@ -1481,13 +1481,13 @@ tlsext_keyshare_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert) uint16_t group; if (!CBS_get_u16_length_prefixed(cbs, &client_shares)) - goto err; + return 0; while (CBS_len(&client_shares) > 0) { /* Unpack client share. */ if (!CBS_get_u16(&client_shares, &group)) - goto err; + return 0; if (!CBS_get_u16_length_prefixed(&client_shares, &key_exchange)) return 0; @@ -1511,17 +1511,13 @@ tlsext_keyshare_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert) /* Decode and store the selected key share. */ if ((S3I(s)->hs.key_share = tls_key_share_new(group)) == NULL) - goto err; + return 0; if (!tls_key_share_peer_public(S3I(s)->hs.key_share, &key_exchange, NULL)) - goto err; + return 0; } return 1; - - err: - *alert = SSL_AD_DECODE_ERROR; - return 0; } int -- cgit v1.2.3