Commit Graph

286 Commits (d72b516c29e21f07e2dac2612d9571614172a304)

Author SHA1 Message Date
Jeffrey Walton 13ea8f374f
Add interface to TweetNaCl library (#566)
TweetNaCl is a compact reimplementation of the NaCl library by Daniel J. Bernstein, Bernard van Gastel, Wesley Janssen, Tanja Lange, Peter Schwabe and Sjaak Smetsers. The library is less than 20 KB in size and provides 25 of the NaCl library functions.

The compact library uses curve25519, XSalsa20, Poly1305 and SHA-512 as default primitives, and includes both x25519 key exchange and ed25519 signatures. The complete list of functions can be found in TweetNaCl: A crypto library in 100 tweets (20140917), Table 1, page 5.

Crypto++ retained the function names and signatures but switched to data types provided by <stdint.h> to promote interoperability with Crypto++ and avoid size problems on platforms like Cygwin. For example, NaCl typdef'd u64 as an unsigned long long, but Cygwin, MinGW and MSYS are LP64 systems (not LLP64 systems). In addition, Crypto++ was missing NaCl's signed 64-bit integer i64.

Crypto++ enforces the 0-key restriction due to small points. The TweetNaCl library allowed the 0-keys to small points. Also see RFC 7748, Elliptic Curves for Security, Section 6.

TweetNaCl is well written but not well optimized. It runs 2x to 3x slower than optimized routines from libsodium. However, the library is still 2x to 4x faster than the algorithms NaCl was designed to replace.

The Crypto++ wrapper for TweetNaCl requires OS features. That is, NO_OS_DEPENDENCE cannot be defined. It is due to TweetNaCl's internal function randombytes. Crypto++ used DefaultAutoSeededRNG within randombytes, so OS integration must be enabled. You can use another generator like RDRAND to avoid the restriction.
2018-01-17 22:02:09 -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 1a7f19cdde
Use 'command -v' to test for ld.gold 2018-01-02 01:13:59 -05:00
Jeffrey Walton 651563e6c2
Temporary fix for IBM XLC failed SM3 self tests (GH #553) 2017-12-30 22:18:08 -05:00
Jeffrey Walton 8b7f21b07d
Update makefiles to use one call to $(CXX) -dumpmachine 2017-12-30 18:38:40 -05:00
Jeffrey Walton cd35346f70
Fix Solaris failed compile due to SHA with GCC (GH #551) 2017-12-28 19:14:20 -05:00
zorun c3a85caf52 Build fixes (#547)
* GNUmakefile-cross: Fix install target

The install target was not working: missing mkdir before copying files,
wrong dynamic library copied, missing ldconf.

The fix is mostly taken from the install target from GNUmakefile.

* Makefile: call 'ln -sf' instead of 'ln -sf -sf'
2017-12-16 09:07:23 -05:00
Jeffrey Walton b7e636ac51
Rename ppc-crypto.h to ppc-simd.h 2017-12-12 07:15:59 -05:00
Jeffrey Walton 074c889210
Add NEON flags to rijndael-simd.cpp
AES does not have a NEON implementation. However, because it includes "adv-simd.h", it needs the compiler options so NEON types are available. Otherwise the compile fails.
We can't guard "adv-simd.h" and NEON on just AES because Simon and Speck use the templates in their NEON implementations.
2017-12-10 12:11:53 -05:00
Jeffrey Walton 25709d2597
Fix SPECK64 vector permutes
Thanks to Peter Cordes for the suggestion on handling the case
2017-12-04 09:47:26 -05:00
Jeffrey Walton 18ccd89965
Add SSE4 flags to makefile for Simon and Speck 2017-12-03 06:02:24 -05:00
Jeffrey Walton f86c6124a8
Add Valgrind suppression file (GH #543) 2017-11-29 06:52:43 -05:00
Jeffrey Walton 33caa1e13f
Add Valgrind --track-origins=yes to recipe 2017-11-29 05:26:21 -05:00
Jeffrey Walton 568e608ea6
Add NEON and ASIMD intrinsics for SPECK-128 (GH #539)
Performance increased by about 200% on a 980 MHz BananaPi dev-board. Throughput went from about 176.6 cpb to about 60.3 cpb.
2017-11-27 00:36:45 -05:00
Jeffrey Walton c5303b9c2a
Fix "variable tracking size limit exceeded" with UBsan
threefish.cpp: In member function ‘virtual void CryptoPP::Threefish512::Enc::ProcessAndXorBlock(const byte*, const byte*, CryptoPP::byte*) const’:
threefish.cpp:316:6: note: variable tracking size limit exceeded with -fvar-tracking-assignments, retrying without
 void Threefish512::Enc::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const
...
2017-11-26 05:27:03 -05:00
Jeffrey Walton f4975461a9
Remove IS_ARM64 from makefile
ARM64 is kind of useless. We need A-32 (old ARM), Aarch32 (new 32-bit ARM) and Aarch64 (new 64-bit ARM). Aarch32 and Aarch64 is captured by IS_ARMV8, and A-32 is captured by IS_ARM
2017-11-23 03:42:26 -05:00
Jeffrey Walton 304809a65d
Add NEON and ASIMD intrinsics for SPECK-128 (GH #538)
Performance increased by about 115% on a 980 MHz BananaPi dev-board. Throughput went from about 46.2 cpb to about 21.5 cpb.
2017-11-23 02:47:44 -05:00
Jeffrey Walton 78ec2aa5f4
Fix NEON detection on arm-hf 2017-11-22 23:15:20 -05:00
Jeffrey Walton 39697d92bf
Add SSSE3 intrinsics for SPECK-128 (GH #538)
Performance increased by about 100% on a 3.1 GHz Core i5 Skylake. Throughput went from about 7.3 cpb to about 3.5 cpb. Not bad for a software-based implementation of a block cipher
2017-11-22 07:57:39 -05:00
Jeffrey Walton a5bf962681
Fix target misdetection on OS X with '-arch i386'
This tested OK on Linux OS X, Solaris and Windows. It may break things under IBM XL C/C++. We will cross that bridge when we get to it.
2017-11-16 19:37:29 -05:00
Jeffrey Walton bd41c3d5dd
Remove SSE2 from cpu.cpp, add sse-simd.cpp
We need to ensure SSE2 does not cross pollinate into other CPU functions since SSE2 is greater than the minimum arch. The minimum arch is i586/i686, and both lack SSE2 instructions
2017-11-16 15:11:51 -05:00
Jeffrey Walton 8b52a03d08
Fix SunCC 12.2 compiler crash with GCM_Xor16_SSE2
SunCC 12.3 through 12.5 still cannot handle CLMUL, though. It would be nice if Sun fixed the regression.
2017-11-16 02:38:53 -05:00
Jeffrey Walton c49b6d4d71
Cleanup comments and old code artifacts 2017-11-15 21:11:42 -05:00
Jeffrey Walton e8bed05b7d
Use SSE4.1 instead of SSE4.2 for BLAKE2
BLAKE2 requires SSE4.1, no SSE4.2. This change should have been made when we split SSE4 into .1 and .2, but we needed more OS X and LLVM testing
2017-11-15 20:08:06 -05:00
Jeffrey Walton a3784a3ac5
Update Power8 support for Autotools 2017-11-14 20:54:43 -05:00
Jeffrey Walton dd1484800c
Rename mapfile for Solaris 2017-11-12 22:48:51 -05:00
Marcel Raad 4043164205 RFC: workarounds for original MinGW (#531)
* Set default target Windows version for MinGW to XP

The original MinGW from mingw.org targets Windows 2000 by default, but lacks
the <wspiapi.h> include needed for Windows 2000 support.

* Disable CRYPTOPP_CXX11_SYNCHRONIZATION for original MinGW

std::mutex is only available in libstdc++ if _GLIBCXX_HAS_GTHREADS is defined,
which is not the case for original MinGW. Make the existing fix for AIX more
general to fix this. Unfortunately, any C++ header has to be included to
detect the standard library and the otherwise empty <ciso646> is going to be
removed from C++20, so use <cstddef> instead.
2017-11-06 20:49:16 -05:00
Jeffrey Walton f40afed631
Add more Autotools artifacts to distclean recipe 2017-11-06 07:27:37 -05:00
Jeffrey Walton 432881065c
Removed *.pl from clean rules 2017-11-05 07:21:09 -05:00
Jeffrey Walton 3b43ce53ec
Add more Autotools artifacts to distclean recipe 2017-11-05 03:42:39 -05:00
Jeffrey Walton c50f2f23d8
Add more Autotools artifacts to distclean recipe 2017-11-05 03:38:19 -05:00
Jeffrey Walton 78a64e37d3
Remove cryptopp.mapfile from distclean rule 2017-11-01 18:30:49 -04:00
Jeffrey Walton defa3f78d1
Add more Autotools artifacts to distclean recipe 2017-11-01 18:25:44 -04:00
Jeffrey Walton a72225afff
Add more Autotools artifacts to distclean recipe 2017-11-01 15:51:10 -04:00
Jeffrey Walton 9e85633ff7
Add more Autotools artifacts to distclean recipe 2017-11-01 13:12:27 -04:00
Jeffrey Walton 0f2f753696
Add Autotools artifacts to distclean recipe 2017-11-01 12:11:04 -04:00
Jeffrey Walton 4e6c4e0522
Fix Solaris build using SunCC
This broke when we fixed xlC builds on AIX
2017-10-27 18:09:40 -04:00
Jeffrey Walton 6f25cf682a
Improve 64-bit support for GCC on AIX 2017-10-18 05:55:12 -04:00
Jeffrey Walton c2c0a1ed82
Improve 64-bit support for XL C/C++ 2017-10-18 04:49:26 -04:00
Jeffrey Walton f8d97b83ed
Fix compile on old PowerPC
This cleans up the compile on old PwerMac G5's. Our Altivec and Crypto code relies on Power7 and Power8 extensions. There's no need to shoehorn Altivec and Power4 into old platforms, so we disable Altivec and Crypto unless Power7 is available. The GNUmakefile sets CRYPTOPP_DISABLE_ALTIVEC if Power7 is not available.
2017-10-17 20:47:14 -04:00
Jeffrey Walton 3ffff750d7
Fix feature detection on AIX with XL C/C++ 2017-10-13 01:27:09 -04:00
Jeffrey Walton 8f6afb3079
Fix -pipe warning under SunCC 2017-09-16 22:09:50 -04:00
Jeffrey Walton 913a9e60d3
Remove CMake from library sources (GH #506)
CMake can now be found at http://www.cryptopp.com/wiki/CMake. The Cmake project files are now maintianed by the community.
2017-09-16 21:09:40 -04:00
Jeffrey Walton 30d519c0bc
Use -O3 for IBM XL C/C++ (GH #502)
We held back XL C/C++ due to warnings and self test failures. Since clearing Issue 502, we are OK for -O3 so we can live with the warnings.
2017-09-16 08:22:25 -04:00
Jeffrey Walton 4670e3d5bc Revert "Use -O3 for IBM XL C/C++ (GH #502)"
This reverts commit aa348abd15. It caused a hang in the TEA algorithm. Also see GH #503.
2017-09-16 05:55:37 -04:00
Jeffrey Walton aa348abd15
Use -O3 for IBM XL C/C++ (GH #502)
We held back XL C/C++ due to warnings and self test failures. Since clearing Issue 502, we are OK for -O3 so we can live with the warnings.
2017-09-16 02:19:06 -04:00
Jeffrey Walton 502fdc61c9
Add -msse2 to i586 build (Issue 494) 2017-09-12 21:23:23 -04:00
Jeffrey Walton 2ebd30d43c
Remove -mvsx option from Linux Power8 builds
This option is not needed
2017-09-12 18:10:07 -04:00
Jeffrey Walton fb78afba29
Add PowerPC support to cpu.h and validate.cpp 2017-09-11 03:05:04 -04:00
Jeffrey Walton 9276b95221
Add Power8 support to Makefile 2017-09-09 20:33:06 -04:00