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
toddouska
feeb18600f
Merge pull request #2636 from SparkiDev/mp_exptmod_fixes
...
Handle more values in fp_exptmod
2019-12-17 15:22:24 -08:00
toddouska
9fd5628148
Merge pull request #2631 from SparkiDev/mp_invmod_fix
...
mp_invmod handles more inputs
2019-12-05 16:21:33 -08:00
Sean Parkinson
c5f9a601e8
Handle more values in mp_exptmod
...
Handle prime (modulus) of 0 and 1.
Handle exponent of 0.
Fix for base of 0 in fp_exptmod and hadnle base of 0 in mp_exptmod.
fp_exptmod - Don't modify X's sign during operation when passed in as negative.
2019-12-04 09:32:08 +10:00
David Garske
7e45ae2ec6
Merge pull request #2621 from JacobBarthelmeh/SanityChecks
...
sanity check on "a" input to invmod
2019-12-02 10:57:01 -08:00
Sean Parkinson
bd7a572a8f
mp_invmod handles more inputs
...
Value to invert: a
Modulus: b
integer.c - normal math
- a is one, or a mod b is one
tfm.c - fast math
- b is -ve (error), or b is zero
- a is zero or a mod b is zero
2019-11-29 09:08:44 +10:00
toddouska
e1ebb39296
Merge pull request #2618 from ejohnstown/maintenance-prime
...
Maintenance: Prime
2019-11-27 14:06:23 -08:00
John Safranek
2de52c7666
Maintenance: Prime
...
When returning a result from mp_prime_is_prime for normal math, the
result should be MP_YES or MP_NO, not a bare number (1 or 0).
2019-11-26 15:44:30 -08:00
toddouska
5d41ef171c
Merge pull request #2610 from ejohnstown/maintenance-DTLS
...
Maintenance: DTLS
2019-11-26 15:17:22 -08:00
Jacob Barthelmeh
7c3a4a1975
update comment to reflect new sanity check
2019-11-25 10:57:09 -07:00
Jacob Barthelmeh
316b8b0b4d
add early return to normal math and WOLFSSL_VALIDATE_ECC_IMPORT to enable-all and enable-fpecc builds
2019-11-25 10:47:08 -07:00
John Safranek
3432a8a1fc
Maintenance: Prime
...
1. Prime test should return NO for 1. (ex function, normal math and fast
math)
2. Call mp_init() on the k value for the primality test case in the
wolfCrypt test.
2019-11-22 13:02:59 -08:00
John Safranek
452ba5b502
Maintenance: Prime
...
1. Prime test should return NO for 1. (normal math and fast math)
2019-11-21 13:49:26 -08:00
John Safranek
ce0136e968
Maintenance: Integers
...
In TFM and Integer, rshb() shouldn't try to shift a value that is 0.
This leads to using a negative offset to a pointer, but isn't used.
2019-11-20 13:55:57 -08:00
toddouska
5de27443d0
Merge pull request #2596 from dgarske/mqx_fio_cleanup
...
Support for MQX 5.0 and cleanup of the MQX includes
2019-11-19 11:49:03 -08:00
David Garske
1542482cd5
Cleanup of the MQX file headers for STDIO. Cleanup of fio.h and nio.h includes to use wc_port.h. ZD 9453.
2019-11-18 12:14:34 -08:00
Sean Parkinson
5221c082f1
SP now has support for RSA/DH 4096-bit operations
2019-11-12 12:04:06 +10:00
Tesfa Mael
1267987c31
Review comment
2019-10-15 12:24:57 -07:00
Tesfa Mael
1a18e3bba8
Add leading zero padding for odd hex ASCII digits
2019-10-15 11:54:58 -07:00