Commit Graph

145 Commits

Author SHA1 Message Date
Jeffrey Walton
255a6f2aa0
Clear UBsan warning -Wstringop-overflow 2019-04-27 21:08:02 -04:00
Jeffrey Walton
48531785b7
Use IsPowerOf2 in Integer::Divide 2019-02-05 02:05:36 -05:00
Jeffrey Walton
b09ca89a6e
Update comments 2019-02-05 01:19:35 -05:00
Jeffrey Walton
1f1c90cc29
Fix _M_IX86 typo 2019-01-04 20:33:53 -05:00
Jeffrey Walton
5ccbd9af6a
Use Microsoft x86-beased defined for __emulu 2019-01-04 10:29:24 -05:00
Jeffrey Walton
c085c7a75b
Fix Integer ARM64 compile with MSVC compiler (GH #776) 2019-01-03 23:19:06 -05:00
Jeffrey Walton
8769302a8b
Add CRYPTOPP_DISABLE_MIXED_ASM define and feature test (GH #756, PR #757) 2018-12-05 13:22:10 -05:00
Jeffrey Walton
3e909c13d4
Add IBM XLC init priority support 2018-11-30 08:23:35 -05:00
Jeffrey Walton
c601213ce1
Sync CRYPTOPP_{BIG|LITTLE}_ENDIAN with Autotools
Autotools sets up its config.h file with the '#define XXX 0' or '#define XXX 1' pattern. This check-in makes the sources Autotools aware. We need to verify CMake does the same
2018-10-28 04:24:22 -04:00
Jeffrey Walton
e185cbd803 Revert "Sync CRYPTOPP_{BIG|LITTLE}_ENDIAN with Autotools"
This reverts commit 04306f86ac. It broke GCC 4.8 on PowerPC.
2018-10-28 03:42:50 -04:00
Jeffrey Walton
04306f86ac
Sync CRYPTOPP_{BIG|LITTLE}_ENDIAN with Autotools 2018-10-27 07:30:15 -04:00
Jeffrey Walton
8c450a9f7a
Avoid Singleton when possible (GH #708)
Also clear several sign conversion warnings
2018-08-22 16:36:05 -04:00
Jeffrey Walton
0ba3687c39
Update comments 2018-08-22 14:46:30 -04:00
Jeffrey Walton
60c5146c5e
Update comments in integer.cpp 2018-08-21 15:10:22 -04:00
Jeffrey Walton
a65cf70ff8
Update comments in integer.cpp 2018-08-21 15:03:20 -04:00
Jeffrey Walton
81f8c48faf
Avoid std::call_once (GH #707)
This commit also favors init priorities over C++ dynamic initialization. After the std::call_once problems on Sparc and PowerPC I'm worried about problems with Dynamic Initialization and Destruction with Concurrency.
We also do away with supressing warnings and use CRYPTOPP_UNUSED instead.
2018-08-21 12:53:10 -04:00
Jeffrey Walton
874f79c320
Fix compile on Visual Studio 2005 without serve packs 2018-08-20 05:35:34 -04:00
Jeffrey Walton
f8f6afd1fa
Use IsZero()/NotZero() for 0 denominator test 2018-07-03 22:04:27 -04:00
Jeffrey Walton
a665e0825f
Use '*this >= m' for InverseMod reduction
The previous test used '*this > m', which did not capture 'm'
2018-03-26 13:31:18 -04:00
Jeffrey Walton
874c48a329
Fix a_exp_b_mod_c and divide by 0 (GH #604) 2018-03-25 19:22:42 -04:00
Jeffrey Walton
1efa1a9fc7
Add additional Integer class tests 2018-03-25 18:28:56 -04:00
Jeffrey Walton
932f392b2d
Fix incorrect InverseMod (GH #602)
cryptest.sh revealed a corner case still producing an incorrect result. We need to check for '*this > m', not '*this > 2m-1'.

The corner case looks obscure. The failure surfaced as 1 failed self test for about every 2048 tests. It was also in a code path where 'a' was explicitly set to '2m-1', with 'm' random.

The test result can be duplicated with 'cryptest.exe v 9996 1521969687'. The value '1521969687' is a seed for the random number generator to reproduce.
2018-03-25 11:15:34 -04:00
Jeffrey Walton
ff82b5a886
Fix incorrect InverseMod (GH #602) (#603) 2018-03-25 00:43:21 -04:00
Jeffrey Walton
30bcc7022d
Clear clang-tidy warnings 2018-01-24 15:35:45 -05:00
Jeffrey Walton
c4e0942a68
Add CRYPTOPP_TABLE, remove CRYPTOPP_SECTION 2018-01-21 14:19:00 -05:00
Jeffrey Walton
fb0ecfde62
Clear clang-tidy warnings
This commit also tweaks the way Integer parses byte arrays. The modified routines are slightly faster. On a Core-i5 6400 the self tests are 0.1 to 0.2 seconds faster
2018-01-02 04:17:22 -05:00
Jeffrey Walton
23d95e803d
Provide virtual destructor for Threefish_Base 2017-11-19 01:39:47 -05:00
Jeffrey Walton
660681a884
Fix SunCC 12.2 compile 2017-11-13 12:30:46 -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
69c8a4f9c6
Prefix IS_LITTLE_ENDIAN and IS_BIG_ENDIAN with CRYPTOPP 2017-11-10 14:15:30 -05:00
Jeffrey Walton
6d459afa15 Revert "Bump Visual Studio version number for checked iterators (GH #496)"
This reverts commit 3b6e17b1. The version in Master was correct. The version the OP was using was incorrect.
2017-09-13 02:03:35 -04:00
Jeffrey Walton
3b6e17b1b4
Bump Visual Studio version number for checked iterators (GH #496) 2017-09-13 00:30:57 -04:00
Jeffrey Walton
7851a0d510 Remove BOOL macro value (GH #462)
Currently the CRYPTOPP_BOOL_XXX macros set the macro value to 0 or 1. If we remove setting the 0 value (the #else part of the expression), then the self tests speed up by about 0.3 seconds. I can't explain it, but I have observed it repeatedly.
This check-in prepares for the removal in Upstream master
2017-08-20 21:25:29 -04:00
Marcel Raad
d9de314e86 Fix Windows compilation issues (by RaptorFactor) (#444)
* Fix compilation on Windows with /DUNICODE

* Fix linking of fipstest for MSVC targeting ARM (__crt_debugger_hook is not available).

* Fix build for Clang on Windows with optimizations on.

* Fix a warning about a non-existant warning under Clang.

* Fix compilation under Intel C++ 18.0 on Windows
2017-07-17 12:10:38 -04:00
Jeffrey Walton
555617d456
Clear coverity finding CONSTANT_EXPRESSION_RESULT (CID 147833) 2017-05-20 01:35:39 -04:00
Jeffrey Walton
537ee61ade
Switch to _MSC_FULL_VER for SP1 releases 2017-05-11 12:05:57 -04:00
Jeffrey Walton
c305e88127
Fix runtime crash when CRYPTOPP_INIT_PRIORITY=0
Couple use of initialization priorities to no NO_OS_DEPENDENCE
Add comments explaining what integer does, how it does it, and why we want to inprove on the Singleton pattern as a resource manager.
Update documentation.
2017-03-27 06:06:12 -04:00
Jeffrey Walton
0e55f5ac7d
Remove g_pAssignIntToInteger pointer, add CRYPTOPP_NO_ASSIGN_TO_INTEGER (Issue 389)
This effectively decouples Integer and Public Key from the rest of the library. The change means a compile time define is used rather than a runtime pointer. It avoids the race with Issue 389.
The Public Key algorithms will fail if you use them. For example, running the self tests with CRYPTOPP_NO_ASSIGN_TO_INTEGER in effect results in "CryptoPP::Exception caught: NameValuePairs: type mismatch for 'EquivalentTo', stored 'i', trying to retrieve 'N8CryptoPP7IntegerE'". The exception is expected, and the same happend when g_pAssignIntToInteger was present.
2017-03-25 16:38:42 -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
7fb6b3df74
Fix compile under Visual Studio 2005/MSC 14.00
Previous testing occurred with Visual Studio 2005 SP 1, and it lacks some of the Safe C++/security enhanced functions.
2017-03-18 16:56:14 -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
5efb019d8b
Add C++ nullptr support (Issue 383) 2017-03-01 06:10:06 -05:00
Jeffrey Walton
6d86e546f9
Backed off ASSERT. PKCS12_PBKDF and other classes use truncated buffers 2017-01-29 00:19:28 -05:00
Jeffrey Walton
de688a66d9
Validate Integer::Decode inputLen (Issue 346) 2017-01-28 23:17:33 -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
3dbf6e785c
Removed debug instrumentation 2017-01-23 21:33:23 -05:00
Jeffrey Walton
81669590d5
Update documentation
Added additional asserts
2017-01-23 19:25:06 -05:00
Jeffrey Walton
ba75834ae9
Removed VC++ 5.0 and 6.0 workarounds (Issue 342) 2016-12-03 05:05:56 -05:00
Jeffrey Walton
6eb2792bc2
Silence select conversion warnings (Issue 340) 2016-12-02 14:47:31 -05:00
Jeffrey Walton
ccef9149af
Switch from WordCount() to reg.size() for bitops
This avoids a potential problem when OR'ing with 0 that results in a WordCount() of 1. Integer's minimum reg[] size is 2 due to RoundupSize(), and there could be implicit assumptions for the minimum that did not surface under testing
2016-11-26 00:56:02 -05:00