diff --git a/src/libsodium/crypto_generichash/blake2b/ref/blake2b-ref.c b/src/libsodium/crypto_generichash/blake2b/ref/blake2b-ref.c index 8da3de42..10bb4d2e 100644 --- a/src/libsodium/crypto_generichash/blake2b/ref/blake2b-ref.c +++ b/src/libsodium/crypto_generichash/blake2b/ref/blake2b-ref.c @@ -25,14 +25,6 @@ #include "runtime.h" #include "utils.h" -#ifdef HAVE_TI_MODE -# if defined(__SIZEOF_INT128__) -typedef unsigned __int128 uint128_t; -# else -typedef unsigned uint128_t __attribute__((mode(TI))); -# endif -#endif - static blake2b_compress_fn blake2b_compress = blake2b_compress_ref; static const uint64_t blake2b_IV[8] = { diff --git a/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna64.h b/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna64.h index a082e9ae..e0ed7547 100644 --- a/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna64.h +++ b/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna64.h @@ -3,11 +3,7 @@ and 128 bit addition */ -#if defined(__SIZEOF_INT128__) -typedef unsigned __int128 uint128_t; -#else -typedef unsigned uint128_t __attribute__((mode(TI))); -#endif +#include "private/common.h" #define MUL(out, x, y) out = ((uint128_t) x * y) #define ADD(out, in) out += in @@ -23,8 +19,6 @@ typedef unsigned uint128_t __attribute__((mode(TI))); # define POLY1305_NOINLINE #endif -#include "private/common.h" - #define poly1305_block_size 16 /* 17 + sizeof(unsigned long long) + 8*sizeof(unsigned long long) */ diff --git a/src/libsodium/crypto_onetimeauth/poly1305/sse2/poly1305_sse2.c b/src/libsodium/crypto_onetimeauth/poly1305/sse2/poly1305_sse2.c index 953685c1..022f1524 100644 --- a/src/libsodium/crypto_onetimeauth/poly1305/sse2/poly1305_sse2.c +++ b/src/libsodium/crypto_onetimeauth/poly1305/sse2/poly1305_sse2.c @@ -19,12 +19,6 @@ typedef __m128i xmmi; -# if defined(__SIZEOF_INT128__) -typedef unsigned __int128 uint128_t; -# else -typedef unsigned uint128_t __attribute__((mode(TI))); -# endif - # if defined(_MSC_VER) # define POLY1305_NOINLINE __declspec(noinline) # elif defined(__GNUC__) diff --git a/src/libsodium/crypto_scalarmult/curve25519/donna_c64/curve25519_donna_c64.c b/src/libsodium/crypto_scalarmult/curve25519/donna_c64/curve25519_donna_c64.c index 84ea326c..55746f68 100644 --- a/src/libsodium/crypto_scalarmult/curve25519/donna_c64/curve25519_donna_c64.c +++ b/src/libsodium/crypto_scalarmult/curve25519/donna_c64/curve25519_donna_c64.c @@ -29,13 +29,12 @@ #include "../scalarmult_curve25519.h" #include "curve25519_donna_c64.h" +#include "private/common.h" #include "utils.h" typedef uint8_t u8; typedef uint64_t limb; typedef limb felem[5]; -/* Special gcc mode for 128-bit integers */ -typedef unsigned uint128_t __attribute__((mode(TI))); /* Sum two numbers: output += in */ static inline void diff --git a/src/libsodium/include/sodium/private/common.h b/src/libsodium/include/sodium/private/common.h index 7e9919fd..b012d245 100644 --- a/src/libsodium/include/sodium/private/common.h +++ b/src/libsodium/include/sodium/private/common.h @@ -7,6 +7,14 @@ #define COMPILER_ASSERT(X) (void) sizeof(char[(X) ? 1 : -1]) +#ifdef HAVE_TI_MODE +# if defined(__SIZEOF_INT128__) +typedef unsigned __int128 uint128_t; +# else +typedef unsigned uint128_t __attribute__((mode(TI))); +# endif +#endif + #define ROTL32(X, B) rotl32((X), (B)) static inline uint32_t rotl32(const uint32_t x, const int b)