Commit Graph

3083 Commits (3cfbe66c829b68de01ff40536664bdffe2cb2a7f)

Author SHA1 Message Date
Jeffrey Walton 3cfbe66c82
Update documentation 2017-10-01 09:32:07 -04:00
Jeffrey Walton bbc6ea5355
Comments, constants and whitespace 2017-09-30 06:19:28 -04:00
Jeffrey Walton abc92b2e74
Updated documentation 2017-09-30 04:52:50 -04:00
Jeffrey Walton e92eb31690
Update StreamTransformation and ProcessLastBlock
Some authenticated encryption modes have needs that are not expressed well with MandatoryBlockSize() and MinLastBlockSize(). When IsLastBlockSpecial() returns true three things happen. First, standard block cipher padding is not applied. Second, the ProcessLastBlock() is used that provides inString and outString lengths. Third, outString is larger than inString by 2*MandatoryBlockSize(). That is, there's a reserve available when processing the last block.

The return value of ProcessLastBlock() indicates how many bytes were written to outString. A filter driving data will send outString and returned length to an AttachedTransformation() for additional processing.
2017-09-29 22:34:33 -04:00
Jeffrey Walton bebdc8b917
Add second ctor to StreamTransformationFilter for authenticated encryption modes
StreamTransformationFilter had a small hack to accomodate AuthenticatedEncryptionFilter and AuthenticatedDecryptionFilter. The hack was enough to support CCM, EAX and GCM modes, which looks a lot like a regular stream cipher from the filter framework point of view.

OCB is slightly different. To the filter framework it looks like a block cipher with an unusual last block size and padding scheme. OCB uses MandatoryBlockSize() == BlockSize() and  MinLastBlockSize() == 1 with custom padding of the last block (see the handling of P_* and A_* in the RFC). The unusual config causes the original StreamTransformationFilter assert to fire even though OCB is in a normal configuration.

For the time being, we are trying to retain the assert becuase it is a useful diagnostic. Its possible another authenticated encryption mode, like AEZ or NORX, will cause the assert to incorrectly fire (yet again). We will cross that bridge when we come to it.
2017-09-29 17:36:04 -04:00
Jeffrey Walton 8e67eb5153
Update documentation 2017-09-29 03:22:03 -04:00
Jeffrey Walton b2b65d6376
Update documentation 2017-09-28 05:03:55 -04:00
Jeffrey Walton 1e822b0636
Update documentation links 2017-09-28 05:00:13 -04:00
Jeffrey Walton db641b9258
Update documentation 2017-09-28 04:42:48 -04:00
Jeffrey Walton 7ef1c47c6d
Update documentation 2017-09-28 04:06:59 -04:00
Jeffrey Walton 9099dc0625
Update documentation 2017-09-27 06:40:05 -04:00
Jeffrey Walton 69fd4a040d
Update documentation 2017-09-27 06:24:58 -04:00
Jeffrey Walton 69a40e992c
Fix GNUmakefile-cross distclean recipe (GH #514) 2017-09-26 01:05:15 -04:00
Jeffrey Walton ea3c80c949
Move Rijndael_AdvancedProcessBlocks_ARMV8 into anonymous namespace 2017-09-23 05:28:59 -04:00
Jeffrey Walton 26597059d9
Move to anonymous namespaces in rijndael-simd.cpp 2017-09-23 02:13:16 -04:00
Jeffrey Walton 0ebdb07705
Update documentation 2017-09-22 22:36:42 -04:00
Jeffrey Walton 12953fd0e4
Add IncrementPointerAndStore
This speeds up XL C/C++ by 0.1 to 0.2 cpb
2017-09-22 20:35:18 -04:00
Jeffrey Walton bb5be2979e
Provide body for VectorStore
Calling VectorStoreBE inside VectorStore slowed us down by up to 0.5 cpb on LE systems.
Update documentation for VectorShiftLeft
2017-09-22 19:37:54 -04:00
Jeffrey Walton d5c12191b3
Update documentation 2017-09-22 18:31:59 -04:00
Jeffrey Walton fba3fd724b
Update documentation 2017-09-22 10:14:46 -04:00
Jeffrey Walton ced7cff64f
Add Power8 SHA256 and SHA512 support (GH #513) 2017-09-22 09:39:36 -04:00
Jeffrey Walton 3bd01f73ba
Add Power8 SHA256 and SHA512 support (GH #513) 2017-09-22 08:58:50 -04:00
Jeffrey Walton 375d5e18b3
Clear Doxygen warnings 2017-09-22 08:09:05 -04:00
Jeffrey Walton 8b2bf5ed88 Add Power8 SHA support
This provides the functions needed for an implementation. It does not provide the implementation itself

Signed-off-by: Jeffrey Walton <noloader@gmail.com>
2017-09-22 07:44:18 -04:00
Jeffrey Walton 2f1b60676f
Remove static from functions
Static was an artifact from being in rijndael-simd.cpp
2017-09-22 06:42:05 -04:00
Jeffrey Walton e725ebadd0
Fix Power8 compile error on AIX with XL C/C++
Add documentation
2017-09-22 06:20:19 -04:00
Jeffrey Walton 1057f89363
Move Power8 crypto functions into ppc-crypto.h 2017-09-22 05:23:29 -04:00
Jeffrey Walton 3e55817819
Add C++ templates for additional Vector ops
Removed lower-level C-like functions such as Store8x16 and Store64x2
2017-09-22 04:15:33 -04:00
Jeffrey Walton 441e944a66
Switch to vec_vsx_ld, remove unaligned loads
Partially unroll loop Rijndael_UncheckedSetKey_POWER8 loop. It saves about another 60 cycles
2017-09-22 02:53:08 -04:00
Jeffrey Walton d9592a303c
Updated comments 2017-09-21 21:45:23 -04:00
Jeffrey Walton dabad4b409
Cleanup asserts and casts 2017-09-21 20:55:35 -04:00
Jeffrey Walton 1edea5a80f
Vectorize tail of Rijndael_UncheckedSetKey_POWER8 2017-09-21 20:02:40 -04:00
Jeffrey Walton e43c0eee74
Fold ConditionalByteReverse for non-Power8 paths 2017-09-21 19:17:42 -04:00
Jeffrey Walton f763bf3da6
Updated comments 2017-09-21 12:08:54 -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 dfeae9e983
Guard compile assert for Borland/Embarcadero (GH #512) 2017-09-21 02:01:04 -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 9fd5d023f9
Load r5 mask once for key expansion 2017-09-20 20:27:58 -04:00
Jeffrey Walton e4498a105e
Use ::time() and ::log() instead of std::time() and std::log() (GH #512)
The 35c0fa82fd change broke GCC 4.8
2017-09-20 18:43:51 -04:00
Jeffrey Walton 4b7549a990
Use 'static const int' for constant Borland/Embarcadero (GH #512) 2017-09-20 18:18:51 -04:00
Jeffrey Walton 35c0fa82fd
Use <time.h> for Borland/Embarcadero (GH #512) 2017-09-20 18:10:07 -04:00
Jeffrey Walton c5a427d690
Add PowerPC VectorLoadKeyUnaligned for AES-192
Make internal functions static. We get better optimizations depsice using unnamed namespaces
Add PowerPC uint32x4 functions for handling 32-bit rcon and mask
2017-09-20 08:57:53 -04:00
Jeffrey Walton c94d076aa1 Move r1 write to caller; remove from Rijndael_Subkey_POWER8
Signed-off-by: Jeffrey Walton <noloader@gmail.com>
2017-09-20 04:38:53 -04:00
Jeffrey Walton 5159d0803d
Add Power8 key expansion for big endian
This is AES-128 key expansion for big endian. Little endian has a bug in it so it can't be enabled at the moment. GDB is acting up on GCC112, so I've had trouble investigating it
2017-09-20 03:34:54 -04:00
Jeffrey Walton 6102333fc3
Add CRYPTOPP_NO_CPU_FEATURE_PROBES (GH #511)
We determine machine capabilities by performing an os/platform *query* first, like getauxv(). If the *query* fails, we move onto a cpu *probe*. The cpu *probe* tries to exeute an instruction and then catches a SIGILL on Linux or the exception EXCEPTION_ILLEGAL_INSTRUCTION on Windows. Some OSes fail to hangle a SIGILL gracefully, like Apple OSes. Apple machines corrupt memory and variables around the probe.
2017-09-19 21:08:37 -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 3290711a82
Clear duplicate symbol warning from AIX linker 2017-09-18 21:05:26 -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 1661ff127a
Fix dead code strip test on AIX 2017-09-18 02:45:03 -04:00