Commit Graph

161 Commits

Author SHA1 Message Date
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
Jeffrey Walton
beb9df9d9e
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:51:27 -05:00
Jeffrey Walton
16ffe513a4
Add Integer bitwise AND, OR and XOR (Issue 336) 2016-11-23 21:55:30 -05:00
Jeffrey Walton
e794d53806
Cleanup comments 2016-10-18 02:23:07 -04:00
Jeffrey Walton
54d17c7361
Updated CRYPTOPP_ASSERT based on comments
Also see 399a1546de (commitcomment-19448453)
2016-10-17 22:00:31 -04:00
Jeffrey Walton
2d8992a547
Add statics to anonymous namespace 2016-10-10 18:20:49 -04:00
Jeffrey Walton
4c1b5472cc Cutover to SecByteBlock member for AES (Issue 302, CVE-2016-7544) 2016-09-30 01:09:21 -04:00
Jeffrey Walton
8518d22760
Change to file scope statics for Zero(), One(), Two() (Thanks DB, Issue 310) 2016-09-29 21:10:11 -04:00
Jeffrey Walton
afe391571b
Make Singleton<Integer> static with function scope (Issue 310)
This may not fix the issue. Drilling into the issue from the web-based dashboard, Coverity is targeting:

    1. noescape: CryptoPP::Integer::operator =(CryptoPP::Integer const &) does not free or save its parameter t.

3049 Integer& Integer::operator=(const Integer& t)
3050 {
3051   if (this != &t)
3052   {
3053     if (reg.size() != t.reg.size() || t.reg[t.reg.size()/2] == 0)
3054       reg.New(RoundupSize(t.WordCount()));
3055     CopyWords(reg, t.reg, reg.size());
3056     sign = t.sign;
3057   }
3058   return *this;
3059 }
2016-09-29 14:31:54 -04:00
Jeffrey Walton
584f2f2ad1 Cleared Coverity finding CID 170385 (UNINIT_CTOR) (Issue 293) 2016-09-20 20:51:13 -04:00
Jeffrey Walton
91ca6c117d Change from NDEBUG to CRYPTOPP_DEBUG in source files to ensure all debug behavior pivots on CRYPTOPP_DEBUG, and not NDEBUG (Issue 277, CVE-2016-7420) 2016-09-16 14:51:48 -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
f2e5149319 Cleared "Types cannot be declared in anonymous union" (Issue 274)
Thanks to Martin Bonner at http://stackoverflow.com/a/39507183
2016-09-15 09:38:40 -04:00
Jeffrey Walton
c2d60cc91f Removed ARMEL work-arounds from Integer class. 2016-09-08 09:42:47 -04:00
Jeffrey Walton
be4cc91a63 Cleared SDLC warning under Visual Studio 2005 2016-07-13 11:01:24 -04:00
Jeffrey Walton
a011d5f9bf Fix "Error: The operand ___LKDB cannot be assigned to" under Sun Studio 12.5 (formerly Issue 188) 2016-07-08 19:05:01 -04:00
Jeffrey Walton
b1df5736a7 Merge 'solaris' dev branch into 'master' 2016-06-15 05:02:28 -04:00
Jeffrey Walton
1ce593357f Cleared compile errors under Visual Studio .Net compilers 2016-04-29 10:25:18 -04:00
Jeffrey Walton
f45813bd12 Use stdext::make_checked_array_iterator for reverse_copy on VS2008 and above (Issue 123) 2016-02-05 02:43:08 -05:00
Jeffrey Walton
bce92ed5e5 Cleared uninitialized variable warning 2016-01-24 19:53:17 -05:00
Alexander Afanasyev
96c51ffb2c Fix compilation for armeabi with gcc-4.9, 5.0 toolchains
Refs: #119
2016-01-23 12:32:11 -08:00
DevJPM
07ff7b0d61 moved BE case before LE to improve performance 2016-01-14 12:24:36 +01:00
DevJPM
fb9da4e043 finalized patch
added final components of the Integer patch
2016-01-13 23:24:39 +01:00
DevJPM
ea980e5ec0 applied main changes
applied main changes from the Integer Patch
2016-01-13 23:19:49 +01:00
DevJPM
ba0ce02134 added std::showbase support
applied the std::showbase part of the integer patch
2016-01-13 22:42:52 +01:00
Jeffrey Walton
dce2317195 Increase range for GCC workaround on ARMEL. After speaking with AP from GCC, he states some issues are still likely present in Master, which is GCC 6.0 2016-01-09 00:09:06 -05:00
Jeffrey Walton
9fca0c2802 Work around issue on ARMEL in MultiplyTop and GCC. ARMHF is OK 2016-01-08 15:43:09 -05:00
Jeffrey Walton
3941be1889 Fixed hang on ARM platforms in Integer::DivideThreeWordsByTwo 2016-01-08 06:53:27 -05:00
Marco Deckel
f6499edf3a Microsoft ARM support
* Adjusted config to compile for Microsoft ARM (e.g. Windows Universal apps)
2015-12-14 16:11:17 +01: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
69c6989e99 Cleared "-Wunused-but-set-variable" warning due to Bot_2 macro on x86_64 2015-08-03 13:14:44 -04:00
Jeffrey Walton
22c3e41133 Removed USING_NAMESPACE(std). Changed cout → std::cout, cerr → std::cerr, ... 2015-07-30 17:35:58 -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
e75cb8dd8b Backed out commit 1dc875a44a. MinGW complained "error: 'p0' was not declared in this scope". Thanks to Ilya Bizyaev for reporting 2015-07-25 06:15:53 -04:00
Jeffrey Walton
1dc875a44a Cleared "unused variable" warning under GCC 5.1 2015-07-25 02:05:38 -04:00
Jeffrey Walton
6d0dd41eb0 Specialized defines to work with/around Clang integrated assembler. The two defines are WORKAROUND_LLVM_BUG_18916 and CRYPTOPP_USING_CLANG_INTEGRATED_ASSEMBLER. Once the 18916 bug is fixed, the other issues around the integrated assembler will remain 2015-07-22 03:48:10 -04:00
Jeffrey Walton
3c56063c3f Added CRYPTOPP_CLANG_NO_INTEGRATED_AS as a guard in config.h (disabled by default since integrated-as is default behavior and the bug is active). GNU_ATT_SYNTAX → GNU_AS_ATT_SYNTAX and GNUINTEL_SYNTAX → GNU_AS_INTEL_SYNTAX 2015-07-21 18:05:48 -04:00
Jeffrey Walton
444d1f1a3b Cut-in to utilize GNU_ATT_SYNTAX and GNU_INTEL_SYNTAX macros. Also see LLVM Bug 18916 (https://llvm.org/bugs/show_bug.cgi?id=18916) 2015-07-21 14:37:55 -04:00
Jeffrey Walton
81aa87df02 Cleared -Wunused-but-set-variable from GCC 4.8 and GCC 5.1. The way to handle separators is via locales and facets 2015-07-20 00:18:54 -04:00
Jeffrey Walton
3faaf986a4 Cleared warning under Visual Studio 2015-07-17 10:39:45 -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
1315a7bc9a port to Sun Studio 12u1 Sun C++ 5.10 SunOS_i386 128229-02 2009/09/21
change makefile to compile for both i386 and x86_64 on Darwin/Mac OS X
2010-07-05 01:15:14 +00:00
weidai
1435784dee switch to non-branching code in AlmostInverse() 2010-06-28 22:42:31 +00:00
weidai
82cc3ff5d4 fix Integer operator<< output on Windows x64 2009-04-05 20:02:22 +00:00
weidai
5e19e65655 fix compile on OpenBSD 4.4 2009-03-13 22:13:21 +00:00
weidai
1b88e58600 from Jeffery Walton: move *.dat files into TestData, make Integer operator<< respect ios::uppercase flag 2009-03-12 01:55:02 +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
fa25129ac9 port to Sun Studio 12's 64-bit C++ Compiler 5.9 Patch 124864-09 2008/12/16 2009-02-13 12:18:26 +00:00
weidai
f871754502 fix compile with GCC 4.0.1 on MacOS X 64-bit 2008-12-22 06:55:08 +00:00
weidai
3f30574ced fixes for GCC 4.3.2 (reports from Chris Morgan and DiegoT) 2008-11-21 03:05:32 +00:00
weidai
1240b1690b fix compile with ICC 10 2007-09-25 04:08:17 +00:00
weidai
c9c1fdbcb4 fix compile with ICC 9.1 on x64 2007-09-24 07:05:29 +00:00
weidai
4e8bde6f04 remove branch in assert 2007-09-24 00:45:16 +00:00
weidai
d42ea79cd7 fix possible branch prediction analysis (BPA) vulnerability 2007-08-13 23:47:54 +00:00
weidai
bbfb7ff438 fix crash in SSE2_Add on P4 when compiled with MSVC 6.0 with Processor Pack 2007-08-02 01:11:25 +00:00
weidai
4443d6e363 revert to int return value for Add and Sub 2007-05-05 19:37:51 +00:00
weidai
d2510f30c7 fix compile for x64, DLL and VC 6 2007-05-04 15:24:09 +00:00
weidai
3a3fef7436 fix compile on Sun CC 2007-04-16 05:40:37 +00:00
weidai
68a38c0b9a fix compile with Intel compiler 2007-04-16 02:51:59 +00:00
weidai
643b302227 MMX/SSE2 optimizations 2007-04-15 23:00:27 +00:00
weidai
826889105d fix compile with Sun CC 64-bit 2006-12-20 15:20:02 +00:00
weidai
43b41c1042 update version number, port to Sun C++ 5.8 2006-12-18 02:34:33 +00:00
weidai
813d784ea5 fix compile with MSVC 2005 SP1 beta 2006-12-10 23:50:09 +00:00
weidai
1012e664ef improve Integer initialization 2006-06-09 06:28:22 +00:00
weidai
254b0f0d4d fix Integer::Encode 2006-03-17 00:38:11 +00:00
weidai
922fdeb150 fix MSVC 2005 warnings 2006-03-13 13:26:41 +00:00
weidai
09bb1aab64 port to GCC 4 2005-09-05 21:43:43 +00:00
weidai
1db8ea5084 port to MSVC .NET 2005 beta 2 2005-07-12 04:23:32 +00:00
weidai
b3924f2108 changes done for FIPS-140 lab code drop 2005-01-20 04:19:35 +00:00
weidai
d617e3d925 fix compile with -msse2 on systems without memalign() 2004-07-18 09:23:13 +00:00
weidai
7001c6d388 fix for -fPIC 2004-07-05 21:49:50 +00:00
weidai
5bee373ff3 disable x86 assembly on systems without GNU as 2.10 or later 2004-06-19 11:00:52 +00:00
weidai
f78fccb3cc port to GCC 3.4 2004-06-19 08:28:09 +00:00
weidai
c5dc93b4dd avoid read-ahead into invalid memory in P4Optimized::Add 2003-10-31 02:40:42 +00:00
weidai
ac8389ac92 add detection for OS support of SSE2 2003-09-05 00:54:14 +00:00
weidai
89862d1220 guard against potential integer overflow in allocators 2003-08-04 19:00:41 +00:00
weidai
2d11a04dc7 fix DLL build 2003-08-01 04:24:51 +00:00
weidai
3d354a8bf2 unify GCC and MSVC multiplication code 2003-08-01 03:20:16 +00:00
weidai
93d56c76c1 enable SSE2 intrinsics on GCC 3.3 or later 2003-07-31 01:54:53 +00:00
weidai
9c5c4769a9 fix potential threading problem with initialization of static objects 2003-07-29 01:18:33 +00:00
weidai
1a6d66e68a fix for x64-64 2003-07-26 07:57:55 +00:00
weidai
57109b3120 fix bugs in 64-bit CPU support 2003-07-25 00:15:52 +00:00
weidai
4e67d23468 fix 64-bit CPU issues 2003-07-19 05:16:49 +00:00