1*f49eea4eStb /* $OpenBSD: valid_handshakes_terminate.c,v 1.4 2022/12/01 13:49:12 tb Exp $ */
28e460600Stb /*
38e460600Stb * Copyright (c) 2019 Theo Buehler <tb@openbsd.org>
48e460600Stb *
58e460600Stb * Permission to use, copy, modify, and distribute this software for any
68e460600Stb * purpose with or without fee is hereby granted, provided that the above
78e460600Stb * copyright notice and this permission notice appear in all copies.
88e460600Stb *
98e460600Stb * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
108e460600Stb * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
118e460600Stb * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
128e460600Stb * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
138e460600Stb * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
148e460600Stb * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
158e460600Stb * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
168e460600Stb */
178e460600Stb
188e460600Stb #include <err.h>
198e460600Stb #include <stdio.h>
208e460600Stb
218e460600Stb #include "tls13_handshake.c"
228e460600Stb
238e460600Stb int
main(int argc,char * argv[])248e460600Stb main(int argc, char *argv[])
258e460600Stb {
268e460600Stb size_t i, j;
278e460600Stb int terminates;
288e460600Stb int fail = 0;
298e460600Stb
303d034219Stb for (i = 1; i < handshake_count; i++) {
318e460600Stb enum tls13_message_type mt = handshakes[i][0];
328e460600Stb
338e460600Stb if (mt == INVALID)
348e460600Stb continue;
35da7f19bcStb
368e460600Stb terminates = 0;
378e460600Stb
388e460600Stb for (j = 0; j < TLS13_NUM_MESSAGE_TYPES; j++) {
398e460600Stb mt = handshakes[i][j];
408e460600Stb if (state_machine[mt].handshake_complete) {
418e460600Stb terminates = 1;
428e460600Stb break;
438e460600Stb }
448e460600Stb }
458e460600Stb
468e460600Stb if (!terminates) {
478e460600Stb fail = 1;
488e460600Stb printf("FAIL: handshake_complete never true in "
498e460600Stb "handshake %zu\n", i);
508e460600Stb }
518e460600Stb }
528e460600Stb
538e460600Stb return fail;
548e460600Stb }
55