diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-02-07 22:28:10 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-02-07 22:28:36 +0000 |
commit | 4d0e7b66e50b17a7b091394f3496089757a75fc0 (patch) | |
tree | 6685e9a4ca77d2fc7adcbdbe2278764047e0b097 /src/libcryptobox/poly1305 | |
parent | 06a8ad2bae9e0aa0fe62e6059198bb3ec57eb08f (diff) | |
download | rspamd-4d0e7b66e50b17a7b091394f3496089757a75fc0.tar.gz rspamd-4d0e7b66e50b17a7b091394f3496089757a75fc0.zip |
Fix optimized poly1305.
Diffstat (limited to 'src/libcryptobox/poly1305')
-rw-r--r-- | src/libcryptobox/poly1305/avx.S | 2 | ||||
-rw-r--r-- | src/libcryptobox/poly1305/avx2.S | 2 | ||||
-rw-r--r-- | src/libcryptobox/poly1305/poly1305.c | 3 | ||||
-rw-r--r-- | src/libcryptobox/poly1305/ref-32.c | 1 | ||||
-rw-r--r-- | src/libcryptobox/poly1305/ref-64.c | 11 | ||||
-rw-r--r-- | src/libcryptobox/poly1305/sse2.S | 3 |
6 files changed, 15 insertions, 7 deletions
diff --git a/src/libcryptobox/poly1305/avx.S b/src/libcryptobox/poly1305/avx.S index a5c4ccf26..b64d4ca2d 100644 --- a/src/libcryptobox/poly1305/avx.S +++ b/src/libcryptobox/poly1305/avx.S @@ -834,8 +834,10 @@ ret FN_END poly1305_finish_ext_avx GLOBAL_HIDDEN_FN poly1305_auth_avx +/* cmp $128, %rdx jb poly1305_auth_x86_local +*/ pushq %rbp movq %rsp, %rbp pushq %r14 diff --git a/src/libcryptobox/poly1305/avx2.S b/src/libcryptobox/poly1305/avx2.S index 068e24d3d..b1ab0d61a 100644 --- a/src/libcryptobox/poly1305/avx2.S +++ b/src/libcryptobox/poly1305/avx2.S @@ -8,8 +8,10 @@ ret FN_END poly1305_block_size_avx2 GLOBAL_HIDDEN_FN poly1305_auth_avx2 +/* cmp $128, %rdx jb poly1305_auth_x86_local +*/ pushq %rbp movq %rsp, %rbp andq $-64, %rsp diff --git a/src/libcryptobox/poly1305/poly1305.c b/src/libcryptobox/poly1305/poly1305.c index ef3b366bc..c98b28017 100644 --- a/src/libcryptobox/poly1305/poly1305.c +++ b/src/libcryptobox/poly1305/poly1305.c @@ -91,10 +91,9 @@ POLY1305_GENERIC, #if defined(POLY1305_SSE2) POLY1305_SSE2, #endif - }; +}; static const poly1305_impl_t *poly1305_opt = &poly1305_list[0]; -; /* is the pointer aligned on a word boundary? */ static int poly1305_is_aligned(const void *p) diff --git a/src/libcryptobox/poly1305/ref-32.c b/src/libcryptobox/poly1305/ref-32.c index 8086e1c46..ea9633f62 100644 --- a/src/libcryptobox/poly1305/ref-32.c +++ b/src/libcryptobox/poly1305/ref-32.c @@ -5,6 +5,7 @@ */ #include "config.h" +#include "poly1305.h" enum { POLY1305_BLOCK_SIZE = 16 diff --git a/src/libcryptobox/poly1305/ref-64.c b/src/libcryptobox/poly1305/ref-64.c index f6ead5955..db7b85c1e 100644 --- a/src/libcryptobox/poly1305/ref-64.c +++ b/src/libcryptobox/poly1305/ref-64.c @@ -5,6 +5,7 @@ */ #include "config.h" +#include "poly1305.h" enum { POLY1305_BLOCK_SIZE = 16 }; @@ -62,12 +63,12 @@ U64TO8(unsigned char *p, uint64_t v) { p[7] = (unsigned char)(v >> 56) & 0xff; } -static size_t +size_t poly1305_block_size_ref(void) { return POLY1305_BLOCK_SIZE; } -static void +void poly1305_init_ext_ref(void *state, const poly1305_key *key, size_t bytes_hint) { poly1305_state_ref_t *st = (poly1305_state_ref_t *)state; uint64_t t0, t1; @@ -94,7 +95,7 @@ poly1305_init_ext_ref(void *state, const poly1305_key *key, size_t bytes_hint) { st->final = 0; } -static void +void poly1305_blocks_ref(void *state, const unsigned char *in, size_t inlen) { poly1305_state_ref_t *st = (poly1305_state_ref_t *)state; const uint64_t hibit = (st->final) ? 0 : ((uint64_t)1 << 40); /* 1 << 128 */ @@ -146,7 +147,7 @@ poly1305_blocks_ref(void *state, const unsigned char *in, size_t inlen) { st->h[2] = h2; } -static void +void poly1305_finish_ext_ref(void *state, const unsigned char *in, size_t remaining, unsigned char mac[16]) { poly1305_state_ref_t *st = (poly1305_state_ref_t *)state; uint64_t h0, h1, h2, c; @@ -215,7 +216,7 @@ poly1305_finish_ext_ref(void *state, const unsigned char *in, size_t remaining, } -static void +void poly1305_auth_ref(unsigned char mac[16], const unsigned char *in, size_t inlen, const poly1305_key *key) { poly1305_state_ref_t st; size_t blocks; diff --git a/src/libcryptobox/poly1305/sse2.S b/src/libcryptobox/poly1305/sse2.S index a4ec004d9..1ca4139ce 100644 --- a/src/libcryptobox/poly1305/sse2.S +++ b/src/libcryptobox/poly1305/sse2.S @@ -1,5 +1,6 @@ #include "../chacha20/macro.S" #include "constants.S" + SECTION_TEXT GLOBAL_HIDDEN_FN poly1305_block_size_sse2 @@ -920,8 +921,10 @@ ret FN_END poly1305_finish_ext_sse2 GLOBAL_HIDDEN_FN poly1305_auth_sse2 +/* cmpq $128, %rdx jb poly1305_auth_x86_local +*/ pushq %rbp movq %rsp, %rbp pushq %r14 |