diff --git a/include/port.h b/include/port.h new file mode 100644 index 0000000..6058a5a --- /dev/null +++ b/include/port.h @@ -0,0 +1,26 @@ +#ifndef __MPC_LIB_PORT_H__ +#define __MPC_LIB_PORT_H__ + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +#if HAVE_BYTESWAP_H +#include +#else + // bswap_xx macros + #if defined(__APPLE__) + #include + #define bswap_16(x) OSSwapInt16(x) + #define bswap_32(x) OSSwapInt32(x) + #define bswap_64(x) OSSwapInt64(x) + #else + #error bswap_xx macros should be defined + #endif +#endif + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif // __MPC_LIB_PORT_H__ diff --git a/src/common/crypto/GFp_curve_algebra/GFp_curve_algebra.c b/src/common/crypto/GFp_curve_algebra/GFp_curve_algebra.c index 7c77a83..079e7b1 100644 --- a/src/common/crypto/GFp_curve_algebra/GFp_curve_algebra.c +++ b/src/common/crypto/GFp_curve_algebra/GFp_curve_algebra.c @@ -2,7 +2,7 @@ #include #include -#include +#include "port.h" #include #include diff --git a/src/common/crypto/ed25519_algebra/ed25519_algebra.c b/src/common/crypto/ed25519_algebra/ed25519_algebra.c index cb9b115..af22180 100644 --- a/src/common/crypto/ed25519_algebra/ed25519_algebra.c +++ b/src/common/crypto/ed25519_algebra/ed25519_algebra.c @@ -3,7 +3,7 @@ #include "crypto/keccak1600/keccak1600.h" #include "curve25519.c" -#include +#include "port.h" #include #include diff --git a/src/common/crypto/zero_knowledge_proof/diffie_hellman_log.c b/src/common/crypto/zero_knowledge_proof/diffie_hellman_log.c index 8eefd5d..871dbde 100644 --- a/src/common/crypto/zero_knowledge_proof/diffie_hellman_log.c +++ b/src/common/crypto/zero_knowledge_proof/diffie_hellman_log.c @@ -1,6 +1,6 @@ #include "crypto/zero_knowledge_proof/diffie_hellman_log.h" #include "crypto/drng/drng.h" -#include +#include "port.h" #include #include diff --git a/test/crypto/ed25519_algebra/tests.cpp b/test/crypto/ed25519_algebra/tests.cpp index e7969d7..a9b6d92 100644 --- a/test/crypto/ed25519_algebra/tests.cpp +++ b/test/crypto/ed25519_algebra/tests.cpp @@ -4,7 +4,7 @@ #include #include -#include +#include "port.h" #include #include diff --git a/test/crypto/secp256k1_algebra/tests.cpp b/test/crypto/secp256k1_algebra/tests.cpp index 8530950..2d5b71b 100644 --- a/test/crypto/secp256k1_algebra/tests.cpp +++ b/test/crypto/secp256k1_algebra/tests.cpp @@ -5,7 +5,7 @@ #include #include -#include +#include "port.h" #include #include