/src/libsodium/src/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-avx2.c
Line | Count | Source (jump to first uncovered line) |
1 | | |
2 | | #define BLAKE2_USE_SSSE3 |
3 | | #define BLAKE2_USE_SSE41 |
4 | | #define BLAKE2_USE_AVX2 |
5 | | |
6 | | #include <stdint.h> |
7 | | #include <string.h> |
8 | | |
9 | | #include "blake2.h" |
10 | | #include "private/common.h" |
11 | | |
12 | | #if defined(HAVE_AVX2INTRIN_H) && defined(HAVE_EMMINTRIN_H) && \ |
13 | | defined(HAVE_TMMINTRIN_H) && defined(HAVE_SMMINTRIN_H) |
14 | | |
15 | | # ifdef __clang__ |
16 | | # pragma clang attribute push(__attribute__((target("sse2,ssse3,sse4.1,avx2"))), apply_to = function) |
17 | | # elif defined(__GNUC__) |
18 | | # pragma GCC target("sse2,ssse3,sse4.1,avx2") |
19 | | # endif |
20 | | |
21 | | # include <emmintrin.h> |
22 | | # include <immintrin.h> |
23 | | # include <smmintrin.h> |
24 | | # include <tmmintrin.h> |
25 | | # include "private/sse2_64_32.h" |
26 | | |
27 | | # include "blake2b-compress-avx2.h" |
28 | | |
29 | | CRYPTO_ALIGN(64) |
30 | | static const uint64_t blake2b_IV[8] = { |
31 | | 0x6a09e667f3bcc908ULL, 0xbb67ae8584caa73bULL, 0x3c6ef372fe94f82bULL, |
32 | | 0xa54ff53a5f1d36f1ULL, 0x510e527fade682d1ULL, 0x9b05688c2b3e6c1fULL, |
33 | | 0x1f83d9abfb41bd6bULL, 0x5be0cd19137e2179ULL |
34 | | }; |
35 | | |
36 | | int |
37 | | blake2b_compress_avx2(blake2b_state *S, const uint8_t block[BLAKE2B_BLOCKBYTES]) |
38 | 0 | { |
39 | 0 | __m256i a = LOADU(&S->h[0]); |
40 | 0 | __m256i b = LOADU(&S->h[4]); |
41 | 0 | BLAKE2B_COMPRESS_V1(a, b, block, S->t[0], S->t[1], S->f[0], S->f[1]); |
42 | 0 | STOREU(&S->h[0], a); |
43 | 0 | STOREU(&S->h[4], b); |
44 | |
|
45 | 0 | return 0; |
46 | 0 | } |
47 | | |
48 | | # ifdef __clang__ |
49 | | # pragma clang attribute pop |
50 | | # endif |
51 | | |
52 | | #endif |