Commit Graph

64 Commits

Author SHA1 Message Date
Jeffrey Walton
4c5487b0e4
Increase use of ptrdiff_t when performing pointer math
Increase use of ptrdiff_t when performing pointer math
Reduce AlgorithmProvider overrides
Fix CPU_ProbeARMv7 on Aarch64
2018-07-09 06:31:17 -04:00
Jeffrey Walton
62a9574f3f
Make AuthenticatedSymmetricCipher::AlgorithmName non-pure
Also see https://stackoverflow.com/q/49658309/608639
2018-04-05 20:34:08 -04:00
Jeffrey Walton
7b33bc5e04
Cutover PBKDF to KeyDerivationFunction interface (GH #610, PR #612) 2018-03-29 23:13:56 -04:00
Jeffrey Walton
32abab75f2
Add KeyDerivationFunction interface (GH #610, PR #611) 2018-03-29 20:18:27 -04:00
Jeffrey Walton
51db9eb436
Clear clang-tidy warnings 2018-01-24 20:04:16 -05:00
Jeffrey Walton
befd04312d
Remove unneeded Doxygen directive 2018-01-19 14:31:20 -05:00
Jeffrey Walton
4232cfd40b
Fix failed self test under Clang (GH #533)
This may cause GH #300, "Clang 3.9 and missing member definitions for template classes" or GH #294, "Fix clang warnings about undefined variable templates in pkcspad.h" to resurface. Man I hope not...
2017-12-25 22:27:53 -05:00
Jeffrey Walton
41da3fa7f1
Use ptrdiff_t cast in BlockTransformation (GH #549) 2017-12-17 09:07:12 -05:00
Jeffrey Walton
19deccf3ba
Fix Clang 5.0 "runtime error: addition of unsigned offset to 0xXXXX overflowed to 0xYYYY" (GH #549) 2017-12-16 18:18:53 -05:00
Jeffrey Walton
61ec50dabe
Change Doxygen comment style from //! to ///
Also see https://groups.google.com/forum/#!topic/cryptopp-users/A7-Xt5Knlzw
2017-11-29 10:54:33 -05:00
Jeffrey Walton
2623d24f5c
Update documentation
Removed defined-out code
2017-11-12 13:10:22 -05:00
Jeffrey Walton
bf717f47e6
Reduce C++ file scope class objects
Update comments and documentation
2017-11-12 11:55:57 -05:00
Jeffrey Walton
3cfbe66c82
Update documentation 2017-10-01 09:32:07 -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
092b3cb467
Backed off assert.
Its too noisy
2017-08-15 04:42:12 -04:00
Jeffrey Walton
1427f5ecf9
Clear coverity finding FORWARD_NULL (CID 147865) 2017-05-20 02:37:51 -04:00
Jeffrey Walton
1abb5c36bd Revert "Clear coverity finding FORWARD_NULL (CID 147865)"
This broke some self tests.
2017-05-20 02:20:25 -04:00
Jeffrey Walton
0bdbde2c21
Clear coverity finding FORWARD_NULL (CID 147865) 2017-05-20 02:12:43 -04:00
Jeffrey Walton
0cbaea0428
Add tests for Information Dispersal and Secret Sharing 2017-05-09 18:44:45 -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
f502ee9218
Simplify C++ dynamic object initialization
Wrap DetectArmFeatures and DetectX86Features in InitializeCpu class
Use init_priority for InitializeCpu
Remove HAVE_GCC_CONSTRUCTOR1 and HAVE_GCC_CONSTRUCTOR0
Use init_seg(<name>) on Windows and explicitly insert at XCU segment
Simplify logic for HAVE_GAS
Remove special recipies for MACPORTS_GCC_COMPILER
Move C++ static initializers into anonymous namespace when possible
Add default NullNameValuePairs ctor for Clang
2017-03-20 08:51:10 -04:00
Jeffrey Walton
301437e693
Updated static initializers
When MSVC init_seg or GCC init_priority is available, we don't need to use the Singleton. We only need to create a file scope class variable and place it in the segment for MSVC or provide the attribute for GCC.
An additional upside is we cleared all the memory leaks that used to be reported by MSVC for debug builds.
2017-03-17 20:47:32 -04:00
Jeffrey Walton
d8570a3435
Avoid inlining LibraryVersion (Issue 371) 2017-03-14 10:26:51 -04:00
Jeffrey Walton
5efb019d8b
Add C++ nullptr support (Issue 383) 2017-03-01 06:10:06 -05:00
Jeffrey Walton
5fb2f5d45b
Remove NULL_CHANNEL and CW8 workaround (Issue 382) 2017-03-01 03:54:02 -05:00
Jeffrey Walton
42af35fd2b
Change to more intuitive names LibraryVersion and HeaderVersion (Issue 371) 2017-01-28 07:09:27 -05:00
Jeffrey Walton
6f7339c81b
Add BuildVersion and RuntimeVersion functions (Issue 371)
These function are intended to catch mining and matching of library versions. BuildVersion provides CRYPTOPP_VERSION when the shared object was built. RuntimeVersion provides CRYPTOPP_VERSION the app compiled against, which could be different than the shared object's version
2017-01-28 05:43:24 -05: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
klemens
5a5c633073 spelling fixes 2016-12-27 18:34:57 +01:00
Jeffrey Walton
6eb2792bc2
Silence select conversion warnings (Issue 340) 2016-12-02 14:47:31 -05:00
Jeffrey Walton
923efa865b Fix Solaris GCC and "constructor priorities are not supported" 2016-09-19 21:18:58 -04:00
Jeffrey Walton
399a1546de Add CRYPTOPP_ASSERT (Issue 277, CVE-2016-7420)
trap.h and CRYPTOPP_ASSERT has existed for over a year in Master. We deferred on the cut-over waiting for a minor version bump (5.7). We have to use it now due to CVE-2016-7420
2016-09-16 11:27:15 -04:00
Jeffrey Walton
fcdc845bba Updated documentation (Issue 248) 2016-08-27 23:52:43 -04:00
Jeffrey Walton
8281e51e94 Cleared most "Conditional jump or move depends on uninitialised value" (Issue 223) 2016-07-13 00:40:07 -04: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
Jeffrey Walton
d935fd80ba Partial cut-over to static local strings for DefaultChannel() and AadChannel(). Cout-over DEFAULT_CHANNEL and AAD_CHANNEL to use them behind the scenes 2015-07-31 08:23:53 -04:00
Jeffrey Walton
7ad12ab5b0 Cleared auto_ptr deprecation warning with C++11 under Debian 8/i686 2015-07-30 12:07:26 -04:00
Jeffrey Walton
ef318d5423 Fixed compiler errors on Apple due to cross product of {C++03,C++11} x {libc++, libstdc++}. It included bringing in the correct <memory> in <stdcpp.h>, and then only including <stdcpp.h> when <memory> was needed. 2015-07-27 16:01:55 -04:00
Jeffrey Walton
b7de164d62 Cut-in CRYPTOPP_ASSERT in all remaining header and source files 2015-07-26 16:03:14 -04:00
Jeffrey Walton
7b64ca489a Added "trap.h" include for header and source files that assert 2015-07-26 15:51:16 -04:00
Jeffrey Walton
a14a5696e1 Added GCC_DIAGNOSTIC_AWARE to help suppress some warnings on contemporary compilers. The macro was needed to help with managing old compilers, like GCC 4.2.1, present on OpenBSD 2015-06-29 02:09:02 -04:00
weidai
d938406410 fix CTR mode not allowing NULL as IV 2010-08-05 09:48:04 +00:00
weidai
d60229a02a fix possible race condition in Singleton::Ref()
tolerate double destruction of Singleton and g_nullNameValuePairs
fix #include of standard headers
2010-06-18 07:06:59 +00:00
weidai
8ca6148ad5 add x86/x64 assembly for SHA-256,
add DEFAULT_CHANNEL and AAD_CHANNEL,
fix macChannel for AuthenticatedEncryptionFilter
2009-03-10 02:56:19 +00:00
weidai
8565900724 tweaks/fixes for 5.6 2009-03-03 03:28:39 +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
5834ecc870 add IncorporateEntropy and GenerateIntoBufferedTransformation to RNG interface 2007-05-04 15:38:32 +00:00
weidai
2a427babae rename STRUCTURED_IV to UNIQUE_IV. Sun CC workaround 2007-04-16 00:29:47 +00:00
weidai
f05ea58bb3 port to GCC 4, reorganize implementations of SetKey 2006-12-10 02:12:23 +00:00