tbuktu / libntru

C Implementation of NTRUEncrypt
Other
202 stars 59 forks source link

OS X does not have htole64(). #14

Closed textbrowser closed 9 years ago

textbrowser commented 9 years ago

Please apply the following changes to poly.c.

--- a/libNTRU/src/poly.c +++ b/libNTRU/src/poly.c @@ -8,6 +8,11 @@

include "err.h"

include "arith.h"

+#ifdef APPLE +#include <libkern/OSByteOrder.h> +#define htole64(x) OSSwapHostToLittleInt64(x) +#endif +

define NTRU_SPARSE_THRESH 20

textbrowser commented 9 years ago

GitHub is misinterpreting underscores.

underscoreunderscoreAPPLEunderscoreunderscore

textbrowser commented 9 years ago

And on a Windows 7 machine.

src/poly.c:679:9: warning: implicit declaration of function 'htole64' [-Wimplicit-function-declaration] a64[i] = htole64(a64[i]); ^ gcc -g -O2 -Wall -Wextra -Wno-unused-parameter -shared -o libntru.dll 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 -lws2_32 -ladvapi32 src/poly.o: In function ntru_to_arr_64': D:\datawin\spoton7git\spot-on\libNTRU/src/poly.c:679: undefined reference tohtole64' collect2.exe: error: ld returned 1 exit status

tbuktu commented 9 years ago

Yeah, MinGW doesn't have htole64(), either. I pushed a fix. Thanks for reporting this!

Ivoz commented 9 years ago

@textbrowser see the code tab on this page for how to paste code correctly in github comments / issues.

textbrowser commented 9 years ago

Thank you for the link.