From 1652f81ebe9f9b928aa53068e4097b4b536640c5 Mon Sep 17 00:00:00 2001 From: jsing <> Date: Sat, 30 Jul 2022 16:30:42 +0000 Subject: Allow the AEAD to be specified for a test file. Currently, this must be specified per test - allow it to be given as a command line argument that applies to the entire test file. --- src/regress/lib/libcrypto/aead/Makefile | 4 ++-- src/regress/lib/libcrypto/aead/aeadtest.c | 16 ++++++++++------ 2 files changed, 12 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/regress/lib/libcrypto/aead/Makefile b/src/regress/lib/libcrypto/aead/Makefile index c7ee88bf6a..cc58fc17f5 100644 --- a/src/regress/lib/libcrypto/aead/Makefile +++ b/src/regress/lib/libcrypto/aead/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.5 2022/01/14 09:38:50 tb Exp $ +# $OpenBSD: Makefile,v 1.6 2022/07/30 16:30:42 jsing Exp $ PROG= aeadtest LDADD= -lcrypto @@ -9,6 +9,6 @@ CFLAGS+= -DLIBRESSL_INTERNAL -Werror REGRESS_TARGETS=regress-aeadtest regress-aeadtest: ${PROG} - ./${PROG} ${.CURDIR}/aeadtests.txt + ./${PROG} aead ${.CURDIR}/aeadtests.txt .include diff --git a/src/regress/lib/libcrypto/aead/aeadtest.c b/src/regress/lib/libcrypto/aead/aeadtest.c index bd6192324b..189cece6a4 100644 --- a/src/regress/lib/libcrypto/aead/aeadtest.c +++ b/src/regress/lib/libcrypto/aead/aeadtest.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aeadtest.c,v 1.19 2022/07/30 16:17:22 jsing Exp $ */ +/* $OpenBSD: aeadtest.c,v 1.20 2022/07/30 16:30:42 jsing Exp $ */ /* * Copyright (c) 2014, Google Inc. * @@ -392,14 +392,14 @@ main(int argc, char **argv) unsigned int line_no = 0, num_tests = 0, j; unsigned char bufs[NUM_TYPES][BUF_MAX]; unsigned int lengths[NUM_TYPES]; + const char *aeadname; - if (argc != 2) { - fprintf(stderr, "%s \n", argv[0]); + if (argc != 3) { + fprintf(stderr, "%s \n", argv[0]); return 1; } - f = fopen(argv[1], "r"); - if (f == NULL) { + if ((f = fopen(argv[2], "r")) == NULL) { perror("failed to open input"); return 1; } @@ -434,7 +434,11 @@ main(int argc, char **argv) if (!any_values_set) continue; - if (!aead_from_name(&aead, &cipher, bufs[AEAD])) { + aeadname = argv[1]; + if (lengths[AEAD] != 0) + aeadname = bufs[AEAD]; + + if (!aead_from_name(&aead, &cipher, aeadname)) { fprintf(stderr, "Aborting...\n"); return 4; } -- cgit v1.2.3-55-g6feb