-# $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
REGRESS_TARGETS=regress-aeadtest
regress-aeadtest: ${PROG}
- ./${PROG} ${.CURDIR}/aeadtests.txt
+ ./${PROG} aead ${.CURDIR}/aeadtests.txt
.include <bsd.regress.mk>
-/* $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.
*
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 <test file.txt>\n", argv[0]);
+ if (argc != 3) {
+ fprintf(stderr, "%s <aead> <test file.txt>\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;
}
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;
}