mirror of https://github.com/status-im/BearSSL.git
Worked around some compiler errors with GCC 4.4 and 4.5.
This commit is contained in:
parent
af9c79a071
commit
8e94ad2fcb
21
src/inner.h
21
src/inner.h
|
@ -2243,18 +2243,25 @@ int br_ssl_choose_hash(unsigned bf);
|
||||||
*/
|
*/
|
||||||
#if BR_i386 || BR_amd64
|
#if BR_i386 || BR_amd64
|
||||||
|
|
||||||
|
/*
|
||||||
|
* On GCC before version 5.0, we need to use the pragma to enable the
|
||||||
|
* target options globally, because the 'target' function attribute
|
||||||
|
* appears to be unreliable. Before 4.6 we must also avoid the
|
||||||
|
* push_options / pop_options mechanism, because it tends to trigger
|
||||||
|
* some internal compiler errors.
|
||||||
|
*/
|
||||||
#if BR_GCC && !BR_GCC_5_0
|
#if BR_GCC && !BR_GCC_5_0
|
||||||
#if BR_GCC_4_6
|
#if BR_GCC_4_6
|
||||||
#define BR_TARGETS_X86_UP \
|
#define BR_TARGETS_X86_UP \
|
||||||
_Pragma("GCC push_options") \
|
_Pragma("GCC push_options") \
|
||||||
_Pragma("GCC target(\"sse2,ssse3,sse4.1,aes,pclmul,rdrnd\")")
|
_Pragma("GCC target(\"sse2,ssse3,sse4.1,aes,pclmul,rdrnd\")")
|
||||||
#else
|
|
||||||
#define BR_TARGETS_X86_UP \
|
|
||||||
_Pragma("GCC push_options") \
|
|
||||||
_Pragma("GCC target(\"sse2,ssse3,sse4.1,aes,pclmul\")")
|
|
||||||
#endif
|
|
||||||
#define BR_TARGETS_X86_DOWN \
|
#define BR_TARGETS_X86_DOWN \
|
||||||
_Pragma("GCC pop_options")
|
_Pragma("GCC pop_options")
|
||||||
|
#else
|
||||||
|
#define BR_TARGETS_X86_UP \
|
||||||
|
_Pragma("GCC target(\"sse2,ssse3,sse4.1,aes,pclmul\")")
|
||||||
|
#endif
|
||||||
|
#define BR_TARGETS_X86_DOWN
|
||||||
#pragma GCC diagnostic ignored "-Wpsabi"
|
#pragma GCC diagnostic ignored "-Wpsabi"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -2286,7 +2293,7 @@ int br_ssl_choose_hash(unsigned bf);
|
||||||
BR_TARGETS_X86_UP
|
BR_TARGETS_X86_UP
|
||||||
#include <x86intrin.h>
|
#include <x86intrin.h>
|
||||||
#include <cpuid.h>
|
#include <cpuid.h>
|
||||||
#define bswap32 __builtin_bswap32
|
#define br_bswap32 __builtin_bswap32
|
||||||
BR_TARGETS_X86_DOWN
|
BR_TARGETS_X86_DOWN
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -2294,7 +2301,7 @@ BR_TARGETS_X86_DOWN
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <intrin.h>
|
#include <intrin.h>
|
||||||
#include <immintrin.h>
|
#include <immintrin.h>
|
||||||
#define bswap32 _byteswap_ulong
|
#define br_bswap32 _byteswap_ulong
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
|
|
|
@ -68,10 +68,10 @@ br_aes_x86ni_ctr_run(const br_aes_x86ni_ctr_keys *ctx,
|
||||||
while (len > 0) {
|
while (len > 0) {
|
||||||
__m128i x0, x1, x2, x3;
|
__m128i x0, x1, x2, x3;
|
||||||
|
|
||||||
x0 = _mm_insert_epi32(ivx, bswap32(cc + 0), 3);
|
x0 = _mm_insert_epi32(ivx, br_bswap32(cc + 0), 3);
|
||||||
x1 = _mm_insert_epi32(ivx, bswap32(cc + 1), 3);
|
x1 = _mm_insert_epi32(ivx, br_bswap32(cc + 1), 3);
|
||||||
x2 = _mm_insert_epi32(ivx, bswap32(cc + 2), 3);
|
x2 = _mm_insert_epi32(ivx, br_bswap32(cc + 2), 3);
|
||||||
x3 = _mm_insert_epi32(ivx, bswap32(cc + 3), 3);
|
x3 = _mm_insert_epi32(ivx, br_bswap32(cc + 3), 3);
|
||||||
x0 = _mm_xor_si128(x0, sk[0]);
|
x0 = _mm_xor_si128(x0, sk[0]);
|
||||||
x1 = _mm_xor_si128(x1, sk[0]);
|
x1 = _mm_xor_si128(x1, sk[0]);
|
||||||
x2 = _mm_xor_si128(x2, sk[0]);
|
x2 = _mm_xor_si128(x2, sk[0]);
|
||||||
|
|
Loading…
Reference in New Issue