tbuktu / libntru

C Implementation of NTRUEncrypt
Other
202 stars 59 forks source link

Errors during make #58

Open p0syd0n opened 3 months ago

p0syd0n commented 3 months ago

During make, errors fly all over the place:


cc -g -Wall -Wextra -Wno-unused-parameter -DNTRU_DETECT_SIMD -O2  -c -fPIC src/encparams.c -o src/encparams.o
cc -g -Wall -Wextra -Wno-unused-parameter -DNTRU_DETECT_SIMD -O2  -c -fPIC src/hash.c -o src/hash.o
cc -g -Wall -Wextra -Wno-unused-parameter -DNTRU_DETECT_SIMD -O2  -c -fPIC src/idxgen.c -o src/idxgen.o
cc -g -Wall -Wextra -Wno-unused-parameter -DNTRU_DETECT_SIMD -O2  -c -fPIC src/key.c -o src/key.o
cc -g -Wall -Wextra -Wno-unused-parameter -DNTRU_DETECT_SIMD -O2  -c -fPIC src/mgf.c -o src/mgf.o
cc -g -Wall -Wextra -Wno-unused-parameter -DNTRU_DETECT_SIMD -O2  -c -fPIC src/ntru.c -o src/ntru.o
cc -g -Wall -Wextra -Wno-unused-parameter -DNTRU_DETECT_SIMD -O2  -c -fPIC src/poly.c -o src/poly.o
cc -g -Wall -Wextra -Wno-unused-parameter -DNTRU_DETECT_SIMD -O2  -c -fPIC src/rand.c -o src/rand.o
cc -g -Wall -Wextra -Wno-unused-parameter -DNTRU_DETECT_SIMD -O2  -c -fPIC src/arith.c -o src/arith.o
cc -g -Wall -Wextra -Wno-unused-parameter -DNTRU_DETECT_SIMD -O2  -c -fPIC src/sha1.c -o src/sha1.o
cc -g -Wall -Wextra -Wno-unused-parameter -DNTRU_DETECT_SIMD -O2  -c -fPIC src/sha2.c -o src/sha2.o
cc -g -Wall -Wextra -Wno-unused-parameter -DNTRU_DETECT_SIMD -O2  -c -fPIC src/nist_ctr_drbg.c -o src/nist_ctr_drbg.o
cc -g -Wall -Wextra -Wno-unused-parameter -DNTRU_DETECT_SIMD -O2  -c -fPIC src/rijndael.c -o src/rijndael.o
src/rijndael.c:856:64: warning: argument 3 of type ‘const u8[16]’ {aka ‘const unsigned char[16]’} with mismatched bound [-Warray-parameter=]
  856 | rijndaelEncrypt(const u32 rk[/*4*(Nr + 1)*/], int Nr, const u8 pt[16],
      |                                                       ~~~~~~~~~^~~~~~
In file included from src/rijndael.c:33:
src/rijndael.h:55:53: note: previously declared as ‘const unsigned char[]’
   55 | void    rijndaelEncrypt(const unsigned int [], int, const unsigned char [],
      |                                                     ^~~~~~~~~~~~~~~~~~~~~~
src/rijndael.c:857:8: warning: argument 4 of type ‘u8[16]’ {aka ‘unsigned char[16]’} with mismatched bound [-Warray-parameter=]
  857 |     u8 ct[16])
      |     ~~~^~~~~~
src/rijndael.h:56:13: note: previously declared as ‘unsigned char[]’
   56 |             unsigned char []);
      |             ^~~~~~~~~~~~~~~~
CC=cc ASM="cc -c" /usr/bin/perl src/sha1-mb-x86_64.pl elf > src/sha1-mb-x86_64.s
cc -c src/sha1-mb-x86_64.s -o src/sha1-mb-x86_64.o
CC=cc ASM="cc -c" /usr/bin/perl src/sha256-mb-x86_64.pl elf > src/sha256-mb-x86_64.s
cc -c src/sha256-mb-x86_64.s -o src/sha256-mb-x86_64.o
cc -g -Wall -Wextra -Wno-unused-parameter -DNTRU_DETECT_SIMD -O2  -mssse3 -c -fPIC src/hash_simd.c -o src/hash_simd.o
cc -g -Wall -Wextra -Wno-unused-parameter -DNTRU_DETECT_SIMD -O2  -mssse3 -c -fPIC src/poly_ssse3.c -o src/poly_ssse3.o
cc -g -Wall -Wextra -Wno-unused-parameter -DNTRU_DETECT_SIMD -O2  -mavx2 -c -fPIC src/poly_avx2.c -o src/poly_avx2.o
cc -g -Wall -Wextra -Wno-unused-parameter -DNTRU_DETECT_SIMD -O2  -shared -Wl,-soname,libntru.so -o libntru.so src/bitstring.o src/encparams.o src/hash.o src/idxgen.o src/key.o src/mgf.o src/ntru.o src/poly.o src/rand.o src/arith.o src/sha1.o src/sha2.o src/nist_ctr_drbg.o src/rijndael.o src/sha1-mb-x86_64.o src/sha256-mb-x86_64.o src/hash_simd.o src/poly_ssse3.o src/poly_avx2.o  -lrt
/usr/bin/ld: src/mgf.o:/home/posydon/coding/Web Server C/libntru/src/poly.h:382: multiple definition of `ntru_invert'; src/key.o:/home/posydon/coding/Web Server C/libntru/src/poly.h:382: first defined here
/usr/bin/ld: src/mgf.o:/home/posydon/coding/Web Server C/libntru/src/poly.h:316: multiple definition of `ntru_mod_mask'; src/key.o:/home/posydon/coding/Web Server C/libntru/src/poly.h:316: first defined here
/usr/bin/ld: src/mgf.o:/home/posydon/coding/Web Server C/libntru/src/poly.h:276: multiple definition of `ntru_mult_int'; src/key.o:/home/posydon/coding/Web Server C/libntru/src/poly.h:276: first defined here
/usr/bin/ld: src/mgf.o:/home/posydon/coding/Web Server C/libntru/src/poly.h:239: multiple definition of `ntru_to_arr'; src/key.o:/home/posydon/coding/Web Server C/libntru/src/poly.h:239: first defined here
/usr/bin/ld: src/mgf.o:/home/posydon/coding/Web Server C/libntru/src/poly.h:138: multiple definition of `ntru_mult_tern'; src/key.o:/home/posydon/coding/Web Server C/libntru/src/poly.h:138: first defined here
/usr/bin/ld: src/ntru.o:/home/posydon/coding/Web Server C/libntru/src/poly.h:382: multiple definition of `ntru_invert'; src/key.o:/home/posydon/coding/Web Server C/libntru/src/poly.h:382: first defined here
/usr/bin/ld: src/ntru.o:/home/posydon/coding/Web Server C/libntru/src/poly.h:316: multiple definition of `ntru_mod_mask'; src/key.o:/home/posydon/coding/Web Server C/libntru/src/poly.h:316: first defined here
/usr/bin/ld: src/ntru.o:/home/posydon/coding/Web Server C/libntru/src/poly.h:239: multiple definition of `ntru_to_arr'; src/key.o:/home/posydon/coding/Web Server C/libntru/src/poly.h:239: first defined here
/usr/bin/ld: src/ntru.o:/home/posydon/coding/Web Server C/libntru/src/poly.h:276: multiple definition of `ntru_mult_int'; src/key.o:/home/posydon/coding/Web Server C/libntru/src/poly.h:276: first defined here
/usr/bin/ld: src/ntru.o:/home/posydon/coding/Web Server C/libntru/src/poly.h:138: multiple definition of `ntru_mult_tern'; src/key.o:/home/posydon/coding/Web Server C/libntru/src/poly.h:138: first defined here
/usr/bin/ld: src/poly.o:/home/posydon/coding/Web Server C/libntru/src/poly.h:316: multiple definition of `ntru_mod_mask'; src/key.o:/home/posydon/coding/Web Server C/libntru/src/poly.h:316: first defined here
/usr/bin/ld: src/poly.o:/home/posydon/coding/Web Server C/libntru/src/poly.h:138: multiple definition of `ntru_mult_tern'; src/key.o:/home/posydon/coding/Web Server C/libntru/src/poly.h:138: first defined here
/usr/bin/ld: src/poly.o:/home/posydon/coding/Web Server C/libntru/src/poly.h:276: multiple definition of `ntru_mult_int'; src/key.o:/home/posydon/coding/Web Server C/libntru/src/poly.h:276: first defined here
/usr/bin/ld: src/poly.o:/home/posydon/coding/Web Server C/libntru/src/poly.h:239: multiple definition of `ntru_to_arr'; src/key.o:/home/posydon/coding/Web Server C/libntru/src/poly.h:239: first defined here
/usr/bin/ld: src/poly.o:/home/posydon/coding/Web Server C/libntru/src/poly.h:382: multiple definition of `ntru_invert'; src/key.o:/home/posydon/coding/Web Server C/libntru/src/poly.h:382: first defined here
/usr/bin/ld: src/poly_ssse3.o:/home/posydon/coding/Web Server C/libntru/src/poly.h:382: multiple definition of `ntru_invert'; src/key.o:/home/posydon/coding/Web Server C/libntru/src/poly.h:382: first defined here
/usr/bin/ld: src/poly_ssse3.o:/home/posydon/coding/Web Server C/libntru/src/poly.h:316: multiple definition of `ntru_mod_mask'; src/key.o:/home/posydon/coding/Web Server C/libntru/src/poly.h:316: first defined here
/usr/bin/ld: src/poly_ssse3.o:/home/posydon/coding/Web Server C/libntru/src/poly.h:276: multiple definition of `ntru_mult_int'; src/key.o:/home/posydon/coding/Web Server C/libntru/src/poly.h:276: first defined here
/usr/bin/ld: src/poly_ssse3.o:/home/posydon/coding/Web Server C/libntru/src/poly.h:239: multiple definition of `ntru_to_arr'; src/key.o:/home/posydon/coding/Web Server C/libntru/src/poly.h:239: first defined here
/usr/bin/ld: src/poly_ssse3.o:/home/posydon/coding/Web Server C/libntru/src/poly.h:138: multiple definition of `ntru_mult_tern'; src/key.o:/home/posydon/coding/Web Server C/libntru/src/poly.h:138: first defined here
/usr/bin/ld: warning: src/sha256-mb-x86_64.o: missing .note.GNU-stack section implies executable stack
/usr/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
collect2: error: ld returned 1 exit status
make: *** [Makefile.linux:82: libntru.so] Error 1```
odiferousmint commented 1 month ago
diff --git a/src/poly.h b/src/poly.h
index 8ca4be6..eac24ff 100644
--- a/src/poly.h
+++ b/src/poly.h
@@ -16,5 +16,5 @@
  * @param modulus
  */
-uint8_t ntruprime_mult_poly(NtruIntPoly *a, NtruIntPoly *b, NtruIntPoly *c, uint16_t modulus);
+extern uint8_t ntruprime_mult_poly(NtruIntPoly *a, NtruIntPoly *b, NtruIntPoly *c, uint16_t modulus);

 /**
@@ -28,5 +28,5 @@ uint8_t ntruprime_mult_poly(NtruIntPoly *a, NtruIntPoly *b, NtruIntPoly *c, uint
  * @return 1 for success, 0 for failure
  */
-uint8_t ntruprime_rand_tern(uint16_t N, NtruIntPoly *poly, NtruRandContext *rand_ctx);
+extern uint8_t ntruprime_rand_tern(uint16_t N, NtruIntPoly *poly, NtruRandContext *rand_ctx);

 /**
@@ -41,8 +41,8 @@ uint8_t ntruprime_rand_tern(uint16_t N, NtruIntPoly *poly, NtruRandContext *rand
  * @return 1 for success, 0 for failure
  */
-uint8_t ntruprime_rand_tern_t(uint16_t N, uint16_t t, NtruIntPoly *poly, NtruRandContext *rand_ctx);
+extern uint8_t ntruprime_rand_tern_t(uint16_t N, uint16_t t, NtruIntPoly *poly, NtruRandContext *rand_ctx);

 /* Multiplies a polynomial by an integer, modulo another integer */
-void ntruprime_mult_mod(NtruIntPoly *a, uint16_t factor, uint16_t modulus);
+extern void ntruprime_mult_mod(NtruIntPoly *a, uint16_t factor, uint16_t modulus);

 /**
@@ -55,5 +55,5 @@ void ntruprime_mult_mod(NtruIntPoly *a, uint16_t factor, uint16_t modulus);
  * @return the inverse of a
  */
-uint16_t ntruprime_inv_int(uint16_t a, uint16_t modulus);
+extern uint16_t ntruprime_inv_int(uint16_t a, uint16_t modulus);

 /**
@@ -68,5 +68,5 @@ uint16_t ntruprime_inv_int(uint16_t a, uint16_t modulus);
  * @return 1 if a is invertible, 0 otherwise
  */
-uint8_t ntruprime_inv_poly(NtruIntPoly *a, NtruIntPoly *b, uint16_t modulus);
+extern uint8_t ntruprime_inv_poly(NtruIntPoly *a, NtruIntPoly *b, uint16_t modulus);

 /**
@@ -82,5 +82,5 @@ uint8_t ntruprime_inv_poly(NtruIntPoly *a, NtruIntPoly *b, uint16_t modulus);
  * @return 1 for success, 0 for failure
  */
-uint8_t ntru_rand_tern(uint16_t N, uint16_t num_ones, uint16_t num_neg_ones, NtruTernPoly *poly, NtruRandContext *rand_ctx);
+extern uint8_t ntru_rand_tern(uint16_t N, uint16_t num_ones, uint16_t num_neg_ones, NtruTernPoly *poly, NtruRandContext *rand_ctx);

 #ifndef NTRU_AVOID_HAMMING_WT_PATENT
@@ -99,5 +99,5 @@ uint8_t ntru_rand_tern(uint16_t N, uint16_t num_ones, uint16_t num_neg_ones, Ntr
  * @return 1 for success, 0 for failure
  */
-uint8_t ntru_rand_prod(uint16_t N, uint16_t df1, uint16_t df2, uint16_t df3_ones, uint16_t df3_neg_ones, NtruProdPoly *poly, NtruRandContext *rand_ctx);
+extern uint8_t ntru_rand_prod(uint16_t N, uint16_t df1, uint16_t df2, uint16_t df3_ones, uint16_t df3_neg_ones, NtruProdPoly *poly, NtruRandContext *rand_ctx);
 #endif   /* NTRU_AVOID_HAMMING_WT_PATENT */

@@ -111,5 +111,5 @@ uint8_t ntru_rand_prod(uint16_t N, uint16_t df1, uint16_t df2, uint16_t df3_ones
  * @param b a polynomial to add to the polynomial a
  */
-void ntru_add(NtruIntPoly *a, NtruIntPoly *b);
+extern void ntru_add(NtruIntPoly *a, NtruIntPoly *b);

 /**
@@ -122,5 +122,5 @@ void ntru_add(NtruIntPoly *a, NtruIntPoly *b);
  * @param b a polynomial to subtract from the polynomial a
  */
-void ntru_sub(NtruIntPoly *a, NtruIntPoly *b);
+extern void ntru_sub(NtruIntPoly *a, NtruIntPoly *b);

 /**
@@ -136,5 +136,5 @@ void ntru_sub(NtruIntPoly *a, NtruIntPoly *b);
  * @return 0 if the number of coefficients differ, 1 otherwise
  */
-uint8_t (*ntru_mult_tern)(NtruIntPoly *a, NtruTernPoly *b, NtruIntPoly *c, uint16_t mod_mask);
+extern uint8_t (*ntru_mult_tern)(NtruIntPoly *a, NtruTernPoly *b, NtruIntPoly *c, uint16_t mod_mask);

 /**
@@ -151,5 +151,5 @@ uint8_t (*ntru_mult_tern)(NtruIntPoly *a, NtruTernPoly *b, NtruIntPoly *c, uint1
  * @return 0 if the number of coefficients differ, 1 otherwise
  */
-uint8_t ntru_mult_tern_32(NtruIntPoly *a, NtruTernPoly *b, NtruIntPoly *c, uint16_t mod_mask);
+extern uint8_t ntru_mult_tern_32(NtruIntPoly *a, NtruTernPoly *b, NtruIntPoly *c, uint16_t mod_mask);

 /**
@@ -166,5 +166,5 @@ uint8_t ntru_mult_tern_32(NtruIntPoly *a, NtruTernPoly *b, NtruIntPoly *c, uint1
  * @return 0 if the number of coefficients differ, 1 otherwise
  */
-uint8_t ntru_mult_tern_64(NtruIntPoly *a, NtruTernPoly *b, NtruIntPoly *c, uint16_t mod_mask);
+extern uint8_t ntru_mult_tern_64(NtruIntPoly *a, NtruTernPoly *b, NtruIntPoly *c, uint16_t mod_mask);

 #ifndef NTRU_AVOID_HAMMING_WT_PATENT
@@ -181,5 +181,5 @@ uint8_t ntru_mult_tern_64(NtruIntPoly *a, NtruTernPoly *b, NtruIntPoly *c, uint1
  * @return 0 if the number of coefficients differ, 1 otherwise
  */
-uint8_t ntru_mult_prod(NtruIntPoly *a, NtruProdPoly *b, NtruIntPoly *c, uint16_t mod_mask);
+extern uint8_t ntru_mult_prod(NtruIntPoly *a, NtruProdPoly *b, NtruIntPoly *c, uint16_t mod_mask);
 #endif   /* NTRU_AVOID_HAMMING_WT_PATENT */

@@ -197,5 +197,5 @@ uint8_t ntru_mult_prod(NtruIntPoly *a, NtruProdPoly *b, NtruIntPoly *c, uint16_t
  * @return 0 if the number of coefficients differ, 1 otherwise
  */
-uint8_t ntru_mult_priv(NtruPrivPoly *a, NtruIntPoly *b, NtruIntPoly *c, uint16_t mod_mask);
+extern uint8_t ntru_mult_priv(NtruPrivPoly *a, NtruIntPoly *b, NtruIntPoly *c, uint16_t mod_mask);

 /**
@@ -211,5 +211,5 @@ uint8_t ntru_mult_priv(NtruPrivPoly *a, NtruIntPoly *b, NtruIntPoly *c, uint16_t
  *          No extra room is needed at the end.
  */
-void ntru_to_arr_32(NtruIntPoly *p, uint16_t q, uint8_t *a);
+extern void ntru_to_arr_32(NtruIntPoly *p, uint16_t q, uint8_t *a);

 /**
@@ -225,5 +225,5 @@ void ntru_to_arr_32(NtruIntPoly *p, uint16_t q, uint8_t *a);
  *          Must accommodate at least 7 more bytes than the result takes up.
  */
-void ntru_to_arr_64(NtruIntPoly *p, uint16_t q, uint8_t *a);
+extern void ntru_to_arr_64(NtruIntPoly *p, uint16_t q, uint8_t *a);

 /**
@@ -237,5 +237,5 @@ void ntru_to_arr_64(NtruIntPoly *p, uint16_t q, uint8_t *a);
  * @param a output parameter; a pointer to store the encoded polynomial
  */
-void (*ntru_to_arr)(NtruIntPoly *p, uint16_t q, uint8_t *a);
+extern void (*ntru_to_arr)(NtruIntPoly *p, uint16_t q, uint8_t *a);

 /**
@@ -248,7 +248,7 @@ void (*ntru_to_arr)(NtruIntPoly *p, uint16_t q, uint8_t *a);
  * @param arr output parameter; a pointer to store the encoded polynomial
  */
-void ntru_to_arr4(NtruIntPoly *p, uint8_t *arr);
+extern void ntru_to_arr4(NtruIntPoly *p, uint8_t *arr);

-void ntru_from_arr(uint8_t *arr, uint16_t N, uint16_t q, NtruIntPoly *p);
+extern void ntru_from_arr(uint8_t *arr, uint16_t N, uint16_t q, NtruIntPoly *p);

 /**
@@ -260,5 +260,5 @@ void ntru_from_arr(uint8_t *arr, uint16_t N, uint16_t q, NtruIntPoly *p);
  * @param factor the factor to multiply by
  */
-void ntru_mult_fac(NtruIntPoly *a, int16_t factor);
+extern void ntru_mult_fac(NtruIntPoly *a, int16_t factor);

 /**
@@ -274,5 +274,5 @@ void ntru_mult_fac(NtruIntPoly *a, int16_t factor);
  * @return 0 if the number of coefficients differ, 1 otherwise
  */
-uint8_t (*ntru_mult_int)(NtruIntPoly *a, NtruIntPoly *b, NtruIntPoly *c, uint16_t mod_mask);
+extern uint8_t (*ntru_mult_int)(NtruIntPoly *a, NtruIntPoly *b, NtruIntPoly *c, uint16_t mod_mask);

 /**
@@ -289,5 +289,5 @@ uint8_t (*ntru_mult_int)(NtruIntPoly *a, NtruIntPoly *b, NtruIntPoly *c, uint16_
  * @return 0 if the number of coefficients differ, 1 otherwise
  */
-uint8_t ntru_mult_int_16(NtruIntPoly *a, NtruIntPoly *b, NtruIntPoly *c, uint16_t mod_mask);
+extern uint8_t ntru_mult_int_16(NtruIntPoly *a, NtruIntPoly *b, NtruIntPoly *c, uint16_t mod_mask);

 /**
@@ -304,5 +304,5 @@ uint8_t ntru_mult_int_16(NtruIntPoly *a, NtruIntPoly *b, NtruIntPoly *c, uint16_
  * @return 0 if the number of coefficients differ, 1 otherwise
  */
-uint8_t ntru_mult_int_64(NtruIntPoly *a, NtruIntPoly *b, NtruIntPoly *c, uint16_t mod_mask);
+extern uint8_t ntru_mult_int_64(NtruIntPoly *a, NtruIntPoly *b, NtruIntPoly *c, uint16_t mod_mask);

 /**
@@ -314,5 +314,5 @@ uint8_t ntru_mult_int_64(NtruIntPoly *a, NtruIntPoly *b, NtruIntPoly *c, uint16_
  * @param mod_mask an AND mask to apply to the coefficients of c
  */
-void (*ntru_mod_mask)(NtruIntPoly *p, uint16_t mod_mask);
+extern void (*ntru_mod_mask)(NtruIntPoly *p, uint16_t mod_mask);

 /**
@@ -324,5 +324,5 @@ void (*ntru_mod_mask)(NtruIntPoly *p, uint16_t mod_mask);
  * @param p input and output parameter; coefficients are overwritten
  */
-void ntru_mod3(NtruIntPoly *p);
+extern void ntru_mod3(NtruIntPoly *p);

 /**
@@ -335,5 +335,5 @@ void ntru_mod3(NtruIntPoly *p);
  * @param modulus the modulus to apply to the coefficients of p
  */
-void ntru_mod_center(NtruIntPoly *p, uint16_t modulus);
+extern void ntru_mod_center(NtruIntPoly *p, uint16_t modulus);

 /**
@@ -346,5 +346,5 @@ void ntru_mod_center(NtruIntPoly *p, uint16_t modulus);
  * @return 1 iff all coefficients are equal
  */
-uint8_t ntru_equals_int(NtruIntPoly *a, NtruIntPoly *b);
+extern uint8_t ntru_equals_int(NtruIntPoly *a, NtruIntPoly *b);

 /**
@@ -356,5 +356,5 @@ uint8_t ntru_equals_int(NtruIntPoly *a, NtruIntPoly *b);
  * @param p a polynomial
  */
-void ntru_clear_priv(NtruPrivPoly *p);
+extern void ntru_clear_priv(NtruPrivPoly *p);

 /**
@@ -365,5 +365,5 @@ void ntru_clear_priv(NtruPrivPoly *p);
  * @param p a polynomial
  */
-void ntru_clear_int(NtruIntPoly *p);
+extern void ntru_clear_int(NtruIntPoly *p);

 /**
@@ -380,5 +380,5 @@ void ntru_clear_int(NtruIntPoly *p);
  * @return 1 if a is invertible, 0 otherwise
  */
-uint8_t (*ntru_invert)(NtruPrivPoly *a, uint16_t mod_mask, NtruIntPoly *Fq);
+extern uint8_t (*ntru_invert)(NtruPrivPoly *a, uint16_t mod_mask, NtruIntPoly *Fq);

 /**
@@ -396,5 +396,5 @@ uint8_t (*ntru_invert)(NtruPrivPoly *a, uint16_t mod_mask, NtruIntPoly *Fq);
  * @return 1 if a is invertible, 0 otherwise
  */
-uint8_t ntru_invert_32(NtruPrivPoly *a, uint16_t mod_mask, NtruIntPoly *Fq);
+extern uint8_t ntru_invert_32(NtruPrivPoly *a, uint16_t mod_mask, NtruIntPoly *Fq);

 /**
@@ -412,5 +412,5 @@ uint8_t ntru_invert_32(NtruPrivPoly *a, uint16_t mod_mask, NtruIntPoly *Fq);
  * @return 1 if a is invertible, 0 otherwise
  */
-uint8_t ntru_invert_64(NtruPrivPoly *a, uint16_t mod_mask, NtruIntPoly *Fq);
+extern uint8_t ntru_invert_64(NtruPrivPoly *a, uint16_t mod_mask, NtruIntPoly *Fq);

 /**
@@ -420,5 +420,5 @@ uint8_t ntru_invert_64(NtruPrivPoly *a, uint16_t mod_mask, NtruIntPoly *Fq);
  * variant is used.
  */
-void ntru_set_optimized_impl_poly();
+extern void ntru_set_optimized_impl_poly();

 #endif   /* NTRU_POLY_H */

Just apply this patch, and it should compile successfully.