From 7487366b0c006f64ef4a639a12da3414da17c23c Mon Sep 17 00:00:00 2001 From: Daniele Lacamera Date: Thu, 9 Jul 2026 02:00:39 +0200 Subject: [PATCH] tests: keep OQS_SIG_keypair() out of ExpectIntEQ ExpectIntEQ casts both arguments to int (tests/unit.h ExpectInt), and casting a function call that returns the liboqs OQS_STATUS enum trips -Werror=bad-function-cast, which is part of the test warning set. Store the status in a local first; casting a variable does not trigger the warning. Broke falcon-enabled configs once the HAVE_PQC guard fix made this test compile. Verified: the TU reproduces the exact CI error before this change and compiles clean after, and test_wc_falcon_sign_verify still passes in a --disable-md5 --enable-opensslextra --enable-falcon --with-liboqs build. --- tests/api/test_signature.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/api/test_signature.c b/tests/api/test_signature.c index e8c6617500..e8e928c42f 100644 --- a/tests/api/test_signature.c +++ b/tests/api/test_signature.c @@ -175,6 +175,7 @@ int test_wc_falcon_sign_verify(void) falcon_key key; WC_RNG rng; OQS_SIG* oqssig = NULL; + OQS_STATUS oqs_status; byte pub[FALCON_LEVEL1_PUB_KEY_SIZE]; byte priv[FALCON_LEVEL1_KEY_SIZE]; byte sig[FALCON_LEVEL1_SIG_SIZE]; @@ -189,7 +190,11 @@ int test_wc_falcon_sign_verify(void) ExpectNotNull(oqssig = OQS_SIG_new(OQS_SIG_alg_falcon_512)); if (oqssig != NULL) { - ExpectIntEQ(OQS_SIG_keypair(oqssig, pub, priv), OQS_SUCCESS); + /* Keep the call out of ExpectIntEQ: the macro casts its arguments to + * int, and casting a function call returning the OQS_STATUS enum + * trips -Werror=bad-function-cast; casting a variable does not. */ + oqs_status = OQS_SIG_keypair(oqssig, pub, priv); + ExpectIntEQ((int)oqs_status, (int)OQS_SUCCESS); ExpectIntEQ(wc_falcon_import_private_key(priv, (word32)sizeof(priv), pub, (word32)sizeof(pub), &key), 0); ExpectIntGT(wc_falcon_size(&key), 0);