Commit Graph

72 Commits

Author SHA1 Message Date
Jeffrey Walton
e8b07b162f
Avoid preprocessor error in SIZE_MAX (GH #864) 2019-07-14 00:52:30 -04:00
Jeffrey Walton
8260dd1e81
Increase m_buf size (GH #862) 2019-07-10 15:54:48 -04:00
Jeffrey Walton
6d69043403
Add BufferedTransformation GetWord64 and PutWord64 (GH #862) 2019-07-10 10:04:58 -04:00
Jeffrey Walton
2ffa70fbc6
Clear asserts under DEBUG builds 2019-07-06 15:57:08 -04:00
Jeffrey Walton
71ce30f75f
Whitespace check-in 2018-12-04 03:56:47 -05:00
Jeffrey Walton
6729b29410
Move DEFAULT_CHANNEL and AAD_CHANNEL defs into cryptlib.cpp (GH #751)
The library used to provide DEFAULT_CHANNEL and AAD_CHANNEL this way. We experienced Static Initialization Order Fiasco crashes on occassion, so we moved them into cryptlib.h with internal linkage. The cost was, each translation unit got a copy of the strings which contributed to bloat. Issue 751 shows Clang compiles the global constructors for DEFAULT_CHANNEL and AAD_CHANNEL above the base ISA so we caught crashes on OS X with down-level hardware.

We are now at a "pick your poison" point. We selected Static Initialization Order Fiasco because it seems to be less prevalent.

Hat tip to the C++ Committee for allowing this problem to fester for three decades.
2018-12-03 06:33:15 -05:00
Jeffrey Walton
f2171cbe2f
Remove Thread and Socket classes (GH #208, PR #703)
Also see https://groups.google.com/forum/#!topic/cryptopp-users/5btwLoxXXD4.
2018-08-17 23:55:39 -04:00
Jeffrey Walton
c6c44aa5d1
Add PtrAdd and PtrSub helper functions
This helps contain UB on pointer subtraction by ensuring a ptrdiff_t is used. The code is a little uglier but it is also more portable.
2018-07-10 05:00:02 -04:00
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