Commit Graph

44 Commits

Author SHA1 Message Date
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
f8c1348667
Fix "There are no arguments to ‘GetAlgorithm’ that depend on a template parameter" 2017-05-01 16:56:21 -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
81b1a18063
Change file preamble to include "originally written by Wei Dai"
We have made a fair number of changes, and we don't want WD to receive credit for issues he was not part of
2017-01-27 07:05:45 -05:00
Jeffrey Walton
6eb2792bc2
Silence select conversion warnings (Issue 340) 2016-12-02 14:47:31 -05:00
Jeffrey Walton
cb7dbd32ec
Updated documentation 2016-11-17 09:16:09 -05:00
Jeffrey Walton
1694193101
Make StaticGetValidKeyLength constexpr in seckey.h 2016-11-15 04:15:17 -05:00
Jeffrey Walton
76b11b010c
Add CRYPTOPP_STATIC_CONSTEXPR macro 2016-11-13 11:50:34 -05:00
Jeffrey Walton
4bee0519f5
Updated documentation 2016-10-11 19:51:15 -04:00
Jeffrey Walton
1de8ca5774 Revert "Rewrite 'keylength < MIN_KEYLENGTH' to avoid -Wtautological-compare"
This reverts commit 08a206f3eb. This broke the self tests, and casting everything to 'signed int' to avoid unsigned promots did not resolve the issue.
2016-09-21 13:47:47 -04:00
Jeffrey Walton
08a206f3eb Rewrite 'keylength < MIN_KEYLENGTH' to avoid -Wtautological-compare
The warning surfaces under earlier Clnag's and GCC's
2016-09-21 12:47:26 -04:00
Jeffrey Walton
f0e7b45bcb Remove comma operator from return values for StaticGetDefaultRounds and StaticGetValidKeyLength in non-constexpr builds (Issue 255) 2016-09-07 09:32:06 -04:00
Jeffrey Walton
33522b39b1 Updated documentation 2016-09-05 13:57:33 -04:00
Jeffrey Walton
60be5a672a Fixed compile under SunCC 5.14 and SimpleKeyingInterfaceImpl (with virtual functions) using constexpr. Updated documentation 2016-09-05 04:36:08 -04:00
Jeffrey Walton
cf81d8a099 Add constexpr-ness to seckey.h classes.
Coarse grained benchmarking with GCC 4.8 at -O2 using 'time' and 'cryptest.exe' shows we shaved about 100ms to 150ms off the running time. We are ready to break the 1-second mark for the running time (its elluded me for some time now)
2016-09-05 03:13:45 -04:00
Flo
262d125fb2 Update seckey.h
InvalidRounds expects a std::string, so it can be constructed in-place and the `__BORLANDC__` define can be removed.
2016-09-04 14:10:43 +02:00
Flo
a11985e6e4 Update seckey.h
See
https://github.com/weidai11/cryptopp/issues/252
2016-09-04 13:47:39 +02:00
Crayon2000
0892ee411b C++Builder: The problem with the CRYPTOPP_CONSTANT macro was corrected properly 2016-01-12 12:29:44 -05:00
Crayon2000
602eb5fa0b The Crypto++ library can now be compiled with C++Builder
Two macro were causing compiler problems with bcc32
[bcc32 Error] seckey.h(83): E2313 Constant expression required
and
[bcc32 Error] seckey.h(194): E2313 Constant expression required
2016-01-11 22:21:30 -05:00
Crayon2000
91321b8b7f Casting string literal to avoid bcc32 Error
This will fix this error with C++Builder:
[bcc32 Error] seckey.h(88): E2354 Two operands must evaluate to the same type
2016-01-08 18:03:11 -05:00
Jeffrey Walton
d1ae977256 Fixed copy/paste error 2015-12-17 01:39:13 -05:00
Jeffrey Walton
f70667b762 Updated documentation 2015-12-17 01:37:01 -05:00
Jeffrey Walton
d9502a6ea9 Updated documentation 2015-12-13 23:53:50 -05:00
Jeffrey Walton
baa19fb2b4 Added config.h due to privately reported issue 2015-11-19 16:48:56 -05:00
Jeffrey Walton
6ac1e46a1f Cleared issues 11,12,13 (Clang integrated assembler), 58 (RC rollup), 66 (Coverity rollup) 2015-11-18 15:32:28 -05:00
Jeffrey Walton
48809d4e85 CRYPTOPP 5.6.3 RC6 checkin 2015-11-05 01:59:46 -05:00
weidai
2f070fe411 fix documentation 2009-03-15 00:51:46 +00:00
weidai
d8a644fc4e changes for 5.6:
- added AuthenticatedSymmetricCipher interface class and Filter wrappers
    - added CCM, GCM (with SSE2 assembly), CMAC, and SEED
    - improved AES speed on x86 and x64
    - removed WORD64_AVAILABLE; compiler 64-bit int support is now required
2009-03-02 02:39:17 +00:00
weidai
517d6a55ca IV_REQUIREMENT changes 2007-04-16 00:43:17 +00:00
weidai
03f54a866e remove old code 2006-12-14 12:53:44 +00:00
weidai
4afd858ae4 port to Borland C++Builder 2006 2006-12-14 11:41:39 +00:00
weidai
f05ea58bb3 port to GCC 4, reorganize implementations of SetKey 2006-12-10 02:12:23 +00:00
weidai
1db8ea5084 port to MSVC .NET 2005 beta 2 2005-07-12 04:23:32 +00:00
weidai
b3924f2108 changes done for FIPS-140 lab code drop 2005-01-20 04:19:35 +00:00
weidai
393ae4859a fix documentation, fix PanamaMAC, fix algorithm names 2004-07-22 00:51:57 +00:00
weidai
f78fccb3cc port to GCC 3.4 2004-06-19 08:28:09 +00:00
weidai
4707cf61eb reduce warnings on GCC 2003-11-05 01:11:03 +00:00
weidai
93ba4e160f minor changes 2003-08-25 21:41:09 +00:00
weidai
f278895908 create DLL version, fix GetNextIV() bug in CTR and OFB modes 2003-07-04 00:17:37 +00:00
weidai
a003ea18cc add CRYPTOPP_NO_VTABLE 2003-05-16 00:53:53 +00:00
weidai
39fd2045e9 fixed to compile with Intel compiler 2002-11-19 20:44:40 +00:00
weidai
a3b6ece7ab Initial revision 2002-10-04 17:31:41 +00:00