Skip to content

Commit 3c6fc6e

Browse files
Fix AEAD tests.
SKEY_SUPPORT is not defined for the test sources, use an OpenSSL macro instead. Moreover, tokens may support only a subset of AEAD algorithms, so skip algorithms that are not available. Signed-off-by: Ilie Halip <ilie.halip@nxp.com>
1 parent 5648079 commit 3c6fc6e

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

tests/taead

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,19 @@ ALGORITHMS=(
2323
AES-128-GCM
2424
AES-192-GCM
2525
AES-256-GCM
26-
CHACHA20-POLY1305
26+
ChaCha20-Poly1305
2727
)
2828

2929
title PARA "Test AEAD support"
3030

3131
for alg in "${ALGORITHMS[@]}"; do
3232
echo "Checking algorithm $alg"
33-
$CHECKER "${TESTBLDDIR}/taead" "$alg" "$KEY" "$IV" "$AAD" "$DATA"
33+
if $OPENSSL list -cipher-algorithms 2>/dev/null | grep -q "$alg"; then
34+
title PARA "Run AEAD test with $alg"
35+
$CHECKER "${TESTBLDDIR}/taead" "$alg" "$KEY" "$IV" "$AAD" "$DATA"
36+
else
37+
title PARA "Skipping AEAD test with $alg"
38+
fi
3439
done
3540

3641
echo "PASSED"

tests/taead.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include <openssl/core_names.h>
1313
#include "util.h"
1414

15-
#if SKEY_SUPPORT == 1
15+
#if defined(OSSL_FUNC_CIPHER_ENCRYPT_SKEY_INIT)
1616

1717
#define MAX_DATA_LEN 1024
1818

@@ -271,7 +271,7 @@ int main(int argc, char *argv[])
271271
argv[0]);
272272
fprintf(stderr,
273273
" Algorithms: AES-128-GCM, AES-192-GCM, AES-256-GCM,\n"
274-
" CHACHA20-POLY1305\n");
274+
" ChaCha20-Poly1305\n");
275275
exit(EXIT_FAILURE);
276276
}
277277

0 commit comments

Comments
 (0)