diff options
author | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2017-06-26 16:53:12 +0200 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2017-06-27 00:55:22 +0200 |
commit | 3d8260d3d3243ff5747b846cde296642156f51b0 (patch) | |
tree | c12fe1bfa0c8619a3dbdafbc3fd1d7411b30c0ae | |
parent | e8bafa6a378852977326c060c505b6487232664b (diff) | |
download | VeraCrypt-3d8260d3d3243ff5747b846cde296642156f51b0.tar.gz VeraCrypt-3d8260d3d3243ff5747b846cde296642156f51b0.zip |
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)
-rw-r--r-- | src/Crypto/Camellia_aesni_x64.S | 2 | ||||
-rw-r--r-- | src/Crypto/Camellia_aesni_x86.S | 2 | ||||
-rw-r--r-- | src/Crypto/Camellia_x64.S | 2 | ||||
-rw-r--r-- | src/Crypto/Camellia_x86.S | 2 | ||||
-rw-r--r-- | src/Crypto/Sha2.c | 6 | ||||
-rw-r--r-- | src/Crypto/Twofish_x64.S | 2 | ||||
-rw-r--r-- | src/Crypto/Twofish_x86.S | 14 | ||||
-rw-r--r-- | src/Crypto/sha256-x64-nayuki.S | 4 | ||||
-rw-r--r-- | src/Crypto/sha256-x86-nayuki.S | 4 | ||||
-rw-r--r-- | src/Crypto/sha512-x64-nayuki.S | 4 | ||||
-rw-r--r-- | src/Crypto/sha512-x86-nayuki.S | 2 | ||||
-rw-r--r-- | src/Makefile | 6 | ||||
-rw-r--r-- | src/Volume/Volume.make | 28 |
13 files changed, 36 insertions, 42 deletions
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 diff --git a/src/Makefile b/src/Makefile index c09828a5..3e8a9e32 100644 --- a/src/Makefile +++ b/src/Makefile @@ -44,7 +44,7 @@ export RANLIB ?= ranlib export CFLAGS := -Wall export CXXFLAGS := -Wall -Wno-unused-parameter C_CXX_FLAGS := -MMD -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGE_FILES -I$(BASE_DIR) -I$(BASE_DIR)/Crypto -export ASFLAGS := -D __GNUC__ +export ASFLAGS := -D __GNUC__ -D __YASM__ export LFLAGS := export PKG_CONFIG_PATH ?= /usr/local/lib/pkgconfig @@ -251,8 +251,8 @@ ifeq "$(shell uname -s)" "Darwin" endif AS := $(BASE_DIR)/Build/Tools/MacOSX/yasm - export ASFLAGS32 := -D __GNUC__ -D __BITS__=32 --prefix _ -f macho32 - export ASFLAGS64 := -D __GNUC__ -D __BITS__=64 --prefix _ -f macho64 + export ASFLAGS32 := -D __GNUC__ -D __YASM__ -D __BITS__=32 --prefix=_ -f macho32 + export ASFLAGS64 := -D __GNUC__ -D __YASM__ -D __BITS__=64 --prefix=_ -f macho64 ifeq "$(TC_BUILD_CONFIG)" "Release" diff --git a/src/Volume/Volume.make b/src/Volume/Volume.make index e15ee2c4..b8f69429 100644 --- a/src/Volume/Volume.make +++ b/src/Volume/Volume.make @@ -36,14 +36,14 @@ ifeq "$(PLATFORM)" "MacOSX" OBJSEX += ../Crypto/Twofish_asm.oo OBJSEX += ../Crypto/Camellia_asm.oo OBJSEX += ../Crypto/Camellia_aesni_asm.oo - OBJS += ../Crypto/sha256-nayuki.oo - OBJS += ../Crypto/sha512-nayuki.oo - OBJS += ../Crypto/sha256_avx1.oo - OBJS += ../Crypto/sha256_avx2.oo - OBJS += ../Crypto/sha256_sse4.oo - OBJS += ../Crypto/sha512_avx1.oo - OBJS += ../Crypto/sha512_avx2.oo - OBJS += ../Crypto/sha512_sse4.oo + OBJSEX += ../Crypto/sha256-nayuki.oo + OBJSEX += ../Crypto/sha512-nayuki.oo + OBJSEX += ../Crypto/sha256_avx1.oo + OBJSEX += ../Crypto/sha256_avx2.oo + OBJSEX += ../Crypto/sha256_sse4.oo + OBJSEX += ../Crypto/sha512_avx1.oo + OBJSEX += ../Crypto/sha512_avx2.oo + OBJSEX += ../Crypto/sha512_sse4.oo else ifeq "$(CPU_ARCH)" "x86" OBJS += ../Crypto/Aes_x86.o OBJS += ../Crypto/Aes_hw_cpu.o @@ -106,7 +106,10 @@ ifeq "$(PLATFORM)" "MacOSX" $(AS) $(ASFLAGS64) -p gas -o ../Crypto/Camellia_aesni_asm.oo ../Crypto/Camellia_aesni_x64.S ../Crypto/sha256-nayuki.oo: ../Crypto/sha256-x86-nayuki.S @echo Assembling $(<F) - $(AS) $(ASFLAGS32) -p gas -o ../Crypto/sha256-nayuki.oo ../Crypto/sha256-x86-nayuki.S + $(AS) $(ASFLAGS32) -p gas -o ../Crypto/sha256-x86-nayuki.o ../Crypto/sha256-x86-nayuki.S + $(AS) $(ASFLAGS64) -p gas -o ../Crypto/sha256-x64-nayuki.o ../Crypto/sha256-x64-nayuki.S + lipo -create ../Crypto/sha256-x86-nayuki.o ../Crypto/sha256-x64-nayuki.o -output ../Crypto/sha256-nayuki.oo + rm -fr ../Crypto/sha256-x86-nayuki.o ../Crypto/sha256-x64-nayuki.o ../Crypto/sha256_avx1.oo: ../Crypto/sha256_avx1_x64.asm @echo Assembling $(<F) $(AS) $(ASFLAGS64) -o ../Crypto/sha256_avx1.oo ../Crypto/sha256_avx1_x64.asm @@ -116,12 +119,9 @@ ifeq "$(PLATFORM)" "MacOSX" ../Crypto/sha256_sse4.oo: ../Crypto/sha256_sse4_x64.asm @echo Assembling $(<F) $(AS) $(ASFLAGS64) -o ../Crypto/sha256_sse4.oo ../Crypto/sha256_sse4_x64.asm -../Crypto/sha512-nayuki.oo: ../Crypto/sha512-x86-nayuki.S ../Crypto/sha512-x64-nayuki.S +../Crypto/sha512-nayuki.oo: ../Crypto/sha512-x64-nayuki.S @echo Assembling $(<F) - $(AS) -p gas $(ASFLAGS32) -o ../Crypto/sha512-x86-nayuki.o ../Crypto/sha512-x86-nayuki.S - $(AS) -p gas $(ASFLAGS64) -o ../Crypto/sha512-x64-nayuki.o ../Crypto/sha512-x64-nayuki.S - lipo -create ../Crypto/sha512-x86-nayuki.o ../Crypto/sha512-x64-nayuki.o -output ../Crypto/sha512-nayuki.oo - rm -fr ../Crypto/sha512-x86-nayuki.o ../Crypto/sha512-x64-nayuki.o + $(AS) -p gas $(ASFLAGS64) -o ../Crypto/sha512-nayuki.oo ../Crypto/sha512-x64-nayuki.S ../Crypto/sha512_avx1.oo: ../Crypto/sha512_avx1_x64.asm @echo Assembling $(<F) $(AS) $(ASFLAGS64) -o ../Crypto/sha512_avx1.oo ../Crypto/sha512_avx1_x64.asm |