From 811b1a6c141cf533cdc502515439260e9dc8fbb7 Mon Sep 17 00:00:00 2001 From: Steffen Jaeckel Date: Fri, 24 Apr 2026 13:37:01 +0200 Subject: [PATCH] Introduce `LTC_NOP_TEST()` Signed-off-by: Steffen Jaeckel --- tests/argon2_test.c | 7 +------ tests/bcrypt_test.c | 8 +------- tests/common.c | 2 ++ tests/common.h | 3 +++ tests/der_test.c | 7 +------ tests/dh_test.c | 7 +------ tests/dsa_test.c | 7 +------ tests/ecc_test.c | 5 +---- tests/ed25519_test.c | 7 +------ tests/ed448_test.c | 7 +------ tests/mpi_test.c | 5 +---- tests/pem_test.c | 7 +------ tests/pkcs_1_eme_test.c | 7 +------ tests/pkcs_1_emsa_test.c | 7 +------ tests/pkcs_1_oaep_test.c | 7 +------ tests/pkcs_1_pss_test.c | 7 +------ tests/pkcs_1_test.c | 7 +------ tests/rsa_test.c | 7 +------ tests/scrypt_test.c | 7 +------ tests/siv_wycheproof_test.c | 2 +- tests/ssh_test.c | 5 +---- tests/test.c | 1 + tests/tomcrypt_test.h | 1 + tests/x25519_test.c | 7 +------ tests/x448_test.c | 7 +------ 25 files changed, 28 insertions(+), 116 deletions(-) diff --git a/tests/argon2_test.c b/tests/argon2_test.c index 5274f272..8d22840e 100644 --- a/tests/argon2_test.c +++ b/tests/argon2_test.c @@ -76,10 +76,5 @@ int argon2_test(void) } #else - -int argon2_test(void) -{ - return CRYPT_NOP; -} - +LTC_NOP_TEST(argon2_test) #endif diff --git a/tests/bcrypt_test.c b/tests/bcrypt_test.c index 41822a00..972854de 100644 --- a/tests/bcrypt_test.c +++ b/tests/bcrypt_test.c @@ -136,11 +136,5 @@ int bcrypt_test(void) } #else - - -int bcrypt_test(void) -{ - return CRYPT_NOP; -} - +LTC_NOP_TEST(bcrypt_test) #endif diff --git a/tests/common.c b/tests/common.c index 6e0312cf..855842a3 100644 --- a/tests/common.c +++ b/tests/common.c @@ -9,6 +9,8 @@ Steffen Jaeckel */ +LTC_NOP_TEST(nop_test) + void run_cmd(int res, int line, const char *file, const char *cmd, const char *algorithm) { if (res != CRYPT_OK) { diff --git a/tests/common.h b/tests/common.h index b1c1aea6..7c5719b6 100644 --- a/tests/common.h +++ b/tests/common.h @@ -50,6 +50,9 @@ typedef void (*dir_cleanup_cb)(void* ctx); int test_process_dir(const char *path, void *ctx, dir_iter_cb iter, dir_fiter_cb fiter, dir_cleanup_cb cleanup, const char *test); #endif +int ltc_test_nop(void); +#define LTC_NOP_TEST(n) int n(void) { return CRYPT_NOP; } + void run_cmd(int res, int line, const char *file, const char *cmd, const char *algorithm); void print_hex(const char* what, const void* v, const unsigned long l); diff --git a/tests/der_test.c b/tests/der_test.c index b6228341..2c160487 100644 --- a/tests/der_test.c +++ b/tests/der_test.c @@ -3,12 +3,7 @@ #include #if !defined(LTC_DER) - -int der_test(void) -{ - return CRYPT_NOP; -} - +LTC_NOP_TEST(der_test) #else #include diff --git a/tests/dh_test.c b/tests/dh_test.c index 9bde5f9d..acc4011d 100644 --- a/tests/dh_test.c +++ b/tests/dh_test.c @@ -397,10 +397,5 @@ int dh_test(void) } #else - -int dh_test(void) -{ - return CRYPT_NOP; -} - +LTC_NOP_TEST(dh_test) #endif diff --git a/tests/dsa_test.c b/tests/dsa_test.c index 0a0257d7..879acaf1 100644 --- a/tests/dsa_test.c +++ b/tests/dsa_test.c @@ -385,10 +385,5 @@ int dsa_test(void) } #else - -int dsa_test(void) -{ - return CRYPT_NOP; -} - +LTC_NOP_TEST(dsa_test) #endif diff --git a/tests/ecc_test.c b/tests/ecc_test.c index 59f8b3d9..86adb2d8 100644 --- a/tests/ecc_test.c +++ b/tests/ecc_test.c @@ -2459,8 +2459,5 @@ int ecc_test(void) return CRYPT_OK; } #else -int ecc_test(void) -{ - return CRYPT_NOP; -} +LTC_NOP_TEST(ecc_test) #endif diff --git a/tests/ed25519_test.c b/tests/ed25519_test.c index ca1ebecd..10494beb 100644 --- a/tests/ed25519_test.c +++ b/tests/ed25519_test.c @@ -468,10 +468,5 @@ int ed25519_test(void) } #else - -int ed25519_test(void) -{ - return CRYPT_NOP; -} - +LTC_NOP_TEST(ed25519_test) #endif diff --git a/tests/ed448_test.c b/tests/ed448_test.c index e8e61062..45b155ca 100644 --- a/tests/ed448_test.c +++ b/tests/ed448_test.c @@ -476,10 +476,5 @@ int ed448_test(void) } #else - -int ed448_test(void) -{ - return CRYPT_NOP; -} - +LTC_NOP_TEST(ed448_test) #endif diff --git a/tests/mpi_test.c b/tests/mpi_test.c index 89f5c049..bdaa373e 100644 --- a/tests/mpi_test.c +++ b/tests/mpi_test.c @@ -137,8 +137,5 @@ int mpi_test(void) return s_radix_to_bin_test(); } #else -int mpi_test(void) -{ - return CRYPT_NOP; -} +LTC_NOP_TEST(mpi_test) #endif diff --git a/tests/pem_test.c b/tests/pem_test.c index 652a341b..8027dc47 100644 --- a/tests/pem_test.c +++ b/tests/pem_test.c @@ -202,10 +202,5 @@ int pem_test(void) } #else - -int pem_test(void) -{ - return CRYPT_NOP; -} - +LTC_NOP_TEST(pem_test) #endif diff --git a/tests/pkcs_1_eme_test.c b/tests/pkcs_1_eme_test.c index 61bf9d91..172cfd30 100644 --- a/tests/pkcs_1_eme_test.c +++ b/tests/pkcs_1_eme_test.c @@ -59,11 +59,6 @@ int pkcs_1_eme_test(void) } #else - -int pkcs_1_eme_test(void) -{ - return CRYPT_NOP; -} - +LTC_NOP_TEST(pkcs_1_eme_test) #endif diff --git a/tests/pkcs_1_emsa_test.c b/tests/pkcs_1_emsa_test.c index 4691e259..47e77be4 100644 --- a/tests/pkcs_1_emsa_test.c +++ b/tests/pkcs_1_emsa_test.c @@ -56,11 +56,6 @@ int pkcs_1_emsa_test(void) } #else - -int pkcs_1_emsa_test(void) -{ - return CRYPT_NOP; -} - +LTC_NOP_TEST(pkcs_1_emsa_test) #endif diff --git a/tests/pkcs_1_oaep_test.c b/tests/pkcs_1_oaep_test.c index ec90c13c..86d0b62b 100644 --- a/tests/pkcs_1_oaep_test.c +++ b/tests/pkcs_1_oaep_test.c @@ -62,11 +62,6 @@ int pkcs_1_oaep_test(void) } #else - -int pkcs_1_oaep_test(void) -{ - return CRYPT_NOP; -} - +LTC_NOP_TEST(pkcs_1_oaep_test) #endif diff --git a/tests/pkcs_1_pss_test.c b/tests/pkcs_1_pss_test.c index 12365bf9..88f1d3e6 100644 --- a/tests/pkcs_1_pss_test.c +++ b/tests/pkcs_1_pss_test.c @@ -66,11 +66,6 @@ int pkcs_1_pss_test(void) } #else - -int pkcs_1_pss_test(void) -{ - return CRYPT_NOP; -} - +LTC_NOP_TEST(pkcs_1_pss_test) #endif diff --git a/tests/pkcs_1_test.c b/tests/pkcs_1_test.c index 79ee4e07..70237cb9 100644 --- a/tests/pkcs_1_test.c +++ b/tests/pkcs_1_test.c @@ -79,11 +79,6 @@ int pkcs_1_test(void) } #else - -int pkcs_1_test(void) -{ - return CRYPT_NOP; -} - +LTC_NOP_TEST(pkcs_1_test) #endif diff --git a/tests/rsa_test.c b/tests/rsa_test.c index e4d16ac1..80055f8f 100644 --- a/tests/rsa_test.c +++ b/tests/rsa_test.c @@ -879,10 +879,5 @@ print_hex("q", tmp, len); } #else - -int rsa_test(void) -{ - return CRYPT_NOP; -} - +LTC_NOP_TEST(rsa_test) #endif diff --git a/tests/scrypt_test.c b/tests/scrypt_test.c index b3f57920..750e9453 100644 --- a/tests/scrypt_test.c +++ b/tests/scrypt_test.c @@ -97,10 +97,5 @@ int scrypt_test(void) } #else - -int scrypt_test(void) -{ - return CRYPT_NOP; -} - +LTC_NOP_TEST(scrypt_test) #endif diff --git a/tests/siv_wycheproof_test.c b/tests/siv_wycheproof_test.c index e5ea4832..f6eccfbe 100644 --- a/tests/siv_wycheproof_test.c +++ b/tests/siv_wycheproof_test.c @@ -95,5 +95,5 @@ int siv_wycheproof_test(void) } #else -int siv_wycheproof_test(void) { return CRYPT_NOP; } +LTC_NOP_TEST(siv_wycheproof_test) #endif diff --git a/tests/ssh_test.c b/tests/ssh_test.c index 990db726..0f062494 100644 --- a/tests/ssh_test.c +++ b/tests/ssh_test.c @@ -347,10 +347,7 @@ int ssh_test(void) #else -int ssh_test(void) -{ - return CRYPT_NOP; -} +LTC_NOP_TEST(ssh_test) #endif diff --git a/tests/test.c b/tests/test.c index 1d5bc6b8..7ebcda0c 100644 --- a/tests/test.c +++ b/tests/test.c @@ -40,6 +40,7 @@ static const test_function test_functions[] = LTC_TEST_FN(multi_test), LTC_TEST_FN(pem_test), LTC_TEST_FN(deprecated_test), + LTC_TEST_FN(nop_test), /* keep the prng_test always at the end as * it has to be handled specially when * testing with LTC_PTHREAD enabled diff --git a/tests/tomcrypt_test.h b/tests/tomcrypt_test.h index 3e6eaa03..f76fe152 100644 --- a/tests/tomcrypt_test.h +++ b/tests/tomcrypt_test.h @@ -51,6 +51,7 @@ int scrypt_test(void); int no_null_termination_check_test(void); int pk_oid_test(void); int deprecated_test(void); +int nop_test(void); #ifdef LTC_PKCS_1 struct ltc_prng_descriptor* no_prng_desc_get(void); diff --git a/tests/x25519_test.c b/tests/x25519_test.c index 04efd413..cd7a42f3 100644 --- a/tests/x25519_test.c +++ b/tests/x25519_test.c @@ -248,10 +248,5 @@ int x25519_test(void) } #else - -int x25519_test(void) -{ - return CRYPT_NOP; -} - +LTC_NOP_TEST(x25519_test) #endif diff --git a/tests/x448_test.c b/tests/x448_test.c index 31e89293..f9140cc5 100644 --- a/tests/x448_test.c +++ b/tests/x448_test.c @@ -240,10 +240,5 @@ int x448_test(void) } #else - -int x448_test(void) -{ - return CRYPT_NOP; -} - +LTC_NOP_TEST(x448_test) #endif