diff options
author | 2020-05-21 19:43:40 +0000 | |
---|---|---|
committer | 2020-05-21 19:43:40 +0000 | |
commit | 17b5695187bbd914ec4658af1d1f38d2a57c8719 (patch) | |
tree | bbf350d1930d145c202ddb50966f76919d9569e2 /lib/libssl/tls13_lib.c | |
parent | Make ssl_set_cert_masks() more consistent and closer to readable. (diff) | |
download | wireguard-openbsd-17b5695187bbd914ec4658af1d1f38d2a57c8719.tar.xz wireguard-openbsd-17b5695187bbd914ec4658af1d1f38d2a57c8719.zip |
Simplify: transform a dangling else into an early return and
unindent a bunch of code.
Suggested by jsing
Diffstat (limited to 'lib/libssl/tls13_lib.c')
-rw-r--r-- | lib/libssl/tls13_lib.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/lib/libssl/tls13_lib.c b/lib/libssl/tls13_lib.c index 9d5889ff1ee..7232b6dea00 100644 --- a/lib/libssl/tls13_lib.c +++ b/lib/libssl/tls13_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tls13_lib.c,v 1.48 2020/05/21 19:27:22 tb Exp $ */ +/* $OpenBSD: tls13_lib.c,v 1.49 2020/05/21 19:43:40 tb Exp $ */ /* * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org> * Copyright (c) 2019 Bob Beck <beck@openbsd.org> @@ -281,25 +281,25 @@ tls13_key_update_recv(struct tls13_ctx *ctx, CBS *cbs) if (!tls13_phh_update_peer_traffic_secret(ctx)) goto err; - if (key_update_request == 1) { - if ((hs_msg = tls13_handshake_msg_new()) == NULL) - goto err; - if (!tls13_handshake_msg_start(hs_msg, &cbb_hs, - TLS13_MT_KEY_UPDATE)) - goto err; - if (!CBB_add_u8(&cbb_hs, 0)) - goto err; - if (!tls13_handshake_msg_finish(hs_msg)) - goto err; - - ctx->key_update_request = 1; - tls13_handshake_msg_data(hs_msg, &cbs_hs); - ret = tls13_record_layer_phh(ctx->rl, &cbs_hs); - - tls13_handshake_msg_free(hs_msg); - hs_msg = NULL; - } else - ret = TLS13_IO_SUCCESS; + if (key_update_request == 0) + return TLS13_IO_SUCCESS; + + /* key_update_request == 1 */ + if ((hs_msg = tls13_handshake_msg_new()) == NULL) + goto err; + if (!tls13_handshake_msg_start(hs_msg, &cbb_hs, TLS13_MT_KEY_UPDATE)) + goto err; + if (!CBB_add_u8(&cbb_hs, 0)) + goto err; + if (!tls13_handshake_msg_finish(hs_msg)) + goto err; + + ctx->key_update_request = 1; + tls13_handshake_msg_data(hs_msg, &cbs_hs); + ret = tls13_record_layer_phh(ctx->rl, &cbs_hs); + + tls13_handshake_msg_free(hs_msg); + hs_msg = NULL; return ret; |