Skip to content

main fails to compile #67

@mouse07410

Description

@mouse07410

MacOS Sonoma 14.1.2, Xcode-15.1

[ 25%] Building C object ref/CMakeFiles/test_kyber512_ref.dir/test_kyber.c.o
/Users/ur20980/src/kyber/ref/test_kyber.c:9:21: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
static int test_keys()
                    ^
                     void
/Users/ur20980/src/kyber/ref/test_kyber.c:34:29: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
static int test_invalid_sk_a()
                            ^
                             void
/Users/ur20980/src/kyber/ref/test_kyber.c:62:35: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
static int test_invalid_ciphertext()
                                  ^
                                   void
3 errors generated.

Proposed fix is obvious (it also addresses the fact that MacOS has shasum, but not sha256sum):

index 313ab24..6bc127d 100644
--- a/ref/CMakeLists.txt
+++ b/ref/CMakeLists.txt
@@ -114,4 +114,8 @@ else()
   add_test(NAME vectors1024-90s_ref COMMAND sh -c "\"$<TARGET_FILE:test_vectors1024-90s_ref>\" > tvecs1024-90s")
 endif()
 
-add_test(NAME hashes COMMAND sha256sum -c ../../SHA256SUMS)
+if (DARWIN)
+  add_test(NAME hashes COMMAND shasum -a 256 -c ../../SHA256SUMS)
+else()
+  add_test(NAME hashes COMMAND sha256sum -c ../../SHA256SUMS)
+endif(DARWIN)
diff --git a/ref/test_kyber.c b/ref/test_kyber.c
index 0f28af5..cac6b41 100644
--- a/ref/test_kyber.c
+++ b/ref/test_kyber.c
@@ -6,7 +6,7 @@
 
 #define NTESTS 1000
 
-static int test_keys()
+static int test_keys(void)
 {
   uint8_t pk[CRYPTO_PUBLICKEYBYTES];
   uint8_t sk[CRYPTO_SECRETKEYBYTES];
@@ -31,7 +31,7 @@ static int test_keys()
   return 0;
 }
 
-static int test_invalid_sk_a()
+static int test_invalid_sk_a(void)
 {
   uint8_t pk[CRYPTO_PUBLICKEYBYTES];
   uint8_t sk[CRYPTO_SECRETKEYBYTES];
@@ -59,7 +59,7 @@ static int test_invalid_sk_a()
   return 0;
 }
 
-static int test_invalid_ciphertext()
+static int test_invalid_ciphertext(void)
 {
   uint8_t pk[CRYPTO_PUBLICKEYBYTES];
   uint8_t sk[CRYPTO_SECRETKEYBYTES];

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions