* configure.ac (GCRYPT_PUBKEY_CIPHERS): It's kyber.lo.
* tests/Makefile.am (tests_bin): [USE_KYBER]: Add t-mlkem only when
USE_KYBER.
* tests/t-kem.c: Allow building with no Kyber.
--
Fixes-commit: 7eaa43bf0931494afccbd413d83a3010aa80cee0
Signed-off-by: NIIBE Yutaka <[email protected]>
---
configure.ac | 2 +-
tests/Makefile.am | 6 +++++-
tests/t-kem.c | 8 ++++++++
3 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index b9b0e8a8..084ec954 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3563,7 +3563,7 @@ LIST_MEMBER(kyber, $enabled_pubkey_ciphers)
AM_CONDITIONAL(USE_KYBER, [test "$found" = "1"])
if test "$found" = "1" ; then
GCRYPT_PUBKEY_CIPHERS="$GCRYPT_PUBKEY_CIPHERS \
- kyber.c"
+ kyber.lo"
AC_DEFINE(USE_KYBER, 1, [Defined if this module should be included])
fi
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 428210f7..e7850a9b 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -25,7 +25,7 @@ tests_bin = \
version t-secmem mpitests t-sexp t-convert \
t-mpi-bit t-mpi-point t-lock \
prime basic keygen pubkey hmac hashtest t-kdf keygrip \
- aeswrap random t-kem t-mlkem t-thread-local t-fips-service-ind
+ aeswrap random t-kem t-thread-local t-fips-service-ind
if USE_RSA
tests_bin += pkcs1v2 t-rsa-pss t-rsa-15 t-rsa-testparm
@@ -39,6 +39,10 @@ if USE_ECC
tests_bin += curves t-ecdsa t-ed25519 t-cv25519 t-x448 t-ed448
endif
+if USE_KYBER
+tests_bin += t-mlkem
+endif
+
if USE_DILITHIUM
tests_bin += t-mldsa
endif
diff --git a/tests/t-kem.c b/tests/t-kem.c
index 27823907..cafb68b1 100644
--- a/tests/t-kem.c
+++ b/tests/t-kem.c
@@ -151,6 +151,7 @@ test_kem_mceliece6688128f (int testno)
}
+#ifdef USE_KYBER
static void
test_kem_mlkem512 (int testno)
{
@@ -324,6 +325,7 @@ test_kem_mlkem1024 (int testno)
putc ('\n', stderr);
}
}
+#endif
static void
@@ -496,6 +498,7 @@ check_kem (int n_loops)
ntests += n_loops;
}
+#ifdef USE_KYBER
if ((selected_algo & SELECTED_ALGO_MLKEM512))
{
for (; testno < ntests + n_loops; testno++)
@@ -516,6 +519,7 @@ check_kem (int n_loops)
test_kem_mlkem1024 (testno);
ntests += n_loops;
}
+#endif
if ((selected_algo & SELECTED_ALGO_RAW_X25519))
{
@@ -568,9 +572,11 @@ main (int argc, char **argv)
" --loops N specify the loop count\n"
" --sntrup761 select SNTRUP761 algo\n"
" --cm6688128f select CM6688128F algo\n"
+#ifdef USE_KYBER
" --mlkem512 select MLKEM512 algo\n"
" --mlkem768 select MLKEM768 algo\n"
" --mlkem1024 select MLKEM1024 algo\n"
+#endif
" --dhkem25519 select DHKEM25519 algo\n",
stdout);
exit (0);
@@ -608,6 +614,7 @@ main (int argc, char **argv)
argc--;
argv++;
}
+#ifdef USE_KYBER
else if (!strcmp (*argv, "--mlkem512"))
{
selected_algo = SELECTED_ALGO_MLKEM512;
@@ -626,6 +633,7 @@ main (int argc, char **argv)
argc--;
argv++;
}
+#endif
else if (!strcmp (*argv, "--raw-x25519"))
{
selected_algo = SELECTED_ALGO_RAW_X25519;
_______________________________________________
Gcrypt-devel mailing list
[email protected]
https://lists.gnupg.org/mailman/listinfo/gcrypt-devel