Commit Graph

4711 Commits

Author SHA1 Message Date
Sean Parkinson
e187a74b1c sp_lcm small stack: fix size of temporary
Temporary sp_int needs to be allocated to be 1 digit larger than a or b
for the div operation.
Change sp_div to check sizes of r and rem when passed in.
Fix sp_invmod, sp_gcm, sp_submod to use temporary sp_int sizes that work
with calls to sp_div().
2021-02-15 09:48:18 +10:00
Sean Parkinson
3926ccd39b AES-GCM type fixes: internal functions now have word32 type parameters
Lengths were signed int for decrypt while unsigned int for encrypt.
Use word32 across the board.
Also fix AES-NI code on Windows to cast lengths to word64 before
multiplying by 8 to avoid averflow.
2021-02-12 08:30:08 +10:00
toddouska
d40ea03621 Merge pull request #3703 from SparkiDev/sp_int_malloc
SP int: Rework allocation of temporaries
2021-02-11 13:49:45 -08:00
toddouska
3eeeb39fb7 Merge pull request #3711 from dgarske/ecc_encrypt_rng
Fix for `--enable-eccencrypt` with timing resistance enabled
2021-02-11 12:28:13 -08:00
toddouska
80b9949052 Merge pull request #3739 from kaleb-himes/FusionRTOS-Porting-R3
Fusion RTOS porting round 3
2021-02-11 12:25:55 -08:00
JacobBarthelmeh
e87e818c6e Merge pull request #3749 from dgarske/zd11624_pkcs11
Fix another PKCS11 case where the ECC key type is not set
2021-02-12 01:36:41 +07:00
toddouska
39cb84de25 Merge pull request #3697 from julek-wolfssl/openvpn-2.5-missing-stuff
OpenVPN master additions
2021-02-11 08:56:45 -08:00
David Garske
f006479645 Fix another PKCS11 case where the ECC key type is not set and causes failures. Broke in PR #3687. 2021-02-11 08:04:58 -08:00
Sean Parkinson
b330196c28 SP int: Rework allocation of temporaries
Allocate only as much is as needed.
Use macros to simplify code.
Don't use an sp_int if you can use an array of 'sp_int_digit's.
2021-02-11 10:34:40 +10:00
toddouska
acdc267104 Merge pull request #3718 from SparkiDev/sp_int_fast_nct
SP int: allow faster NCT exptmod to be compiled in
2021-02-10 16:14:39 -08:00
toddouska
389a5e0301 Merge pull request #3684 from SparkiDev/sp_fixes_5
SP fixes: even mod testing, ECC compilation with SP
2021-02-10 16:10:21 -08:00
toddouska
6983aa9331 Merge pull request #3700 from SparkiDev/sp_math_lshb
SP math lshb: check space for result
2021-02-10 16:01:27 -08:00
toddouska
67b1280bbf Merge pull request #3545 from kabuobeid/smime
Added support for reading S/MIME messages via SMIME_read_PKCS7.
2021-02-10 15:59:32 -08:00
Sean Parkinson
5151e1f749 Merge pull request #3715 from JacobBarthelmeh/Testing
openssl x509 small with req cert gen
2021-02-11 09:39:15 +10:00
Sean Parkinson
7efaf14fce Merge pull request #3727 from JacobBarthelmeh/Prime
check prime is prime with ecc compressed keys
2021-02-11 09:22:40 +10:00
David Garske
c9c4a7ee68 Fix spelling errors. 2021-02-10 10:17:51 -08:00
David Garske
0c75099111 Fix for copy/paste error in PR 3728, which makes sure the ECC key type is specified. 2021-02-10 10:14:31 -08:00
kaleb-himes
4c171524dd Address missed CloseSocket item and revert some white space changes 2021-02-10 09:14:54 -07:00
Jacob Barthelmeh
3c0563908f openssl x509 small with req cert gen
add test for build case with x509small and add back in function

adjust macro guard for i2d_X509_NAME implementation

add macro guard on test case
2021-02-10 21:48:29 +07:00
Sean Parkinson
64bc4b663d SP fixes: even mod testing, ECC compilation with SP
Even mod inversion will sometimes work with integer.c.
Don't call SP code to perform ECC ops unless WOLFSSL_HAVE_SP_ECC is
defined.
2021-02-10 14:38:58 +10:00
toddouska
b704c3b3f8 Merge pull request #3693 from SparkiDev/curve448_ppc64
Curve448 PPC64: 'char' is not always signed - use type 'sword8'
2021-02-09 16:08:06 -08:00
toddouska
75d0496f77 Merge pull request #3722 from SparkiDev/sp_clang_fix
test.c: don't check key NULL when not small stack
2021-02-09 16:07:04 -08:00
toddouska
157ad65a6e Merge pull request #3677 from SparkiDev/ecdsa_keep_e
ECDSA: don't modify the e mp_int (hash) value
2021-02-09 16:06:05 -08:00
toddouska
47b2e8342b Merge pull request #3698 from SparkiDev/sp_math_no_asm_fix
SP math: fix one word Montgomery Reduction for non-asm
2021-02-09 16:04:38 -08:00
toddouska
32424f715c Merge pull request #3699 from SparkiDev/sp_ecdsa_vfy_fix
SP ECC verify: check point for z=0 and set to infinity
2021-02-09 16:02:51 -08:00
toddouska
27475291b1 Merge pull request #3733 from SparkiDev/sp_int_mont_red_size
SP int: mont_red - check size of a relative to m
2021-02-09 16:00:24 -08:00
toddouska
ae3706d5e5 Merge pull request #3734 from SparkiDev/sp_int_8_bit
SP int: fixes for 8-bit digits
2021-02-09 15:59:26 -08:00
toddouska
2f47934184 Merge pull request #3735 from SparkiDev/sp_int_32_bit
SP int SP_WORD_SIZE=32: cast down explicitly
2021-02-09 15:56:49 -08:00
toddouska
fc30f379ee Merge pull request #3736 from SparkiDev/sp_int_neg_zero
SP int neg: fix handling of negative zero and mp_cond_copy
2021-02-09 15:48:21 -08:00
Sean Parkinson
ca3c5bf6c4 SP math lshb: check space for result 2021-02-10 08:58:58 +10:00
Sean Parkinson
9792e062c3 SP int: allow faster NCT exptmod to be compiled in
For small builds, this may be needed to get the right performance.
2021-02-10 08:51:32 +10:00
kaleb-himes
6d23728a56 Fusion RTOS porting round 3 2021-02-09 15:33:06 -07:00
David Garske
47d5f6f624 Merge pull request #3714 from SparkiDev/sp_int_rsavfy 2021-02-09 07:28:40 -08:00
Sean Parkinson
5818923762 Merge pull request #3723 from douzzer/AesCcmEncrypt-zero-inSz-null-in
AES-CCM null payload buffers with inSz zero
2021-02-09 17:22:03 +10:00
Daniel Pouzzner
bdd4ceb445 aes.c: fix overwide code text in wc_AesCcmEncrypt(). 2021-02-08 21:50:29 -06:00
Sean Parkinson
539ef512fc SP int neg: fix handling of negative zero and mp_cond_copy
mp_cond_copy: copy sign when available.
Check for zero and ensure sign is MP_ZPOS.
2021-02-09 11:03:06 +10:00
Kareem Abuobeid
a4e819c60a Added support for reading S/MIME messages via SMIME_read_PKCS7. 2021-02-08 17:14:37 -07:00
Sean Parkinson
763f388471 SP int: get rsavfy and rsapub working again 2021-02-09 09:58:23 +10:00
toddouska
0d499a28e5 Merge pull request #3725 from elms/build/fix_distcheck
build: fix `make distcheck`
2021-02-08 15:57:04 -08:00
Daniel Pouzzner
7a583d5b4b aesccm_test(): test for (and require) BAD_FUNC_ARG when in or out pointer to wc_AesCcm{En,De}crypt() is null and inSz > 0. 2021-02-08 16:43:38 -06:00
Daniel Pouzzner
b8a019dedd AES-CCM: allow null payload buffers in wc_AesCcmEncrypt() and wc_AesCcmDecrypt() when inSz is zero, and add to aesccm_test() a test for this, tolerating early BAD_FUNC_ARG (for FIPS and arch-specific 3rd party code), and a test for the zero-length string, that must succeed. 2021-02-08 16:34:09 -06:00
David Garske
dda4c3b3c4 Merge pull request #3724 from embhorn/zd11646
Move var declaration to top
2021-02-08 11:09:28 -08:00
Jacob Barthelmeh
812b44d58e guard check on prime with macro WOLFSSL_VALIDATE_ECC_IMPORT 2021-02-08 20:25:01 +07:00
Sean Parkinson
36d124ed2f Merge pull request #3730 from guidovranken/zd11650
SP math: Better error propagation
2021-02-08 14:17:43 +10:00
Sean Parkinson
c3cc36c55f SP int SP_WORD_SIZE=32: cast down explicitly 2021-02-08 13:20:12 +10:00
Sean Parkinson
7986b37aa5 SP int: fixes for 8-bit digits
Fix mask type in mp_cond_copy to be at least 16 bits to handle 'used'
being larger than 8-bit but mp_digit being 8-bit.
When large numbers are used with 8-bit words, mul/sqr partial sums will
overflow a word. Fix implementations to handle this.
2021-02-08 12:24:28 +10:00
Sean Parkinson
aefddaf2b8 SP int: mont_red - check size of a relative to m 2021-02-08 10:07:15 +10:00
Jacob Barthelmeh
cced2038b8 conditional compile and check on idx 2021-02-08 06:10:04 +07:00
Guido Vranken
358dbd5090 _sp_exptmod_base_2: Break out of loops on error 2021-02-08 00:09:29 +01:00
Sean Parkinson
2933db8915 Merge pull request #3729 from guidovranken/zd11649
SHA 256,512: Only write hash if no error has occurred
2021-02-08 08:47:51 +10:00