diff --git a/crypto_kem/kyber768/clean/api.h b/crypto_kem/kyber768/clean/api.h index 737a208e..35b6978c 100644 --- a/crypto_kem/kyber768/clean/api.h +++ b/crypto_kem/kyber768/clean/api.h @@ -1,5 +1,5 @@ -#ifndef API_H -#define API_H +#ifndef PQCLEAN_KYBER768_CLEAN_API_H +#define PQCLEAN_KYBER768_CLEAN_API_H #include diff --git a/crypto_sign/dilithium-iii/clean/api.h b/crypto_sign/dilithium-iii/clean/api.h index c9c15380..7edbe671 100644 --- a/crypto_sign/dilithium-iii/clean/api.h +++ b/crypto_sign/dilithium-iii/clean/api.h @@ -1,6 +1,5 @@ -#ifndef API_H -#include -#define API_H +#ifndef PQCLEAN_DILITHIUMIII_API_H +#define PQCLEAN_DILITHIUMIII_API_H #include #include diff --git a/test/Makefile b/test/Makefile index a21545e3..add8a886 100644 --- a/test/Makefile +++ b/test/Makefile @@ -15,7 +15,7 @@ COMMON_HEADERS=$(COMMON_DIR)/fips202.h $(COMMON_DIR)/randombytes.h $(COMMON_DIR) DEST_DIR=../bin # This -Wall was supported by the European Commission through the ERC Starting Grant 805031 (EPOQUE) -CFLAGS=-Wall -Wextra -Wpedantic -Werror -std=c99 -I$(COMMON_DIR) $(EXTRAFLAGS) +CFLAGS=-Wall -Wextra -Wpedantic -Werror -Wundef -std=c99 -I$(COMMON_DIR) $(EXTRAFLAGS) all: $(DEST_DIR)/functest_$(SCHEME)_$(IMPLEMENTATION) $(DEST_DIR)/testvectors_$(SCHEME)_$(IMPLEMENTATION) diff --git a/test/crypto_kem/functest.c b/test/crypto_kem/functest.c index 5a513810..a2721e86 100644 --- a/test/crypto_kem/functest.c +++ b/test/crypto_kem/functest.c @@ -50,12 +50,16 @@ static int check_canary(const uint8_t *d) { return -1; \ } +#define DEFER(x) x +#define NAMESPACE_CHECK DEFER(NAMESPACE(API_H)) + static int test_keys(void) { /* * This is most likely going to be aligned by the compiler. * 16 extra bytes for canary * 1 extra byte for unalignment */ + uint8_t key_a_aligned[CRYPTO_BYTES + 16 + 1]; uint8_t key_b_aligned[CRYPTO_BYTES + 16 + 1]; uint8_t pk_aligned[CRYPTO_PUBLICKEYBYTES + 16 + 1]; @@ -196,7 +200,10 @@ static int test_invalid_ciphertext(void) { } int main(void) { + // these two will trigger compiler errors puts(CRYPTO_ALGNAME); + NAMESPACE_CHECK; + int result = 0; result += test_keys(); result += test_invalid_sk_a(); diff --git a/test/crypto_sign/functest.c b/test/crypto_sign/functest.c index 11938648..2eaf8f5c 100644 --- a/test/crypto_sign/functest.c +++ b/test/crypto_sign/functest.c @@ -51,6 +51,9 @@ static int check_canary(const uint8_t *d) { return -1; \ } +#define DEFER(x) x +#define NAMESPACE_CHECK DEFER(NAMESPACE(API_H)) + static int test_sign(void) { /* * This is most likely going to be aligned by the compiler. @@ -160,7 +163,10 @@ static int test_wrong_pk(void) { } int main(void) { + // these two will generate compile errors puts(CRYPTO_ALGNAME); + NAMESPACE_CHECK; + int result = 0; result += test_sign(); result += test_wrong_pk();