Commit Graph

2580 Commits

Author SHA1 Message Date
Jeffrey Walton
02df6ea847
Add additional self tests under debug builds 2017-05-05 23:16:28 -04:00
Jeffrey Walton
ac930b084d
Add additional tests
Whitespace check-in
2017-05-05 20:34:43 -04:00
Jeffrey Walton
9225ca09cb
Updated MersenneTwister tests
The tests now include the first 10 elements of the sequence to ensure a properly implemented algorithm and endianess correctness.
2017-05-05 19:00:17 -04:00
Jeffrey Walton
c1377b2955
Add additional self tests under debug builds 2017-05-05 17:21:08 -04:00
Jeffrey Walton
5c1de7b5a5
Add variable block size support to test and benchmarks
CRYPTOPP_COVERAGE was added at 9614307ab7 to increase code coverage support. This commit enables additional validation routines when  CRYPTOPP_COVERAGE is in effect.
2017-05-04 19:11:24 -04:00
Jeffrey Walton
9614307ab7
Add CRYPTOPP_COVERAGE define for 'make coverage' recipe 2017-05-04 03:01:07 -04:00
Jeffrey Walton
7131a0fbb8
Add VariableBlockSize constants to FixedBlockSize
This also follows the pattern set forth by FxiedKeyLength and VariableKeyLength
2017-05-03 22:34:37 -04:00
Jeffrey Walton
2d9678fa6d
Remove BLOCKSIZE from VariableBlockSize (Issue 408)
VariableBlockSize and VariableBlockCipherImpl were added at Commit bd8edfa87b. Reflecting on FixedKeyLength and VariableKeyLength, the const KEYLENGTH is only provided by FixedKeyLength. VariableKeyLength provides DEFAULT_KEYLENGTH. This check-in makes VariableBlockSize follow VariableKeyLength.
This check-in also splits block size and iv length. Its conceivable we will encounter a cipher with a block size of 128-bits with an iv of 256-bits. The bd8edfa87b check-in could not handle the difference, so we fix it now.
2017-05-03 21:06:49 -04:00
Jeffrey Walton
ca9e788fbf
Add const GetStream() member function 2017-05-02 18:25:58 -04:00
Jeffrey Walton
554b7a2747
Fix "error: inlining failed ... target specific option mismatch (Issue 407) 2017-05-01 17:54:05 -04:00
Jeffrey Walton
f8c1348667
Fix "There are no arguments to ‘GetAlgorithm’ that depend on a template parameter" 2017-05-01 16:56:21 -04:00
Jeffrey Walton
a33a3435f4
Remove HashFunction typedef (Issue 369)
This should have happened when we removed most of MAINTAIN_BACKWARDS_COMPATIBILITY artifacts.
2017-05-01 16:41:43 -04:00
Jeffrey Walton
9db82ed793
Use symbolic defines StaticGetDefaultBlockSize 2017-05-01 16:40:32 -04:00
Jeffrey Walton
bd8edfa87b
Add variable block size support for block ciphers
This should lead the way for more modern block ciphers like Threefish and Kalyna. It tested well with both regular cipher modes (the mode has an instance of the cipher) and external cipher modes (the cipher and mode are distinct objects, and the mode holds a reference to the cipher).

We still have to work out the details of naming a cipher. For example, Kalyna with a 128-bit key can use a 128-bit or 256-bit block size. Kalyna-128 is not enough to describe the algorithm and locate it in the object registry. Kalyna-128-128 looks kind of weird; maybe Kalyna-128(128) or Kalyna-128(256) would be better.

Here are the initial test cases to verify functionality:

byte key[64] = {}, iv[32] = {};

ECB_Mode<Kalyna>::Encryption enc1;
enc1.SetKey(key, 16);

CBC_Mode<Kalyna>::Encryption enc2;
enc2.SetKeyWithIV(key, 16, iv);

AlgorithmParameters params = MakeParameters
                        (Name::BlockSize(), 32)
                        (Name::IV(), ConstByteArrayParameter(iv, 32));

CTR_Mode<Kalyna>::Encryption enc3;
enc3.SetKey(key, 16, params);

CBC_Mode<Kalyna>::Encryption enc4;
enc4.SetKey(key, 32, params);

Kalyna::Encryption enc5;
ECB_Mode_ExternalCipher::Encryption ecb(enc5);
ecb.SetKey(key, 16, params);

Kalyna::Encryption enc6;
ECB_Mode_ExternalCipher::Encryption cbc(enc6);
cbc.SetKey(key, 32, params);
2017-05-01 16:23:57 -04:00
Jeffrey Walton
1543649ead
Cleanup ARIA typedefs 2017-04-28 21:35:55 -04:00
Jeffrey Walton
ff9b46e513 Merge pull request #405 from kvirund/alignment.issues
Added -xmemalign=4i for Sparc
2017-04-27 15:52:39 -04:00
Anton Gorev
7eeab3d0bf Added -xmemalign=4i compiler option for Sparc's. 2017-04-27 14:15:12 -05:00
Anton Gorev
1df5fc1e21 Revert "Some fixes related to SunCC compiler bugs."
This reverts commit 72d8cbe917.
2017-04-27 13:50:47 -05:00
Jeffrey Walton
2297dd000a
Removed "typedef SHA1 SHA" (Issue 369)
This should have happened when we removed most of MAINTAIN_BACKWARDS_COMPATIBILITY artifacts. Its not practical move SHA1 into Weak:: namespace or "typedef SHA256 SHA" because SHA1 is too intertwined at the moment.

In the interim, maybe we can place SHA1 in both CryptoPP:: and Weak:: namespaces. This will allow us to transition into Weak::SHA1 over time, and signal to users SHA1 should be avoided.
2017-04-24 05:05:14 -04:00
Jeffrey Walton
64f1b50b7f
Add pclmulqdq for OS X disassembly tests 2017-04-24 03:05:37 -04:00
Jeffrey Walton
e2f5da337e
Add mapfile to allow additional capability bits
Also see http://www.oracle.com/technetwork/server-storage/solaris/hwcap-modification-139536.html
2017-04-23 12:11:08 -04:00
Jeffrey Walton
422600c5b8
Update scripts for testing 2017-04-23 07:38:25 -04:00
Jeffrey Walton
89176e51cd
Add safety for SSSE4.1 and SSE4.2 intructions
They are giving ARIA and BLAKE2 trouble. It looks like SSE4  support appeared in the GCC compiler around 4.1 or 4.2. It looks like SHA support appeared in the GNU assembler around 2.18
2017-04-23 06:37:03 -04:00
Jeffrey Walton
96cc3522ce
Add test for '-march=native' 2017-04-22 23:37:13 -04:00
Jeffrey Walton
4478e4cf39
Removed Unified ASM and Modern Compiler tests
Unified adds no value, and modern compilers are already tested
2017-04-22 21:22:32 -04:00
Jeffrey Walton
7562e38ad6
Add safety for SHA intructions
It looks like SHA support appeared in the GCC compiler around 4.8 or 4.9. It looks like SHA support appeared in the GNU assembler around 2.23
2017-04-22 19:46:13 -04:00
Jeffrey Walton
f818d4e50f
Updated code generation tests 2017-04-22 16:27:37 -04:00
Jeffrey Walton
b9abd7141e
Fix endian-reversal and loading of MSG0-MSG3
Initially we performed a 32-bit word-size ByteReverse() on the entire 64-byte buffer being hashed. Then we performed another fix-up when loading each 16-byte portion of the buffer into the SSE2 registers for SHA processing. The [undesired] consequence was byte swapping and reversals happened twice. Worse, the call to ByteReverse() produced 16 bswaps instead of 1 call pshufb, so it was orders of magnitude slower than it needed to be.

This check-in takes the sane approach to byte reversals and swapping. It performs it once when the message is loaded for SSE processing. The result is SHA1 calculations drop from about 3.0 cpb to about 2.5 cpb.
2017-04-22 12:19:55 -04:00
Jeffrey Walton
cd65ce873a
Add -xmemalign=4i for Sun SPARC (Issue 403) 2017-04-22 01:15:17 -04:00
Jeffrey Walton
12b5074c72
Fix SunCC and "_mm_set_epi8 must have prototype" 2017-04-22 00:17:45 -04:00
Jeffrey Walton
c25edcaff3
Add potential workaround for Solaris SIGBUS 2017-04-22 00:05:55 -04:00
Jeffrey Walton
8ded8bc38d
Clear SunCC anachronism warning "Attempt to redefine IS_BIG_ENDIAN without using #undef" 2017-04-21 23:52:43 -04:00
Jeffrey Walton
1249ac16eb Merge pull request #402 from kvirund/alignment.issues
Some fixes related to SunCC compiler bugs.
2017-04-21 22:25:06 -04:00
Anton Gorev
63cc633be7 Reverted change in config.h as it does not fix anything. 2017-04-21 21:23:08 -05:00
Anton Gorev
72d8cbe917 Some fixes related to SunCC compiler bugs.
Fixes for "invalid address alignment" errors. See https://groups.google.com/d/topic/cryptopp-users/OYaByDEbSI0/discussion for details.
Changed config.h in accordance to Jeffrey Walton's request;
2017-04-21 15:26:16 -05:00
Jeffrey Walton
cede0f3fb1
Whitespace 2017-04-18 02:57:38 -04:00
Jeffrey Walton
ceecf3faf5
Fix table whitespace 2017-04-17 04:23:50 -04:00
Jeffrey Walton
ba904cc9da
Update algorithm list in cryptlib.h 2017-04-17 02:39:22 -04:00
Jeffrey Walton
f69504f6b4
Cleanup travis.yml file 2017-04-17 01:15:55 -04:00
Jeffrey Walton
cfa98a32c0
Add Win64 to exclude until the issues are sorted out 2017-04-17 01:06:27 -04:00
Jeffrey Walton
3d9ac8f66f
Add Travis configuration file 2017-04-17 00:25:57 -04:00
Jeffrey Walton
b784852998
Add no-asm target to ease testing of -DCRYPTOPP_DISABLE_ASM
This is intended to be used on Travis CI
2017-04-17 00:20:22 -04:00
Jeffrey Walton
7df4418258
Add allow_failures to appveyor.yml until we sort out some of the issues 2017-04-16 15:57:46 -04:00
Jeffrey Walton
3504f1da25
Add VS2010 - VS2017 images to appveyor.yml 2017-04-16 15:10:20 -04:00
Jeffrey Walton
dad532cb4b
Remove stdio.h header 2017-04-16 13:23:27 -04:00
Jeffrey Walton
1d1a150737
Avoid extra loads of workspace variables 2017-04-16 13:00:45 -04:00
Jeffrey Walton
ddc0f3a899
Switch to Put and Get blocks. Remove unneeded macros 2017-04-16 08:06:20 -04:00
Jeffrey Walton
83a87cb4df
Group DSA-RFC6979 tests together by hash value
Previously, all 1024-bit tests were run, and then 2048-bit tests were run. Splitting them meant there were two entries for DSA-RFC6979/SHA-1, two entries for DSA-RFC6979/SHA-256 and so on. Now there will be one entry output during testing.
2017-04-15 09:03:22 -04:00
Jeffrey Walton
106106813a
Add missing sha2 and sha3 test file names
sha2.txt and sha3.txt are just collections of other files, so they don't take up much space.

This commit stens from and exception when running 'cryptest.exe tv sha2' and  'cryptest.exe tv sha3'. Its not obvious the name of the file to be run sha2_224_fips_180.txt. Users should not have to hunt for the reason sha2 and sha3 do not work.
2017-04-15 08:50:03 -04:00
Jeffrey Walton
5e27404a15
Add missing sha2 and sha3 test file names
sha2.txt and sha3.txt are just collections of other files, so they don't take up much space.

This commit stens from and exception when running 'cryptest.exe tv sha2' and  'cryptest.exe tv sha3'. Its not obvious the name of the file to be run sha2_224_fips_180.txt. Users should not have to hunt for the reason sha2 and sha3 do not work.
2017-04-15 08:49:00 -04:00