Commit Graph

118 Commits

Author SHA1 Message Date
Jeffrey Walton
307ada58d6
Disable global optimizations for all versions of VS2017 (GH #649, GH #735, PR #1146)
We started seeing failed self test under VS2017 on AppVeyor. See https://ci.appveyor.com/project/noloader/cryptopp/builds/44570276 .
2022-08-24 22:45:28 -04:00
chausner
bc4a1b5330
Enable MSVC global optimizations for AES and ChaCha for newer MSVC versions (GH #1131) 2022-07-29 11:44:53 -04:00
Dimitris Apostolou
715a0bcce3
Fix typos (PR# 1099) 2022-01-04 05:06:35 -05:00
Jeffrey Walton
0e117ee65b
Consistently use cryptogams_ prefix for Andy Polyakov's code (PR #952) 2020-12-26 03:16:42 -05:00
Sergiu Giurgiu
818f1ca944
Fix conflicting Cryptogams API names on ARM with OpenSSL (GH #952) 2020-06-03 21:03:18 -04:00
Jeffrey Walton
2c3dd14a1e
Cleanup CFB mode for Cryptogams AES 2020-04-13 02:47:38 -04:00
Jeffrey Walton
cac28287cc
Fix AES/CFB mode failure on ARMv7 2020-04-12 12:56:50 -04:00
Jeffrey Walton
76c92e019f
Align Rijdael SIMD data to natural alignment
This should provide a small speedup and avoid problems with loads using 32-bit pointers
2020-04-03 00:57:15 -04:00
Jeffrey Walton
883dbce74a Remove double semicolons after sed'ing defines
Also see https://github.com/weidai11/cryptopp/issues/889
2019-10-03 20:44:33 -04:00
Jeffrey Walton
a7f2796dda
Update comments 2019-07-21 22:21:10 -04:00
Jeffrey Walton
318d53f6f9
Avoid use of NDEBUG in source files
Posix NDEBUG causes our test script to fail the Posix Assert test
2018-12-03 04:18:41 -05:00
Jeffrey Walton
74ee0eef7e
Update comments 2018-11-11 10:55:51 -05:00
Jeffrey Walton
896225069d
Rename files with dashes to underscores (GH #736)
Also see https://groups.google.com/forum/#!topic/cryptopp-users/HBz-6gZZFOA on the mailing list
2018-11-10 08:00:14 -05:00
Jeffrey Walton
092309b266
Fix global optimization bug for ChaCha AVX2 under VS2017 (GH #735)
Also see https://github.com/weidai11/cryptopp/issues/649. The 649 issue is the one affecting AES. It appears to be the same problem.
2018-11-09 08:00:53 -05:00
Jeffrey Walton
f57df06c5e
Disable global optimizations for Rijndael using MSC compiler (GH #649) 2018-11-05 23:45:59 -05:00
Jeffrey Walton
c601213ce1
Sync CRYPTOPP_{BIG|LITTLE}_ENDIAN with Autotools
Autotools sets up its config.h file with the '#define XXX 0' or '#define XXX 1' pattern. This check-in makes the sources Autotools aware. We need to verify CMake does the same
2018-10-28 04:24:22 -04:00
orangefour
253f1ba5da Fix unused variable warnings (GH #723) 2018-10-22 07:50:04 -04:00
Jeffrey Walton
6660982a55
Allow Cryptogam's AES thunk to be inlined 2018-10-14 07:39:08 -04:00
Jeffrey Walton
01779726db
Use consistent suffix for SSE2 ASM 2018-08-20 07:16:59 -04:00
Jeffrey Walton
4282f94712
Disable X32 inline assembly (GH #686, PR #704)
Also use CRYPTOPP_DISABLE_XXX_ASM consistently. The pattern is needed for Clang which still can't compile Intel assembly language. Also see http://llvm.org/bugs/show_bug.cgi?id=24232.
2018-08-18 04:44:53 -04:00
Jeffrey Walton
e580ed588a
Disable same buffer for in and out on ARM A-32 (GH #683) 2018-07-12 07:05:18 -04:00
Jeffrey Walton
b3fe24b8b5
Remove CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS support (GH #682)
We were able to gut CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS for everything except Rijndael. Rijndael uses unaligned accesses on x86 to harden against timing attacks.
There's a little more to CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS and Rijndael. If we remove unaligned access then AliasedWithTable hangs in an endless loop on non-AESNI machines. So care must be taken when trying to remove the vestige from Rijndael.
2018-07-11 11:40:25 -04:00
Jeffrey Walton
3ff7d7f028
Add ARM AES asm implementation from Cryptogams (GH #683) 2018-07-11 06:59:44 -04:00
Jeffrey Walton
b74a6f4445
Add algorithm provider member function to Algorithm class 2018-07-06 09:23:37 -04:00
Jeffrey Walton
244c40ed61
Remove unneeded round parameter on Rijndael_UncheckedSetKey_SSE4_AESNI 2018-02-20 13:32:53 -05:00
Jeffrey Walton
c80e28eec8
Remove unneeded parameter for Rijndael_UncheckedSetKey_POWER8 2018-02-20 06:42:43 -05:00
Jeffrey Walton
fac3a44a84
Move Altivec AdvancedProcessBlocks into adv-simd.h 2018-01-02 07:08:13 -05:00
Jeffrey Walton
a074722bfa
Switch to rotlConstant and rotrConstant
This will help Clang and its need for a constexpr
2017-11-25 02:52:19 -05:00
Jeffrey Walton
561926db34
Rename CRYPTOPP_ENABLE_ADVANCED_PROCESS_BLOCKS for Rijndael 2017-11-22 17:55:20 -05:00
Jeffrey Walton
69c8a4f9c6
Prefix IS_LITTLE_ENDIAN and IS_BIG_ENDIAN with CRYPTOPP 2017-11-10 14:15:30 -05:00
Jeffrey Walton
6e436427fb
Use SetMark to avoid unneeded zeroization in Rijndael 2017-10-08 12:05:33 -04:00
Jeffrey Walton
01e46aa474
Move AliasedWithTable into unnamed namespace
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.
2017-10-05 09:28:56 -04:00
Jeffrey Walton
1057f89363
Move Power8 crypto functions into ppc-crypto.h 2017-09-22 05:23:29 -04:00
Jeffrey Walton
e78464a1af
Enable little endian Rijndael_UncheckedSetKey_POWER8 using built-ins
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
2017-09-21 09:56:37 -04:00
Jeffrey Walton
c6b096ddd4
Move Rijndael_UncheckedSetKey_POWER8 prior to GetUserKey call
Arg... GetUserKey was performing a 32-bit word reverse. It was part of the problem on little endian machines
2017-09-21 01:08:44 -04:00
Jeffrey Walton
6440921723
Add Rijndael_UncheckedSetKey_POWER8
We are going to attempt to perform key setup using Power8 in-core vector instructions
2017-09-19 04:55:15 -04:00
Jeffrey Walton
923cf95571
ByteReverseArray → ReverseByteArrayLE 2017-09-18 18:40:19 -04:00
Jeffrey Walton
2c18fe8af8
Refactor LoadT() and StoreT(). Add separate ReverseT() for little endian 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
2017-09-18 18:15:25 -04:00
Jeffrey Walton
6899d3f8bb
Add AdvancedProcessBlocks for Power8
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
2017-09-12 18:15:55 -04:00
Jeffrey Walton
b090e5f69f
Add Power8 AES decryption 2017-09-12 05:53:17 -04:00
Jeffrey Walton
81a272b046
Update comments 2017-09-12 00:30:48 -04:00
Jeffrey Walton
7fb34e9b08
Add Power8 AES encryption
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).
2017-09-11 22:52:22 -04:00
Jeffrey Walton
37e02f9e0e
Revert AltiVec and Power8 commits
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
2017-09-05 16:28:00 -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
5c6a32ba0f
Support Base Implementation + SIMD implementation on Solaris (PR #461) 2017-08-24 19:17:21 -04:00
Jeffrey Walton
7851a0d510 Remove BOOL macro value (GH #462)
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
2017-08-20 21:25:29 -04:00
Jeffrey Walton
a1b3102eab
Update comments 2017-08-19 01:35:36 -04:00
Jeffrey Walton
e2c377effd Split source files to support Base Implementation + SIMD implementation (GH #461)
Split source files to support Base Implementation + SIMD implementation
2017-08-17 12:33:43 -04:00
Jeffrey Walton
08c37e5887
Update comments in Rijndael head comments 2017-08-15 14:26:30 -04:00