Commit Graph

3997 Commits

Author SHA1 Message Date
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
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
Daniel Pouzzner
f6acbd5f97 test_wc_curve25519_make_pub(): fix order of args to wc_curve25519_make_pub(). 2020-08-06 18:37:00 -05:00
Daniel Pouzzner
c325001d0d note argument endianness and return values in intro comment for wc_curve25519_make_pub(). 2020-08-06 18:07:39 -05:00
Daniel Pouzzner
758665e347 Fix for TLS anonymous cipher and PKCS11 cast warnings. (author=dgarske) 2020-08-06 17:49:55 -05:00
Daniel Pouzzner
52a2222c79 curve25519.c: call the new API routine wc_curve25519_make_pub(), not wc_curve25519(), for clarity and consistency (hat tip to Jacob). 2020-08-06 14:48:29 -05:00
toddouska
15be5476e9 Merge pull request #3185 from SparkiDev/fp_check_max
tfm: Check for overflow and return error (fixed max size)
2020-08-06 10:54:26 -07:00
toddouska
462f4f9e45 Merge pull request #3196 from cconlon/cavpmarvell
Add fips-check.sh target for marvell-linux-selftest, selftest v2 support
2020-08-06 10:45:03 -07:00
Daniel Pouzzner
b2e7c09b71 ksdk_port.c: third time's the charm? (typo, s/curve25529_bCurveParam/curve25519_bCurveParam) 2020-08-06 12:02:01 -05:00
Daniel Pouzzner
7ae789dbb0 wolfcrypt/src/curve25519.c: fix typo in wc_curve25519() -- CURVE25519_KEYSIZE, not CURVE25519_KEY_SIZE; add static kCurve25519BasePoint at top level 2020-08-06 11:45:54 -05:00
Daniel Pouzzner
5cad0b10e5 fix typo in wolfcrypt/src/port/nxp/ksdk_port.c ("curve_bCurveParam" vs correct curve25529_bCurveParam) introduced in aadec345ab. 2020-08-06 11:35:04 -05:00
Daniel Pouzzner
18178e056d add missing const qualifiers to arch variants of curve25519(), and to nxp_ltc_curve25519(). 2020-08-05 21:12:50 -05:00
David Garske
4a167c0f2c Merge pull request #3119 from tmael/do178-fix
DO-178 fix
2020-08-05 16:30:00 -07:00
Sean Parkinson
83caf39caa SP ECC Cache Resitance
SP ECC improved cache attack resistant implementation.
On by defualt and turn off with WC_NO_CACHE_RESISTANT.
2020-08-06 08:21:08 +10:00
Daniel Pouzzner
ffa2cdd2d1 add public function wc_curve25519() "compute the public key from an existing private key, using bare vectors."; rename existing _LOCAL functions wc_curve25519_GetBasePoint() and wc_curve25519() to nxp_ltc_curve25519_GetBasePoint() and nxp_ltc_curve25519() respectively; add const qualifiers opportunistically to existing _LOCAL function curve25519() 2020-08-05 16:28:17 -05:00
Chris Conlon
d12b80abdf Merge pull request #3192 from ethanlooney/21st_branch
Added check for wolfmath.c for digits == 0 and test for api.c
2020-08-05 09:51:51 -06:00
Sean Parkinson
6c4bcb3b59 tfm: Check for overflow and return error (fixed max size) 2020-08-05 10:42:32 +10:00
Tesfa Mael
5d7649c959 Review comment in sp_int file 2020-08-04 15:37:20 -07:00
toddouska
0bdaa2d572 Merge pull request #3169 from dgarske/stmcube
STM Cube fixes and documentation improvements
2020-08-04 15:08:04 -07:00
Ethan Looney
42856287ee Added check for wolfmath.c for digits == 0 and test for api.c 2020-08-04 13:25:10 -07:00
toddouska
0df2da47ff Merge pull request #3180 from embhorn/zd10697
Fix OOB in fp_read_radix_16
2020-08-03 16:44:01 -07:00
toddouska
a536e8acd6 Merge pull request #3187 from SparkiDev/config_fix_1
Fixes for different configurations
2020-08-03 16:41:50 -07:00
toddouska
48be407852 Merge pull request #3186 from SparkiDev/rsa_pss_oob
RSA PSS check input length is hash length
2020-08-03 16:41:15 -07:00
toddouska
bfb4b2079b Merge pull request #3163 from dgarske/nrf52
Fixes for building against latest nRF52 SDK
2020-08-03 16:33:49 -07:00
Sean Parkinson
d0969ea1ce Fixes for different configurations
Fix SkipInt() to work with DSA.
Fix protection around SetBitString16Bit() - when WOLFSSL_CERT_GEN and
WOLFSSL_CERT_EXT defined is only use.
WOLFSSL_RSA_VERIFY_ONLY and PSS means testing of PSS won't work.
Fix g++ build around ASN1_SEQUENCE - const variable required to be
initialized.
2020-08-03 14:55:09 +10:00
Sean Parkinson
3ffa4350e8 RSA PSS check input length is hash length
Input is the hash of the message and the hash type is the hash used to
generate the hash/input.
2020-08-03 12:17:03 +10:00
David Garske
776b1a2d17 Fix for ED25519 with user_settings.h. Fixes for build warnings. Fix spelling error. Added template for wolfBoot key/sign tools. 2020-07-31 15:17:53 -07:00
Eric Blankenhorn
d21d95c629 Fix OOB in fp_read_radix_16 2020-07-31 15:19:40 -05:00
David Garske
3531b581b5 Added return code check wolfSSL_CryptHwMutexInit 2020-07-31 12:01:09 -07:00
David Garske
904241cba4 Fix to only init the RNG once for nRF51/nRF52x. 2020-07-31 11:56:32 -07:00
David Garske
c30ffad622 Fix for STM PKA ECC parameters. Improvements to the STM AES GCM code. Cleanup of hardware mutex code. 2020-07-30 16:00:19 -07:00
Tesfa Mael
493510e2ea Review comments 2020-07-30 09:18:45 -07:00
Tesfa Mael
4cc7f9e4a9 Check correct returned value 2020-07-30 09:18:45 -07:00
Tesfa Mael
cebb283822 DO-178 changes 2020-07-30 09:18:45 -07:00
David Garske
46ef82e2fd For for STM32 with TLS v1.3 and AES-GCM. The IV was not being reset after using hardware causing the aes->reg to be incorrect. 2020-07-29 15:39:49 -07:00
David Garske
e4650a9151 Fixes for STM32 Crypto hardware acceleration locking to work with multiple threads. Fix for api.c missing devId in new RNG test. Added STM32F207 to configuration template. 2020-07-29 14:55:35 -07:00