From 0ca0ff89235bf6c142c8d5b07526b9775a220cb5 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Wed, 4 Nov 2015 19:03:13 +0100 Subject: [PATCH] Protect Sandy2x files against double compilation (Cocoapods...) --- src/libsodium/crypto_scalarmult/curve25519/sandy2x/consts.S | 4 ++++ .../crypto_scalarmult/curve25519/sandy2x/fe51_mul.S | 4 ++++ .../crypto_scalarmult/curve25519/sandy2x/fe51_nsquare.S | 4 ++++ .../crypto_scalarmult/curve25519/sandy2x/fe51_pack.S | 4 ++++ src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder.S | 4 ++++ .../crypto_scalarmult/curve25519/sandy2x/ladder_base.S | 4 ++++ .../crypto_scalarmult/curve25519/sandy2x/sandy2x.S | 6 ++++++ 7 files changed, 30 insertions(+) diff --git a/src/libsodium/crypto_scalarmult/curve25519/sandy2x/consts.S b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/consts.S index b672fd85..67f1f018 100644 --- a/src/libsodium/crypto_scalarmult/curve25519/sandy2x/consts.S +++ b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/consts.S @@ -1,3 +1,5 @@ +#ifdef IN_SANDY2X + /* REDMASK51 is from amd64-51/consts.s. */ @@ -19,3 +21,5 @@ m26: .quad 67108863, 67108863 subc0: .quad 0x07FFFFDA, 0x03FFFFFE subc2: .quad 0x07FFFFFE, 0x03FFFFFE REDMASK51: .quad 0x0007FFFFFFFFFFFF + +#endif diff --git a/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_mul.S b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_mul.S index 3add6504..3b763788 100644 --- a/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_mul.S +++ b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_mul.S @@ -1,3 +1,5 @@ +#ifdef IN_SANDY2X + /* This file is basically amd64-51/fe25519_mul.s. */ @@ -183,3 +185,5 @@ add %r11,%rsp mov %rdi,%rax mov %rsi,%rdx ret + +#endif diff --git a/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_nsquare.S b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_nsquare.S index fd79b8f0..9b74ee3e 100644 --- a/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_nsquare.S +++ b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_nsquare.S @@ -1,3 +1,5 @@ +#ifdef IN_SANDY2X + /* This file is adapted from amd64-51/fe25519_square.s: Adding loop to perform n squares. @@ -159,3 +161,5 @@ movq 40(%rsp),%rbx movq 48(%rsp),%rbp add %r11,%rsp ret + +#endif diff --git a/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_pack.S b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_pack.S index e652ace8..c8cf405b 100644 --- a/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_pack.S +++ b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_pack.S @@ -1,3 +1,5 @@ +#ifdef IN_SANDY2X + /* This file is the result of merging amd64-51/fe25519_pack.c and amd64-51/fe25519_freeze.s. @@ -213,3 +215,5 @@ movq 0(%rsp),%r11 movq 8(%rsp),%r12 add %r11,%rsp ret + +#endif diff --git a/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder.S b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder.S index 12843d8a..0adc44af 100644 --- a/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder.S +++ b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder.S @@ -1,3 +1,5 @@ +#ifdef IN_SANDY2X + #include "ladder_namespace.h" #include "consts_namespace.h" .p2align 5 @@ -1426,3 +1428,5 @@ movq 1840(%rsp),%r13 movq 1848(%rsp),%r14 add %r11,%rsp ret + +#endif diff --git a/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder_base.S b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder_base.S index 404c3955..536ac101 100644 --- a/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder_base.S +++ b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder_base.S @@ -1,3 +1,5 @@ +#ifdef IN_SANDY2X + #include "ladder_base_namespace.h" #include "consts_namespace.h" .p2align 5 @@ -1281,3 +1283,5 @@ movq 1544(%rsp),%r12 movq 1552(%rsp),%r13 add %r11,%rsp ret + +#endif diff --git a/src/libsodium/crypto_scalarmult/curve25519/sandy2x/sandy2x.S b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/sandy2x.S index dfb092ff..c955b0af 100644 --- a/src/libsodium/crypto_scalarmult/curve25519/sandy2x/sandy2x.S +++ b/src/libsodium/crypto_scalarmult/curve25519/sandy2x/sandy2x.S @@ -1,4 +1,8 @@ +#ifdef HAVE_AMD64_ASM + +#define IN_SANDY2X + #include "consts.S" #include "fe51_mul.S" #include "fe51_nsquare.S" @@ -9,3 +13,5 @@ #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif + +#endif