From 2f94b75cb8a09a1e5840cd3e49a5c7e18fffa395 Mon Sep 17 00:00:00 2001 From: tb Date: Tue, 8 Mar 2022 16:59:25 +0000 Subject: [PATCH] Some more c99 initializers for consistency and readability --- .../lib/libssl/handshake/handshake_table.c | 85 ++++++++++++++----- 1 file changed, 62 insertions(+), 23 deletions(-) diff --git a/regress/lib/libssl/handshake/handshake_table.c b/regress/lib/libssl/handshake/handshake_table.c index 5651c6deb74..b316734524b 100644 --- a/regress/lib/libssl/handshake/handshake_table.c +++ b/regress/lib/libssl/handshake/handshake_table.c @@ -1,4 +1,4 @@ -/* $OpenBSD: handshake_table.c,v 1.16 2021/10/13 17:00:35 tb Exp $ */ +/* $OpenBSD: handshake_table.c,v 1.17 2022/03/08 16:59:25 tb Exp $ */ /* * Copyright (c) 2019 Theo Buehler * @@ -84,52 +84,91 @@ struct child { uint8_t illegal; }; -#define DEFAULT 0x00 - static struct child stateinfo[][TLS13_NUM_MESSAGE_TYPES] = { [CLIENT_HELLO] = { - {SERVER_HELLO_RETRY_REQUEST, DEFAULT, 0, 0}, - {SERVER_HELLO, WITHOUT_HRR, 0, 0}, + { + .mt = SERVER_HELLO_RETRY_REQUEST, + }, + { + .mt = SERVER_HELLO, + .flag = WITHOUT_HRR, + }, }, [SERVER_HELLO_RETRY_REQUEST] = { - {CLIENT_HELLO_RETRY, DEFAULT, 0, 0}, + { + .mt = CLIENT_HELLO_RETRY, + }, }, [CLIENT_HELLO_RETRY] = { - {SERVER_HELLO, DEFAULT, 0, 0}, + { + .mt = SERVER_HELLO, + }, }, [SERVER_HELLO] = { - {SERVER_ENCRYPTED_EXTENSIONS, DEFAULT, 0, 0}, + { + .mt = SERVER_ENCRYPTED_EXTENSIONS, + }, }, [SERVER_ENCRYPTED_EXTENSIONS] = { - {SERVER_CERTIFICATE_REQUEST, DEFAULT, 0, 0}, - {SERVER_CERTIFICATE, WITHOUT_CR, 0, 0}, - {SERVER_FINISHED, WITH_PSK, 0, 0}, + { + .mt = SERVER_CERTIFICATE_REQUEST, + }, + { .mt = SERVER_CERTIFICATE, + .flag = WITHOUT_CR, + }, + { + .mt = SERVER_FINISHED, + .flag = WITH_PSK, + }, }, [SERVER_CERTIFICATE_REQUEST] = { - {SERVER_CERTIFICATE, DEFAULT, 0, 0}, + { + .mt = SERVER_CERTIFICATE, + }, }, [SERVER_CERTIFICATE] = { - {SERVER_CERTIFICATE_VERIFY, DEFAULT, 0, 0}, + { + .mt = SERVER_CERTIFICATE_VERIFY, + }, }, [SERVER_CERTIFICATE_VERIFY] = { - {SERVER_FINISHED, DEFAULT, 0, 0}, + { + .mt = SERVER_FINISHED, + }, }, [SERVER_FINISHED] = { - {CLIENT_FINISHED, DEFAULT, WITHOUT_CR | WITH_PSK, 0}, - {CLIENT_CERTIFICATE, DEFAULT, 0, WITHOUT_CR | WITH_PSK}, + { + .mt = CLIENT_FINISHED, + .forced = WITHOUT_CR | WITH_PSK, + }, + { + .mt = CLIENT_CERTIFICATE, + .illegal = WITHOUT_CR | WITH_PSK, + }, }, [CLIENT_CERTIFICATE] = { - {CLIENT_FINISHED, DEFAULT, 0, 0}, - {CLIENT_CERTIFICATE_VERIFY, WITH_CCV, 0, 0}, + { + .mt = CLIENT_FINISHED, + }, + { + .mt = CLIENT_CERTIFICATE_VERIFY, + .flag = WITH_CCV, + }, }, [CLIENT_CERTIFICATE_VERIFY] = { - {CLIENT_FINISHED, DEFAULT, 0, 0}, + { + .mt = CLIENT_FINISHED, + }, }, [CLIENT_FINISHED] = { - {APPLICATION_DATA, DEFAULT, 0, 0}, + { + .mt = APPLICATION_DATA, + }, }, [APPLICATION_DATA] = { - {0, DEFAULT, 0, 0}, + { + .mt = 0, + }, }, }; @@ -469,10 +508,10 @@ main(int argc, char *argv[]) }, }; struct child start = { - CLIENT_HELLO, DEFAULT, 0, 0, + .mt = CLIENT_HELLO, }; struct child end = { - APPLICATION_DATA, DEFAULT, 0, 0, + .mt = APPLICATION_DATA, }; struct child path[TLS13_NUM_MESSAGE_TYPES] = {{0}}; uint8_t flags = NEGOTIATED; -- 2.20.1