]> source.dussan.org Git - rspamd.git/commitdiff
Fix optimized poly1305.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 7 Feb 2015 22:28:10 +0000 (22:28 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 7 Feb 2015 22:28:36 +0000 (22:28 +0000)
src/libcryptobox/poly1305/avx.S
src/libcryptobox/poly1305/avx2.S
src/libcryptobox/poly1305/poly1305.c
src/libcryptobox/poly1305/ref-32.c
src/libcryptobox/poly1305/ref-64.c
src/libcryptobox/poly1305/sse2.S

index a5c4ccf26a289acb151fc655395a68404fc2bb6f..b64d4ca2d16f346d94425a94bc538972285431ad 100644 (file)
@@ -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
index 068e24d3d45b41f6c0f7e7bba9ecc2b7c21c3784..b1ab0d61a5f53b050ac89ff0a5830710510b03e8 100644 (file)
@@ -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
index ef3b366bced27cc879d7df23d9d80f973aab9cf7..c98b28017bcc14be5b7e7a94486ad73e96cf1ed6 100644 (file)
@@ -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)
index 8086e1c46bd4a549073f1063ce82e8e7c6050e7d..ea9633f6281f0a021b0ebbeb081121d60f52ccdf 100644 (file)
@@ -5,6 +5,7 @@
 */
 
 #include "config.h"
+#include "poly1305.h"
 
 enum {
        POLY1305_BLOCK_SIZE = 16
index f6ead595591d65f0aafd928609efdea3400a5c0b..db7b85c1e486114df608ef09df4ad935333a470e 100644 (file)
@@ -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;
index a4ec004d999acda67fabb7795b8e51221879436e..1ca4139ced1c62927bbca126cde25c0cc26b65d5 100644 (file)
@@ -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