19760 Commits

Author SHA1 Message Date
Lealem Amedie
84ea15039f Remove XMEMSET after XFREE in sniffer.c 2023-04-25 09:16:39 -06:00
JacobBarthelmeh
57de292d19 add guard for random with CAAM + MQX 2023-04-24 16:29:22 -07:00
JacobBarthelmeh
3e5c8af571
Merge pull request #6322 from lealem47/remove_shellscript
Fix for CMake with USER_SETTINGS on Windows
2023-04-24 17:01:57 -06:00
JacobBarthelmeh
a991ce1a6b
Merge pull request #6327 from SparkiDev/memusage_5
Memory usage improvements
2023-04-24 16:42:56 -06:00
lealem47
a10526d5f9
Async sniffer: don't retry if seeing non-pending error (#6220)
* Async sniffer: don't retry if seeing non-pending error

* Print error messages when decrypting from queue

* Zeroize the SessionTable in ssl_FreeSniffer()

---------

Co-authored-by: Lealem Amedie <lealem47@github.com>
2023-04-24 13:51:55 -07:00
David Garske
9b7ca65608
Merge pull request #6330 from douzzer/20230421-configure-fixes
20230421-configure-fixes
2023-04-24 09:35:48 -07:00
JacobBarthelmeh
e1d1bef085
Merge pull request #6321 from SparkiDev/sp_int_missing_brace
SP int: missing brace
2023-04-24 10:00:39 -06:00
JacobBarthelmeh
cfeb8b9aee
Merge pull request #6332 from SparkiDev/bn_to_asn1_fix
BN_to_ASN1_INTEGER: fix handling of padding
2023-04-24 09:58:12 -06:00
Sean Parkinson
673d72a2dc OpenSSL EC API: fix setting private key
wolfSSL_EC_KEY_set_private_key() should fail on obvious bad private key
values.
2023-04-24 17:59:32 +10:00
Sean Parkinson
2d06718857 Memory usage improvements
TLS 1.3 Server: don't cache the messages for Ed25519/Ed448 when doing
TLS 1.3.

ASN DecodeCertInternal: Call GetCertName for issuer and subject after
freeing the dataASN.
2023-04-24 11:12:00 +10:00
Sean Parkinson
6634ec198e BN_to_ASN1_INTEGER: fix handling of padding
Incorrect calculation of when padding byte needed and consequently
adding byte manually when properly handled by SetASNInt().
2023-04-24 09:30:38 +10:00
Sean Parkinson
865581704e
Merge pull request #6312 from philljj/zd15961
Fix out-of-bounds write in fp_mod_2d.
2023-04-24 08:03:02 +10:00
Daniel Pouzzner
800f4df7a3 fix typos in configure.ac (from shellcheck --severity=warning). 2023-04-21 16:05:43 -05:00
Daniel Pouzzner
32ff165d8b remove buggy+bug-prone WOLFSSL_NO_XOR_OPS setup in settings.h. 2023-04-21 16:05:20 -05:00
JacobBarthelmeh
60d059fc9e
Merge pull request #6305 from SparkiDev/sp_radix_size_stack_fix
SP int: sp_radix_size when radix 10 fix temp size
2023-04-21 09:59:56 -06:00
JacobBarthelmeh
e194c90b3e
Merge pull request #6326 from SparkiDev/ecc_key_max_bits_fix
ECC: max bits for a key must handle order as well
2023-04-21 09:47:42 -06:00
JacobBarthelmeh
12cec5ec61
Merge pull request #6325 from SparkiDev/memusage_fix_4
Memory Usage fixes
2023-04-21 09:37:11 -06:00
tmael
1106e5ff0e
TLS v1.3: Support a stateful ticket and test HAVE_EXT_CACHE (#5960)
* Add TLSv1.3 stateful support
Fix internal and external session cache

* session cache fixes

* Refactor

- implement wolfSSL_CTX_flush_sessions
- use wolfSSL_CTX_flush_sessions to make test_wolfSSL_CTX_add_session_ext deterministic
- add dtls to test_wolfSSL_CTX_add_session_ext
- DoClientTicket_ex does not modify ssl object
- only call session remove callback on:
  - timeout
  - session is being overwritten/removed from the cache

* Session fixes

- restore bogus ID on session duplicate
- don't evict on overwrite
- use memmove instead on memcpy as `ssl->session == session` is possible
- ignore ClientSession parameter in AddSessionToCache on NO_SESSION_CACHE_REF
- use sessionID when altSessionID not present

* Session fixes

- DoClientTicketFinalize: always copy in the ID as teh altSessionID
- don't overwrite ex_data when overwriting cacheSession and cacheSession owns it

* Callback wants to retain a copy

* wolfSSL_GetSessionClient: ssl->ctx->get_sess_cb does not apply here

* test_wolfSSL_CTX_add_session_ext 

gate expected results on WOLFSSL_DTLS_NO_HVR_ON_RESUME

* TlsSessionIdIsValid: copy return can't be ignored

* Silence unused parameter

* test_wolfSSL_CTX_add_session_ext: handle async case

* Gate wolfSSL_SSL_CTX_remove_session on NO_SESSION_CACHE

* ssl.c: style fixes

* Add twcase_get_sessionCb_cleanup to free external cache

* Remove hard tab

* Correct build error in wolfSSL_CTX_flush_sessions

* Jenkins fixes:

- altSessionID only available with WOLFSSL_TICKET_HAVE_ID
- slim out psk_sess_free_cb_ctx

* Stateful dtls case has 2 accesses. Stateless just one.

* Add version numbering to hostap logs

* Import internal.h for test_wolfSSL_SESSION_get_ex_new_index

* wolfSSL_SetSession: don't check SslSessionCacheOff for session setting

* wolfSSL_SetSession: fully set expired session for OpenSSL compatibility

* wolfSSL_SetSession: check if setting same object

* AddSession: always populate the session object to allow re-use

* Add logging to wolfSSL_NewSession and wolfSSL_FreeSession

* Always setup session object

* Check if session has been setup before setting it

* Print errors in async test

* Make SetupSession available outside NO_SESSION_CACHE

* Review comments

* Fix ticBuf leak and TlsSessionIdIsValid logic

* Fix unmatched curly brackets

* TlsSessionIdIsValid: always need to check copy var

* TlsResumptionIsValid: set resume to FALSE default

* wolfSSL_SetSession: remove now variable since only used in one place

* Move internalCacheLookupOff into HAVE_EXT_CACHE block

---------

Co-authored-by: Juliusz Sosinowicz <juliusz@wolfssl.com>
2023-04-21 06:46:08 -07:00
Sean Parkinson
9230d9cfe3
Merge pull request #6185 from lealem47/time_check
Adding NO_ASN_TIME_CHECK build option
2023-04-21 11:55:52 +10:00
Sean Parkinson
0cc50521b6 ECC: max bits for a key must handle order as well
The order may be 1 bit larger than prime for some curves.
Handle this in calculation of maximum size of curve.

SP int _sp_mont_red(): ensure m->used is never 0 when doing default
implementaion.
2023-04-21 11:23:47 +10:00
Sean Parkinson
d414ae9492 Memory Usage fixes
Ed25519CheckPubKey/Ed448CheckPubKey: get the public key from certificate
in a new function, wc_CertGetPubKey, that uses less memory.
Set the ENCRYPT_BASE_BITS to minimal values when Curve448/Curve25519 are
the largest public key algorithms.
2023-04-21 09:59:38 +10:00
Sean Parkinson
0bae919a9c SP int: ensure declaration of sp_ints are with valid values
Move declaration of sp_ints until after checks of valid parameters.
In particular, whether used field of input/s are valid.
Pull implementations of algorithms out into separate functions as a
pattern to fix.
2023-04-21 08:48:38 +10:00
Sean Parkinson
8994aab0ed SP int: sp_radix_size when radix 10 fix temp size
SP int should be able to calculate size of encoded number for a radix of
10 when mp_int has all digits used.
sp_radix_size declared a temporary mp_int of 1 greater than input. Don't
need it 1 greater. Stack declaration of maximum plus one caused address
sanitizer error.
Changed temporary mp_int to be same size as input mp_int.
2023-04-21 08:46:46 +10:00
Lealem Amedie
42be04f323 Remove duplicate line 2023-04-20 16:45:53 -06:00
Lealem Amedie
a963adc33d Add more comments for alternatives and security risk 2023-04-20 14:36:22 -06:00
Lealem Amedie
b0c6a3ec75 Adding NO_ASN_TIME_CHECK build option 2023-04-20 14:16:00 -06:00
JacobBarthelmeh
d099fe34b5
Merge pull request #6324 from SparkiDev/sp_int_thumb_asm_r7
SP int: ARM Thumb ASM don't use r7 on debug
2023-04-20 10:51:19 -06:00
JacobBarthelmeh
ebff7f46b7
Merge pull request #6323 from SparkiDev/sp_c_to_bin_mp_fix
SP C: fix handling of oversized arrays
2023-04-20 09:24:06 -06:00
David Garske
c761f587f6
Merge pull request #6278 from julek-wolfssl/fix-zephyr
Zephyr port update
2023-04-20 06:48:02 -07:00
Sean Parkinson
1d94521abe SP int: ARM Thumb ASM don't use r7 on debug
When DEBUG is defined, use versions of assembly code that don't use
register r7.
2023-04-20 15:13:54 +10:00
Sean Parkinson
574d8c3f63
Merge pull request #6319 from douzzer/20230418-more-Wconversion-fixes
20230418-more-Wconversion-fixes
2023-04-20 13:19:07 +10:00
Sean Parkinson
32e2775d34 SP C: fix handling of oversized arrays
For mul and sqr implementation efficiency the fixed array has extra
digits beyond what is needed. When encoding, only put in the useful
digits.
2023-04-20 12:42:51 +10:00
Daniel Pouzzner
da9cda7eae wolfcrypt/src/pkcs12.c: fix non-portable casts;
wolfcrypt/src/sp_int.c: use unsigned int, not word32, for sign variables, to match type in header file.
2023-04-19 21:22:34 -05:00
Lealem Amedie
fa914a0054 Let hashbang decide which shell to run with instead of default shell 2023-04-19 18:13:57 -06:00
Lealem Amedie
cc8b789545 Remove shellscript dependency from CMake with WOLFSSL_USER_SETTINGS 2023-04-19 17:20:33 -06:00
Sean Parkinson
4ec23571c6 SP int: missing brace
Missing a brace in sp_exptmod_ex().
2023-04-20 08:27:44 +10:00
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
JacobBarthelmeh
0186fb7114
Merge pull request #6313 from anhu/empty_stack
Should not be an error to call wolfSSL_X509_REQ_add_extensions with...
2023-04-19 10:32:06 -06:00
Juliusz Sosinowicz
c9d91c5e79 Zephyr port update
- Add CONFIG_PTHREAD_IPC when using threads
- Add logging config suggestions
- test.c: fix undefined `ret` error
- Increase stack size for samples
- Ignore ASN_BEFORE_DATE_E in examples
- wc_port.h: add missing posix thread includes
- wc_port.h: move definitions to relevant section
- benchmark.c: fix missing `arc` and `argv` errors
- benchmark.c: fflush does not work on stdout in Zephyr
- Update z_fs_open implementation to support flags
2023-04-19 18:18:00 +02: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