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
Sean Parkinson
901ee627fc
Fixes from using cppcheck tool
...
Various fixes for uninitialized variable use.
sniffer.c: close file when seek fails
tls.c: fix QSH_GET_SIZE macro
wolfio.c: uIPGenerateCookie: use the parameter, _ctx, instead of self
referencing.
wolfssl_adds.c: check for equivalent to XBADFILE to indicate error.
SP: change right shift of signed value to unsigned
sp_int.h: define 128-bit types
types.h: change a XMALLOC define to not use (,,) - cppcheck doesn't like
it and is unnecessary.
2019-10-01 09:22:00 +10:00
Sean Parkinson
000fc64f27
Fixes from overnight build failures
...
ssl.c: Certificate store fields freed without being NULLed and then
freed again.
integer.c: Compiler complained that a->dp may be NULL in mp_set_bit when
setting bit.
pkcs12.c: ret is zero after GetLength and this is an error but data is
freed only when ret != 0.
pkcs7.c: derArr was not zeroized for full allocated size.
2019-09-16 10:21:08 +10:00
toddouska
51c31695bd
Merge pull request #2391 from SparkiDev/tfm_dh_2
...
Specialized mod exponentiation for base 2 in tfm.c and integer.c
2019-08-15 15:59:20 -07:00
Sean Parkinson
d4cf6e37e8
DH base 2 impl - better error handling
2019-08-09 12:12:59 -06:00
toddouska
31461dbfb5
Merge pull request #2373 from dgarske/mpint
...
Improvements to atoi, mp_int allocations and STSAFE-A100 error handling
2019-08-02 15:43:20 -07:00
Sean Parkinson
2a22179068
Specialized mod exponentiation for base 2 in tfm.c and integer.c
2019-08-02 15:50:08 +10:00
Sean Parkinson
d7b893f250
Use a fixed number of bits with DSA gen and sign
2019-07-29 09:33:11 +10:00
David Garske
b658f2e7c3
Refactor for all fp_int and mp_int allocations to use DYNAMIC_TYPE_BIGINT. This allows customers to setup a static pool for these allocations if desired.
2019-07-23 15:36:59 -07:00
Sean Parkinson
40864da533
Fix prime testing to do t iterations of random values in range
2019-07-02 14:42:03 +10:00
toddouska
b957415609
Merge pull request #2245 from MKinclRA/coverity-issues
...
Coverity issues
2019-06-24 16:12:52 -07:00
Sean Parkinson
c82c9b481b
When checking primes call only available SP ModExp functions
2019-06-20 18:05:25 +10:00