Mounir IDRASSI
7a35ecb154
Windows: use separate assembly files for RDRAND and RDSEED in order to fix a mysterious crash when MASM_RDSEED_GenerateBlock is called after MASM_RDRAND_GenerateBlock.
2019-10-30 08:52:55 +01:00
Mounir IDRASSI
3b5d4771a0
Fix wrong detection of AMD CPUs.
2019-10-29 15:42:43 +01:00
Mounir IDRASSI
afe6b2f45b
Linux: Fix compilation error on non-x86 platform by providing generic implementation for jent_get_nstime function
2019-10-28 23:18:11 +01:00
Mounir IDRASSI
3fa636d477
Linux: Fix compilation error if type __u64 is already defined by gcc
...
This is the case with Mageia Cauldron which has gcc 9.2.1
2019-10-28 18:59:07 +01:00
Mounir IDRASSI
96c90d18c2
Linux/MacOSX: Better approach to avoid that jitterentropy code is optimized by the compiler
2019-10-24 21:07:39 +02:00
Mounir IDRASSI
478066c607
Linux/MacOSX: Add missing JitterEntropy implementation
2019-10-23 22:46:25 +02:00
Mounir IDRASSI
4119521f9e
Linux: Workaround for gcc 4.4.7 bug under CentOS 6 that causes VeraCrypt built under CentOS 6 to crash when Whirlpool hash is used.
2019-10-17 15:00:37 +02:00
El Mostafa Idrassi
9a895bedde
Fix "error "SSSE3 instruction set not enabled" when compiling using GCC version < 4.9 without -mssse3 option (SSSE3=1 when using make). ( #507 )
...
Compiling with -mxxx defines the corresponding macro of the intrinsics.
For example, -mssse3 defines __SSSE3__ macro to 1.
In GCC versions < 4.9, it is not possible to use and call x86 intrinsics only at runtime without
compiling the entire file with the -mxxx option.
For example, if we want to call SSSE3 intrinsics without compiling with -mssse3, the macro __SSSE3__ is not defined.
Therefore, when including <tmmintrin.h>, this results in "error "SSSE3 instruction set not enabled"" because of :
#ifndef __SSSE3__
# error "SSSE3 instruction set not enabled"
Since GCC 4.9, this has been fixed and it is possible to call x86 intrinsics from select functions in a file
that are tagged with the corresponding target attribute without having to compile the entire file with the -mxxx option.
This can be seen in <tmmintrin.h> which in recent versions (>= 4.9) contains :
#ifndef __SSSE3__
#pragma GCC push_options
#pragma GCC target("ssse3")
#define __DISABLE_SSSE3__
Since SSSE3 is only used under Windows for ChaCha256, this can be fixed by preceding '#include <tmmintrin.h>' with
#if defined (_MSC_VER) && !defined (TC_WINDOWS_BOOT).
See https://gcc.gnu.org/gcc-4.9/changes.html
2019-10-04 14:07:10 +02:00
Hans-Peter Jansen
0d91dab5b9
Align section types of Whirlpool_C and SHA256_K ( #479 )
...
in order to fix LTO linking.
After switching to LTO for openSUSE Tumbleweed, veracrypt build failed with:
[ 185s] ../Crypto/Whirlpool.c:105:45: error: 'Whirlpool_C' causes a section type conflict with 'SHA256_K'
[ 185s] 105 | CRYPTOPP_ALIGN_DATA(16) static const uint64 Whirlpool_C[8*256+R] CRYPTOPP_SECTION_ALIGN16 = {
[ 185s] | ^
[ 185s] ../Crypto/Sha2.c:321:34: note: 'SHA256_K' was declared here
[ 185s] 321 | CRYPTOPP_ALIGN_DATA(16) uint_32t SHA256_K[64] CRYPTOPP_SECTION_ALIGN16 = {
[ 185s] | ^
[ 185s] lto-wrapper: fatal error: g++ returned 1 exit status
Aligning section types of Whirlpool_C and SHA256_K fixes this.
2019-10-02 21:25:10 +02:00
Mounir IDRASSI
2ab57bcf70
Windows: fix compilation error of legacy MBR bootloader caused by missing intrin.h header
2019-08-26 00:50:25 +02:00
Mounir IDRASSI
08a8a0ce30
Linux: Fix compilation error caused by wrong include of "intrin.h"
2019-03-21 18:52:14 +01:00
Mounir IDRASSI
321715202a
Windows: Generalize RAM encryption for keys to VeraCrypt binaries, especially Format and Expander
2019-03-02 10:23:39 +01:00
Mounir IDRASSI
cf48b532b4
Windows: Implement RAM encryption for keys on 64-bit machines using ChaCha12 cipher and t1ha non-cryptographic fast hash ( https://github.com/leo-yuriev/t1ha )
2019-03-01 00:35:13 +01:00
Mounir IDRASSI
86f0fde6e7
Windows: Use Hardware RNG based on CPU timing jitter "Jitterentropy" by Stephan Mueller as a good alternative to RDRAND ( http://www.chronox.de/jent.html , smueller@chronox.de)
2019-02-12 19:06:14 +01:00
Mounir IDRASSI
ba5da0946c
Windows: Add implementation of ChaCha20 based random generator. Use it for driver need of random bytes (currently only wipe bytes but more to come later).
2019-02-08 01:50:12 +01:00
Mounir IDRASSI
61c1baa4bf
Windows: use CPU RDRAND or RDSEED as an additional entropy source for our random generator when available
2019-02-01 00:35:50 +01:00
Mounir IDRASSI
915855f43b
Fix detection of CPU features AVX2 & BMI2. Add detection of RDRAND & RDSEED CPU features. Detect Hygon CPU as AMD one.
2019-02-01 00:35:42 +01:00
Mounir IDRASSI
f02882ce60
Help compiler optimize some crypto code on 64-bit build since x64 capable CPUs always support SSE and SSE2
2019-01-30 00:46:10 +01:00
Mounir IDRASSI
a11cada735
crypto: cleaner code for Streebog carry bit handling and add comment about missing handling of overflow caused by carry bit.
2018-08-06 00:13:15 +02:00
Mounir IDRASSI
f53eb8e260
SIMD speed optimization for Kuznyechik cipher implementation (up to 2x speedup). Based on https://github.com/aprelev/libgost15 .
2017-11-27 16:16:35 +01:00
Mounir IDRASSI
3bdb9a32d7
Windows MBR bootloader: reduce required stack size for cascade bootloader by removing unnecessary field from Twofish structure in this case.
2017-07-19 01:12:23 +02:00
Mounir IDRASSI
b37d732408
Windows MBR Bootloader: workaround for 16-bit compiler internal error when compiling Camellia source code. In GET_UINT32_BE macro, we use |= operator instead of ORing shift values.
2017-07-19 01:12:22 +02:00
Mounir IDRASSI
ac37fb0003
Windows: generate pdb files for binaries in order to help investigate crashes in the future.
2017-07-09 09:49:33 +02:00
Mounir IDRASSI
d2eacde0da
Remove unnecessary code from Camellia assembly implementation that checks for key size since we always use it with 256-bit keys.
2017-07-09 00:19:14 +02:00
Mounir IDRASSI
2577797fc4
Windows: preserve volatile registers XMM6-XMM15 in 64-bit assembly of Camellia.
2017-07-09 00:19:12 +02:00
Mounir IDRASSI
88cc8a00f4
Windows: correctly handle SEH exceptions during self-tests in order to disable CPU extended features in such case.
2017-07-04 12:28:17 +02:00
Mounir IDRASSI
0358eb6c71
Don't check for SSSE3 to use 64-bit SHA-512 assembly code since it uses only SSE2 instructions.
2017-07-04 02:26:26 +02:00
Mounir IDRASSI
89efcdb8cd
Windows Driver: correctly save and restore extended processor state when performing AVX operations on Windows 7 and later. Enhance readability of code handling save/restore of floating point state.
2017-07-04 02:26:24 +02:00
Mounir IDRASSI
c2f6190627
Windows: use stack instead of MMX register to save registers in 64-bit assembly implementation of SHA-512 in order to avoid issues with the driver.
2017-07-04 02:26:23 +02:00
Mounir IDRASSI
e5728bd36e
Linux/MacOSX: align workspace stack variable in WhirlpoolTransform SSE code.
2017-07-02 00:51:57 +02:00
Mounir IDRASSI
d8dd1accb4
Avoid alignement issues with some old compilers by using movdqu instead of movdqa in SHA-256 SSE2 assembly.
2017-07-02 00:51:56 +02:00
Mounir IDRASSI
fe278afb18
Fix crash on machines without SSSE3 support in CPU by correctly checking for SSSE3 before using SHA-512 SSE2 assembly which uses PSHUFB instruction.
2017-07-01 01:56:33 +02:00
Mounir IDRASSI
f5e6136830
For code logic clarity, add check for xgetbv support in CPU before using it.
2017-07-01 01:56:32 +02:00
Mounir IDRASSI
eebb277374
Enable AVX assembly instructions only when the OS implements AVX support
2017-06-27 00:55:25 +02:00
Mounir IDRASSI
79cb3af526
Windows: use yasm define __YASM__ for compatibility with the assembly changes done in MacOSX.
2017-06-27 00:55:24 +02:00
Mounir IDRASSI
3d8260d3d3
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)
2017-06-27 00:55:22 +02:00
Mounir IDRASSI
a64d054cdd
Linux/MacOSX: properly declare 64-bit constant integer values to avoid being truncated by compiler.
2017-06-24 01:11:16 +02:00
Mounir IDRASSI
0ebc26e125
Update IDRIX copyright year
2017-06-23 22:15:59 +02:00
Mounir IDRASSI
f27b37b73f
Modify Aes_hw_cpu.asm to use nasm syntax that is compatible with yasm.
2017-06-23 19:05:47 +02:00
Mounir IDRASSI
546d6cff44
Crypto: Add optimized SHA-512 and SHA-256 assembly implementations for x86_64 and x86. This improves speed by 30%.
2017-06-23 02:11:21 +02:00
Mounir IDRASSI
f3db66f37f
Windows: don't use AVX optimized Camellia in EFI bootloader until compatibility issues are investigated
2017-06-21 01:39:57 +02:00
Mounir IDRASSI
70097ecfe5
Crypto: Add optimized Camellia assembly implementation for x86_64 based on work by Jussi Kivilinna ( https://github.com/jkivilin/supercop-blockciphers ). This improve speed by a factor of 2.5 when AES-NI supported by CPU and by 30% if AES-NI not supported.
2017-06-21 01:39:55 +02:00
Mounir IDRASSI
78803703e6
Windows: fix compilation error of assembly files after latest changes on Linux.
2017-06-21 01:39:51 +02:00
Mounir IDRASSI
ba1fbb688e
Linux: fix executable stack in resulting binary which was caused by crypto assembly files missing the GNU-stack note.
2017-06-13 01:26:22 +02:00
kavsrf
79aa488106
cland static code analyzer fixes
2017-06-05 17:45:47 +02:00
Mounir IDRASSI
7c78c4f4ac
Windows Driver: fix "__chkstk" link error in debug build caused by some crypto functions using too much stack space for local variables.
2017-05-22 00:43:29 +02:00
Mounir IDRASSI
c0f46187de
Fix build error in Crypto/Whirpool.c when using LLVM Clang compiler by disabling inline assembly in this case (caused by http://llvm.org/bugs/show_bug.cgi?id=24232 )
2017-01-12 18:13:24 +01:00
Mounir IDRASSI
5493de11d5
Windows: Enable Twofish optimized 64-bit assembly for UEFI bootloader since a pre-compiled object file was included to its build system.
2016-12-26 00:00:05 +01:00
Mounir IDRASSI
a0eadbd660
Windows: Don't use Twofish x64 assembly implementation for UEFI bootloader (for now, yasm is not integrated in EDKII framework).
2016-12-07 12:36:08 +01:00
Mounir IDRASSI
f10e26fc89
Windows Bootloader: fix compilation error following Twofish code changes.
2016-12-07 12:36:07 +01:00