Commit Graph

6481 Commits

Author SHA1 Message Date
Daniel Pouzzner
2a00b67056 revert change in wc_ShaFinal() capturing InitSha() retval, introduced in 510038022f, to (void)ed result. 2023-04-19 17:25:33 -05:00
Daniel Pouzzner
8f610bb156 fix for retval overwrite (warned by clang-analyzer-deadcode.DeadStores) in sha.c:wc_ShaFinal();
fix for benign clang-analyzer-deadcode.DeadStores in aes.c:wc_AesFeedbackEncrypt();

fix for cppcheck:selfAssignment in chacha.c:wc_Chacha_wordtobyte().
2023-04-19 15:53:48 -05:00
Daniel Pouzzner
f396989d20 more -Wconversion fixes, now covering everything inside the 140-3 boundary with default build options, everything in wolfcrypt with default build options, all modes of AES, builds with/without intelasm, all permutations of c89/c99 32/64 bit, and much of the crypto-all-cryptonly boundary;
also a gating fix for asn.c:SetShortInt().
2023-04-19 15:26:05 -05:00
JacobBarthelmeh
3865f943c3 Merge pull request #6203 from julek-wolfssl/xor-optim
Try to XOR as many words as possible in xorbuf APIs
2023-04-19 11:59:33 -06:00
JacobBarthelmeh
0e64972c86 Merge pull request #6316 from SparkiDev/memusage_fix_3
ASN.1 template: CheckCertSignature memory usage fix
2023-04-19 10:37:11 -06:00
Juliusz Sosinowicz
81c9062973 sakke.c: use xorbuf 2023-04-19 17:06:25 +02:00
Juliusz Sosinowicz
bed99401a0 hpke.c: use xorbufout in wc_HpkeContextComputeNonce 2023-04-19 17:06:25 +02:00
Juliusz Sosinowicz
3c57228197 aes.c: Use xorbufout when possible 2023-04-19 17:06:25 +02:00
Juliusz Sosinowicz
6079b92e26 xorbuf: fix alignment when possible 2023-04-19 17:06:25 +02:00
Juliusz Sosinowicz
82e8eb2f70 rsa.c: Use xorbuf when possible 2023-04-19 17:06:25 +02:00
Juliusz Sosinowicz
e7ae64d9b5 pkcs12.c: Ignore param when heap not used 2023-04-19 17:05:03 +02:00
Juliusz Sosinowicz
7a0d6487b7 Simplify ctMaskCopy 2023-04-19 17:05:03 +02:00
Juliusz Sosinowicz
b91f3063ea Use xorbuf in 3des for FREESCALE_MMCAU 2023-04-19 17:05:03 +02:00
Juliusz Sosinowicz
aeb4338085 Use xorbufout in chacha 2023-04-19 17:05:03 +02:00
Juliusz Sosinowicz
8fe321d5be Try to XOR as many words as possible in xorbuf APIs 2023-04-19 17:05:03 +02:00
Chris Conlon
81ab16b105 Merge pull request #6314 from TakayukiMatsuo/vla2 2023-04-19 08:11:40 -06:00
gojimmypi
510038022f Various Espressif HW crypto, SHA2, AES, MP updates. (#6287)
* various Espressif HW crypto, SHA2, AES, MP updates.

* code review updates & cleanup

* clean trailing whitespace

* cleanup per code review

* removed additional unused WOLFSSL_USE_ESP32C3_CRYPT_HASH_HW

* Code review updates; pack & order WC_ESP32SHA

* clean up TAG text for Espressif ESP_LOG()
2023-04-19 06:10:22 -07:00
Sean Parkinson
436c647acc Memory Usage: reduce maximum in use
CheckCertSignature
Free the dataASN before calling ConfirmSignature.
dataASN not needed at this point and ConfirmSignature uses lots of
memory.

DecodeCertInternal:
Free the dataASN before calling DecodeCertExtensions,
dataASN not needed at this point and DecodeCertExtensions uses more
memory.

ecc_verify_hash:
v doesn't need to be a new allocated variable - reuse w.
v is the modular reduction of x-ordinate to prime calculated at end.
2023-04-19 16:44:34 +10:00
David Garske
70322f620d Merge pull request #6303 from douzzer/20230414-yet-more-c89
20230414-yet-more-c89
2023-04-18 16:00:12 -07:00
JacobBarthelmeh
c67de7f914 Merge pull request #6308 from SparkiDev/sp_mod_err_check
SP int: sp_mod check sp_div error before adding and replacing error
2023-04-18 15:44:50 -06:00
JacobBarthelmeh
8b79248eab Merge pull request #6307 from SparkiDev/decode_ecdsa_sig_inited
ECC, ASN.1: DecodeECC_DSA_Sig didn't handle r and s being initialized
2023-04-18 15:43:42 -06:00
JacobBarthelmeh
a525fa19f4 Merge pull request #6306 from SparkiDev/wc_ecc_is_point_check_args
ECC: wc_ecc_is_point - validate parameters
2023-04-18 15:37:22 -06:00
TakayukiMatsuo
cc747f0094 Add WOLFSSL_SP_NO_DYN_STACK macro to avoid compilation error in CC-RX compiler 2023-04-19 04:39:49 +09:00
Daniel Pouzzner
f1a674eec9 wolfcrypt/src/wc_port.c: in wc_FileLoad(), use ssize_t for fileSz, not long int, for portability. 2023-04-18 14:30:38 -05:00
Daniel Pouzzner
4180a650c8 fix clang-analyzer-deadcode.DeadStores in wolfcrypt/src/asn.c:SetOthername(). 2023-04-18 14:27:52 -05:00
Daniel Pouzzner
a4aef0e55d refinements from peer review for #6303. 2023-04-18 12:23:24 -05:00
Daniel Pouzzner
193919a276 add wc_strcasecmp() and wc_strncasecmp() to wc_port.c, and set up (USE_WOLF_STR[N]CASECMP) in types.h for targets lacking native implementations (including WOLF_C89);
define USE_WOLF_STRSEP if defined(WOLF_C89).
2023-04-18 12:23:24 -05:00
Daniel Pouzzner
4b9302cdb3 another batch of -Wconversion fixes. 2023-04-18 12:23:24 -05:00
gojimmypi
98b718f91b wolfcrypt polish: init, checks, corrections (#6249)
* wolfcrypt polish: init, checks, corrections
2023-04-18 09:41:42 -07:00
Sean Parkinson
59c113d358 SP int: sp_mod check sp_div error before adding and replacing error
Fix to not overwrite error when sp_div fails in sp_mod.
2023-04-18 09:38:13 +10:00
Sean Parkinson
eddcf0c0ee ECC, ASN.1: DecodeECC_DSA_Sig didn't handle r and s being initialized
New creation of mp_ints r and s to be minimal size must not be
re-initialized.
Changes to ASN.1 code to handle r and s being initialized and to not
initialize again.
2023-04-18 09:37:23 +10:00
Sean Parkinson
04ae676629 ECC: wc_ecc_is_point - validate parameters
Public API wc_ecc_is_point() needs to validate the parameters.
Ensure that the x and y are in range [0, p-1] and z is one (affine
ordinates).

Made the API a wrapper around existing calculation code.
When x-ordinate is a large negative, then it will spend large amounts of
time adding the prime to a large negative intermediate value.
2023-04-18 09:35:22 +10:00
Anthony Hu
120d1f0d1a Support in the compatibility layer for UPN and SID. 2023-04-17 14:42:27 -04:00
Daniel Pouzzner
1bed740710 address peer review: make C89-compatible refactors in sakke_pairing() and sakke_modexp_loop(); add explanatory comment for WOLF_ENUM_DUMMY_LAST_ELEMENT() in types.h. 2023-04-14 15:07:05 -05:00
Daniel Pouzzner
ac85cfa3d5 fix "comma at end of enumerator list" warnings in wolfcrypt for C89 compatibility, mostly by just snipping out unneeded comma, but several using WOLF_ENUM_DUMMY_LAST_ELEMENT() to preserve gated enum values as-is. 2023-04-14 13:48:03 -05:00
Daniel Pouzzner
d5588af0a2 wolfcrypt/src/sakke.c: fixes for C89 "initializer element is not computable at load time". 2023-04-14 13:29:26 -05:00
Daniel Pouzzner
105714460c wolfcrypt/src/fe_448.c: fix declaration-after-statement in fe448_mul_8(). 2023-04-14 13:29:26 -05:00
Daniel Pouzzner
edf95dbcbd add WOLF_C89 clauses to the W64LIT() definitions in wolfssl/wolfcrypt/types.h, and wrap several long long numeric literals with W64LIT() in wolfcrypt/src/{aes.c,blake2b.c,siphash.c};
add WOLF_C89 handling to SP_ULONG_BITS and SP_ULLONG_BITS setup in wolfssl/wolfcrypt/sp_int.h.
2023-04-14 13:29:26 -05:00
JacobBarthelmeh
00aa061d77 Merge pull request #6300 from douzzer/20230413-fixes
20230413-fixes
2023-04-13 15:41:51 -06:00
Daniel Pouzzner
358af4ef05 fix for cppcheck/zerodivcond in wolfcrypt/src/pkcs7.c:wc_PKCS7_DecodeAuthEnvelopedData();
fixes for clang-tidy/bugprone-macro-parentheses in wolfssl/wolfcrypt/sp_int.{c,h} and wolfcrypt/src/ecc.c;

fix for clang-analyzer-deadcode.DeadStores in olfcrypt/src/asn.c.
2023-04-13 14:51:29 -05:00
JacobBarthelmeh
9a0934161d fix for wpas build with x509 small 2023-04-13 10:38:12 -07:00
JacobBarthelmeh
441b78e5a2 Merge pull request #6284 from douzzer/20230410-Wconversion-fixes
20230410-Wconversion-fixes
2023-04-12 17:07:24 -06:00
Daniel Pouzzner
c41030663e wolfcrypt/src/pkcs7.c: correct fix for clang-analyzer-core.DivideZero in wc_PKCS7_DecodeAuthEnvelopedData(). 2023-04-12 16:37:20 -05:00
David Garske
b7ff375ac6 Fix PKA build error with SP sign. Fix U5/H5/H7 hashing, which require a workaround to write an extra 32-bit to flush FIFO before save/restore. 2023-04-12 13:45:29 -07:00
JacobBarthelmeh
2c26b068b2 Merge pull request #6239 from dgarske/stm32h5
Support for STM32H5
2023-04-12 14:33:25 -06:00
Daniel Pouzzner
4b59588cf3 more fixes for implicit casts, mostly asn=original. 2023-04-12 02:17:18 -05:00
Daniel Pouzzner
fe2acb53af wolfcrypt/src/ecc.c:fix overstringent arg check in wc_ecc_gen_k(). 2023-04-12 01:37:09 -05:00
Daniel Pouzzner
7155c5748e fix overlong lines. 2023-04-12 01:37:09 -05:00
Daniel Pouzzner
99ffd7726f wolfcrypt/src/pkcs7.c:wc_PKCS7_DecodeAuthEnvelopedData(): fix clang-analyzer-core.DivideZero (expBlockSz not properly set before use as a denominator in a mod op). 2023-04-12 01:37:09 -05:00
Daniel Pouzzner
ed11669f3c more fixes for implicit casts, including asn=template. 2023-04-12 01:37:09 -05:00