Initial OS X support.

This commit is contained in:
Admin 2017-05-26 23:17:12 +03:00 committed by Admin
parent ebb0f81f2f
commit bc2b7d1895
11 changed files with 244 additions and 49 deletions

View file

@ -33,7 +33,7 @@ extern __m128i soft_aeskeygenassist(__m128i key, uint8_t rcon);
// This will shift and xor tmp1 into itself as 4 32-bit vals such as
// sl_xor(a1 a2 a3 a4) = a1 (a2^a1) (a3^a2^a1) (a4^a3^a2^a1)
inline __m128i sl_xor(__m128i tmp1)
static inline __m128i sl_xor(__m128i tmp1)
{
__m128i tmp4;
tmp4 = _mm_slli_si128(tmp1, 0x04);
@ -46,7 +46,7 @@ inline __m128i sl_xor(__m128i tmp1)
}
inline void aes_genkey_sub(__m128i* xout0, __m128i* xout2, uint8_t rcon)
static inline void aes_genkey_sub(__m128i* xout0, __m128i* xout2, uint8_t rcon)
{
__m128i xout1 = soft_aeskeygenassist(*xout2, rcon);
xout1 = _mm_shuffle_epi32(xout1, 0xFF); // see PSHUFD, set all elems to 4th elem
@ -59,7 +59,7 @@ inline void aes_genkey_sub(__m128i* xout0, __m128i* xout2, uint8_t rcon)
}
inline void aes_round(__m128i key, __m128i* x0, __m128i* x1, __m128i* x2, __m128i* x3, __m128i* x4, __m128i* x5, __m128i* x6, __m128i* x7)
static inline void aes_round(__m128i key, __m128i* x0, __m128i* x1, __m128i* x2, __m128i* x3, __m128i* x4, __m128i* x5, __m128i* x6, __m128i* x7)
{
*x0 = soft_aesenc(*x0, key);
*x1 = soft_aesenc(*x1, key);
@ -72,7 +72,7 @@ inline void aes_round(__m128i key, __m128i* x0, __m128i* x1, __m128i* x2, __m128
}
inline void aes_genkey(const __m128i* memory, __m128i* k0, __m128i* k1, __m128i* k2, __m128i* k3, __m128i* k4, __m128i* k5, __m128i* k6, __m128i* k7, __m128i* k8, __m128i* k9)
static inline void aes_genkey(const __m128i* memory, __m128i* k0, __m128i* k1, __m128i* k2, __m128i* k3, __m128i* k4, __m128i* k5, __m128i* k6, __m128i* k7, __m128i* k8, __m128i* k9)
{
__m128i xout0 = _mm_load_si128(memory);
__m128i xout2 = _mm_load_si128(memory + 1);
@ -192,7 +192,7 @@ static inline void cn_implode_scratchpad(const __m128i* input, __m128i* output)
#if defined(__x86_64__)
# define EXTRACT64(X) _mm_cvtsi128_si64(X)
inline uint64_t _umul128(uint64_t a, uint64_t b, uint64_t* hi)
static inline uint64_t _umul128(uint64_t a, uint64_t b, uint64_t* hi)
{
unsigned __int128 r = (unsigned __int128) a * (unsigned __int128) b;
*hi = r >> 64;