Commit Graph

3243 Commits

Author SHA1 Message Date
Jeffrey Walton
24a19b7a18
Cleanup use of BMI intrinsics under GCC and compatibles 2017-10-09 21:14:21 -04:00
Jeffrey Walton
55fe79e5ee
Add governor.sh to run benchmarks from a performance state on Linux
The script is based on code by Andy Polyakov, http://www.openssl.org/~appro/cryptogams.
2017-10-08 14:12:16 -04:00
Jeffrey Walton
6e436427fb
Use SetMark to avoid unneeded zeroization in Rijndael 2017-10-08 12:05:33 -04:00
Jeffrey Walton
ebcd91a0ac
Make UncheckedSetKey in authenc.h
UncheckedSetKey has traditionally been a protected member function. The public API traditionally uses SetKey (and friends) to set the key. Internally, SetKey may call UncheckedSetKey. It looks like UncheckedSetKey was made public when authenticated encryption support was added.
Its probably not a good idea to have users calling UncheckedSetKey. Most (all?) of the time it does nothing for authenc modes. The other remaining cases it may not work as expected.
2017-10-07 10:32:43 -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
1d0df34ae8
Add PKCS #1 SHA3-based signatures (GH #517) 2017-10-04 23:24:18 -04:00
Jeffrey Walton
73928489f9
Removed m_authenticated member variable
Add m_isSpecial, m_mandatoryBlockSize and m_optimalBufferSize members. The additional members stabilize running times and avoid some unnecessary calculations. Previously we were calculating some values in each call to Put and LastPut.
2017-10-03 21:49:59 -04:00
Jeffrey Walton
04d15304f1
Updated documentation 2017-10-03 20:47:03 -04:00
Jeffrey Walton
84390ee1e1
Add MandatoryBlockSize to last block test
CC optimizes things best when isSpecial uses the two predicates. If the 'm_cipher.MandatoryBlockSize() > 0' is removed, then some block ciphers and modes lose up to 0.2 cpb. Apparently GCC can optimize away the second predicate easier than the first predicate.
2017-10-03 15:46:51 -04:00
Jeffrey Walton
aaeda3a57d
Update documentation 2017-10-01 09:37:36 -04:00
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