Commit Graph

87 Commits

Author SHA1 Message Date
Jeffrey Walton
1190da17ea Avoid circular dependency using AlignedAllocate (GH #885) 2019-09-28 18:22:11 -04:00
Jeffrey Walton
b1c691b53a
Fix RDSEED hang on x86 (GH #872) (#873)
Calls to `MASM_RDSEED_GenerateBlock` would hang for an unknown reasons on Windows 10 and VS2017/VS2019 toolchains. Similar calls to `MASM_RDRAND_GenerateBlock` worked as expected. They were effectively the same code. The only differences were the function names and the opcodes (they were literally copy/paste).

Splitting `rdrand.asm` (with both `RDRAND` and `RDSEED`) into `rdrand.asm` (with `RDRAND`) and `rdseed.asm` (with `RDSEED`) resolved the issue. We don't know why.
2019-08-06 21:01:22 -04:00
Jeffrey Walton
8fab1c3677
Revert changes for lgtm findings
This broke SunCC to the point of no repair. SunCC is using AVX2 instructions for C++ and SSE2. Man this compiler sucks...
2019-06-09 01:49:44 -04:00
Jeffrey Walton
43b01973b1
Clear lgtm findings
We did some refactoring and added sse_simd.h. Over time more SSE functions will likely move into sse_simd.h
2019-06-08 11:00:11 -04:00
Jeffrey Walton
c51f0ecbfd
Make config.h more Autoconf friendly (GH #835, PR #836) 2019-05-17 15:18:17 -04:00
Jeffrey Walton
c6e8a61b8b
Add SHAKE-128 and SHAKE-256 (GH #805, PR #806) 2019-02-12 19:51:37 -05:00
Jeffrey Walton
315e54e63d
Add ChaCha20/Poly1305 AEAD cipher (GH #724) 2019-01-28 08:52:56 -05:00
Jeffrey Walton
df9fa62205
Use carryless multiplies for NIST b233 and k233 curves (GH #783, PR #784)
Use carryless multiplies for NIST b233 and k233 curves.
2019-01-16 00:02:04 -05:00
Jeffrey Walton
d62674b561
Add ed25519 (GH #764, PR #767)
Add ed25519
2018-12-24 17:17:32 -05:00
Jeffrey Walton
33cb5e63ab
Add Test vectors and data to VS project files 2018-12-15 04:39:12 -05:00
Jeffrey Walton
152ac6177c
Add Moon's curve25519 using SSE2 (GH #761)
Moon's code is very fast. In fact it is so fast it broke our benchmarks. Moon's code registers 0.00 milliseconds and 0.00 megacycles/operation.
2018-12-13 10:19:54 -05:00
Jeffrey Walton
77923a291a
Add Langley's curve25519 (GH #761, PR# 762) 2018-12-11 16:17:56 -05:00
Jeffrey Walton
f07f01f415
Add Power9 Random Number Generator support (GH #747, PR #748)
This adds the missing changes to the Windows source files
2018-11-28 21:51:39 -05:00
Jeffrey Walton
4da4f7ea2a Add AVX2 arch to chacha_avx.cpp 2018-11-13 00:01:55 -05:00
Jeffrey Walton
896225069d
Rename files with dashes to underscores (GH #736)
Also see https://groups.google.com/forum/#!topic/cryptopp-users/HBz-6gZZFOA on the mailing list
2018-11-10 08:00:14 -05:00
Jeffrey Walton
d9011f07d2
Add ChaCha AVX2 implementation (GH #735) 2018-11-08 16:20:31 -05:00
Jeffrey Walton
5dca85b819
Split Blake2 SIMD files into blake2s-simd.cpp and blake2b-simd.cpp (GH #729, GH #731)
The split was required for Blake2b and Power8; Blake2s only requires Power7
2018-11-02 19:09:36 -04:00
Jeffrey Walton
916c4484a2
Add ChaCha SSE2 implementation
Thanks to Jack Lloyd and Botan for allowing us to use the implementation.
The numbers for SSE2 are very good. When compared with Salsa20 ASM the results are:
  * Salsa20 2.55 cpb; ChaCha/20 2.90 cpb
  * Salsa20/12 1.61 cpb; ChaCha/12 1.90 cpb
  * Salsa20/8 1.34 cpb; ChaCha/8 1.5 cpb
2018-10-23 07:57:59 -04:00
Jeffrey Walton
b9a6034a81
Add keccakc.h and keccakc.cpp for shared F1600 2018-08-22 00:40:30 -04:00
Jeffrey Walton
f2171cbe2f
Remove Thread and Socket classes (GH #208, PR #703)
Also see https://groups.google.com/forum/#!topic/cryptopp-users/5btwLoxXXD4.
2018-08-17 23:55:39 -04:00
Jeffrey Walton
7a43a04048
Split simon-simd.cpp and speck-simd.cpp into separate source files
SIMON-64 and SIMON-128 have different ISA requirements. The same applies to SPECK-64 and SPECK-128. GCC generated code that resulted in a SIGILL due to the ISA differences on a down level machine. The instructions was a mtfprwz from POWER8. It was prsent in a function prologue on a POWER7 machine.
2018-08-15 09:59:40 -04:00
Jeffrey Walton
678bdb1735
Add AES-NI accelerated SM4 encryption (GH #540)
Thanks to Markku-Juhani Olavi Saarinen for the code. Also see https://github.com/mjosaarinen/sm4ni
2018-07-13 08:48:43 -04:00
Jeffrey Walton
989bf6dc5e
Add HC-256 stream cipher (GH #680) 2018-07-05 06:43:04 -04:00
Jeffrey Walton
dd31eb80c0
Add HC-128 stream cipher (GH #679) 2018-07-05 00:29:07 -04:00
Jeffrey Walton
d00777e1d7
Add Rabbit stream cipher (GH #678) 2018-07-04 03:47:28 -04:00
Jeffrey Walton
08e6137082
Add SIMECK-64 SSSE3 implementation (GH #675) 2018-07-01 03:11:00 -04:00
Jeffrey Walton
ac036496d3
Add Simeck lightweight block cipher (GH #675)
Add Simeck lightweight block cipher (GH #675)
2018-06-30 02:43:12 -04:00
Jeffrey Walton
2f5b110b52
Add HIGHT lightweight block cipher (GH #672) 2018-06-24 00:54:16 -04:00
Jeffrey Walton
fa7714f6cb
Add LEA-128 SSSE3 implementation (GH #669)
LEA-128(128) from 6.73 cpb to 2.84 cpb on modern Core-i5 6400. LEA-128 from 10.12 cpb to 7.84 cpb antique Core2 Duo.
2018-06-22 16:26:27 -04:00
Jeffrey Walton
6138829572
Add CHAM128 SSSE3 implementation (PR #670)
CHAM-128(128) from 10.5 cpb to 4.1 cpb. CHAM-128(256) from 12.5 cpb to 4.7 cpb.
2018-06-19 18:03:28 -04:00
Jeffrey Walton
54d5100344
Add CHAM lightweight block cipher (PR #670)
Add CHAM lightweight block cipher
2018-06-17 23:24:47 -04:00
Jeffrey Walton
1f06c512c4
Add LEA lightweight block cipher (GH #669) 2018-06-17 22:36:41 -04:00
Jeffrey Walton
91faa5d399
Add AdditionalOptions property to VCXPROJ files (GH #649) 2018-05-01 23:42:04 -04:00
Jeffrey Walton
64d02e3a18
Add scrypt key derivation function (GH #613, PR #626) 2018-03-31 20:09:38 -04:00
Jeffrey Walton
e416b243d3
Re-add Simon and Speck, enable SSE (GH #585)
This commit re-adds Simon and Speck. The commit includes C++, SSSE3 and SSE4. NEON, Aarch32 and Aarch64 are disabled at the moment.
2018-02-18 23:23:50 -05:00
Jeffrey Walton
15b14cc618
Remove Simon and Speck ciphers (GH #585)
We recently learned our Simon and Speck implementation was wrong. The removal will stop harm until we can loop back and fix the issue.
The issue is, the paper, the test vectors and the ref-impl do not align. Each produces slightly different result. We followed the test vectors but they turned out to be wrong for the ciphers.
We have one kernel test vector but we don't have a working implementation to observe it to fix our implementation. Ugh...
2018-02-14 04:06:16 -05:00
Jeffrey Walton
8ffd165c7a
Rename nacl.h to naclite.h
This should avoid confusion with header files from the reference implementation and libsodium
2018-01-21 17:04:15 -05:00
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
8a5911e6eb
Refactor <cipher>_AdvancedProcessBlocks_<arch> into adv-simd.h
This also fixes the SPECK64 bug where CTR mode self tests fail. It was an odd failure because it only affected 64-bit SPECK. SIMON was fine and it used nearly the same code. We tracked it down through trial and error to the table based rotates.
2017-12-09 21:04:25 -05:00
Jeffrey Walton
07c2047cec
Add simon-simd.cpp to file list and nmake file 2017-11-27 01:20:15 -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
5267723a49
Add SM3 hash function (GH #541) 2017-11-23 23:19:09 -05:00
Jeffrey Walton
2c8a618a03
Add SM4 block ciphers (GH #540) 2017-11-23 11:41:40 -05:00
Jeffrey Walton
f2bc3cd0ca
Add speck-simd.cpp to project files (GH #538, #539)
Cleaned up whitespace
2017-11-22 08:45:38 -05:00
Jeffrey Walton
3970a066e3
Add SIMON-64 and SIMON-128 lightweight block ciphers (GH #539) 2017-11-21 04:58:51 -05:00
Jeffrey Walton
b9fc470bc7
Add SPECK-64 and SPECK-128 lightweight block ciphers (GH #538) 2017-11-20 06:30:21 -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
7fb5953055
Add VIA Padlock RNG 2017-08-19 15:41:45 -04:00
Jeffrey Walton
e2c377effd Split source files to support Base Implementation + SIMD implementation (GH #461)
Split source files to support Base Implementation + SIMD implementation
2017-08-17 12:33:43 -04:00
Jeffrey Walton
8f4b0dc081
Suppress C4251 and C4275 warnings in project files (Issue 412) 2017-08-16 11:24:48 -04:00