Commit Graph

433 Commits

Author SHA1 Message Date
David Garske 7fb2c0f63f Merge pull request #3603 from haydenroche5/zd11434
Ensure that all leading zeros are skipped in sp_tohex.
2020-12-30 08:28:52 -08:00
David Garske 1b6a988dc0 Merge pull request #3601 from tmael/mp_rand_p
Add parameter check in sp_rand_prime()
2020-12-30 08:20:18 -08:00
Hayden Roche 81f70fba5f Ensure that all leading zeros are skipped in sp_tohex. 2020-12-30 08:32:01 -06:00
Tesfa Mael d366ca74af Review comments and cast 2020-12-29 19:48:45 -08:00
Tesfa Mael cedec3ae28 Add parameter check 2020-12-28 15:53:56 -08:00
Tesfa Mael 5c4011b3b4 cast to int 2020-12-23 12:09:35 -08:00
Sean Parkinson 356b419532 SP math all: fixes for different compilers and configs 2020-12-15 17:37:59 +10:00
Sean Parkinson 3e8e7aa17f Merge pull request #3550 from douzzer/sp-math-all-sp-word-typo
sp_int.c: fix typos in _sp_mul_4() and _sp_sqr_4().
2020-12-11 16:16:48 +10:00
Daniel Pouzzner 741098c108 sp_int.c, srp.c: fixes for 5 deadcode.DeadStores found by LLVM11 scan-build. 2020-12-10 14:16:21 -06:00
Daniel Pouzzner 2de261c2de sp_int.c: fix typos in _sp_mul_4() and _sp_sqr_4(). 2020-12-09 12:10:46 -06:00
Sean Parkinson 281ba96bd0 SP math all: fixes for configurations that don't specify size 2020-12-04 16:47:11 +10:00
Sean Parkinson 91d23d3f5a Implement all relevant mp functions in sp_int 2020-11-19 11:58:14 +10:00
John Safranek 1e348b991d Scan-Build Fixes
1. Fix a potential dereference of NULL pointer.

To recreate:
    $ scan-build ./configure --enable-sp --enable-sp-asm --enable-sp-math
2020-11-12 20:58:17 -08:00
John Safranek 38867ae2bf Scan-Build Fixes
1. Added a check to see if the "d" in sp_div() ended up with a negative used length. Return error if so.

To recreate:
    $ scan-build ./configure --enable-sp --enable-sp-asm --enable-sp-math
2020-11-12 10:24:11 -08:00
Daniel Pouzzner a9cad51b65 sp_mod_word(): add unoptimized alternative if -U__GNUC__. 2020-09-23 18:32:16 -05:00
Daniel Pouzzner fdbd6addd0 sp_int.c: add sp_mod_word() gated on WOLFSSL_SP_MOD_WORD_RP for runtimes lacking intrinsic support for int128 % int64; for linuxkm, use WOLFSSL_SP_DIV_WORD_HALF and the new WOLFSSL_SP_MOD_WORD_RP. 2020-09-23 18:32:16 -05:00
Daniel Pouzzner 3c91ce9342 wolfcrypt/src/sp_int.c: undo 8efb1142f1f2744ff128033df8a3a2d43e42fd93 to take dgarske's better wc_bigint_init()-based take on it (aa870861921a317cca9a978a75a7de127809e100). 2020-09-23 18:32:15 -05:00
Daniel Pouzzner c5d28c16b5 wolfcrypt/src/sp_int.c: clear whole struct in sp_init() and sp_init_multi(), to fix uninited pointer free()s in sp_free() when --enable-sp-math -DHAVE_WOLF_BIGINT. 2020-09-23 18:32:15 -05:00
Daniel Pouzzner add78dfba9 wolfcrypt/src/sp_int.c: add _LINUXKM do_div codepaths for a couple more 64 bit divisions, in sp_div_word() and sp_mod_d(). 2020-09-23 18:32:15 -05:00
David Garske b8bdeec940 Fix in SP math for casting signed -1 to unsigned. 2020-09-08 14:18:09 -07:00
David Garske 3878af96cd Fix for SP init and free with HAVE_WOLF_BIGINT. Fix for sp_free macro typo. Fix to expose mp_init_copy with ECC disabled because its used by mp_test. 2020-08-26 09:42:29 -07: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 1d55b2f526 Fixes for several memory leaks related to HAVE_WOLF_BIGINT. 2020-08-20 14:25:06 -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
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
Tesfa Mael 5d7649c959 Review comment in sp_int file 2020-08-04 15:37:20 -07:00
Tesfa Mael cebb283822 DO-178 changes 2020-07-30 09:18:45 -07:00
Sean Parkinson 056ee0987c Merge pull request #3146 from dgarske/sp_nonblock
ECC non-blocking support
2020-07-22 08:36:21 +10: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
David Garske 547144bc9c Adds ECC non-blocking sign/verify support when used with SP math. New --enable-sp=nonblock and --enable-ecc=nonblock options. Example ./configure --enable-ecc=nonblock --enable-sp=yes,nonblock. 2020-07-17 15:13:50 -07:00
Sean Parkinson 0336fdb98d Fix SP math for small builds 2020-07-17 12:00:14 +10:00
Sean Parkinson 51e49dbfac Fix sp_add_d 2020-07-15 09:15:04 +10:00
toddouska 2dcf4c1696 Merge pull request #3087 from SparkiDev/sp_math_mod
Fix div implementation in SP int
2020-07-14 11:19:15 -07:00
Sean Parkinson 1af2e5cf02 Fix div implementation in SP int 2020-07-06 08:52:44 +10:00
Sean Parkinson 0e79943a5c Fix SP int size of result checks
sp_lshb: Only put values in extra word id necessary
2020-07-03 09:12:27 +10:00
David Garske b947f69f60 Fix to correct SP 4096-bit enable. Correct nonexistent WOLFSSL_SP_NO_4096, which should be WOLFSSL_SP_4096. 2020-06-01 10:49:08 -07:00
kaleb-himes 82c86447e7 Fix failing build for rsa_verify_only example 2020-05-08 16:18:30 -06:00
David Garske 174b4d5159 Cleanup of SP with small stack. Expand support for WOLFSSL_SP_NO_MALLOC. Fix for evp.c when included directly. 2020-05-04 14:23:32 -07:00
David Garske c28ad38b16 Fix for cast issue caused by PR #2900. Applies to WOLFSSL_SP_CACHE_RESISTANT and c32/c64 versions only. 2020-05-04 10:49:59 -07:00
Sean Parkinson 416f0775d3 Merge pull request #2900 from dgarske/sp_no_malloc
Added option to build SP small without malloc
2020-04-14 09:40:11 +10:00
David Garske d412ccb6f8 Added new option WOLFSSL_SP_NO_MALLOC for building small SP without malloc. Added SP documentation. Added ./configure --enable-sp=yes,nomalloc supprt. https://github.com/wolfSSL/scripts/pull/79 2020-04-10 11:13:55 -07: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
Sean Parkinson 8972bf6278 Add support for P384 curve into SP 2020-02-17 15:46:34 +10:00
Sean Parkinson 81bebd8e5c Improve performance of SP Intel 64-bit asm
RSA: Only constant time copy out when doing private key op
Improve performance of sp_count_bits
2020-01-30 12:23:38 +10:00
Sean Parkinson ec877aa91e Add support to sp_int.c for platforms that do not divide an sp_int_word by an sp_int_digit 2020-01-23 14:39:19 -08:00
David Garske 4d9dbc9ec3 Adds 3072-bit RSA tests using USE_CERT_BUFFERS_3072. 2020-01-21 22:16:54 -08:00
Sean Parkinson b27ec58d20 Fix RSA verify only build 2020-01-08 10:18:37 +10:00
Sean Parkinson 89d8a90781 Get code compiling with SP math and RSA key gen again. 2020-01-08 09:51:26 +10:00
Chris Conlon 45c5a2d39c update copyright to 2020 2020-01-03 15:06:03 -08:00