Commit Graph

2951 Commits

Author SHA1 Message Date
Jeffrey Walton
d0eefdf32a
Use aligned buffer for Poly1305 nonce 2017-09-04 19:28:19 -04:00
Jeffrey Walton
fe0a5ee8e8
Warn of under-aligned buffers when using AES in debug mode
This commit supports the upcoming AltiVec and Power8 processor. This commit affects a number of classes due to the ubiquitous use of AES. The commit adds debug asserts to warn of under-aligned and misaligned buffers in debug builds.
2017-09-04 12:01:44 -04:00
Jeffrey Walton
75aef9bded
Fixup under-aligned buffers when using AES on AltiVec and Power8
This commit supports the upcoming AltiVec and Power8 processor. This commit affects a number of classes due to the ubiquitous use of AES. The commit provides the data alignment requirements.
2017-09-04 11:21:47 -04:00
Jeffrey Walton
32cc92e048
Fixup under-aligned buffers for stream ciphers on AltiVec and Power8
This commit supports the upcoming AltiVec and Power8 processor support for stream ciphers. This commit affects GlobalRNG() most because its an AES-based generator. The commit favors AlignedSecByteBlock over SecByteBlock in places where messages are handled on the AltiVec and Power8 processor data paths. The data paths include all block cipher modes of operation, and some filters like FilterWithBufferedInput.

Intel and ARM processors are tolerant of under-aligned buffers when using crypto instructions. AltiVec and Power8 are less tolerant, and they simply ignore the three low-order bits to ensure an address is aligned. The AltiVec and Power8 have caused a fair number of wild writes on the stack and in the heap.

Testing on a 64-bit Intel Skylake show a marked improvement in performance. We suspect GCC is generating better code since it knows the alignment of the pointers, and does not have to emit fixup code for under-aligned and mis-aligned data. Testing on an mid-2000s 32-bit VIA C7-D with SSE2+SSSE3 showed no improvement, and no performance was lost.
2017-09-04 11:03:10 -04:00
Jeffrey Walton
6b1a56cf72
Fixup under-aligned buffers for DefaultEncryptors and DefaultDecryptors on AltiVec and Power8
This commit supports the upcoming AltiVec and Power8 processor support for DefaultEncryptors and DefaultDecryptors. The commit favors AlignedSecByteBlock over SecByteBlock in places where messages are handled on the AltiVec and Power8 processor data paths. The data paths include all block cipher modes of operation, and some filters like FilterWithBufferedInput.

Intel and ARM processors are tolerant of under-aligned buffers when using crypto intstructions. AltiVec and Power8 are less tolerant, and they simply ignore the three low-order bits to ensure an address is aligned. The AltiVec and Power8 have caused a fair number of wild writes on the stack and in the heap.

Testing on a 64-bit Intel Skylake show a marked improvement in performance. We suspect GCC is generating better code since it knows the alignment of the pointers, and does not have to emit fixup code for under-aligned and mis-aligned data. Testing on an mid-2000's 32-bit VIA C7-D with SSE2+SSSE3 showed no improvement, and no performance was lost.
2017-09-04 10:47:55 -04:00
Jeffrey Walton
9c2a1c74fe
Fixup under-aligned buffers for AltiVec and Power8
This commit supports the upcoming AltiVec and Power8 processor support. The commit favors AlignedSecByteBlock over SecByteBlock in places where messages are handled on the AltiVec and Power8 processor data paths. The data paths include all block cipher modes of operation, and some filters like

Intel and ARM processors are tolerant of under-aligned buffers when using crypto intstructions. AltiVec and Power8 are less tolerant, and they simply ignore the three low-order bits to ensure an address is aligned. The AltiVec and Power8 have caused a fair number of wild writes on the stack and in the heap.

Testing on a 64-bit Intel Skylake show a marked improvement in performance. We suspect GCC is generating better code since it knows the alignment of the pointers, and does not have to emit fixup code for under-aligned and mis-aligned data. Here are some data points:

  SecByteBlock
    - Poly1305: 3.4 cpb
    - Blake2s: 6.7 cpb
    - Blake2b: 4.5 cpb
    - SipHash-2-4: 3.1 cpb
    - SipHash-4-8: 3.5 cpb
    - ChaCha20: 7.4 cpb
    - ChaCha12: 4.6 cpb
    - ChaCha8: 3.5 cpb

  AlignedSecByteBlock
    - Poly1305: 2.9 cpb
    - Blake2s: 5.5. cpb
    - Blake2b: 3.9 cpb
    - SipHash-2-4: 1.9 cpb
    - SipHash-4-8: 3.3 cpb
    - ChaCha20: 6.0 cpb
    - ChaCha12: 4.0 cpb
    - ChaCha8: 2.9 cpb

Testing on an mid-2000's 32-bit VIA C7-D with SSE2+SSSE3 showed no improvement, and no performance was lost.
2017-09-04 10:24:24 -04:00
Jeffrey Walton
8578383e2c
Switch to static_cast 2017-09-03 20:33:01 -04:00
Jeffrey Walton
e7974c7915
Fix unaligned data in self test
AltiVec and Power8 are brutal. The SIMD units just mask-off the lower 3 address bits. They make the buffer aligned whethere it is aligned or not
2017-09-03 11:17:57 -04:00
Jeffrey Walton
b9e871d1e8
Add PPC, PPC64, AltiVec and Power8 awareness
We are going to try AltiVec/Powe8 crypto. It appears to be a lot like ARMv8-a crypto
2017-09-02 19:25:37 -04:00
Jeffrey Walton
4a28391495
Back-off assert in SecBlock
Since removing the allocator overloards that handled the wipe mark, we have to route deallocate into the standard one. The standard one fires an assert for [now] normal operation
2017-09-02 19:22:53 -04:00
Jeffrey Walton
a57cd5e193
Update test script 2017-09-02 06:18:08 -04:00
Jeffrey Walton
5b12be29e6
Update test script 2017-09-01 20:38:57 -04:00
Jeffrey Walton
3525fd48da
Remove MOVBE intrinsics
GCC never defines __MOVBE__
2017-09-01 20:38:32 -04:00
Jeffrey Walton
d2ad6751d5
Clear uninitialized variable warnings under xlC 2017-09-01 20:37:23 -04:00
Jeffrey Walton
602fa05825
Cleared unused variable warning under MSC 2017-09-01 14:19:48 -04:00
Jeffrey Walton
6544f75769
Clear strict aliasing rule violation in BLAKE2
There was no aliasing violation in practice. We used a  to assign the right pointer. If the compiler would have removed the unneeded assignment based on T_64bit, then we would not have been flagged.
2017-09-01 11:36:22 -04:00
Jeffrey Walton
069ae2a179
Fix missing object factory of xlC on AIX 2017-09-01 03:58:45 -04:00
Jeffrey Walton
29cf783458
Clear xLC "1540-1102 (W) "e" might be used before it is set" 2017-09-01 03:19:43 -04:00
Jeffrey Walton
14a5221d82
Remove unneeded Debug tests
These tests are effectively performed in MDC, SEAL and OldRandomPool
2017-09-01 02:37:41 -04:00
Jeffrey Walton
b47de6150f
Remove unneeded deallocate (GH #485)
This should have been yanked when we removed the same for allocate
2017-08-31 22:50:09 -04:00
Jeffrey Walton
55a5dd8b85
Add core to clean rule 2017-08-31 12:15:39 -04:00
Jeffrey Walton
d8b30e1bd4
Remove deallocate() overload in SecBlock for AIX (GH #485) 2017-08-31 11:23:37 -04:00
Jeffrey Walton
ea07825127
Add -pthread for Linux and GCC compatibles
Fix AIX dtection
Guard use of -m32 and -m64
2017-08-31 10:08:18 -04:00
Jeffrey Walton
6c35eaf737
Update test script for AIX 2017-08-31 08:05:48 -04:00
Jeffrey Walton
0d6f349749
Fold CXX11 feature block 2017-08-31 06:41:44 -04:00
Jeffrey Walton
67bcdaed9a
Fix compile under AIX 7.1 2017-08-31 06:29:35 -04:00
Jeffrey Walton
5cd854b2d3
Update comments 2017-08-30 21:47:05 -04:00
Jeffrey Walton
de8478af2a
Add ARMv7-a NEON tests (GH #481)
The tests were already present; they just needed some tuning
2017-08-30 19:31:11 -04:00
Wyatt O'Day
ffbedcefc5 Fix build on FreeBSD 10.3 x86 with clang++ 3.4.1. (#483)
* Fix build on FreeBSD 10.3 x86 with clang++ v. 3.4.1. The x64 build (also clang++ 3.4.1) doesn't require CRYPTOPP_DISABLE_SHA_ASM. It seems to be a bug specific to the x86 version of clang++.

* Based on suggestion from @noloader, don't split x86/x64 clang++ version detection. Just wait until clang++ is consistently working in both x86/x64.
2017-08-30 16:42:36 -04:00
Wyatt O'Day
23809a3576 Actually fix the VS2010 compilation bug. I somehow missed this in the first pull request. (#482)
Thank you very much.
2017-08-30 13:46:14 -04:00
Jeffrey Walton
c079abdbc0
Fix missing DetectArmFeatures for ARMv7 (GH #480) 2017-08-30 11:12:39 -04:00
Jeffrey Walton
b2693c4327
Fix IS_ARMV8 in GNUmakefile
Fix guard for HasPMULL()
2017-08-30 10:00:46 -04:00
Jeffrey Walton
1aecb3d4ad
Use optimization level -O3 for release testing (GH #454)
This change should have been made with Commit 18a05659f3
2017-08-30 08:32:20 -04:00
Jeffrey Walton
796a5c1a02
Remove PLATFORM_CXXFLAGS tests (GH #481)
cryptest.sh still needs some tweaking from the recent changes
2017-08-30 07:58:34 -04:00
Wyatt O'Day
5149237a5d Fix compilation of secblock.h under Visual Studio 2010 (which only has partial C++ 2011 support). (#477) 2017-08-29 14:55:01 -04:00
Jeffrey Walton
8624587943
Remove WORKAROUND_MS_BUG_Q258000 from the config and osrng 2017-08-29 14:48:08 -04:00
Jeffrey Walton
c06995a71b
Consistent use of grep and sed (GH #476)
MinGW is really messing things up for us.
2017-08-29 08:57:04 -04:00
Jeffrey Walton
ef28f46691
Fix CMakeList.txt under Solaris
We needed to add GREP_CMD back and use grep from /usr/bin/xpg4 for Posix xompliant grep.
2017-08-29 07:33:25 -04:00
Jeffrey Walton
7e7de550e9
Fix broken CMakeList.txt under MinGW (again) (Issue 476)
Sorry about that Anonimal (x2)
2017-08-28 18:51:41 -04:00
Jeffrey Walton
238154966c
Fix broken CMakeList.txt under MinGW (again) (Issue 476)
Sorry about that Anonimal
2017-08-28 18:15:32 -04:00
Jeffrey Walton
76c4d6e9fa
Add -xarch options to linker flags (Issue 472)
Also see https://docs.oracle.com/cd/E19205-01/819-5267/bkabt/index.html
2017-08-28 17:51:59 -04:00
Jeffrey Walton
a3b035b6a8
Add CRYPTOPP_CXX11_ENUM (Issue 475) 2017-08-28 17:37:59 -04:00
Jeffrey Walton
97317914d5
Since moving to split sources (base+simd) we found SecBlocks declared in headers may not be 16-byte aligned because the architecture switch is present on the simd file, and not the base file.
16-byte aligned is the default for most systems nowadays, so we side stepped alignment problems on all platforms except 32-bit Solaris. We need the 16-byte alignment for all Intel compatibles since the late 1990s, which is nearly all processors in the class.

The worst case is, if a processor lacks SSE2, then it gets an aligned SecBlock anyways. The last time we saw processors without the features was 486 and early Pentiums, and that was 1996 or so. Even low-end processors like Intel Atoms and VIA have SSE2+SSSE3.

Also see "Enable 16-byte alignment full-time for i386 and x86_64?" (https://groups.google.com/forum/#!topic/cryptopp-users/ubp-gFC1BJI) for a discussion.
2017-08-28 05:40:23 -04:00
Jeffrey Walton
d4ac135f93
Test align 16 for i386 and x86_64
Take 2
2017-08-27 19:53:12 -04:00
Jeffrey Walton
f488221992
Test align 16 for i386 and x86_64 2017-08-27 19:01:00 -04:00
Jeffrey Walton
7c667bc71e
Fix SunCC crash when compiling GCM 2017-08-27 06:16:04 -04:00
Jeffrey Walton
2d5ed51ca9
Add Mapfile for CMake on Solaris (Issue 380) 2017-08-27 05:47:38 -04:00
Jeffrey Walton
67a24ec75a
Fix output artifact name under Cygwin (GH #466) 2017-08-26 22:34:10 -04:00
Jeffrey Walton
33d20af445
Fix CMake compiler feature misdetection on under SunCC (GH #472)
Take 2
2017-08-26 20:53:35 -04:00
Jeffrey Walton
052c06b2ea Revert "Fix CMake compiler feature misdetection on under SunCC (GH #472)"
This reverts commit 64def346cd. It broke AppVeyor and Travis builds (it tested good locally on Intel, Aarch and Solaris i86). CMake is so fucked up. I regret the day we added it to the project.
2017-08-26 18:47:04 -04:00