diff --git a/src/libsodium/Makefile.am b/src/libsodium/Makefile.am index 4c0146de..2fc79b88 100644 --- a/src/libsodium/Makefile.am +++ b/src/libsodium/Makefile.am @@ -196,28 +196,31 @@ libsodium_la_SOURCES += \ crypto_scalarmult/curve25519/ref10/pow225521.h endif +EXTRA_DIST = \ + crypto_scalarmult/curve25519/sandy2x/consts.S \ + crypto_scalarmult/curve25519/sandy2x/fe51_mul.S \ + crypto_scalarmult/curve25519/sandy2x/fe51_nsquare.S \ + crypto_scalarmult/curve25519/sandy2x/fe51_pack.S \ + crypto_scalarmult/curve25519/sandy2x/ladder.S \ + crypto_scalarmult/curve25519/sandy2x/ladder_base.S + if HAVE_AMD64_ASM libsodium_la_SOURCES += \ crypto_stream/salsa20/amd64_xmm6/api.h \ crypto_stream/salsa20/amd64_xmm6/stream_salsa20_amd64_xmm6.S \ - crypto_scalarmult/curve25519/sandy2x/consts.S \ crypto_scalarmult/curve25519/sandy2x/consts_namespace.h \ crypto_scalarmult/curve25519/sandy2x/curve25519_sandy2x.c \ crypto_scalarmult/curve25519/sandy2x/curve25519_sandy2x.h \ crypto_scalarmult/curve25519/sandy2x/fe.h \ crypto_scalarmult/curve25519/sandy2x/fe51.h \ crypto_scalarmult/curve25519/sandy2x/fe51_invert.c \ - crypto_scalarmult/curve25519/sandy2x/fe51_mul.S \ crypto_scalarmult/curve25519/sandy2x/fe51_namespace.h \ - crypto_scalarmult/curve25519/sandy2x/fe51_nsquare.S \ - crypto_scalarmult/curve25519/sandy2x/fe51_pack.S \ crypto_scalarmult/curve25519/sandy2x/fe_frombytes_sandy2x.c \ - crypto_scalarmult/curve25519/sandy2x/ladder.S \ crypto_scalarmult/curve25519/sandy2x/ladder.h \ - crypto_scalarmult/curve25519/sandy2x/ladder_base.S \ crypto_scalarmult/curve25519/sandy2x/ladder_base.h \ crypto_scalarmult/curve25519/sandy2x/ladder_base_namespace.h \ - crypto_scalarmult/curve25519/sandy2x/ladder_namespace.h + crypto_scalarmult/curve25519/sandy2x/ladder_namespace.h \ + crypto_scalarmult/curve25519/sandy2x/sandy2x.S \ else libsodium_la_SOURCES += \ crypto_stream/salsa20/ref/api.h \ diff --git a/src/libsodium/crypto_scalarmult/curve25519/sandy2x/consts.S b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/consts.S index 456d5e53..b672fd85 100644 --- a/src/libsodium/crypto_scalarmult/curve25519/sandy2x/consts.S +++ b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/consts.S @@ -2,39 +2,16 @@ REDMASK51 is from amd64-51/consts.s. */ -#ifdef __linux__ -# error This is a work in progress, which is known *NOT* to work on Linux -# error Please do not fill a bug report at this point -#endif - #include "consts_namespace.h" .data -.globl v0_0 -.globl v1_0 -.globl v2_1 -.globl v2_2 -.globl v9_0 -.globl v9_9 -.globl v19_19 -.globl v38_1 -.globl v38_19 -.globl v38_38 -.globl v121666_121666 -.globl m25 -.globl m26 -.globl subc0 -.globl subc2 -.globl REDMASK51 .p2align 4 v0_0: .quad 0, 0 v1_0: .quad 1, 0 v2_1: .quad 2, 1 -v2_2: .quad 2, 2 v9_0: .quad 9, 0 v9_9: .quad 9, 9 v19_19: .quad 19, 19 v38_1: .quad 38, 1 -v38_19: .quad 38, 19 v38_38: .quad 38, 38 v121666_121666: .quad 121666, 121666 m25: .quad 33554431, 33554431 diff --git a/src/libsodium/crypto_scalarmult/curve25519/sandy2x/consts_namespace.h b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/consts_namespace.h index f1bb13c7..c9f3efe4 100644 --- a/src/libsodium/crypto_scalarmult/curve25519/sandy2x/consts_namespace.h +++ b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/consts_namespace.h @@ -4,12 +4,10 @@ #define v0_0 crypto_scalarmult_curve25519_sandy2x_v0_0 #define v1_0 crypto_scalarmult_curve25519_sandy2x_v1_0 #define v2_1 crypto_scalarmult_curve25519_sandy2x_v2_1 -#define v2_2 crypto_scalarmult_curve25519_sandy2x_v2_2 #define v9_0 crypto_scalarmult_curve25519_sandy2x_v9_0 #define v9_9 crypto_scalarmult_curve25519_sandy2x_v9_9 #define v19_19 crypto_scalarmult_curve25519_sandy2x_v19_19 #define v38_1 crypto_scalarmult_curve25519_sandy2x_v38_1 -#define v38_19 crypto_scalarmult_curve25519_sandy2x_v38_19 #define v38_38 crypto_scalarmult_curve25519_sandy2x_v38_38 #define v121666_121666 crypto_scalarmult_curve25519_sandy2x_v121666_121666 #define m25 crypto_scalarmult_curve25519_sandy2x_m25 diff --git a/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_mul.S b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_mul.S index ff56a856..3add6504 100644 --- a/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_mul.S +++ b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_mul.S @@ -183,7 +183,3 @@ add %r11,%rsp mov %rdi,%rax mov %rsi,%rdx ret - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_nsquare.S b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_nsquare.S index 41f3e99a..fd79b8f0 100644 --- a/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_nsquare.S +++ b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_nsquare.S @@ -159,7 +159,3 @@ movq 40(%rsp),%rbx movq 48(%rsp),%rbp add %r11,%rsp ret - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_pack.S b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_pack.S index 2ef8666e..e652ace8 100644 --- a/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_pack.S +++ b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_pack.S @@ -213,7 +213,3 @@ movq 0(%rsp),%r11 movq 8(%rsp),%r12 add %r11,%rsp ret - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder.S b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder.S index 871e368c..12843d8a 100644 --- a/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder.S +++ b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder.S @@ -104,7 +104,7 @@ xorq 16(%rsi),%r8 xorq 24(%rsi),%r9 leaq 800(%rsp),%rsi mov $64,%rax -._small_loop: +._ladder_small_loop: mov %rdx,%r10 mov %rcx,%r11 mov %r8,%r12 @@ -127,10 +127,10 @@ movl %r12d,512(%rsi) movl %r13d,768(%rsi) add $4,%rsi sub $1,%rax -jne ._small_loop +jne ._ladder_small_loop mov $255,%rdx add $760,%rsi -._loop: +._ladder_loop: sub $1,%rdx vbroadcastss 0(%rsi),%xmm10 sub $4,%rsi @@ -1409,7 +1409,7 @@ vpunpcklqdq %xmm12,%xmm11,%xmm6 vpunpckhqdq %xmm14,%xmm13,%xmm9 vpunpcklqdq %xmm14,%xmm13,%xmm8 cmp $0,%rdx -jne ._loop +jne ._ladder_loop movdqu %xmm1,160(%rdi) movdqu %xmm0,80(%rdi) movdqu %xmm3,176(%rdi) @@ -1426,7 +1426,3 @@ movq 1840(%rsp),%r13 movq 1848(%rsp),%r14 add %r11,%rsp ret - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder_base.S b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder_base.S index 3df33925..404c3955 100644 --- a/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder_base.S +++ b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder_base.S @@ -55,7 +55,7 @@ xorq 16(%rsi),%r8 xorq 24(%rsi),%r9 leaq 512(%rsp),%rsi mov $64,%rax -._small_loop: +._ladder_base_small_loop: mov %rdx,%r10 mov %rcx,%r11 mov %r8,%r12 @@ -78,10 +78,10 @@ movl %r12d,512(%rsi) movl %r13d,768(%rsi) add $4,%rsi sub $1,%rax -jne ._small_loop +jne ._ladder_base_small_loop mov $255,%rdx add $760,%rsi -._loop: +._ladder_base_loop: sub $1,%rdx vbroadcastss 0(%rsi),%xmm10 sub $4,%rsi @@ -1265,7 +1265,7 @@ vpunpcklqdq %xmm12,%xmm11,%xmm6 vpunpckhqdq %xmm14,%xmm13,%xmm9 vpunpcklqdq %xmm14,%xmm13,%xmm8 cmp $0,%rdx -jne ._loop +jne ._ladder_base_loop movdqu %xmm1,80(%rdi) movdqu %xmm0,0(%rdi) movdqu %xmm3,96(%rdi) @@ -1281,7 +1281,3 @@ movq 1544(%rsp),%r12 movq 1552(%rsp),%r13 add %r11,%rsp ret - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/src/libsodium/crypto_scalarmult/curve25519/sandy2x/sandy2x.S b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/sandy2x.S new file mode 100644 index 00000000..dfb092ff --- /dev/null +++ b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/sandy2x.S @@ -0,0 +1,11 @@ + +#include "consts.S" +#include "fe51_mul.S" +#include "fe51_nsquare.S" +#include "fe51_pack.S" +#include "ladder.S" +#include "ladder_base.S" + +#if defined(__linux__) && defined(__ELF__) +.section .note.GNU-stack,"",%progbits +#endif