1501 Commits

Author SHA1 Message Date
Daniel Pouzzner
2111d6b179
Merge pull request #5322 from SparkiDev/sp_math_all_arm32_div_word_fix
SP math all: fix div word for ARM32
2022-07-06 22:18:07 -05:00
Sean Parkinson
992c7b3b6f SP math all: fix div word for ARM32
Fixup sp_mulmod NULL access.
2022-07-07 08:56:31 +10:00
David Garske
a7fa7875e4
Merge pull request #5244 from julek-wolfssl/wpas-dpp
Support for new DPP and EAP-TEAP/EAP-FAST in wpa_supplicant
2022-07-06 11:35:52 -07:00
David Garske
1c009e8f91
Merge pull request #5311 from SparkiDev/ed_check_pubkey
Ed25519/Ed448: assume public key is not trusted
2022-07-05 09:25:50 -07:00
Juliusz Sosinowicz
ee3636f2e7 wc_EccPublicKeyToDer_ex: exporting the public key in compressed form 2022-07-05 08:48:18 +02:00
Juliusz Sosinowicz
448cde5a4b Support for new DPP in wpa_supplicant
- Add null check to asn template code in MakeCertReq and test
- ENABLED_ECCCUSTCURVES can also be "all"
2022-07-05 08:48:18 +02:00
Daniel Pouzzner
5819332f89
Merge pull request #5312 from dgarske/fips_v5dev
FIPS in core hash using SHA2-256 and SHA2-384
2022-07-01 23:25:52 -05:00
David Garske
b9be5c2c24 Update to FIPS v5-ready will use latest master. Support for FIPS in core hash using SHA2-256 and SHA2-384 in fips_test.h. Fixes for MATH_INT_T. Fix error: ‘tls13_kdf_test’ declared ‘static’ but never defined. 2022-07-01 15:40:21 -07:00
Kareem
90749b7f88 Don't declare tls13_kdf_test if TLS 1.3 is not enabled, to avoid unused function warning. 2022-07-01 13:22:16 -07:00
Sean Parkinson
2c943282f0 Ed25519/Ed448: assume public key is not trusted
In defense against attack, assume the imported public key is not trusted
and check it matches the private key if set.
Added APIs that allow application to explicitly trust public key.
Original APIs default to not trusting public key.
2022-07-01 09:05:43 -07:00
David Garske
00b82888bc
Merge pull request #4759 from dgarske/sp_math_default
Enable wolfSSL SP Math all (sp_int.c) by default
2022-06-23 16:14:54 -07:00
David Garske
78d3284c3c Fix for FIPS 140-2 and older ACVP math selection. Fix for building with "--disable-sp-math-all --disable-fastmath". Fix for building SAKKE with HAVE_WOLF_BIGINT. 2022-06-23 11:10:44 -07:00
Sean Parkinson
ee12c12e98 Fixes required to make SP Math default
fasthugemath means turn on fastmath
Use sp_int_digit and not sp_digit in sp_int.c.
test.c needs to use large static buffer when SP Math used like fastmath.
When building static memroy, SP math all without WOLFSSL_SP_NO_MALLOC is
a valid configuration.
Fix freeing of bigint in sp_int.c.
Cast x to a signed value to negate and then back to unsigned. (For
Windows builds.)
Remove warning about empty file on Windows about integer.obj.
Allow RSA verify only and RSA public only to be used with other public
key algorithms.
If building for FIPS, then older versions of RSA and ECC require SP Math
to support negative numbers.
Get old FIPS files building with SP int.
Disallow --enable-sp-math and --enable-sp-math-all.
When just --enable-sp-math on configuration line then disable SP Math
all.
2022-06-23 14:15:54 +10:00
David Garske
390908bccc
Merge pull request #5236 from SparkiDev/mem_zero
Check memory is zeroized
2022-06-17 12:01:34 -07:00
Sean Parkinson
1b29f7353a Check memory is zeroized
Add a define WOLFSSL_CHECK_MEM_ZERO to turn on code that checks that
memory that must be zeroized before going out of use is zero.
Everytime sensitive data is put into a allocated buffer or stack buffer;
the address, its length and a name is stored to be checked later.
Where the stack buffer is about to go out of use, a call is added to
check that the required parts are zero.

wc_MemZero_Add() adds an address with length and name to a table of
addressed to be checked later.
wc_MemZero_Check() checks that the memory associated with the address is
zeroized where required.
mp_memzero_add() adds mp_int's data pointer with length and name to
table.
mp_memzero_check() checks that the data pointer is zeroized where
required.

Freeing memory will check the address. The length was prepended on
allocation.
Realloction was changed for WOLFSSL_CHECK_MEM_ZERO to perform an
allocate, check, copy, free.
2022-06-16 10:22:32 +10:00
David Garske
7e1549c684 Cleanup the RSA consistency check. Should only be enabled for FIPS v2 (3389), FIPS v5 or later. Can be forcefully enabled for non-FIPS using WOLFSSL_RSA_KEY_CHECK. The existing WOLFSSL_NO_RSA_KEY_CHECK macro will also disable it. This change was introduced in PR #4359. 2022-06-15 14:46:23 -07:00
Sean Parkinson
f1ce0cc95d Memory zeroization fixes
Zeroize secrets in stack buffers and allocated memory.
mp_forcezero to ensure private MP integers are zeroized.
Fix whitespace and add some comments.
2022-06-15 11:26:11 +10:00
Chris Conlon
364bf482eb adjust wolfCrypt test/benchmark Android log TAG name, reset malloc/free counts in memcb_test() 2022-06-13 09:42:02 -06:00
David Garske
802e3127c0
Merge pull request #5145 from JacobBarthelmeh/caam
CAAM support with QNX i.MX8, add AES-CTR crypto callback
2022-06-03 15:24:10 -07:00
Tesfa Mael
aca199cb05 Fix to compile with c89
strncasecmp and snprintf are unavailable in C89
use // static analyzer suppressions
2022-05-27 14:20:37 -05:00
David Garske
da1cbfda46
Merge pull request #5178 from cconlon/nounaligned
Add define to skip SHA-512 unaligned memory test in test.c
2022-05-25 09:55:29 -07:00
Chris Conlon
321d404d6b add define to skip unaligned memory tests in test.c 2022-05-24 11:55:21 -06:00
Daniel Pouzzner
b66fa1680a fix whitespace. 2022-05-24 12:13:14 -05:00
David Garske
b5d65b9579
Merge pull request #5159 from kareem-wolfssl/fipsv3HmacMd5
Allow using 3DES and MD5 with FIPS 140-3, as they fall outside of the FIPS boundary.
2022-05-20 18:40:29 -07:00
Kareem
832a7a40a6 Allow using 3DES and MD5 with FIPS 140-3, as they fall outside of the FIPS boundary. 2022-05-19 12:06:20 -07:00
Hideki Miyazaki
54a96cef06
add test case 2022-05-18 11:16:10 +09:00
Hideki Miyazaki
c1f117413f
get crypto only compiled with openssl extra 2022-05-18 11:16:03 +09:00
John Safranek
7305616452
Merge pull request #5080 from JacobBarthelmeh/DH
with WOLFSSL_NO_DH186 restriction allow odd DH param size generations
2022-05-13 08:57:33 -07:00
Jacob Barthelmeh
5caef7eaba avoid dead store with test case 2022-05-11 11:53:17 -06:00
Daniel Pouzzner
26673a0f28 where appropriate, use strcmp/strcasecmp, not strncmp/strncasecmp;
add macro XSTRCASECMP();

update XSTRNCASECMP() for XC32 >= 1.00 to use strncasecmp.
2022-05-10 12:20:12 -05:00
David Garske
421f54e60a
Merge pull request #5118 from douzzer/20220405-declaration-after-statement
20220405 declaration after statement
2022-05-06 16:16:52 -07:00
Daniel Pouzzner
99b44f15ef fix various -Wdeclaration-after-statement, with and without --enable-smallstack. 2022-05-06 13:34:32 -05:00
Tesfa Mael
ffe5599013 Fix testsuite 32-bit build 2022-05-05 08:08:09 -07:00
Tesfa Mael
ca955032a0 Fix 32-bit enable-trackmemory build 2022-05-03 20:48:38 -07:00
John Safranek
3294a3f8f8
Certificate Extension Generation Test
The test for certificate extensions requires both the test certs option
and the certificate generation option to run. The certs for the test are
generated by wolfCrypt. This disables the extensions test if
certificate generation is disabled.
2022-04-27 13:08:28 -07:00
JacobBarthelmeh
c0d7f3b2e6 add support for i.MX8 with QNX CAAM 2022-04-27 02:27:05 -07:00
David Garske
704a18d103
Merge pull request #5079 from tmael/rsa_vfg
Fix no malloc RSA  test
2022-04-26 08:11:44 -07:00
Jacob Barthelmeh
9bf4a94796 with WOLFSSL_NO_DH186 restriction allow odd DH param size generations 2022-04-25 15:13:24 -06:00
Tesfa Mael
85ef91ce6d Move up local variable at the beginning 2022-04-25 12:40:31 -07:00
David Garske
34d541109d Additional scan-build warning fixes. 2022-04-25 09:55:36 -07:00
Tesfa Mael
18a6a7c4a7 Fix RSA nomalloc test 2022-04-25 09:50:50 -07:00
David Garske
84a33183a6 Various scan-build fixes. 2022-04-22 16:02:54 -07:00
David Garske
659d33fdaf Fixes for minor sniffer and async issues:
* Sniffer: Remove old restrictions for max strength, encrypt-then-mac and forcing openssl-extra.
* Fix bound warning with strncpy in sniffer.c.
* Fix for async DH issue.
* Fix for SP math all not initializing raw big int.
* Fix for array bounds warning with "-O3" on SetEccPublicKey.
* Fix a sniffer async edge case with TLS v1.2 static RSA and extended master.
* Improved the sniffer test script detection of features.
* Disable ECC custom curve test with Intel QuickAssist.
2022-04-18 11:46:40 -07:00
Sean Parkinson
284ebacc57
Merge pull request #4916 from JacobBarthelmeh/hsm
Add SECO use and expand cryptodev
2022-04-07 10:21:32 +10:00
David Garske
1b5af2fdd9
Merge pull request #5022 from SparkiDev/wycheproof_fixes
Wycheproof fixes/changes
2022-04-06 10:29:17 -07:00
JacobBarthelmeh
2a0b726c15 add AES init functions to ECB test case 2022-04-06 09:42:38 -07:00
JacobBarthelmeh
91d883d99f macro guard on ECB test case and use realloc for hash 2022-04-06 07:04:17 -07:00
Sean Parkinson
e9187f5f00 Wycheproof fixes/changes
Allow Chachac20-Poly1305 to take an empty msg.
Allow AES-SIV to have an empty nonce.
Don't allow the length to be malleable. Must use the smallest number of
bytes to represent value.
ECDSA and DSA signature values are positive.
Add Sha512-224 and Sha512-256 OIDs.
ASN template - ensure the ECDSA/DSA signature uses all data.
Curve25519/Curve448 - WOLFSSL_ECDHX_SHARED_NOT_ZERO means shared secret
can't be 0.
Curve25519/Curve448 - check public value is less than order.
ECC - x or y may be zero but not both.
Ed25519/Ed448 - check S is less than order.
Ed448 - ge_p3_dbl can be simplified for ASM.
Prime check (integer.c/tfm.c/sp_int.c): Don't allow negative values and
make sure random candidate doesn't have bits higher than those in a set
when bits not a multiple of 8.
RSA: support Sha512-224 and Sha512-256.
RSA: Fix check for invalid in decryption. Affects plaintexts 256 bytes
and longer.
RSA: Don't allow base be larger than modulus.
RSA: Check small ciphertext (1 or 0) on decrypt when not using OAEP.
RSA: WOLFSSL_RSA_DECRYPT_TO_0_LEN allows decrypted value to be 0.
SP math all: fix div to handle large a and d when checking size of
remainder.
SP math all: set sign of result in sp_mod_2d()
2022-04-06 15:35:01 +10:00
JacobBarthelmeh
a338b4c933 refactor SHA grew function, revert benchmark devid, increase SHA_CTX size, add AES ECB cryptocb test 2022-04-05 14:45:18 -07:00
David Garske
4f5aa81031
Merge pull request #5000 from ejohnstown/tls13-wctest
Add TLSv1.3 KDF to wolfCrypt Test
2022-04-05 10:45:35 -07:00