Move 64-bit emulation to a dedicated private header file
This commit is contained in:
parent
0d270d8345
commit
b3e27d14aa
@ -302,10 +302,10 @@
|
||||
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\randombytes_sysrandom.h" />
|
||||
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\runtime.h" />
|
||||
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\utils.h" />
|
||||
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\version.h" />
|
||||
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\private\common.h" />
|
||||
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\private\curve25519_ref10.h" />
|
||||
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\private\mutex.h" />
|
||||
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\private\sse2_64_32.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugDLL|Win32'">
|
||||
|
@ -692,9 +692,6 @@
|
||||
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\utils.h">
|
||||
<Filter>include\sodium</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\version.h">
|
||||
<Filter>include\sodium</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\private\common.h">
|
||||
<Filter>include\sodium\private</Filter>
|
||||
</ClInclude>
|
||||
@ -704,6 +701,9 @@
|
||||
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\private\mutex.h">
|
||||
<Filter>include\sodium\private</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\private\sse2_64_32.h">
|
||||
<Filter>include\sodium\private</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="crypto_aead">
|
||||
|
@ -302,10 +302,10 @@
|
||||
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\randombytes_sysrandom.h" />
|
||||
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\runtime.h" />
|
||||
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\utils.h" />
|
||||
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\version.h" />
|
||||
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\private\common.h" />
|
||||
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\private\curve25519_ref10.h" />
|
||||
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\private\mutex.h" />
|
||||
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\private\sse2_64_32.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugDLL|Win32'">
|
||||
|
@ -692,9 +692,6 @@
|
||||
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\utils.h">
|
||||
<Filter>include\sodium</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\version.h">
|
||||
<Filter>include\sodium</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\private\common.h">
|
||||
<Filter>include\sodium\private</Filter>
|
||||
</ClInclude>
|
||||
@ -704,6 +701,9 @@
|
||||
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\private\mutex.h">
|
||||
<Filter>include\sodium\private</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\private\sse2_64_32.h">
|
||||
<Filter>include\sodium\private</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="crypto_aead">
|
||||
|
@ -302,10 +302,10 @@
|
||||
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\randombytes_sysrandom.h" />
|
||||
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\runtime.h" />
|
||||
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\utils.h" />
|
||||
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\version.h" />
|
||||
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\private\common.h" />
|
||||
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\private\curve25519_ref10.h" />
|
||||
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\private\mutex.h" />
|
||||
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\private\sse2_64_32.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugDLL|Win32'">
|
||||
|
@ -692,9 +692,6 @@
|
||||
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\utils.h">
|
||||
<Filter>include\sodium</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\version.h">
|
||||
<Filter>include\sodium</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\private\common.h">
|
||||
<Filter>include\sodium\private</Filter>
|
||||
</ClInclude>
|
||||
@ -704,6 +701,9 @@
|
||||
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\private\mutex.h">
|
||||
<Filter>include\sodium\private</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\private\sse2_64_32.h">
|
||||
<Filter>include\sodium\private</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="crypto_aead">
|
||||
|
@ -302,10 +302,10 @@
|
||||
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\randombytes_sysrandom.h" />
|
||||
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\runtime.h" />
|
||||
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\utils.h" />
|
||||
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\version.h" />
|
||||
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\private\common.h" />
|
||||
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\private\curve25519_ref10.h" />
|
||||
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\private\mutex.h" />
|
||||
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\private\sse2_64_32.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugDLL|Win32'">
|
||||
|
@ -692,9 +692,6 @@
|
||||
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\utils.h">
|
||||
<Filter>include\sodium</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\version.h">
|
||||
<Filter>include\sodium</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\private\common.h">
|
||||
<Filter>include\sodium\private</Filter>
|
||||
</ClInclude>
|
||||
@ -704,6 +701,9 @@
|
||||
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\private\mutex.h">
|
||||
<Filter>include\sodium\private</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\private\sse2_64_32.h">
|
||||
<Filter>include\sodium\private</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="crypto_aead">
|
||||
|
@ -540,10 +540,10 @@
|
||||
<ClInclude Include="src\libsodium\include\sodium\randombytes_sysrandom.h" />
|
||||
<ClInclude Include="src\libsodium\include\sodium\runtime.h" />
|
||||
<ClInclude Include="src\libsodium\include\sodium\utils.h" />
|
||||
<ClInclude Include="src\libsodium\include\sodium\version.h" />
|
||||
<ClInclude Include="src\libsodium\include\sodium\private\common.h" />
|
||||
<ClInclude Include="src\libsodium\include\sodium\private\curve25519_ref10.h" />
|
||||
<ClInclude Include="src\libsodium\include\sodium\private\mutex.h" />
|
||||
<ClInclude Include="src\libsodium\include\sodium\private\sse2_64_32.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
|
@ -686,9 +686,6 @@
|
||||
<ClInclude Include="src\libsodium\include\sodium\utils.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\libsodium\include\sodium\version.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\libsodium\include\sodium\private\common.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
@ -698,5 +695,8 @@
|
||||
<ClInclude Include="src\libsodium\include\sodium\private\mutex.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\libsodium\include\sodium\private\sse2_64_32.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
@ -89,6 +89,7 @@ libsodium_la_SOURCES = \
|
||||
include/sodium/private/common.h \
|
||||
include/sodium/private/curve25519_ref10.h \
|
||||
include/sodium/private/mutex.h \
|
||||
include/sodium/private/sse2_64_32.h \
|
||||
randombytes/randombytes.c \
|
||||
sodium/core.c \
|
||||
sodium/runtime.c \
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "crypto_aead_aes256gcm.h"
|
||||
#include "export.h"
|
||||
#include "private/common.h"
|
||||
#include "private/sse2_64_32.h"
|
||||
#include "randombytes.h"
|
||||
#include "runtime.h"
|
||||
#include "utils.h"
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#include "blake2.h"
|
||||
#include "private/common.h"
|
||||
#include "private/sse2_64_32.h"
|
||||
|
||||
#if defined(HAVE_AVX2INTRIN_H) && defined(HAVE_EMMINTRIN_H) && \
|
||||
defined(HAVE_TMMINTRIN_H) && defined(HAVE_SMMINTRIN_H)
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
#include "blake2.h"
|
||||
#include "private/common.h"
|
||||
#include "private/sse2_64_32.h"
|
||||
|
||||
#if defined(HAVE_EMMINTRIN_H) && defined(HAVE_TMMINTRIN_H) && \
|
||||
defined(HAVE_SMMINTRIN_H)
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include "blake2.h"
|
||||
#include "private/common.h"
|
||||
#include "private/sse2_64_32.h"
|
||||
|
||||
#if defined(HAVE_EMMINTRIN_H) && defined(HAVE_TMMINTRIN_H)
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "crypto_verify_16.h"
|
||||
#include "poly1305_sse2.h"
|
||||
#include "private/common.h"
|
||||
#include "private/sse2_64_32.h"
|
||||
#include "utils.h"
|
||||
|
||||
#if defined(HAVE_TI_MODE) && defined(HAVE_EMMINTRIN_H)
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "argon2-core.h"
|
||||
#include "argon2.h"
|
||||
#include "private/common.h"
|
||||
#include "private/sse2_64_32.h"
|
||||
|
||||
#if defined(HAVE_EMMINTRIN_H) && defined(HAVE_TMMINTRIN_H)
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
#define blamka_round_ssse3_H
|
||||
|
||||
#include "private/common.h"
|
||||
#include "private/sse2_64_32.h"
|
||||
|
||||
#define r16 \
|
||||
(_mm_setr_epi8(2, 3, 4, 5, 6, 7, 0, 1, 10, 11, 12, 13, 14, 15, 8, 9))
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "private/common.h"
|
||||
#include "private/sse2_64_32.h"
|
||||
|
||||
#ifdef HAVE_EMMINTRIN_H
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
#include "crypto_stream_chacha20.h"
|
||||
#include "private/common.h"
|
||||
#include "private/sse2_64_32.h"
|
||||
#include "utils.h"
|
||||
|
||||
#if defined(HAVE_AVX2INTRIN_H) && defined(HAVE_EMMINTRIN_H) && \
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
#include "crypto_stream_chacha20.h"
|
||||
#include "private/common.h"
|
||||
#include "private/sse2_64_32.h"
|
||||
#include "utils.h"
|
||||
|
||||
#if defined(HAVE_EMMINTRIN_H) && defined(HAVE_TMMINTRIN_H)
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
#include "crypto_stream_salsa20.h"
|
||||
#include "private/common.h"
|
||||
#include "private/sse2_64_32.h"
|
||||
#include "utils.h"
|
||||
|
||||
#if defined(HAVE_AVX2INTRIN_H) && defined(HAVE_EMMINTRIN_H) && \
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
#include "crypto_stream_salsa20.h"
|
||||
#include "private/common.h"
|
||||
#include "private/sse2_64_32.h"
|
||||
#include "utils.h"
|
||||
|
||||
#ifdef HAVE_EMMINTRIN_H
|
||||
|
@ -214,43 +214,4 @@ store32_be(uint8_t dst[4], uint32_t w)
|
||||
# include <intrin.h>
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_EMMINTRIN_H) && \
|
||||
!(defined(__amd64) || defined(__amd64__) || defined(__x86_64__) || \
|
||||
defined(_M_X64) || defined(_M_AMD64))
|
||||
|
||||
# include <emmintrin.h>
|
||||
|
||||
# ifndef _mm_set_epi64x
|
||||
# define _mm_set_epi64x(Q0, Q1) sodium__mm_set_epi64x((Q0), (Q1))
|
||||
static inline __m128i
|
||||
sodium__mm_set_epi64x(int64_t q1, int64_t q0)
|
||||
{
|
||||
union { int64_t as64; int32_t as32[2]; } x0, x1;
|
||||
x0.as64 = q0; x1.as64 = q1;
|
||||
return _mm_set_epi32(x1.as32[1], x1.as32[0], x0.as32[1], x0.as32[0]);
|
||||
}
|
||||
# endif
|
||||
|
||||
# ifndef _mm_set1_epi64x
|
||||
# define _mm_set1_epi64x(Q) sodium__mm_set1_epi64x(Q)
|
||||
static inline __m128i
|
||||
sodium__mm_set1_epi64x(int64_t q)
|
||||
{
|
||||
return _mm_set_epi64x(q, q);
|
||||
}
|
||||
# endif
|
||||
|
||||
# ifndef _mm_cvtsi64_si128
|
||||
# define _mm_cvtsi64_si128(Q) sodium__mm_cvtsi64_si128(Q)
|
||||
static inline __m128i
|
||||
sodium__mm_cvtsi64_si128(int64_t q)
|
||||
{
|
||||
union { int64_t as64; int32_t as32[2]; } x;
|
||||
x.as64 = q;
|
||||
return _mm_setr_epi32(x.as32[0], x.as32[1], 0, 0);
|
||||
}
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
49
src/libsodium/include/sodium/private/sse2_64_32.h
Normal file
49
src/libsodium/include/sodium/private/sse2_64_32.h
Normal file
@ -0,0 +1,49 @@
|
||||
#ifndef sse2_64_32_H
|
||||
#define sse2_64_32_H 1
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#ifdef HAVE_INTRIN_H
|
||||
# include <intrin.h>
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_EMMINTRIN_H) && \
|
||||
!(defined(__amd64) || defined(__amd64__) || defined(__x86_64__) || \
|
||||
defined(_M_X64) || defined(_M_AMD64))
|
||||
|
||||
# include <emmintrin.h>
|
||||
|
||||
# ifndef _mm_set_epi64x
|
||||
# define _mm_set_epi64x(Q0, Q1) sodium__mm_set_epi64x((Q0), (Q1))
|
||||
static inline __m128i
|
||||
sodium__mm_set_epi64x(int64_t q1, int64_t q0)
|
||||
{
|
||||
union { int64_t as64; int32_t as32[2]; } x0, x1;
|
||||
x0.as64 = q0; x1.as64 = q1;
|
||||
return _mm_set_epi32(x1.as32[1], x1.as32[0], x0.as32[1], x0.as32[0]);
|
||||
}
|
||||
# endif
|
||||
|
||||
# ifndef _mm_set1_epi64x
|
||||
# define _mm_set1_epi64x(Q) sodium__mm_set1_epi64x(Q)
|
||||
static inline __m128i
|
||||
sodium__mm_set1_epi64x(int64_t q)
|
||||
{
|
||||
return _mm_set_epi64x(q, q);
|
||||
}
|
||||
# endif
|
||||
|
||||
# ifndef _mm_cvtsi64_si128
|
||||
# define _mm_cvtsi64_si128(Q) sodium__mm_cvtsi64_si128(Q)
|
||||
static inline __m128i
|
||||
sodium__mm_cvtsi64_si128(int64_t q)
|
||||
{
|
||||
union { int64_t as64; int32_t as32[2]; } x;
|
||||
x.as64 = q;
|
||||
return _mm_setr_epi32(x.as32[0], x.as32[1], 0, 0);
|
||||
}
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user