summaryrefslogtreecommitdiff
path: root/rijndael.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Prefix IS_LITTLE_ENDIAN and IS_BIG_ENDIAN with CRYPTOPPJeffrey Walton2017-11-101-1/+1
|
* Use SetMark to avoid unneeded zeroization in RijndaelJeffrey Walton2017-10-081-0/+4
|
* Move AliasedWithTable into unnamed namespaceJeffrey Walton2017-10-051-57/+54
| | | | | | | | Move m_aliasBlock into Rijndael::Base. m_aliasBlock is now an extra data member for Dec because the aliased table is only used for Enc when unaligned data access is in effect. However, the SecBlock is not allocated in the Dec class so there is no runtime penalty. Moving m_aliasBlock into Base also allowed us to remove the Enc::Enc() constructor, which always appeared as a wart in my eyes. Now m_aliasBlock is sized in UncheckedSetKey, so there's no need for the ctor initialization. Also see https://stackoverflow.com/q/46561818/608639 on Stack Overflow. The SO question had an unusual/unexpected interaction with CMake, so the removal of the Enc::Enc() ctor should help the problem.
* Move Power8 crypto functions into ppc-crypto.hJeffrey Walton2017-09-221-2/+0
|
* Enable little endian Rijndael_UncheckedSetKey_POWER8 using built-insJeffrey Walton2017-09-211-4/+5
| | | | The problem was vec_sld is endian sensitive. The built-in required more than us setting up arguments to ensure the vsx load resulted in a big endian value. Thanks to Paul R on Stack Overflow for sharing the information that IBM did not provide. Also see http://stackoverflow.com/q/46341923/608639
* Move Rijndael_UncheckedSetKey_POWER8 prior to GetUserKey callJeffrey Walton2017-09-211-6/+7
| | | | Arg... GetUserKey was performing a 32-bit word reverse. It was part of the problem on little endian machines
* Add Rijndael_UncheckedSetKey_POWER8Jeffrey Walton2017-09-191-20/+11
| | | | We are going to attempt to perform key setup using Power8 in-core vector instructions
* ByteReverseArray → ReverseByteArrayLEJeffrey Walton2017-09-181-2/+2
|
* Refactor LoadT() and StoreT(). Add separate ReverseT() for little endian ↵Jeffrey Walton2017-09-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | machines The refactoring has no effect on little endian machines. However, on big endian GCC119 using GCC 7.1 the performance improved by 2.5x for ECB and CTR modes: BEFORE: <TR><TH>AES/CTR (128-bit key)<TD>2723<TD>1.4<TD>0.163<TD>670 <TR><TH>AES/CTR (192-bit key)<TD>2560<TD>1.5<TD>0.175<TD>719 <TR><TH>AES/CTR (256-bit key)<TD>2728<TD>1.4<TD>0.183<TD>749 <TR><TH>AES/CBC (128-bit key)<TD>1204<TD>3.2<TD>0.135<TD>554 <TR><TH>AES/CBC (192-bit key)<TD>1066<TD>3.7<TD>0.148<TD>605 <TR><TH>AES/CBC (256-bit key)<TD>948<TD>4.1<TD>0.155<TD>635 <TR><TH>AES/OFB (128-bit key)<TD>1019<TD>3.8<TD>0.158<TD>648 <TR><TH>AES/CFB (128-bit key)<TD>949<TD>4.1<TD>0.192<TD>787 <TR><TH>AES/ECB (128-bit key)<TD>3564<TD>1.1<TD>0.082<TD>337 AFTER: <TR><TH>AES/CTR (128-bit key)<TD>6484<TD>0.6<TD>0.163<TD>677 <TR><TH>AES/CTR (192-bit key)<TD>5641<TD>0.7<TD>0.176<TD>728 <TR><TH>AES/CTR (256-bit key)<TD>5005<TD>0.8<TD>0.183<TD>761 <TR><TH>AES/CBC (128-bit key)<TD>1223<TD>3.2<TD>0.135<TD>559 <TR><TH>AES/CBC (192-bit key)<TD>1080<TD>3.7<TD>0.147<TD>611 <TR><TH>AES/CBC (256-bit key)<TD>966<TD>4.1<TD>0.155<TD>642 <TR><TH>AES/OFB (128-bit key)<TD>1057<TD>3.7<TD>0.158<TD>656 <TR><TH>AES/CFB (128-bit key)<TD>1217<TD>3.3<TD>0.186<TD>774 <TR><TH>AES/ECB (128-bit key)<TD>7289<TD>0.5<TD>0.082<TD>342
* Add AdvancedProcessBlocks for Power8Jeffrey Walton2017-09-121-8/+15
| | | | This increases performance to about 1.6 cpb. We are about 0.5 cpb behind Botan, and about 1.0 cpb behind OpenSSL. However, it beats the snot out of C/C++, which runs at 20 to 30 cpb
* Add Power8 AES decryptionJeffrey Walton2017-09-121-19/+35
|
* Update commentsJeffrey Walton2017-09-121-5/+4
|
* Add Power8 AES encryptionJeffrey Walton2017-09-111-4/+48
| | | | This is the forward direction on encryption only. Crypto++ uses the "Equivalent Inverse Cipher" (FIPS-197, Section 5.3.5, p.23), and it is not compatible with IBM hardware. The library library will need to re-work the decryption key scheduling routines. (We may be able to work around it another way, but I have not investigated it).
* Revert AltiVec and Power8 commitsJeffrey Walton2017-09-051-29/+0
| | | | | The strategy of "cleanup under-aligned buffers" is not scaling well. Corner cases are still turing up. The library has some corner-case breaks, like old 32-bit Intels. And it still has not solved the AltiVec and Power8 alignment problems. For now we are backing out the changes and investigating other strategies
* Warn of under-aligned buffers when using AES in debug modeJeffrey Walton2017-09-041-0/+20
| | | | 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.
* Fixup under-aligned buffers when using AES on AltiVec and Power8Jeffrey Walton2017-09-041-0/+9
| | | | 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.
* Support Base Implementation + SIMD implementation on Solaris (PR #461)Jeffrey Walton2017-08-241-7/+0
|
* Remove BOOL macro value (GH #462)Jeffrey Walton2017-08-201-7/+7
| | | | Currently the CRYPTOPP_BOOL_XXX macros set the macro value to 0 or 1. If we remove setting the 0 value (the #else part of the expression), then the self tests speed up by about 0.3 seconds. I can't explain it, but I have observed it repeatedly. This check-in prepares for the removal in Upstream master
* Update commentsJeffrey Walton2017-08-191-2/+7
|
* Split source files to support Base Implementation + SIMD implementation (GH ↵Jeffrey Walton2017-08-171-402/+74
| | | | | #461) Split source files to support Base Implementation + SIMD implementation
* Update comments in Rijndael head commentsJeffrey Walton2017-08-151-0/+4
|
* Fix bad SHA::Transform calculation (Issue 455)Jeffrey Walton2017-08-131-1/+1
| | | | | | | | Reworked SHA class internals to align all the implementations. Formerly all hashes were software based, IterHashBase handled endian conversions, IterHashBase repeatedly called the single block SHA{N}::Transform. The rework added SHA{N}::HashMultipleBlocks, and the SHA classes attempt to always use it. Now SHA{N}::Transform calls into SHA{N}_HashMultipleBlocks, which is a free standing function. An added wrinkle is hardware wants little endian data and software presents big endian data, so HashMultipleBlocks accepts a ByteOrder for the incoming data. Hardware based SHA{N}_HashMultipleBlocks can often perform the endian swap much easier by setting an EPI mask so it was profitable to defer to hardware when available. The rework also removed the hacked-in pointers to implementations. The class now looks more like AES, GCM, etc.
* Cleanup casts due to ClangJeffrey Walton2017-08-131-28/+32
|
* Add AES for ARMv8 (Issue 458)Jeffrey Walton2017-08-111-0/+122
|
* Updated static initializersJeffrey Walton2017-03-171-1/+0
| | | | | When MSVC init_seg or GCC init_priority is available, we don't need to use the Singleton. We only need to create a file scope class variable and place it in the segment for MSVC or provide the attribute for GCC. An additional upside is we cleared all the memory leaks that used to be reported by MSVC for debug builds.
* Add C++ nullptr support (Issue 383)Jeffrey Walton2017-03-011-1/+1
|
* Fix mismatched arch capabilities (Issue 283)Jeffrey Walton2016-10-271-4/+4
|
* Add debug instrumentation to RijndaelJeffrey Walton2016-09-301-1/+18
| | | | We added asserts due to Coverity findings. We beieve the findings were false positives
* Fix AES and X86 compile on SolarisJeffrey Walton2016-09-301-7/+9
|
* Cutover to SecByteBlock member for AES (Issue 302, CVE-2016-7544)Jeffrey Walton2016-09-301-32/+44
|
* Whitespace cleanupJeffrey Walton2016-09-241-2/+2
|
* When calculating the AES block cipher, allocate 4K of memory on the stack ↵John Byrd2016-09-221-9/+18
| | | | instead of 256+ bytes. Search within that 4K space to put the 256-byte aligned Locals struct in a place which does not have 4K cache conflicts with the Te temporary buffer. This permits us to call _malloca() or alloca() once per call of this function. This commit also makes sure that the Microsoft-only _freea() occurs at the correct location instead of at a pointer to the middle of the stack, when the memory allocated by _malloca() or alloca() is not 256-byte aligned.
* Add CRYPTOPP_ASSERT (Issue 277, CVE-2016-7420)Jeffrey Walton2016-09-161-2/+2
| | | | trap.h and CRYPTOPP_ASSERT has existed for over a year in Master. We deferred on the cut-over waiting for a minor version bump (5.7). We have to use it now due to CVE-2016-7420
* Fix typo on SunCC versionJeffrey Walton2016-08-261-1/+1
|
* Add vec_swap for compilers which do not support std::swap'ing SSE and NEON typesJeffrey Walton2016-07-171-4/+2
|
* Fix SunCC 12.2 and 12.3 failed compile in rijndael.cpp due to ↵Jeffrey Walton2016-07-161-1/+8
| | | | std::swap(__m128i, __m128i)
* Fix typo in SunCC checkJeffrey Walton2016-07-151-1/+1
|
* Fix broken rijndael.cpp compile under Sun Studio (Issue 224)Jeffrey Walton2016-07-151-9/+16
|
* Add C++11 alignas support. Deleting 'alignas' branchJeffrey Walton2016-06-141-19/+20
|
* Check for SSE4 support before using SSE4.1 instructionMarcel Raad2016-05-101-2/+2
| | | | | | | In a 32-bit Windows program compiled with Visual C++ 2013 Update 5, we sometimes get crashes because of an exception "0xC000001D: Illegal Instruction" on the pextrd (_mm_extract_epi32) instruction. Explicitly check for SSE4 support instead of only AES-NI before using this SSE4.1 instruction.
* Fix the Rijndael timing attack counter measure (Issue 146)Jeffrey Walton2016-04-121-1/+1
|
* Improve constant propagation of fix for Issue 146Jeffrey Walton2016-04-071-4/+8
|
* Revert "Improve performance of fix to Issue 146"Jeffrey Walton2016-04-071-2/+1
| | | | This reverts commit 5cce8c33cabd92afecfb0ec31f841d3082d15b3d. It was an incomplete remediation because it was applied to one area of the code, and not both areas of the code. The complete remediation will be checked-in next.
* Improve performance of fix to Issue 146Jeffrey Walton2016-04-071-1/+2
|
* Fix the Rijndael timing attack counter measurePierre Lestringant2016-04-061-2/+2
|
* Add call for _malloca/_freea. They are SDLC compliance items on Windows platformJeffrey Walton2016-02-091-3/+8
|
* Temporary fix for Issue 42 and 132Jeffrey Walton2016-02-071-9/+14
|
* Fix missing CryptoPP::rdtable::Te symbol for Microsoft SSE2 non-AESNI X64 ↵Jeffrey Walton2016-02-061-3/+9
| | | | platforms when CRYPTOPP_NO_UNALIGNED_DATA_ACCESS defined
* Removed CRYPTOPP_ALLOW_RIJNDAEL_UNALIGNED_DATA_ACCESS. No longer necessaryJeffrey Walton2016-02-051-14/+9
|
* Removed garbage charcters suffixed to CRYPTOPP_GENERATE_X64_MASM. They ↵Jeffrey Walton2016-02-051-1/+1
| | | | appear to have entered on November 15, 2015 with commit 48809d4e85c12581