Some more c99 initializers for consistency and readability
authortb <tb@openbsd.org>
Tue, 8 Mar 2022 16:59:25 +0000 (16:59 +0000)
committertb <tb@openbsd.org>
Tue, 8 Mar 2022 16:59:25 +0000 (16:59 +0000)
regress/lib/libssl/handshake/handshake_table.c

index 5651c6d..b316734 100644 (file)
@@ -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 <tb@openbsd.org>
  *
@@ -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;