Commit Graph

92 Commits

Author SHA1 Message Date
Jeffrey Walton
aa45eca561
Clear documentation warning due to specialization
The specialization pivoted on T_Align16 so it is not longer a template parameter
2018-08-28 21:27:48 -04:00
Jeffrey Walton
4fb9fbf5ac
Update comments 2018-08-24 12:19:42 -04:00
Jeffrey Walton
1bbbfb6b75
Fix partial specializations for FixedSizeAllocatorWithCleanup (PR #710)
Commit afbd3e60f6 effectively treated a symptom and not the underlying problem. The problem was linkers on 32-bit systems ignore CRYPTOPP_ALIGN_DAT(16) passed down by the compiler and align to 8-bytes or less. We have to use Wei's original code in some places. It is not a bad thing, but the bit fiddling is something we would like to contain a little more by depending more on language or platform features.

This commit keeps the original changes which improve partial specializations; but fixes 32-bit linker behavior by effectively reverting afbd3e60f6 and e054d36dc8. We also add more comments so the next person has understands why things are done they way they are.
2018-08-24 08:13:23 -04:00
Jeffrey Walton
afbd3e60f6
Fix alignment on Win32 and Solaris Sparc (PR #709)
These fixes were interesting in a morbid sort of way. I thought the FixedSizeAllocatorWithCleanup specializations faithfully reproduced semantics but I was wrong on Win32 and Sparc. Also see Commit e054d36dc8.

It seems there was another requirement or dependency that we missed, but it was not readily apparent. If I am parsing results correctly (which I may not be), it appears the bit twiddling using 8 byte alignment had more influence on alignment than I originally thought based on use of CRYPTOPP_BOOL_ALIGN16 and T_Align16. Or maybe the alignment attributes specified by CRYPTOPP_ALIGN_DATA are not being honored like they should for stack allocations.

This check-in avoids some uses of x86 movdqa (aligned) in favor of movdqu (unaligned). The uses were concentrated on memory operands which were 8-byte aligned instead of 16-byte aligned. It is not clear to me how the specializations lost 8-bytes of alignment. The check-in also enlists CRYPTOPP_ASSERT to tell us when there's a problem so we don't need to go hunting for bugs.
2018-08-23 14:42:29 -04:00
Jeffrey Walton
e054d36dc8
Add partial specializations for FixedSizeAllocatorWithCleanup
This allocator still has some demons buried inside due to the bit fiddling. This commit should isolate the demons to aligned stack allocations when an alignment facility from the platform or OS is not available. That is, we use CRYPTOPP_ALIGN_DATA when we can because it is most reliable.
We can tell when things have gone sideways using Debug builds. The CRYPTOPP_ASSERT(m_allocated) will fire on destruction because the flag gets overwritten.
2018-08-23 07:08:34 -04:00
Jeffrey Walton
d47f69acf3
Fix SecBlock ELEMS_MAX in Visual Studio .Net (2002 and 2003) 2018-08-20 12:52:33 -04:00
Jeffrey Walton
4fc5b8da13
Update comments 2018-07-30 15:18:59 -04:00
Jeffrey Walton
973fbf0e2f
Fix FixedSizeAllocatorWithCleanup assert on Solaris 2018-07-30 11:27:50 -04:00
Marcel Raad
7c1d296283 Fix clang warnings in headers (#655)
* remove superfluous semicolon

* Remove C-style casts from public headers

clang warns about them with -Wold-style-cast. It also warns about
implicitly casting away const with -Wcast-qual. Fix both by removing
unnecessary casts and converting the remaining ones to C++ casts.
2018-05-10 19:59:21 -04:00
Jeffrey Walton
244abbe41c
Fix compile error on Windows due to symbol U collision (GH #599)
A package called cpprest provides U as a macro
2018-03-16 09:00:50 -04:00
Jeffrey Walton
befd04312d
Remove unneeded Doxygen directive 2018-01-19 14:31:20 -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
69fd4a040d
Update documentation 2017-09-27 06:24:58 -04:00
Jeffrey Walton
4a28391495
Back-off assert in SecBlock
Since removing the allocator overloards that handled the wipe mark, we have to route deallocate into the standard one. The standard one fires an assert for [now] normal operation
2017-09-02 19:22:53 -04:00
Jeffrey Walton
b47de6150f
Remove unneeded deallocate (GH #485)
This should have been yanked when we removed the same for allocate
2017-08-31 22:50:09 -04:00
Jeffrey Walton
d8b30e1bd4
Remove deallocate() overload in SecBlock for AIX (GH #485) 2017-08-31 11:23:37 -04:00
Wyatt O'Day
23809a3576 Actually fix the VS2010 compilation bug. I somehow missed this in the first pull request. (#482)
Thank you very much.
2017-08-30 13:46:14 -04:00
Wyatt O'Day
5149237a5d Fix compilation of secblock.h under Visual Studio 2010 (which only has partial C++ 2011 support). (#477) 2017-08-29 14:55:01 -04:00
Jeffrey Walton
d4ac135f93
Test align 16 for i386 and x86_64
Take 2
2017-08-27 19:53:12 -04:00
Jeffrey Walton
f488221992
Test align 16 for i386 and x86_64 2017-08-27 19:01:00 -04:00
Jeffrey Walton
682ab78b01
Update documentation 2017-08-19 02:32:44 -04:00
Jeffrey Walton
a9cd6755c7
Fix MSC C4100 warning for size
Also see commit 42b7c4ea56.
2017-08-18 10:07:47 -04:00
Jeffrey Walton
42b7c4ea56
Clear Coverity finding CONSTANT_EXPRESSION_RESULT (CID 182772)
This may create a MSC warning about a conditional expression being constant
2017-08-18 07:59:21 -04:00
Jeffrey Walton
1267c75369
Fix constexpr issues under GCC 4.1.2 found on CentOS 5 2017-08-17 18:35:06 -04:00
Jeffrey Walton
0110f8397f
Add ELEMS_MAX for SecBlock (Issue 346)
Reset the mark on additional class methods
2017-08-15 03:07:30 -04:00
Jeffrey Walton
d0cd32f405
Make SecBlock<T,A> data members protected
Also see http://github.com/weidai11/cryptopp/issues/448
2017-07-27 20:28:23 -04:00
Jeffrey Walton
2c9a3039e8
Update documentation
This cleanup was performed using Clang and -Wdocumentation -Wno-documentation-deprecated-sync
2017-07-27 19:15:21 -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
b791234b53
Remove VC++ 6.0 guard and code (Issue 342) 2017-03-01 09:11:41 -05:00
Jeffrey Walton
5efb019d8b
Add C++ nullptr support (Issue 383) 2017-03-01 06:10:06 -05:00
Jeffrey Walton
62f92dd592
Change next version from 5.7 to 6.0
Crypto++ 5.7 was the increment after the 5.6.5 release. Crypto++ 6.0 accurately reflects compatibility
2017-02-21 12:59:20 -05:00
Jeffrey Walton
2868452193
Add NIST SP800-90A HMAC_DRBG generator
Move bodies out-of-line
Whitespace
2017-02-07 08:51:58 -05:00
Jeffrey Walton
a49cb0861b
Add SecBlock member to track number of elements to zeroize (Issue 346)
By default the member, named m_mark, is set to the maximum number of elements. If SetMark() is called, then m_mark is adjusted. Upon deallocation and zeroization, STDMIN(m_size, m_mark) elements are zeroized.
We wanted to use a high water mark, but we could not track the writes to the allocation. operator[] would have been OK, but ::memcpy would have been problematic
2017-01-28 13:23:50 -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
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
0d66fd8f82 Fixed use of FixedSizeAlignedSecBlock and non-aligned allocator in validat1.cpp (Issue 256) 2016-09-09 06:33:31 -04:00
Jeffrey Walton
fea45591b2 Add constexpr to size_max() methods for C++11 2016-09-04 02:29:32 -04:00
Jeffrey Walton
f260be1f42 Updated documentation 2016-05-21 08:17:49 -04:00
Jeffrey Walton
2056421881 Updated documentation 2016-05-19 14:54:41 -04:00
Jeffrey Walton
1c8c16f9e8 Updated documentation 2016-05-19 14:37:50 -04:00
Jeffrey Walton
7c77f26c26 Update documentation 2016-02-29 10:22:06 -05:00
Jeffrey Walton
4b5677dcfa Updated documentation 2016-02-01 17:41:13 -05:00
Jeffrey Walton
1f1fecce88 Cleared -Wcast-align (Issue 122) 2016-01-25 19:28:55 -05:00
Jeffrey Walton
2b7dba4fa6 Suppressed false positives on -Wcast-align warning 2016-01-14 19:08:56 -05:00
Jeffrey Walton
ade18f6329 Removed unneeded test for 0-sized SecBlock. Removed temporary SecBlock 2016-01-08 07:15:56 -05:00
Jeffrey Walton
81482d8348 Added test case for growing FixedSizeSecBlock. Fixed copy count during grow 2015-12-31 07:21:23 -05:00
Jeffrey Walton
13748582e5 Added "make coverage" recipe. Added additional SecBlock tests 2015-12-28 07:06:50 -05:00
Jeffrey Walton
605744d826 Fixed SecBlock append when "this == t", fixed assert, added validation test (Issue 92) 2015-12-28 00:11:52 -05:00