diff --git a/builds/msvc/version.h b/builds/msvc/version.h index 2ffad0e6..b06cf396 100644 --- a/builds/msvc/version.h +++ b/builds/msvc/version.h @@ -7,7 +7,7 @@ #define SODIUM_VERSION_STRING "1.0.5" #define SODIUM_LIBRARY_VERSION_MAJOR 7 -#define SODIUM_LIBRARY_VERSION_MINOR 6 +#define SODIUM_LIBRARY_VERSION_MINOR 7 #ifdef __cplusplus extern "C" { diff --git a/configure.ac b/configure.ac index 79245ea1..7e474cae 100644 --- a/configure.ac +++ b/configure.ac @@ -17,9 +17,9 @@ ISODATE=`date +%Y-%m-%d` AC_SUBST(ISODATE) SODIUM_LIBRARY_VERSION_MAJOR=7 -SODIUM_LIBRARY_VERSION_MINOR=6 +SODIUM_LIBRARY_VERSION_MINOR=7 DLL_VERSION=6 -SODIUM_LIBRARY_VERSION=16:0:3 +SODIUM_LIBRARY_VERSION=17:0:4 # | | | # +------+ | +---+ # | | | diff --git a/msvc-scripts/process.bat b/msvc-scripts/process.bat index 21920452..c1a25eaf 100755 --- a/msvc-scripts/process.bat +++ b/msvc-scripts/process.bat @@ -1,4 +1,4 @@ cscript msvc-scripts/rep.vbs //Nologo s/@VERSION@/1.0.5/ < src\libsodium\include\sodium\version.h.in > tmp cscript msvc-scripts/rep.vbs //Nologo s/@SODIUM_LIBRARY_VERSION_MAJOR@/7/ < tmp > tmp2 -cscript msvc-scripts/rep.vbs //Nologo s/@SODIUM_LIBRARY_VERSION_MINOR@/6/ < tmp2 > src\libsodium\include\sodium\version.h +cscript msvc-scripts/rep.vbs //Nologo s/@SODIUM_LIBRARY_VERSION_MINOR@/7/ < tmp2 > src\libsodium\include\sodium\version.h del tmp tmp2 diff --git a/src/libsodium/include/sodium/runtime.h b/src/libsodium/include/sodium/runtime.h index 3bdc4dcd..211723f5 100644 --- a/src/libsodium/include/sodium/runtime.h +++ b/src/libsodium/include/sodium/runtime.h @@ -20,6 +20,12 @@ int sodium_runtime_has_sse2(void); SODIUM_EXPORT int sodium_runtime_has_sse3(void); +SODIUM_EXPORT +int sodium_runtime_has_ssse3(void); + +SODIUM_EXPORT +int sodium_runtime_has_sse41(void); + SODIUM_EXPORT int sodium_runtime_has_pclmul(void); diff --git a/src/libsodium/sodium/runtime.c b/src/libsodium/sodium/runtime.c index 2cf915c8..e3fd0a8a 100644 --- a/src/libsodium/sodium/runtime.c +++ b/src/libsodium/sodium/runtime.c @@ -10,6 +10,8 @@ typedef struct CPUFeatures_ { int has_neon; int has_sse2; int has_sse3; + int has_ssse3; + int has_sse41; int has_pclmul; int has_aesni; } CPUFeatures; @@ -18,6 +20,8 @@ static CPUFeatures _cpu_features; #define CPUID_SSE2 0x04000000 #define CPUIDECX_SSE3 0x00000001 +#define CPUIDECX_SSSE3 0x00000200 +#define CPUIDECX_SSE41 0x00080000 #define CPUIDECX_PCLMUL 0x00000002 #define CPUIDECX_AESNI 0x02000000 @@ -108,6 +112,18 @@ _sodium_runtime_intel_cpu_features(CPUFeatures * const cpu_features) cpu_features->has_sse3 = ((cpu_info[2] & CPUIDECX_SSE3) != 0x0); #endif +#ifndef HAVE_TMMINTRIN_H + cpu_features->has_ssse3 = 0; +#else + cpu_features->has_ssse3 = ((cpu_info[2] & CPUIDECX_SSSE3) != 0x0); +#endif + +#ifndef HAVE_SMMINTRIN_H + cpu_features->has_sse41 = 0; +#else + cpu_features->has_sse41 = ((cpu_info[2] & CPUIDECX_SSE41) != 0x0); +#endif + #ifndef HAVE_WMMINTRIN_H cpu_features->has_pclmul = 0; cpu_features->has_aesni = 0; @@ -146,6 +162,16 @@ sodium_runtime_has_sse3(void) { return _cpu_features.has_sse3; } +int +sodium_runtime_has_ssse3(void) { + return _cpu_features.has_ssse3; +} + +int +sodium_runtime_has_sse41(void) { + return _cpu_features.has_sse41; +} + int sodium_runtime_has_pclmul(void) { return _cpu_features.has_pclmul; diff --git a/test/default/sodium_core.c b/test/default/sodium_core.c index f20ece0c..b177f0d9 100644 --- a/test/default/sodium_core.c +++ b/test/default/sodium_core.c @@ -9,6 +9,8 @@ int main(void) (void)sodium_runtime_has_neon(); (void)sodium_runtime_has_sse2(); (void)sodium_runtime_has_sse3(); + (void)sodium_runtime_has_ssse3(); + (void)sodium_runtime_has_sse41(); (void)sodium_runtime_has_pclmul(); (void)sodium_runtime_has_aesni();