Commit Graph

5081 Commits (29453dcf08f7376e0472970ca690bf8a363b7542)

Author SHA1 Message Date
Jeffrey Walton 29453dcf08
Update comments 2019-08-27 07:52:33 -04:00
Jeffrey Walton 56165883fc
Update comments 2019-08-27 07:08:07 -04:00
Jeffrey Walton 54c8819c70
Fix ElGamal compile on Linux 2019-08-27 06:44:02 -04:00
Jeffrey Walton fcbfd68dfb
Add specialized Validate() to ElGamal
This was added for compatibility with BouncyCastle and other libraries. ElGamals paper and the HAC says to select x over the interval [1,p-1]. Crypto++ selects x over [1,q-1] as with other GFP schemes. Crypto++ fails to validate some of the keys of other libraries.
DL_PublicKey_GFP_OldFormat used to perform a reduction on x, but I think it treated a symptom and not the underlying cause. The underlying cause was, Crypto++ wass too strict in validating the parameter.
Note that wikipedia says to select the privaye key x over [1,q-1]. We are unable to find a reference for the practice, though it is OK.
2019-08-27 06:38:25 -04:00
Jeffrey Walton 90b0699edd
Add private key test data for ElGamal 2019-08-27 06:10:38 -04:00
Jeffrey Walton e06e3bd7a9
Fix ECP::Double and brainpoolP256r1 (GH #878) 2019-08-26 18:33:26 -04:00
Jeffrey Walton 66a6994e99
Add asserts to pubkey.h 2019-08-26 14:44:52 -04:00
Jeffrey Walton 8fa8ec9913
Update documentation 2019-08-25 12:20:21 -04:00
Jeffrey Walton db6d6b38b8
Update documentation 2019-08-25 12:00:28 -04:00
Jeffrey Walton 72f2b72920
Add test data from bug report (GH #876) 2019-08-24 18:00:03 -04:00
Jeffrey Walton f78c3c00d2
Regenerate ElGamal test data 2019-08-24 17:49:41 -04:00
Jeffrey Walton ff941db163
Update documentation 2019-08-24 16:59:39 -04:00
Jeffrey Walton a2c06c35b8
Use ASN1::elGamal() in ElGamal keys (GH #876) 2019-08-24 16:17:03 -04:00
Jeffrey Walton a7e83e6bf4
Update asserts in gfpcrypt.cpp 2019-08-24 15:48:14 -04:00
Jeffrey Walton 3d96234038
Fix typedef for MSVC (GH #876) 2019-08-24 06:44:14 -04:00
Jeffrey Walton 29e3818fd2
Add typedef for ElGamal::PrivateKey and ElGamal::PublicKey (GH #876) 2019-08-24 04:44:22 -04:00
Jeffrey Walton b80693d532
Add OID for ElGamal encryption (GH #876) 2019-08-24 03:18:29 -04:00
Jeffrey Walton 8130bd7a24
Update comments 2019-08-19 08:30:11 -04:00
Jeffrey Walton b9ff95f35a
Add define for CRYPTOPP_BOOL_ARM64 2019-08-18 04:27:25 -04:00
Jeffrey Walton 6545754337
Check size_t to DWORD and ULONG conversions
DWORD and ULONG are 32-bit. The conversion from size_t could fail, and the RNG would return a truncated result. I think it is low risk, but the test for the conversion test is cheap.
2019-08-17 21:19:04 -04:00
Jeffrey Walton d49c1a1605
Update documentation 2019-08-17 14:49:03 -04:00
Jeffrey Walton e22700f741
Fix use of MaxDerivedKeyLength (GH #874) 2019-08-16 07:12:14 -04:00
Jeffrey Walton c0a5a06a82
Fix use of MaxDerivedKeyLength (GH #874)
Also fix memcpy with NULL buffer
2019-08-16 06:45:30 -04:00
Jeffrey Walton 2ba9d3d00f
Restore former Test_RandomNumberGenerator behavior
There's no need to special case for HURD. No one uses it
2019-08-12 14:55:05 -04:00
Jeffrey Walton 7606c35fda
Update comments 2019-08-12 06:32:21 -04:00
Jeffrey Walton ea08de08d6
Add missing pumpAll to Test_RandomNumberGenerator 2019-08-12 06:27:10 -04:00
Jeffrey Walton 197f5fb1df
Add ASSERT to check m_fd for values <0
We are seeing RNG falures on HURD, but we are not throwing when constructing BlockingRng or NonblockingRng. This is despite the fact that /dev/urandom is missing during testing. NonblockingRng should always thwo when /dev/urandom is missing.
2019-08-12 05:40:22 -04:00
Jeffrey Walton 6028587b9f
Tighten Test_RandomNumberGenerator test
Debian HURD was slipping between the cracks. HURD appeared to be a minor failure because entropy on the heap improved the test result. After we zero'd the block, it was a catastrophic failure.
2019-08-12 05:34:11 -04:00
Jeffrey Walton 34e49627b7 Use C++ dynamic initialization if available 2019-08-12 00:11:41 -04:00
Jeffrey Walton 2d6895acb4 Update documentation 2019-08-11 22:37:15 -04:00
Jeffrey Walton 247418eec0 Use Bash arithmetic operators 2019-08-11 14:54:14 -04:00
Jeffrey Walton 11c5d14f85
Whitespace check-in 2019-08-10 03:24:52 -04:00
Jeffrey Walton 04b2a20c5d
Restore ECP ABI (GH #869)
Placing AdditionFunction as an inner class of ECP broke the ABI. We need to maintain the ABI so distros can patch Crypto++ 8.2.
2019-08-09 17:34:14 -04:00
Jeffrey Walton 7ac5791199
Fix cryptest.sh when swap is 0
If there is enough RAM then we don't need a swap file. I've got a Core i7-8800 with 64 GB or RAM that does not need a swap file.
2019-08-09 17:18:58 -04:00
Jeffrey Walton 242df465e8
Update comments 2019-08-07 23:30:48 -04:00
Jeffrey Walton c4700ae0b9
Avoid bitwise operation on boolean values 2019-08-07 23:27:33 -04:00
Jeffrey Walton 348e8e3b30
Clear unreachable code warnings under VC++ 2019-08-07 22:54:32 -04:00
Jeffrey Walton 1a5155fd96
Split public key benchmarks into integers and elliptic curves 2019-08-07 04:20:37 -04:00
Jeffrey Walton f3dd3d2559
Avoid temporary ECP::Point in ECP Addition and Double
This regains a lot of performance lost to the const-timeness (GH #869)
2019-08-07 02:43:13 -04:00
Jeffrey Walton b5fe6ab383
Clear parenthesis warning with GCC 2019-08-07 01:57:59 -04:00
Jeffrey Walton 7dc3b73e92
Add rdseed.asm to FileList.txt 2019-08-06 23:25:01 -04:00
Jeffrey Walton 7bba334641
Whitespace check-in 2019-08-06 21:42:43 -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 e5ab7919f9
Remove unneeded T in ECP Add()
Switch to 'R' variable in AdditionFunction to avoid shadow warnings
2019-08-06 03:28:53 -04:00
Jeffrey Walton 0ded32192e
Avoid branches in Montgomery Add() (GH #869) 2019-08-06 03:14:03 -04:00
Jeffrey Walton 5ae70e22b9
Avoid branches in Montgomery Double() (GH #869) 2019-08-06 01:23:37 -04:00
Jeffrey Walton df18c5b745 Add Debug and Release linker flags 2019-08-06 00:20:59 -04:00
Jeffrey Walton 41864fd49e Use local labels for RDRAND and RDSEED code (GH #872)
This did not fix the issue, but it is something on the TODO list.
2019-08-06 00:18:56 -04:00
Jeffrey Walton a01711e347 Fix CopyToRoot target with spaces in path 2019-08-05 13:27:54 -04:00
Jeffrey Walton c9ef9420e7
Fix ECP leakage in Add() and Double() (GH #869, PR #871)
This check-in provides the fix for leaks in ECP's Add() and Double(). The fixes were taken from Joost Renes, Craig Costello, and Lejla Batina's [Complete addition formulas for prime order elliptic curves](https://eprint.iacr.org/2015/1060.pdf).

The Pull Request includes two additional changes that were related to testing the primary fix. First, an `AuthenticatedKeyAgreementWithRolesValidate` interface was added. It allows us to test key agreement when roles are involved. Roles are "client", "server", "initiator", "recipient", etc.

Second, `SetGlobalSeed` was added to `test.cpp` to help with reproducible results. We had code in two different places that set the seed value for the random number generator. But it was sloppy and doing a poor job since results could not be reproduced under some circumstances.
2019-08-05 03:51:58 -04:00