diff --git a/src/libsodium/crypto_core/hsalsa20/ref2/core_hsalsa20.c b/src/libsodium/crypto_core/hsalsa20/ref2/core_hsalsa20.c index 19aac3c7..384cc33f 100644 --- a/src/libsodium/crypto_core/hsalsa20/ref2/core_hsalsa20.c +++ b/src/libsodium/crypto_core/hsalsa20/ref2/core_hsalsa20.c @@ -4,15 +4,16 @@ D. J. Bernstein Public domain. */ +#include +#include + #include "crypto_core_hsalsa20.h" #include "../../sodium/common.h" #define ROUNDS 20 #define U32C(v) (v##U) -typedef unsigned int uint32; - -static uint32 rotate(uint32 u,int c) +static uint32_t rotate(uint32_t u,int c) { return (u << c) | (u >> (32 - c)); } @@ -24,7 +25,7 @@ int crypto_core_hsalsa20( const unsigned char *c ) { - uint32 x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15; + uint32_t x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15; int i; if (c == NULL) { diff --git a/src/libsodium/crypto_core/salsa20/ref/core_salsa20.c b/src/libsodium/crypto_core/salsa20/ref/core_salsa20.c index 731af4a2..92541c21 100644 --- a/src/libsodium/crypto_core/salsa20/ref/core_salsa20.c +++ b/src/libsodium/crypto_core/salsa20/ref/core_salsa20.c @@ -4,14 +4,15 @@ D. J. Bernstein Public domain. */ +#include +#include + #include "crypto_core_salsa20.h" #include "../../sodium/common.h" #define ROUNDS 20 -typedef unsigned int uint32; - -static uint32 rotate(uint32 u,int c) +static uint32_t rotate(uint32_t u,int c) { return (u << c) | (u >> (32 - c)); } @@ -23,8 +24,8 @@ int crypto_core_salsa20( const unsigned char *c ) { - uint32 x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15; - uint32 j0, j1, j2, j3, j4, j5, j6, j7, j8, j9, j10, j11, j12, j13, j14, j15; + uint32_t x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15; + uint32_t j0, j1, j2, j3, j4, j5, j6, j7, j8, j9, j10, j11, j12, j13, j14, j15; int i; j0 = x0 = LOAD32_LE(c + 0); diff --git a/src/libsodium/crypto_core/salsa2012/ref/core_salsa2012.c b/src/libsodium/crypto_core/salsa2012/ref/core_salsa2012.c index 76261395..1f7c57b5 100644 --- a/src/libsodium/crypto_core/salsa2012/ref/core_salsa2012.c +++ b/src/libsodium/crypto_core/salsa2012/ref/core_salsa2012.c @@ -4,14 +4,15 @@ D. J. Bernstein Public domain. */ +#include +#include + #include "crypto_core_salsa2012.h" #include "../../sodium/common.h" #define ROUNDS 12 -typedef unsigned int uint32; - -static uint32 rotate(uint32 u,int c) +static uint32_t rotate(uint32_t u,int c) { return (u << c) | (u >> (32 - c)); } @@ -23,8 +24,8 @@ int crypto_core_salsa2012( const unsigned char *c ) { - uint32 x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15; - uint32 j0, j1, j2, j3, j4, j5, j6, j7, j8, j9, j10, j11, j12, j13, j14, j15; + uint32_t x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15; + uint32_t j0, j1, j2, j3, j4, j5, j6, j7, j8, j9, j10, j11, j12, j13, j14, j15; int i; j0 = x0 = LOAD32_LE(c + 0); diff --git a/src/libsodium/crypto_core/salsa208/ref/core_salsa208.c b/src/libsodium/crypto_core/salsa208/ref/core_salsa208.c index c37ed3f9..1aa409aa 100644 --- a/src/libsodium/crypto_core/salsa208/ref/core_salsa208.c +++ b/src/libsodium/crypto_core/salsa208/ref/core_salsa208.c @@ -4,14 +4,15 @@ D. J. Bernstein Public domain. */ +#include +#include + #include "crypto_core_salsa208.h" #include "../../sodium/common.h" #define ROUNDS 8 -typedef unsigned int uint32; - -static uint32 rotate(uint32 u,int c) +static uint32_t rotate(uint32_t u,int c) { return (u << c) | (u >> (32 - c)); } @@ -23,8 +24,8 @@ int crypto_core_salsa208( const unsigned char *c ) { - uint32 x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15; - uint32 j0, j1, j2, j3, j4, j5, j6, j7, j8, j9, j10, j11, j12, j13, j14, j15; + uint32_t x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15; + uint32_t j0, j1, j2, j3, j4, j5, j6, j7, j8, j9, j10, j11, j12, j13, j14, j15; int i; j0 = x0 = LOAD32_LE(c + 0); diff --git a/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe.h b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe.h index a9a50e61..b1115f86 100644 --- a/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe.h +++ b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe.h @@ -6,9 +6,10 @@ #ifndef fe_H #define fe_H -#include "crypto_uint64.h" +#include +#include -typedef crypto_uint64 fe[10]; +typedef uint64_t fe[10]; /* fe means field element. diff --git a/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51.h b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51.h index bc81e162..8e3f199b 100644 --- a/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51.h +++ b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51.h @@ -12,12 +12,14 @@ extern "C" { #endif -#include "crypto_uint64.h" +#include +#include + #include "fe51_namespace.h" typedef struct { - crypto_uint64 v[5]; + uint64_t v[5]; } fe51; diff --git a/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe_frombytes_sandy2x.c b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe_frombytes_sandy2x.c index 0de060c8..f1a29a34 100644 --- a/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe_frombytes_sandy2x.c +++ b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe_frombytes_sandy2x.c @@ -3,51 +3,50 @@ */ #include "fe.h" -#include "crypto_uint64.h" #ifdef HAVE_AVX_ASM -static crypto_uint64 load_3(const unsigned char *in) +static uint64_t load_3(const unsigned char *in) { - crypto_uint64 result; - result = (crypto_uint64) in[0]; - result |= ((crypto_uint64) in[1]) << 8; - result |= ((crypto_uint64) in[2]) << 16; + uint64_t result; + result = (uint64_t) in[0]; + result |= ((uint64_t) in[1]) << 8; + result |= ((uint64_t) in[2]) << 16; return result; } -static crypto_uint64 load_4(const unsigned char *in) +static uint64_t load_4(const unsigned char *in) { - crypto_uint64 result; - result = (crypto_uint64) in[0]; - result |= ((crypto_uint64) in[1]) << 8; - result |= ((crypto_uint64) in[2]) << 16; - result |= ((crypto_uint64) in[3]) << 24; + uint64_t result; + result = (uint64_t) in[0]; + result |= ((uint64_t) in[1]) << 8; + result |= ((uint64_t) in[2]) << 16; + result |= ((uint64_t) in[3]) << 24; return result; } void fe_frombytes(fe h,const unsigned char *s) { - crypto_uint64 h0 = load_4(s); - crypto_uint64 h1 = load_3(s + 4) << 6; - crypto_uint64 h2 = load_3(s + 7) << 5; - crypto_uint64 h3 = load_3(s + 10) << 3; - crypto_uint64 h4 = load_3(s + 13) << 2; - crypto_uint64 h5 = load_4(s + 16); - crypto_uint64 h6 = load_3(s + 20) << 7; - crypto_uint64 h7 = load_3(s + 23) << 5; - crypto_uint64 h8 = load_3(s + 26) << 4; - crypto_uint64 h9 = (load_3(s + 29) & 8388607) << 2; - crypto_uint64 carry0; - crypto_uint64 carry1; - crypto_uint64 carry2; - crypto_uint64 carry3; - crypto_uint64 carry4; - crypto_uint64 carry5; - crypto_uint64 carry6; - crypto_uint64 carry7; - crypto_uint64 carry8; - crypto_uint64 carry9; + uint64_t h0 = load_4(s); + uint64_t h1 = load_3(s + 4) << 6; + uint64_t h2 = load_3(s + 7) << 5; + uint64_t h3 = load_3(s + 10) << 3; + uint64_t h4 = load_3(s + 13) << 2; + uint64_t h5 = load_4(s + 16); + uint64_t h6 = load_3(s + 20) << 7; + uint64_t h7 = load_3(s + 23) << 5; + uint64_t h8 = load_3(s + 26) << 4; + uint64_t h9 = (load_3(s + 29) & 8388607) << 2; + uint64_t carry0; + uint64_t carry1; + uint64_t carry2; + uint64_t carry3; + uint64_t carry4; + uint64_t carry5; + uint64_t carry6; + uint64_t carry7; + uint64_t carry8; + uint64_t carry9; carry9 = h9 >> 25; h0 += carry9 * 19; h9 &= 0x1FFFFFF; carry1 = h1 >> 25; h2 += carry1; h1 &= 0x1FFFFFF; diff --git a/src/libsodium/crypto_shorthash/siphash24/ref/shorthash_siphash24.c b/src/libsodium/crypto_shorthash/siphash24/ref/shorthash_siphash24.c index 773ea201..70ff4c80 100644 --- a/src/libsodium/crypto_shorthash/siphash24/ref/shorthash_siphash24.c +++ b/src/libsodium/crypto_shorthash/siphash24/ref/shorthash_siphash24.c @@ -1,12 +1,9 @@ #include "crypto_shorthash_siphash24.h" -#include "crypto_uint64.h" -#include "crypto_uint32.h" -#include "crypto_uint8.h" #include "../../sodium/common.h" -typedef crypto_uint64 u64; -typedef crypto_uint32 u32; -typedef crypto_uint8 u8; +typedef uint64_t u64; +typedef uint32_t u32; +typedef uint8_t u8; #define ROTL(x,b) (u64)( ((x) << (b)) | ( (x) >> (64 - (b))) ) diff --git a/src/libsodium/crypto_stream/aes128ctr/portable/types.h b/src/libsodium/crypto_stream/aes128ctr/portable/types.h index 6aa502fc..ca24b4de 100644 --- a/src/libsodium/crypto_stream/aes128ctr/portable/types.h +++ b/src/libsodium/crypto_stream/aes128ctr/portable/types.h @@ -1,10 +1,10 @@ #ifndef TYPES_H #define TYPES_H -#include "crypto_uint32.h" -typedef crypto_uint32 uint32; +#include +#include -#include "crypto_uint64.h" -typedef crypto_uint64 uint64; +typedef uint32_t uint32; +typedef uint64_t uint64; #endif diff --git a/src/libsodium/crypto_stream/salsa20/ref/stream_salsa20_ref.c b/src/libsodium/crypto_stream/salsa20/ref/stream_salsa20_ref.c index b808446e..5a17b4bc 100644 --- a/src/libsodium/crypto_stream/salsa20/ref/stream_salsa20_ref.c +++ b/src/libsodium/crypto_stream/salsa20/ref/stream_salsa20_ref.c @@ -10,8 +10,6 @@ Public domain. #ifndef HAVE_AMD64_ASM -typedef unsigned int uint32; - int crypto_stream_salsa20( unsigned char *c,unsigned long long clen, const unsigned char *n, diff --git a/src/libsodium/crypto_stream/salsa20/ref/xor_salsa20_ref.c b/src/libsodium/crypto_stream/salsa20/ref/xor_salsa20_ref.c index d4082a78..d5984965 100644 --- a/src/libsodium/crypto_stream/salsa20/ref/xor_salsa20_ref.c +++ b/src/libsodium/crypto_stream/salsa20/ref/xor_salsa20_ref.c @@ -12,8 +12,6 @@ Public domain. #ifndef HAVE_AMD64_ASM -typedef unsigned int uint32; - int crypto_stream_salsa20_xor_ic( unsigned char *c, const unsigned char *m,unsigned long long mlen, diff --git a/src/libsodium/crypto_stream/salsa2012/ref/stream_salsa2012.c b/src/libsodium/crypto_stream/salsa2012/ref/stream_salsa2012.c index 986ec6e5..5a3a3c1e 100644 --- a/src/libsodium/crypto_stream/salsa2012/ref/stream_salsa2012.c +++ b/src/libsodium/crypto_stream/salsa2012/ref/stream_salsa2012.c @@ -8,8 +8,6 @@ Public domain. #include "crypto_stream_salsa2012.h" #include "utils.h" -typedef unsigned int uint32; - int crypto_stream_salsa2012( unsigned char *c,unsigned long long clen, const unsigned char *n, diff --git a/src/libsodium/crypto_stream/salsa2012/ref/xor_salsa2012.c b/src/libsodium/crypto_stream/salsa2012/ref/xor_salsa2012.c index 3443ac20..f885b30f 100644 --- a/src/libsodium/crypto_stream/salsa2012/ref/xor_salsa2012.c +++ b/src/libsodium/crypto_stream/salsa2012/ref/xor_salsa2012.c @@ -8,8 +8,6 @@ Public domain. #include "crypto_stream_salsa2012.h" #include "utils.h" -typedef unsigned int uint32; - int crypto_stream_salsa2012_xor( unsigned char *c, const unsigned char *m,unsigned long long mlen, diff --git a/src/libsodium/crypto_stream/salsa208/ref/stream_salsa208.c b/src/libsodium/crypto_stream/salsa208/ref/stream_salsa208.c index 386d8daa..0b81ce1d 100644 --- a/src/libsodium/crypto_stream/salsa208/ref/stream_salsa208.c +++ b/src/libsodium/crypto_stream/salsa208/ref/stream_salsa208.c @@ -8,8 +8,6 @@ Public domain. #include "crypto_stream_salsa208.h" #include "utils.h" -typedef unsigned int uint32; - int crypto_stream_salsa208( unsigned char *c,unsigned long long clen, const unsigned char *n, diff --git a/src/libsodium/crypto_stream/salsa208/ref/xor_salsa208.c b/src/libsodium/crypto_stream/salsa208/ref/xor_salsa208.c index 1e6b4e71..fdbd5938 100644 --- a/src/libsodium/crypto_stream/salsa208/ref/xor_salsa208.c +++ b/src/libsodium/crypto_stream/salsa208/ref/xor_salsa208.c @@ -8,8 +8,6 @@ Public domain. #include "crypto_stream_salsa208.h" #include "utils.h" -typedef unsigned int uint32; - int crypto_stream_salsa208_xor( unsigned char *c, const unsigned char *m,unsigned long long mlen,