diff options
author | Jack Lloyd <[email protected]> | 2017-01-24 19:38:02 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-01-24 19:38:02 -0500 |
commit | 53d69ce19b02051cbf732af00ab98bcf384561cd (patch) | |
tree | 9257233777f7ab0eb2f1f2411bd363700ad30429 /src/lib/block | |
parent | b49eaee216142ad6eab5ad437aea44b7897baf84 (diff) |
Fix various SunCC and Solaris warnings and build problems.
Based on build output sent by @noloader.
If RLIMIT_MEMLOCK is not defined, assume regular user is not able to
call mlock. This probably also affected Clang/GCC on Solaris.
Work around resolution issue in SIMD_4x32 where it finds ambiguity
between arg taking uint32_t and __m128i. This is probably some
artifact of how SunCC represents vector types, and seems highly bogus
in general but is easy to work around here. Change constructor taking
a single value to instead be `SIMD_4x32::splat` function. The SIMD
class is internal, so no API implications.
Fix various warnings about lambda functions that were missing return
types and which were not a single return statement. AIUI C++11 doesn't
guarantee that lambda return type will be deduced in that situation,
though in practice every compiler including SunCC seems to handle it.
Disable AVX2 usage, since SunCC's intrinsics seem to be broken - its
_mm_loadu_si256 takes non-const pointer.
Rename a few variables in the tests to avoid shadowed var warnings.
Diffstat (limited to 'src/lib/block')
-rw-r--r-- | src/lib/block/aes/aes.cpp | 4 | ||||
-rw-r--r-- | src/lib/block/noekeon/noekeon_simd/noekeon_simd.cpp | 24 | ||||
-rw-r--r-- | src/lib/block/serpent/serpent_simd/serpent_simd.cpp | 8 | ||||
-rw-r--r-- | src/lib/block/threefish/threefish_avx2/info.txt | 7 |
4 files changed, 25 insertions, 18 deletions
diff --git a/src/lib/block/aes/aes.cpp b/src/lib/block/aes/aes.cpp index 6b9d56665..21228e0c1 100644 --- a/src/lib/block/aes/aes.cpp +++ b/src/lib/block/aes/aes.cpp @@ -107,7 +107,7 @@ inline uint8_t xtime14(uint8_t s) { return xtime8(s) ^ xtime4(s) ^ xtime(s); } const std::vector<uint32_t>& AES_TE() { - auto compute_TE = []() { + auto compute_TE = []() -> std::vector<uint32_t> { std::vector<uint32_t> TE(1024); for(size_t i = 0; i != 256; ++i) { @@ -128,7 +128,7 @@ const std::vector<uint32_t>& AES_TE() const std::vector<uint32_t>& AES_TD() { - auto compute_TD = []() { + auto compute_TD = []() -> std::vector<uint32_t> { std::vector<uint32_t> TD(1024); for(size_t i = 0; i != 256; ++i) { diff --git a/src/lib/block/noekeon/noekeon_simd/noekeon_simd.cpp b/src/lib/block/noekeon/noekeon_simd/noekeon_simd.cpp index 03048ec9c..a77ba7b8c 100644 --- a/src/lib/block/noekeon/noekeon_simd/noekeon_simd.cpp +++ b/src/lib/block/noekeon/noekeon_simd/noekeon_simd.cpp @@ -65,10 +65,10 @@ namespace Botan { */ void Noekeon::simd_encrypt_4(const uint8_t in[], uint8_t out[]) const { - const SIMD_32 K0 = SIMD_32(m_EK[0]); - const SIMD_32 K1 = SIMD_32(m_EK[1]); - const SIMD_32 K2 = SIMD_32(m_EK[2]); - const SIMD_32 K3 = SIMD_32(m_EK[3]); + const SIMD_32 K0 = SIMD_32::splat(m_EK[0]); + const SIMD_32 K1 = SIMD_32::splat(m_EK[1]); + const SIMD_32 K2 = SIMD_32::splat(m_EK[2]); + const SIMD_32 K3 = SIMD_32::splat(m_EK[3]); SIMD_32 A0 = SIMD_32::load_be(in ); SIMD_32 A1 = SIMD_32::load_be(in + 16); @@ -79,7 +79,7 @@ void Noekeon::simd_encrypt_4(const uint8_t in[], uint8_t out[]) const for(size_t i = 0; i != 16; ++i) { - A0 ^= SIMD_32(RC[i]); + A0 ^= SIMD_32::splat(RC[i]); NOK_SIMD_THETA(A0, A1, A2, A3, K0, K1, K2, K3); @@ -94,7 +94,7 @@ void Noekeon::simd_encrypt_4(const uint8_t in[], uint8_t out[]) const A3.rotate_right(2); } - A0 ^= SIMD_32(RC[16]); + A0 ^= SIMD_32::splat(RC[16]); NOK_SIMD_THETA(A0, A1, A2, A3, K0, K1, K2, K3); SIMD_32::transpose(A0, A1, A2, A3); @@ -110,10 +110,10 @@ void Noekeon::simd_encrypt_4(const uint8_t in[], uint8_t out[]) const */ void Noekeon::simd_decrypt_4(const uint8_t in[], uint8_t out[]) const { - const SIMD_32 K0 = SIMD_32(m_DK[0]); - const SIMD_32 K1 = SIMD_32(m_DK[1]); - const SIMD_32 K2 = SIMD_32(m_DK[2]); - const SIMD_32 K3 = SIMD_32(m_DK[3]); + const SIMD_32 K0 = SIMD_32::splat(m_DK[0]); + const SIMD_32 K1 = SIMD_32::splat(m_DK[1]); + const SIMD_32 K2 = SIMD_32::splat(m_DK[2]); + const SIMD_32 K3 = SIMD_32::splat(m_DK[3]); SIMD_32 A0 = SIMD_32::load_be(in ); SIMD_32 A1 = SIMD_32::load_be(in + 16); @@ -126,7 +126,7 @@ void Noekeon::simd_decrypt_4(const uint8_t in[], uint8_t out[]) const { NOK_SIMD_THETA(A0, A1, A2, A3, K0, K1, K2, K3); - A0 ^= SIMD_32(RC[16-i]); + A0 ^= SIMD_32::splat(RC[16-i]); A1.rotate_left(1); A2.rotate_left(5); @@ -140,7 +140,7 @@ void Noekeon::simd_decrypt_4(const uint8_t in[], uint8_t out[]) const } NOK_SIMD_THETA(A0, A1, A2, A3, K0, K1, K2, K3); - A0 ^= SIMD_32(RC[0]); + A0 ^= SIMD_32::splat(RC[0]); SIMD_32::transpose(A0, A1, A2, A3); diff --git a/src/lib/block/serpent/serpent_simd/serpent_simd.cpp b/src/lib/block/serpent/serpent_simd/serpent_simd.cpp index f69d1f6f5..59ef46a6c 100644 --- a/src/lib/block/serpent/serpent_simd/serpent_simd.cpp +++ b/src/lib/block/serpent/serpent_simd/serpent_simd.cpp @@ -15,10 +15,10 @@ namespace { #define key_xor(round, B0, B1, B2, B3) \ do { \ - B0 ^= SIMD_32(m_round_key[4*round ]); \ - B1 ^= SIMD_32(m_round_key[4*round+1]); \ - B2 ^= SIMD_32(m_round_key[4*round+2]); \ - B3 ^= SIMD_32(m_round_key[4*round+3]); \ + B0 ^= SIMD_32::splat(m_round_key[4*round ]); \ + B1 ^= SIMD_32::splat(m_round_key[4*round+1]); \ + B2 ^= SIMD_32::splat(m_round_key[4*round+2]); \ + B3 ^= SIMD_32::splat(m_round_key[4*round+3]); \ } while(0); /* diff --git a/src/lib/block/threefish/threefish_avx2/info.txt b/src/lib/block/threefish/threefish_avx2/info.txt index 1612ce390..8e7db6455 100644 --- a/src/lib/block/threefish/threefish_avx2/info.txt +++ b/src/lib/block/threefish/threefish_avx2/info.txt @@ -1,3 +1,10 @@ define THREEFISH_512_AVX2 20160903 need_isa avx2 + +<cc> +gcc +clang +msvc +icc +</cc> |