Sean Parkinson
91c131fbd8
Curve448: fix 32-bit implementation
...
Fix small define check
2020-08-31 09:05:06 +10:00
David Garske
94b0dcb7e9
Peer review feedback to add explicit parenthesis on cast.
2020-08-27 16:18:54 -07:00
David Garske
0d2e37cc42
Fixes for several implicit cast warnings. ZD 10848.
2020-08-27 13:51:55 -07:00
toddouska
d077efcbb3
Merge pull request #3237 from SparkiDev/mp_oob_1
...
Fix out of bounds read when writing to very long buffer
2020-08-24 15:28:00 -07:00
toddouska
c5cab6afba
Merge pull request #3236 from dgarske/retcheck
...
Various fixes and improvements (return codes, build warns and func doc)
2020-08-24 15:27:04 -07:00
toddouska
7e6100593e
Merge pull request #3223 from SparkiDev/fp_gcd_fix
...
Check the error return from fp_mod in fp_gcd
2020-08-24 15:24:20 -07:00
toddouska
cf208901fd
Merge pull request #3218 from guidovranken/wc_PKCS12_PBKDF_ex-leak-fix
...
In wc_PKCS12_PBKDF_ex, free outer loop variable if inner loop fails
2020-08-24 15:23:47 -07:00
David Garske
47cc8d232a
Fix in ED448 wc_ed448_check_key function for possible dereference of a null pointer.
2020-08-24 07:31:06 -07:00
Sean Parkinson
4f44df96dc
MP: integer OOB write fix
...
mp_to_unsigned_bin_len() now checks length passed in is greater than or
equal length to write.
2020-08-24 22:48:52 +10:00
Sean Parkinson
955a53dce3
Ed448: Fix compiler warning Intel -m32
2020-08-24 16:29:48 +10:00
Sean Parkinson
e30361e186
Fix out of bounds read when writing to very long buffer
...
mp_to_unsigned_bin_len() didn't handle buffers longer than maximum MP
size. Fixed tfm and sp_int versions.
2020-08-24 09:18:07 +10:00
David Garske
fd2aece058
Fix for building ECC_CACHE_CURVE without WOLFSSL_CUSTOM_CURVES.
2020-08-20 16:16:18 -07:00
David Garske
dd517fd81c
Fixed several compiler warnings with inline variable declaration, deprecated func decl and small stack use of invaid memory (heap). Thanks @douzzer for these.
2020-08-20 15:13:43 -07:00
David Garske
92cf0d7b10
Fix numerous maybe-uninitialized errors in WOLFSSL_SP_SMALL and WOLFSSL_SMALL_STACK cases.
2020-08-20 15:05:20 -07:00
David Garske
1d55b2f526
Fixes for several memory leaks related to HAVE_WOLF_BIGINT.
2020-08-20 14:25:06 -07:00
David Garske
0011b7b376
Fix possible ECC curve cache leak for custom curves. Fix possible memory leak with wc_DhKeyDecode and WOLFSSL_DH_EXTRA. Fix leak in dh_test with new call to DH key import.
2020-08-20 14:25:05 -07:00
Sean Parkinson
549c47de65
Handle when k is 1 or order + 1 for timing resistant ECC
2020-08-19 10:50:37 -07:00
David Garske
1f10e77b0f
Fix for SP math with WOLFSSL_VALIDATE_ECC_KEYGEN. Fixes logic error on point x/y zero check.
2020-08-19 09:30:32 -07:00
Sean Parkinson
38b717eb42
Clear MP in ECC to free allocated memory
2020-08-18 17:54:25 -07:00
John Safranek
113753370d
Long Test Fixes
...
1. Sniffer was trying to log a NULL pointer as a string. Logged a string instead.
2. Few misc fixes in ECC.
2020-08-18 17:54:25 -07:00
Sean Parkinson
3a7ad4f03b
Check the error return from fp_mod in fp_gcd
...
Error can occur when using small stack and memory allocation fails.
2020-08-19 08:50:27 +10:00
John Safranek
6e49a63e50
fix call to MakeAnyCert from wc_MakeNtruCert(); it was missing the new parameter
2020-08-17 17:12:11 -07:00
toddouska
028bddd7ab
Merge pull request #3215 from ejohnstown/release-4.5.0
...
Release Update
2020-08-17 13:51:23 -07:00
Sean Parkinson
cb5d6a5c12
Check ECC scalar before multiplication
...
A k with more bits than in order doesn't work in ECC scalar
multiplication.
Check private key length in wc_ecc_check_key()
Check private key length in ecc_make_pub_ex()
2020-08-17 08:39:39 -07:00
John Safranek
3f6861ee82
FIPS Ready Fix with ECC Timing Resistance
...
Commit 6467de5 added some timing resistance to ECC shared secret
agreement. It involved adding an RNG object to the ecc keys so
a random z value can be added to the mix. The older FIPS release
has ECC outside the boundary, so it uses the new ECC code. FIPSv2
has ECC inside the boundary, but all the TLS code checks for that
version of FIPS and leaves out the calls to the new functions as
it is using an older version of ecc.c. FIPS Ready uses the latest
version of ecc.c but compiles as FIPSv2. So, the code outside of
the crypto layer is treating ECC as FIPSv2 and not calling the new
functions, but the crypto layer assumes the RNG should be present,
and errs out on testing.
1. Added a separate option for FIPS Ready to the enable-fips
configure option. `--enable-fips=ready`. It will treat FIPS
Ready as the next kind of FIPS release. FIPS Ready will be
treated like FIPS v3 in the build.
2. Changed the C preprocessor checks for FIPS version 2 to be
checks for not version 2, with respect to ECC Timing Resistance
and FIPS builds.
2020-08-14 10:54:55 -07:00
John Safranek
1dc0a76436
Patch from Jacob. When parsing a certificate name, if an item is unknown, its NID is set to 0. Don't try to add NID's of 0.
2020-08-13 17:01:26 -07:00
John Safranek
7e6863e78b
resolving build issues for FIPSv2 OE2 with --enable-opensslextra
2020-08-13 13:24:44 -07:00
Guido Vranken
087fa7cbec
In wc_PKCS12_PBKDF_ex, free outer loop variable if inner loop fails
2020-08-13 19:22:36 +02:00
Sean Parkinson
bc74bfebdd
Fixes from C++ and address access checking
...
Fix access of table for cache resistance.
Don't name variable public or private.
Cast from void*
2020-08-13 15:19:49 +10:00
John Safranek
e30341ea83
Merge pull request #3190 from embhorn/zd10712
...
Sanity check key sizes
2020-08-12 09:37:40 -07:00
toddouska
fa146870bd
Merge pull request #3155 from julek-wolfssl/openssh-fixes-cherry-picked
...
Additional OpenSSL compat stuff for OpenSSH
2020-08-11 16:32:31 -07:00
Daniel Pouzzner
e4fe6b6573
Merge pull request #3210 from dgarske/rsa_checkkey_sp
...
Fix for `unit.test` error with SP and RSA 1024-bit key gen
2020-08-11 12:00:41 -05:00
Sean Parkinson
6467de5a88
Randomize z ordinates in scalar mult when timing resistant
...
An RNG is required for shared secret calculation now.
Use wc_ecc_set_rng() to set an RNG against the ECC object.
ECC verification does not need timing resistance and does not randomize
z ordinates.
2020-08-11 16:12:47 +10:00
Sean Parkinson
3ce933c90a
Make fp_montgomery_reduce constant time
2020-08-11 16:12:10 +10:00
Sean Parkinson
0102902445
Add and use a mp_cmp_mag that is constant time.
2020-08-11 16:12:10 +10:00
Sean Parkinson
8b05160349
Reworked ECC mulmod and fix size of k
...
When using wc_ecc_mulmod_ex2(), the k size can be fixed to be one bit
longer than order.
2020-08-11 16:12:10 +10:00
Sean Parkinson
9ef9671886
ECC uses CT vers of addmod, submod and div_2_mod
...
The TFM implementations of mp_submod_ct, mp_addmod_ct,
mp_div_2_mod_t are more resilient to side-channels.
2020-08-11 16:12:10 +10:00
toddouska
242df3d11a
Merge pull request #3209 from SparkiDev/jenkins_fixes_1
...
Fixes from Jenkins failures
2020-08-10 14:30:27 -07:00
David Garske
26aaf473db
Fix for unit.test error with RSA 1024-bit key gen when using ./configure --enable-keygen --enable-sp. Issue started in PR #3119
2020-08-10 12:40:29 -07:00
Eric Blankenhorn
50647ccdb1
Sanity check key sizes
2020-08-10 07:19:33 -05:00
Sean Parkinson
72d1352bd6
Fix ARM builds
...
Need to include options.h in assembly now.
bufPt declared in block but not outside.
poly1305_block and poly1305_blocks need prototype - declaration in
wolfcrypt/src/port/arm/armv8-poly1305.c (__arch64__ only).
2020-08-10 11:59:10 +10:00
David Garske
62e78b7cf4
Fix state machine after script rebase.
2020-08-07 16:56:58 -07:00
David Garske
bc03b5793c
Add state for ECC verify non-blocking and mont_inv_order to reduce maximum blocking time.
2020-08-07 16:48:16 -07:00
David Garske
f7fcef5f32
Fix for build error / typo for ECC 256-bit non-blocking only.
2020-08-07 16:47:08 -07:00
David Garske
c0a664a8e5
Merge pull request #3200 from douzzer/20200805
...
Add an error-checking wc_curve25519_make_pub() routine to the API for use by Wireguard
2020-08-07 16:32:52 -07:00
toddouska
89e6f3bcd5
Merge pull request #3206 from SparkiDev/ed448_oob
...
ED448: Fix out of bounds read in import public
2020-08-07 15:36:11 -07:00
toddouska
17cc941b29
Merge pull request #3195 from SparkiDev/sp_ecc_cache
...
SP ECC Cache Resitance
2020-08-07 15:35:06 -07:00
Daniel Pouzzner
0faff24a65
refactor wc_curve25519_make_key() to use wc_curve25519_make_pub() to complete the pair. also, add call to fe_init() in the non-NXP codepath of wc_curve25519_make_pub() (note fe_init() is currently a no-op).
2020-08-07 13:02:35 -05:00
Sean Parkinson
4c00af1136
ED448: Fix out of bounds read in import public
...
Fix formatting
2020-08-07 14:11:11 +10:00
Sean Parkinson
1ea3dc5f55
SP ECC: initialize infinity in make key
2020-08-07 12:15:31 +10:00