summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjsing <>2022-07-30 16:30:42 +0000
committerjsing <>2022-07-30 16:30:42 +0000
commit1652f81ebe9f9b928aa53068e4097b4b536640c5 (patch)
treecef2e4bbae0bf96eb16eacb4dabb7c87adda1b13 /src
parent38f9b86dc3cc629ac8624f6c738dcfb732ea73ab (diff)
downloadopenbsd-1652f81ebe9f9b928aa53068e4097b4b536640c5.tar.gz
openbsd-1652f81ebe9f9b928aa53068e4097b4b536640c5.tar.bz2
openbsd-1652f81ebe9f9b928aa53068e4097b4b536640c5.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/regress/lib/libcrypto/aead/Makefile4
-rw-r--r--src/regress/lib/libcrypto/aead/aeadtest.c16
2 files changed, 12 insertions, 8 deletions
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 @@
1# $OpenBSD: Makefile,v 1.5 2022/01/14 09:38:50 tb Exp $ 1# $OpenBSD: Makefile,v 1.6 2022/07/30 16:30:42 jsing Exp $
2 2
3PROG= aeadtest 3PROG= aeadtest
4LDADD= -lcrypto 4LDADD= -lcrypto
@@ -9,6 +9,6 @@ CFLAGS+= -DLIBRESSL_INTERNAL -Werror
9REGRESS_TARGETS=regress-aeadtest 9REGRESS_TARGETS=regress-aeadtest
10 10
11regress-aeadtest: ${PROG} 11regress-aeadtest: ${PROG}
12 ./${PROG} ${.CURDIR}/aeadtests.txt 12 ./${PROG} aead ${.CURDIR}/aeadtests.txt
13 13
14.include <bsd.regress.mk> 14.include <bsd.regress.mk>
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 @@
1/* $OpenBSD: aeadtest.c,v 1.19 2022/07/30 16:17:22 jsing Exp $ */ 1/* $OpenBSD: aeadtest.c,v 1.20 2022/07/30 16:30:42 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2014, Google Inc. 3 * Copyright (c) 2014, Google Inc.
4 * 4 *
@@ -392,14 +392,14 @@ main(int argc, char **argv)
392 unsigned int line_no = 0, num_tests = 0, j; 392 unsigned int line_no = 0, num_tests = 0, j;
393 unsigned char bufs[NUM_TYPES][BUF_MAX]; 393 unsigned char bufs[NUM_TYPES][BUF_MAX];
394 unsigned int lengths[NUM_TYPES]; 394 unsigned int lengths[NUM_TYPES];
395 const char *aeadname;
395 396
396 if (argc != 2) { 397 if (argc != 3) {
397 fprintf(stderr, "%s <test file.txt>\n", argv[0]); 398 fprintf(stderr, "%s <aead> <test file.txt>\n", argv[0]);
398 return 1; 399 return 1;
399 } 400 }
400 401
401 f = fopen(argv[1], "r"); 402 if ((f = fopen(argv[2], "r")) == NULL) {
402 if (f == NULL) {
403 perror("failed to open input"); 403 perror("failed to open input");
404 return 1; 404 return 1;
405 } 405 }
@@ -434,7 +434,11 @@ main(int argc, char **argv)
434 if (!any_values_set) 434 if (!any_values_set)
435 continue; 435 continue;
436 436
437 if (!aead_from_name(&aead, &cipher, bufs[AEAD])) { 437 aeadname = argv[1];
438 if (lengths[AEAD] != 0)
439 aeadname = bufs[AEAD];
440
441 if (!aead_from_name(&aead, &cipher, aeadname)) {
438 fprintf(stderr, "Aborting...\n"); 442 fprintf(stderr, "Aborting...\n");
439 return 4; 443 return 4;
440 } 444 }