Commit Graph

161 Commits

Author SHA1 Message Date
Jeffrey Walton
a89a27b72c
Attempt to keep Clang out of other compiler paths (GH #147) 2023-06-25 18:28:11 -04:00
Jeffrey Walton
6ac6668b29
Remove unneeded check in Integer::Randomize(bitCount) (GH #1206)
Update docs to specify case when bitCount==0
Add tests for Randomize function in debug builds
2023-06-25 02:48:20 -04:00
Jeffrey Walton
f5f63850f9
Use std namespace for memset, memcpy, memcmp (#1204) 2023-04-15 16:45:02 -04:00
Dimitris Apostolou
715a0bcce3
Fix typos (PR# 1099) 2022-01-04 05:06:35 -05:00
Jeffrey Walton
131fdc1bdf
Avoid word ops for Integer And, Or, Xor 2021-10-10 04:44:11 -04:00
Jeffrey Walton
5331e36173
Optimize Integer bit operations fix (GH #1072)
This fix uses IntegerSecBlock directly. It avoids the potential second allocation during Grow at the expense of a potential slightly larger SecBlock
2021-10-08 15:51:17 -04:00
Jeffrey Walton
4adfcd2c6c
Fix undersized SecBlock buffer in Integer bit operations (GH #1072) 2021-10-08 14:11:43 -04:00
Jeffrey Walton
e154280d31
Add octal and decimal literal prefix to Integer class 2021-09-19 05:06:11 -04:00
Jeffrey Walton
e44e90a371
Tighten assert on Integer::OpenPGPEncode 2020-12-08 01:03:11 -05:00
Jeffrey Walton
2c6e4b17d7
Use define CRYPTOPP_CXX11_STATIC_INIT name 2020-08-07 19:11:47 -04:00
Jeffrey Walton
0fdd341811
Update comments 2019-10-19 13:06:58 -04:00
Jeffrey Walton
5499cefb8b
Use umulh for Aarch64 multiply
This saves about 30% on the Integer multiply operations. For example, RSA 1024 encryption goes from 0.068 to 0.044 ms/op. RSA 2048 goes from 0.170 to 0.100 ms/op. We should have taken this sooner. Ugh...
2019-10-18 17:00:17 -04:00
Jeffrey Walton
0ea4354157
Update comments 2019-06-09 12:52:10 -04:00
Jeffrey Walton
1a0d7c516d
Disable BMI2 code paths in Integer class (GH #850) 2019-06-01 00:14:19 -04:00
Jeffrey Walton
4952fa489d
Use BMI2 when available for MultiplyWordsLoHi, MulAcc and friends
Using BMI2 saves about 0.03 ms on a Core i5 6400 @ 2.7 GHz. It is small but measurable. It also gives GCC more freedom in selecting memory or register operands
2019-05-31 09:42:39 -04:00
Jeffrey Walton
fb0bef1eb6
Use BMI2 when available for MultiplyWordsLoHi, MulAcc and friends
Using BMI2 saves about 0.03 ms on a Core i5 6400 @ 2.7 GHz. It is small but measurable. It also gives GCC more freedom in selecting memory or register operands
2019-05-31 05:37:35 -04:00
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