Commit Graph

69 Commits

Author SHA1 Message Date
Jeffrey Walton
8e9cb9d9d8
Whitespace check-in 2021-03-04 22:49:25 -05:00
Tobias Nießen
0a40a0c3ca
Fix typos in documentation and comments (PR #1012) 2021-03-04 13:17:42 -05:00
Jeffrey Walton
883dbce74a Remove double semicolons after sed'ing defines
Also see https://github.com/weidai11/cryptopp/issues/889
2019-10-03 20:44:33 -04:00
Jeffrey Walton
238578a808
Clear lgtm findings
The lgtm service asks for scoped calls to IsolatedInitialize. The code is a tad bit more readable, so we will clear the findings.
2019-06-04 05:31:46 -04:00
Jeffrey Walton
3faf716d73
Call base class IsolatedInitialize 2019-06-03 06:44:58 -04:00
Jeffrey Walton
5ace5e478a
Spelling corrections 2018-12-27 17:47:20 -05:00
Jeffrey Walton
b877782692
Use local definition of space 2018-12-27 13:56:03 -05:00
Jeffrey Walton
004d213e29
Increase use of ptrdiff_t when performing pointer math 2018-07-10 17:31:01 -04:00
Jeffrey Walton
50f99ae802
Increase use of ptrdiff_t when performing pointer math 2018-07-10 09:21:52 -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
Kirit Sælensminde
59b94d2bbf C++17 compatible lambda expressions to replace bind2nd (#559)
* Conditionally use a lambda rather than the older `bind2nd` style.

* Duplicate the if statements.

* Centralise the conditional compilation to an implementation of find_if_not.

* Refactoring of name and code placement after review.

* Use `FindIfNot` where appropriate.

* Remove whitespace.
2018-01-12 08:38:56 -05: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
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
bbc6ea5355
Comments, constants and whitespace 2017-09-30 06:19:28 -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
37e02f9e0e
Revert AltiVec and Power8 commits
The strategy of "cleanup under-aligned buffers" is not scaling well. Corner cases are still turing up. The library has some corner-case breaks, like old 32-bit Intels. And it still has not solved the AltiVec and Power8 alignment problems.
For now we are backing out the changes and investigating other strategies
2017-09-05 16:28:00 -04:00
Jeffrey Walton
e2933070b6
Removed alignment asserts
Rijndael class will assert when it detects a problem.
2017-09-04 20:35:15 -04:00
Jeffrey Walton
7ac77ca9ac Revert "Revert "Clear Visual Studio warnings (Issue 412)""
This reverts commit c3871aec94.
2017-06-02 05:18:52 -04:00
Jeffrey Walton
c3871aec94 Revert "Clear Visual Studio warnings (Issue 412)"
This reverts commit eb3b27a6a5. The change broke GCC 4.8 and unknown version of Clang on OS X. UB reported the OS X break, and JW found duplicated the break on a ARM CubieTruck with GCC 4.8.
2017-06-02 05:06:56 -04:00
Jeffrey Walton
eb3b27a6a5
Clear Visual Studio warnings (Issue 412) 2017-05-30 16:37:41 -04:00
Jeffrey Walton
3b4a9e2ccf
Update padding check logic 2017-05-09 15:48:52 -04:00
Jeffrey Walton
8a177c58e6
Add validation for W3C_PADDING InitializeDerivedAndReturnNewSizes
This should have occurred with PR 368 or Commit 8e088b4865
2017-05-09 00:58:42 -04:00
Jeffrey Walton
5efb019d8b
Add C++ nullptr support (Issue 383) 2017-03-01 06:10:06 -05:00
Jeffrey Walton
8e088b4865
Add W3C_PADDING to encryption path 2017-02-06 08:09:09 -05:00
Jeffrey Walton
061f272da3 Merge pull request #368 from edrlab/aes256cbc-w3c-padding-scheme
Support for AES-256-CBC with W3C padding scheme ( http://www.w3.org/2001/04/xmlenc#aes256-cbc )
2017-02-06 03:53:25 -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
danielweck
46a9323d19 patched CryptoPP Crypto++ to add support for AES-256-CBC with W3C padding scheme (based on https://github.com/readium/readium-lcp-client/pull/26 ) 2017-01-24 16:43:10 +00:00
klemens
5a5c633073 spelling fixes 2016-12-27 18:34:57 +01:00
Jeffrey Walton
40230dd3bf
Removed MAINTAIN_BACKWARDS_COMPATIBILITY_562 (Issue 70) 2016-12-03 00:32:07 -05: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
894874fe75 Whitespace checkin 2016-09-10 04:57:48 -04:00
Jeffrey Walton
c82fd655ed Cleared assert in debug builds (Issue 138) 2016-02-20 22:46:14 -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
Jeffrey Walton
1e103c0e5b Completed cutover to unscoped auto_ptr (which will use Crypto++'s namespace version) 2015-08-03 19:11:23 -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
8e51ab9623 Tightened assert conditions when -DDEBUG is in effect. 2015-07-20 01:15:06 -04:00
Jeffrey Walton
8f59d9af35 Cleared unused variable and function warnings 2015-07-19 10:22:16 -04:00
Jeffrey Walton
d19790bbca Cleared UBsan errors 2015-07-19 07:58:55 -04:00
Jeffrey Walton
e4ab1cd70c Cleared UBsan error on non-null pointer use 2015-07-17 22:53:36 -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
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
da24db2a8b fix bug when AuthenticatedDecryptionFilter::MAC_AT_BEGIN is not specified 2009-03-05 08:53:50 +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
6176add700 fix HashFilter bug when putMessage=true (UnFleshed One) 2008-11-21 05:32:06 +00:00