19726 Commits

Author SHA1 Message Date
Sean Parkinson
d901433999 SP int ARMv6: clz not available, correct #if
Checking for architecture less than 7 to use clz instruction when clz is
only guaranteed to be available in 7 or more. Reverse logic.
2023-04-27 09:41:31 +10:00
JacobBarthelmeh
ca4a17ebf6
Merge pull request #6339 from SparkiDev/asn_orig_ocsp_fix
ASN original, OCSP: fix maximum size calc to GetDateInfo
2023-04-26 16:36:55 -06:00
JacobBarthelmeh
ccb9bdd903
set dev ID with signature check (#6318)
* set dev ID with signature check

* refactor devId use and add API to set devId in WOLFSSL_CERT_MANAGER structure

* add api.c call to set devid with WOLFSSL_CERT_MANAGER

* resolving devID CRL issue and CM pointer

* add device find callback

* add simple test case
2023-04-26 11:19:00 -07:00
David Garske
3556b7adb7
Merge pull request #6338 from JacobBarthelmeh/certs
revert WOLFSSL_NO_ASN_STRICT macro guard
2023-04-26 11:16:04 -07:00
David Garske
b42d3566ab
Merge pull request #6336 from lealem47/useAfterFree
Remove XMEMSET after XFREE in sniffer.c
2023-04-26 10:50:00 -07:00
JacobBarthelmeh
32c6a66a4e
Merge pull request #6341 from douzzer/20230425-analyzer-coddling
20230425-analyzer-coddling
2023-04-26 11:22:23 -06:00
Chris Conlon
4526df6d78
Merge pull request #6199 from JacobBarthelmeh/PKCS7
add messageDigest attribute if adding any custom signed attributes
2023-04-26 09:23:22 -06:00
Daniel Pouzzner
5538d65a79 wolfcrypt/src/asn.c: add to DecodeCertInternal() a workaround for an apparent clang-tidy bug, gated on WOLFSSL_CLANG_TIDY, and add a missing cast to mollify -Wconversion;
wolfssl/wolfcrypt/sp_int.h: refactor MP_INT_SIZEOF() using sizeof(sp_int_minimal) and addition, rather than sizeof(sp_int) and subtraction, for clarity and analyzer mollification.
2023-04-26 00:05:37 -05:00
Sean Parkinson
5b0c017a94 ASN original, OCSP: fix maximum size calc to GetDateInfo
GetDateInfo called with a local index (reset to 0) but size is of
original buffer. Subtract the index into original buffer from size to
get size available for parsing.
2023-04-26 11:18:29 +10:00
Sean Parkinson
c4233e7aec
Merge pull request #6288 from JacobBarthelmeh/Testing
avoid callback buffer overwrite with sha512_224 and remove min from w…
2023-04-26 08:36:20 +10:00
Sean Parkinson
7fb9540176
Merge pull request #6337 from JacobBarthelmeh/fuzzing
add sanity check on PKCS7 index value
2023-04-26 08:33:25 +10:00
JacobBarthelmeh
5c97dfbb4c
Merge pull request #6334 from SparkiDev/openssl_ec_set_priv_key_check
OpenSSL EC API: fix setting private key
2023-04-25 16:32:53 -06:00
Sean Parkinson
2641c493b3
Merge pull request #6335 from JacobBarthelmeh/RT1170
add guard for random with CAAM + MQX
2023-04-26 08:32:20 +10:00
JacobBarthelmeh
71f71074f8 revert WOLFSSL_NO_ASN_STRICT macro guard 2023-04-25 13:32:19 -07:00
Jacob Barthelmeh
bbe9c694a6 more specific naming for attribute types 2023-04-25 13:56:29 -06:00
JacobBarthelmeh
d701a0a06e add sanity check on PKCS7 index value 2023-04-25 08:30:33 -07:00
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