Commit Graph

169 Commits

Author SHA1 Message Date
Guido Vranken
9783d64f7e Add missing return value check in mp_invmod_slow 2021-07-06 02:13:42 +02:00
Sean Parkinson
3180ec96a5 Merge pull request #3963 from dgarske/nxp_ltc_rsa
Fixes for NXP LTC ECC/RSA
2021-06-14 08:29:24 +10:00
David Garske
64ae0a827c Fixes for RSA with NXP LTC. The invmod function must reduce if A > B. Added RSA Key Generation acceleration. 2021-05-25 15:58:22 -07:00
Sean Parkinson
2c6285ccba cppcheck: fixes from reviewing report 2021-05-20 17:55:06 +10:00
Guido Vranken
2ecaa3c4c6 Use unsigned integers in mp_is_bit_set
ZD 12012
2021-04-01 00:57:06 +02:00
toddouska
95b91d8913 Merge pull request #3886 from DKubasekRA/fix/RA/v4.7.0-coverity
RA - Fixes for Coverity issues
2021-03-31 10:41:54 -07:00
toddouska
3ac03d3d66 Merge pull request #3805 from JacobBarthelmeh/copyright
update copyright date to 2021
2021-03-15 16:16:50 -07:00
Sean Parkinson
a55e94cf6f ECCSI and SAKKE: add support
Fixes for static code analysis included.
Added const to function parameters.
Zeroise some temporaries.
2021-03-12 09:31:22 +10:00
Jacob Barthelmeh
c729318ddd update copyright date 2021-03-11 13:42:46 +07:00
Sean Parkinson
419b426a1b MP int: fix word range check in mp_is_bit_set() 2021-03-08 15:45:04 +10:00
Sean Parkinson
298ebd6024 MP small: read radix set result to 0 on all errors 2021-03-05 10:02:07 +10:00
Martin Kinčl
9ea66868d8 Fixed CID 536133. 2021-03-03 20:37:29 +01:00
Martin Kinčl
05156083ec Fixed CID 529770. 2021-03-03 20:29:21 +01:00
toddouska
4c1a94a6ad Merge pull request #3768 from SparkiDev/mp_add_d_too_big
MP small: mp_add_d doesn't support adding a digit greater than MP_DIG…
2021-02-25 16:56:23 -08:00
Sean Parkinson
982ba6c1e0 Math: GCD(0,0) is undefined and LCM(0,*) is undefined.
All integers divide 0 so there is no greatest common divisor.
0 is not in the set of numbers for LCM.
2021-02-25 09:29:21 +10:00
Sean Parkinson
7ce3860e19 MP small: mp_add_d doesn't support adding a digit greater than MP_DIGIT_MAX 2021-02-17 09:24:22 +10:00
David Garske
53e79f1053 Fix for mp_radix_size with radix 2 and mp_int equal to zero. Fix applies to normal and fast math only. ZD11419. 2020-12-21 12:41:32 -08:00
Daniel Pouzzner
b0ec2bf058 wolfcrypt/src/integer.c: fix mp_read_unsigned_bin() accounting on mp_int.used_bits to avoid spurious .used > .alloc condition at loop exit. 2020-12-18 02:05:18 -06:00
Daniel Pouzzner
ef1284165f wolfcrypt/src/integer.c: fix sub-byte clearing step of mp_mod_2d() to work when DIGIT_BIT != sizeof(mp_digit)*8. 2020-12-10 23:50:30 -06:00
Sean Parkinson
a075540343 Merge pull request #3552 from tmael/shiftNeg
Check shift value
2020-12-11 10:19:27 +10:00
Tesfa Mael
9042843e42 Fix shift and clear digits 2020-12-10 16:13:30 -08:00
Daniel Pouzzner
5286cb1a46 optimize domain check in wolfcrypt/src/integer.c and wolfcrypt/src/tfm.c. 2020-12-10 14:16:20 -06:00
Sean Parkinson
9bbef90546 MP integer: fix map string for toradix and read_radix 2020-12-07 09:12:53 +10:00
Sean Parkinson
91d23d3f5a Implement all relevant mp functions in sp_int 2020-11-19 11:58:14 +10:00
Sean Parkinson
f5561b926c rshb: handle cases of shift amount being multiple of DIGIT_BIT
tfm.c and integer.c fixed
2020-11-11 10:04:14 +10:00
John Safranek
d24add10f2 Nightly Test Fix
When performing a fast_mp_montgomery_reduce(), scan-build didn't like
that the destination buffer was fully zeroed out. We were only zeroing
what was expected to be used. This zeroes only the expected to be used
section of the output buffer.
2020-11-01 18:58:05 -08:00
Elms
86b2118550 Address some cppcheck issues 2020-10-19 11:47:53 -07:00
Sean Parkinson
f0db2c177e ECC mulmod: some curves can't do order-1
Change implementation of timing resistant scalar multiplication to use
Joye double-add ladder.
No longer have fake operations being performed therefore can remove the
order adding operations.
Still need to check for boundary condition: order-1 wil not work with
SECP256K1 as it results in an add of order/2 and (order/2)+1 times base
point which are the negatives of each other. The sum is infinity and not
handled by maths.
Added mp_cond_swap_t - Conditionally swap in constant time.
2020-10-13 09:55:35 +10:00
Daniel Pouzzner
453698ba27 add explanatory comments for do_div(), used when WOLFSSL_LINUXKM. 2020-09-23 18:32:16 -05:00
Daniel Pouzzner
03d5a4eadd wolfcrypt/src/integer.c: mp_div_d(): refactor another 64 bit division to use do_div() when WOLFSSL_LINUXKM. 2020-09-23 18:32:15 -05:00
Eric Blankenhorn
5d69c9f1dc Move neg check 2020-09-15 09:12:45 -05:00
Eric Blankenhorn
4688f5fa59 Handle leading zero 2020-09-11 08:39:34 -05:00
Eric Blankenhorn
78a1670334 Fix mp_radix_size off by 1 error 2020-09-10 09:58:26 -05: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
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
Martin Akman
1f8d4149a5 Merge in master 2020-07-23 21:39:18 +10:00
toddouska
ea21d56463 Merge pull request #3127 from SparkiDev/mp_sub_d
mp_sub_d (integer.c): return error when digit is too big
2020-07-22 16:38:37 -07:00
toddouska
61d81dd878 Merge pull request #3123 from SparkiDev/mp_rshb
rshb check range of n
2020-07-20 13:08:45 -07:00
Sean Parkinson
52d363390a rshb check range of n 2020-07-20 11:12:35 +10:00
Sean Parkinson
e754076c37 Change mp_leading_bit (integer.c) to not to require a copy 2020-07-15 09:20:15 +10:00
Sean Parkinson
ddad95d52c mp_sub_d (integer.c): return error when digit is too big
Code can't handle subtracting a number (an mp_digit) larger than
DIGIT_BIT. Now returns an error rather than giving wrong result.
2020-07-15 09:18:35 +10:00
Sean Parkinson
411aee6e05 Fixes from cppcheck
Added PRIVATE_D version of rsa private key operation for SP
implementation for specific platforms.
WC_NO_RNG results in warnings when RNG calls don't do anything.
Added ifdef checks for variables not used otherwise.
Remove superfluous if statements like when checking ret == 0.
Change names of globals that are generic and are used locally before
global definition.
Remove definition of variable len that isn't used except as a
replacement for sz which is parameter.
Don't subtract two variables when one has just been assigned the value
of the other.
Fix shifting of signed value.
Fix parameter checking in aes.c and des3.c for platform specific code.
2020-04-08 09:46:22 +10:00
toddouska
bcc720ef68 Merge pull request #2773 from SKlimaRA/master
Coverity issues fixes.
2020-03-13 10:20:45 -07:00
David Garske
75183262ad Minor typos and fixes to the MDK5 examples. 2020-02-19 12:03:14 -08:00
Stanislav Klima
bbfefd3cde Sanity check NULL dereference. 2020-02-05 16:59:20 +01:00
Martin Akman
20c0beb9e5 'WOLFSSL_USE_FLASHMEM' to store constant tables in flash memory 2020-01-31 23:43:17 +10:00
Martin Akman
14dc5fe2e3 Fixes for 16bit processors 2020-01-31 23:32:48 +10:00
Sean Parkinson
55ea2facdd Changes to clear issues raised by cppcheck 2020-01-30 14:24:32 +10:00
Chris Conlon
45c5a2d39c update copyright to 2020 2020-01-03 15:06:03 -08:00
Eric Blankenhorn
b83804cb9d Correct misspellings and typos from codespell tool 2019-12-24 12:29:33 -06:00