From 3d8260d3d3243ff5747b846cde296642156f51b0 Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Mon, 26 Jun 2017 16:53:12 +0200 Subject: MacOSX: various changes for assembly files build. Don't use 32-bit assembly code of SHA-512 since it is not compatible with PIE configuration of OSX compiler (absolute addressing used) --- src/Crypto/Camellia_aesni_x64.S | 2 +- src/Crypto/Camellia_aesni_x86.S | 2 +- src/Crypto/Camellia_x64.S | 2 +- src/Crypto/Camellia_x86.S | 2 +- src/Crypto/Sha2.c | 6 +++--- src/Crypto/Twofish_x64.S | 2 +- src/Crypto/Twofish_x86.S | 14 ++++---------- src/Crypto/sha256-x64-nayuki.S | 4 ++-- src/Crypto/sha256-x86-nayuki.S | 4 ++-- src/Crypto/sha512-x64-nayuki.S | 4 ++-- src/Crypto/sha512-x86-nayuki.S | 2 +- 11 files changed, 19 insertions(+), 25 deletions(-) (limited to 'src/Crypto') diff --git a/src/Crypto/Camellia_aesni_x64.S b/src/Crypto/Camellia_aesni_x64.S index 4e2e093c..c3b8d193 100644 --- a/src/Crypto/Camellia_aesni_x64.S +++ b/src/Crypto/Camellia_aesni_x64.S @@ -833,7 +833,7 @@ _camellia_setup256: ret; - .ifndef WINABI + .ifndef __YASM__ #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif diff --git a/src/Crypto/Camellia_aesni_x86.S b/src/Crypto/Camellia_aesni_x86.S index 4a466888..0b1721ea 100644 --- a/src/Crypto/Camellia_aesni_x86.S +++ b/src/Crypto/Camellia_aesni_x86.S @@ -1,4 +1,4 @@ - .ifndef WINABI + .ifndef __YASM__ #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif diff --git a/src/Crypto/Camellia_x64.S b/src/Crypto/Camellia_x64.S index d57e5a4e..d1b8fb26 100644 --- a/src/Crypto/Camellia_x64.S +++ b/src/Crypto/Camellia_x64.S @@ -331,7 +331,7 @@ popq %rsi ret; - .ifndef WINABI + .ifndef __YASM__ #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif diff --git a/src/Crypto/Camellia_x86.S b/src/Crypto/Camellia_x86.S index 4a466888..0b1721ea 100644 --- a/src/Crypto/Camellia_x86.S +++ b/src/Crypto/Camellia_x86.S @@ -1,4 +1,4 @@ - .ifndef WINABI + .ifndef __YASM__ #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif diff --git a/src/Crypto/Sha2.c b/src/Crypto/Sha2.c index d383a3e9..fc1d0aec 100644 --- a/src/Crypto/Sha2.c +++ b/src/Crypto/Sha2.c @@ -26,7 +26,7 @@ extern "C" void sha512_avx(const void* M, void* D, uint_64t l); #endif -#if CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64 +#if CRYPTOPP_BOOL_X64 || ((CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32) && !defined (TC_MACOSX)) void sha512_compress_nayuki(uint_64t state[8], const uint_8t block[128]); #endif #if defined(__cplusplus) @@ -173,7 +173,7 @@ void SSE4Transform(sha512_ctx* ctx, void* mp, uint_64t num_blks) } #endif -#if CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64 +#if CRYPTOPP_BOOL_X64 || ((CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32) && !defined (TC_MACOSX)) void SSE2Transform(sha512_ctx* ctx, void* mp, uint_64t num_blks) { @@ -216,7 +216,7 @@ void sha512_begin(sha512_ctx* ctx) else #endif -#if CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64 +#if CRYPTOPP_BOOL_X64 || ((CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32) && !defined (TC_MACOSX)) if (HasSSE2() && HasMMX()) transfunc = SSE2Transform; else diff --git a/src/Crypto/Twofish_x64.S b/src/Crypto/Twofish_x64.S index e5fa5ea8..93f28206 100644 --- a/src/Crypto/Twofish_x64.S +++ b/src/Crypto/Twofish_x64.S @@ -312,7 +312,7 @@ movq %r8, %rdx; .endif ret; - .ifndef WINABI + .ifndef __YASM__ #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif diff --git a/src/Crypto/Twofish_x86.S b/src/Crypto/Twofish_x86.S index d4af8cea..46f0e986 100644 --- a/src/Crypto/Twofish_x86.S +++ b/src/Crypto/Twofish_x86.S @@ -1,11 +1,5 @@ - .ifndef WINABI -%ifidn __OUTPUT_FORMAT__,elf -section .note.GNU-stack noalloc noexec nowrite progbits -%endif -%ifidn __OUTPUT_FORMAT__,elf32 -section .note.GNU-stack noalloc noexec nowrite progbits -%endif -%ifidn __OUTPUT_FORMAT__,elf64 -section .note.GNU-stack noalloc noexec nowrite progbits -%endif + .ifndef __YASM__ +#if defined(__linux__) && defined(__ELF__) +.section .note.GNU-stack,"",%progbits +#endif .endif \ No newline at end of file diff --git a/src/Crypto/sha256-x64-nayuki.S b/src/Crypto/sha256-x64-nayuki.S index c6dd16d1..444b28cd 100644 --- a/src/Crypto/sha256-x64-nayuki.S +++ b/src/Crypto/sha256-x64-nayuki.S @@ -1,6 +1,6 @@ - .ifndef WINABI + .ifndef __YASM__ #if defined(__linux__) && defined(__ELF__) - .section .note.GNU-stack,"",%progbits +.section .note.GNU-stack,"",%progbits #endif .endif \ No newline at end of file diff --git a/src/Crypto/sha256-x86-nayuki.S b/src/Crypto/sha256-x86-nayuki.S index a8e25db7..067496b3 100644 --- a/src/Crypto/sha256-x86-nayuki.S +++ b/src/Crypto/sha256-x86-nayuki.S @@ -161,8 +161,8 @@ retl .endif - .ifndef WINABI + .ifndef __YASM__ #if defined(__linux__) && defined(__ELF__) - .section .note.GNU-stack,"",%progbits +.section .note.GNU-stack,"",%progbits #endif .endif \ No newline at end of file diff --git a/src/Crypto/sha512-x64-nayuki.S b/src/Crypto/sha512-x64-nayuki.S index 0e36ac91..167b31f5 100644 --- a/src/Crypto/sha512-x64-nayuki.S +++ b/src/Crypto/sha512-x64-nayuki.S @@ -195,8 +195,8 @@ _sha512_compress_nayuki: retq - .ifndef WINABI + .ifndef __YASM__ #if defined(__linux__) && defined(__ELF__) - .section .note.GNU-stack,"",%progbits +.section .note.GNU-stack,"",%progbits #endif .endif diff --git a/src/Crypto/sha512-x86-nayuki.S b/src/Crypto/sha512-x86-nayuki.S index dcbebf7a..e1fce56e 100644 --- a/src/Crypto/sha512-x86-nayuki.S +++ b/src/Crypto/sha512-x86-nayuki.S @@ -173,7 +173,7 @@ .quad 0x28DB77F523047D84, 0x32CAAB7B40C72493, 0x3C9EBE0A15C9BEBC, 0x431D67C49C100D4C .quad 0x4CC5D4BECB3E42B6, 0x597F299CFC657E2A, 0x5FCB6FAB3AD6FAEC, 0x6C44198C4A475817 - .ifndef WINABI + .ifndef __YASM__ #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif -- cgit v1.2.3