7050 Commits

Author SHA1 Message Date
David Garske
9f66a58afd
Merge pull request #6159 from philljj/zd15693
Fix ASN1_STRING leak in create_by_NID and create_by_txt
2023-03-06 09:25:37 -08:00
Sean Parkinson
e4c2386b61 BN compatibility API: move implementation out to separate API
BN APIs from ssl.c have been moved out to ssl_bn.c that is included in
ssl.c.
Added defines for BN_rand() and BN_pseudo_rand() to indicate which bits
are to be set.
'internal' field now always maps to the ;mpi' field that is a MP
integer.
SetIndividualInternal/External renamed to wolfssl_bn_get/set_value.
Fixed BN APIs to work as closely to OpenSSL as possible.
Added tests.
Moved wolfssl_make_rng out to ssl.c as BN APIs are using it now.
SP int and TFM now check trials are in a valid range for
mp_prime_is_prime_ex().
2023-03-06 14:32:10 +10:00
Hideki Miyazaki
05b0796361
add favourite drink pilot attibute type to get it from the encoding 2023-03-04 14:20:48 +09:00
Daniel Pouzzner
e76d12f932 src/ssl.c: fix a couple suppressions to use C comment syntax, for C89 goodness. 2023-03-03 22:01:52 -06:00
jordan
51dbb44799 Fix ASN1_STRING leak in create_by_NID and create_by_txt 2023-03-03 08:22:35 -06:00
Sean Parkinson
a8723f71cb
Merge pull request #6154 from kaleb-himes/wolfmikey-w-fips-140-3
Allow building of sakke as external non-FIPS algorithm with wolfmikey product
2023-03-03 08:18:40 +10:00
David Garske
41a9b1148f
Merge pull request #6152 from philljj/spelling_cleanup
Used codespell and fixed obvious typos in src and wolfssl.
2023-03-02 11:39:45 -08:00
David Garske
871754b97c
Merge pull request #6153 from bandi13/fixZD15705
Fix memory leak
2023-03-02 11:39:03 -08:00
kaleb-himes
7ca4b1bc66 Allow building of sakke as external non-FIPS algorithm with wolfmikey product 2023-03-02 11:30:56 -07:00
Andras Fekete
406d8753be Fix memory leak 2023-03-02 11:15:32 -05:00
jordan
409ed6232a Used codespell and fixed obvious typos in src and wolfssl. 2023-03-02 09:52:07 -06:00
David Garske
17ad27c350 Fixes for building with C++17. Adds new USE_CPLUSPLUS_BYTE build option to use std::byte as byte to avoid redefinition issues when customer application sets default namespace to "std" or wants to use "byte".
Tested using `./configure CC="g++ -std=c++17" --enable-all && make check`.
2023-03-01 12:49:47 -08:00
Kareem
08a3e2cb6e Avoid building TLSX_SetResponse unless it is being used. Initialize PIC32 UPDPTR register in all cases. 2023-02-28 14:37:45 -07:00
David Garske
469226f214
Merge pull request #6107 from anhu/ecc_pub
Fixes for encoding/decoding ecc public keys.
2023-02-24 08:36:15 -08:00
Anthony Hu
c2daca1393 Fixes for encoding/decoding ecc public keys. 2023-02-23 13:56:48 -05:00
David Garske
ffa392cdb5
Merge pull request #6125 from embhorn/gh6007
Include sys/time.h for WOLFSSL_RIOT_OS
2023-02-22 16:06:10 -08:00
David Garske
434e869b1d
Merge pull request #6109 from nunojpg/master
Fix out of bound memset to 0
2023-02-22 15:43:09 -08:00
David Garske
2e7713f4c2
Merge pull request #6120 from embhorn/zd15698
Fix NULL dereference in TLSX_CSR_Parse
2023-02-22 13:43:43 -08:00
Eric Blankenhorn
3d71d3c388 Include sys/time.h for WOLFSSL_RIOT_OS 2023-02-22 15:36:50 -06:00
Eric Blankenhorn
0a928208f2 Fix NULL dereference in TLSX_CSR_Parse 2023-02-22 08:19:11 -06:00
Sean Parkinson
b81759173a
Merge pull request #5840 from kareem-wolfssl/dynSessCache2
Add dynamic session cache which allocates sessions from the heap.
2023-02-22 15:14:38 +10:00
David Garske
74bad76707
Merge pull request #6117 from SparkiDev/priv_key_id_fix
Private Key ID: change to always set priv key type and size
2023-02-21 19:23:51 -08:00
Sean Parkinson
39cfd8e566 Private Key ID: change to always set priv key type and size
When a certificate is loaded then the private key type and size is set
based on the public key.
Always set, even if previously set.
Use case is setting an RSA certificate against ctx and then setting EC
certificate against ssl.
2023-02-22 08:07:27 +10:00
David Garske
fc6d693dae Update logging enter, exit, msg to match function names. Fix some typos and improper use of "enter". Fix internal uses of SSL_SUCCESS and SSL_FAILURE. Add WOLFSSL_DEBUG_NONBLOCK option to allow printing iterations without debug enabled. 2023-02-21 12:02:15 -08:00
gojimmypi
136267d29c Add new SHA-512/224 and SHA-512/256 tests 2023-02-20 16:55:38 -08:00
Nuno Gonçalves
4e6bad1225 Fix out of bound memset to 0
In case buf size sz is too small it will get updated to the larger required value
and can't be used anymore to clear the buffer.

As the buffer is untouched don't need to clear it anyway.

Signed-off-by: Nuno Gonçalves <nunojpg@gmail.com>
2023-02-18 10:40:21 +00:00
Daniel Pouzzner
6cc5c1a428
Merge pull request #6102 from dgarske/non_const
Fix for "expression must have a constant value" in tls13.c
2023-02-17 21:07:27 -06:00
David Garske
1bae1ef63e
Merge pull request #6101 from kaleb-himes/invalid-pp-macro
Fix invalid PP macro logic, guard under same conditions as internal.h
2023-02-17 17:05:50 -08:00
Kareem
8de2eba9ab Fix allocating new sessions using the dynamic session cache. 2023-02-17 15:25:12 -07:00
Daniel Pouzzner
21645460cd src/tls13.c: fix a readability-redundant-preprocessor in CheckPreSharedKeys(). 2023-02-16 23:37:43 -06:00
David Garske
82d65481bb Fix for "expression must have a constant value" in tls13.c with GreenHills compiler. 2023-02-16 13:58:48 -08:00
kaleb-himes
b2caa5c5ae Fix invalid PP macro logic, guard under same conditions as internal.h 2023-02-16 14:40:43 -07:00
David Garske
464c2d19dc
Merge pull request #6006 from SparkiDev/tls13_only_psk_dhe_ke
TLS 1.3 PSK: add option to require only PSK with DHE
2023-02-15 21:10:27 -08:00
Daniel Pouzzner
859b1ff398
Merge pull request #6093 from dgarske/fix_async
Fix issue with async and `WOLFSSL_CHECK_ALERT_ON_ERR`
2023-02-15 19:49:56 -06:00
Sean Parkinson
aaed553311
Merge pull request #6092 from dgarske/various
Various cleanups (STM docs, include case, make dist small script)
2023-02-16 11:23:51 +10:00
Kareem
1167ad623b Dynamic session cache: code review feedback 2023-02-15 17:38:14 -07:00
Sean Parkinson
b624fc8377 TLS 1.3 PSK: add option to require only PSK with DHE
Can specify only PSK without DHE.
Add only PSK with DHE.
2023-02-16 09:21:29 +10:00
David Garske
e8a26c673a Fix for async with WOLFSSL_CHECK_ALERT_ON_ERR. 2023-02-15 14:57:34 -08:00
David Garske
5481a059c4 Fix wincrypt.h include header case when used with case sensitive file system. 2023-02-15 11:44:34 -08:00
David Garske
6ea3fe2f7a
Merge pull request #6089 from kaleb-himes/stunnel-5_67_support_fix
Fix unused variable warning when configuring with --enable-apachehttpd
2023-02-15 08:39:30 -08:00
Daniel Pouzzner
ca87a99646 src/ssl.c and src/x509.c: use the customary function pointers (WOLFSSL_CRYPTO_EX_*()), not void *, in the arg lists of wolfSSL_CTX_get_ex_new_index() and wolfSSL_X509_get_ex_new_index(), to avoid "ISO C forbids passing argument ... between function pointer and ‘void *’";
move typedefs for WOLFSSL_CRYPTO_EX_*() from wolfssl/openssl/compat_types.h to wolfssl/wolfcrypt/types.h, grouped with the other EX_DATA-related typedefs, as they are needed whenever defined(HAVE_EX_DATA) regardless of openssl compatness;

properly gate wolfSSL_CTX_get_ex_new_index() and wolfSSL_X509_get_ex_new_index() prototypes on defined(HAVE_EX_DATA).
2023-02-14 19:28:40 -06:00
kaleb-himes
2719943ffd Fix unused variable warning when configuring with --enable-apachehttpd 2023-02-14 14:25:57 -07:00
Juliusz Sosinowicz
0cedc4e1ac
stunnel 5.67 support (#6020)
* stunnel 5.67 support

- ssl->session->ticketAdd may be set when parsing a ticket before PSK
- PSK binders should be calculated based on ciphersuite associated with PSK
- Add option to prioritise PSK order instead of ciphersuite order
- Update ctx->method->version when using Set_CTX_max_proto_version API
- Simplify wolfSSL_parse_cipher_list
  - Keep copy of old list and then add in the previous ciphersuites depending on whether we are doing only TLS 1.3 ciphersuites or not
- Specify CRL revocation in alert
  - Match reason string to match OpenSSL
- Add support for external data callbacks for WOLFSSL_SESSION

* Upref the session for stunnel instead of duplicating it

* Add small stack option for wolfSSL_parse_cipher_list
2023-02-14 09:38:28 -08:00
tmael
c4fa013800
Fix for BIO_reset() (#5887)
* Fix for BIO_reset
* Introduced BIO_FLAGS_MEM_RDONLY
2023-02-14 08:54:25 -08:00
Sean Parkinson
2fe34facba
Merge pull request #6084 from philljj/zd15607
Check keyLen matches cipher in wolfSSL_CMAC_Init.
2023-02-14 12:51:20 +10:00
David Garske
405b98aaa4
Merge pull request #6078 from SparkiDev/rsapss_openssl_compat
X509 RSA PSS: fixes for OpenSSL compat layer
2023-02-13 08:43:10 -08:00
jordan
909aa86d2d Check keyLen matches cipher in wolfSSL_CMAC_Init.
Fixes ZD15607.
2023-02-12 18:26:40 -06:00
Kareem
5a77db3f20 Add dynamic session cache which allocates sessions from the heap. 2023-02-10 14:18:03 -07:00
tmael
55a7e24cfe
Support pthread_rwlock (#5952)
* Support rwlock

* Fix typo, ENABLE_SESSION_CACHE_ROW_LOCK with TITAN_SESSION_CACHE

* Implement read lock

- Use read lock for the SessionCache
- Don't copy the

* TLS 1.3: Don't push ticket to cache if we don't retrieve from it

* Detect rwlock support with PTHREAD_RWLOCK_INITIALIZER

* Implement explicit rwlocks

- Mutex's still necessary for signals. Implement explicit rwlocks and we can migrate critical mutexs to rwlocks when necessary.

* Remove WOLFSSL_USE_RWLOCK guard around mutex condLock

* condLock not necessary after all

* Use configure.ac to check for pthread_rwlock_destroy support

* Can't include config.h in wc_port.h as that breaks make distcheck

* Check for pthread_rwlock_t to determine if rwlock is available

* Code review

---------

Co-authored-by: Juliusz Sosinowicz <juliusz@wolfssl.com>
2023-02-10 10:42:38 -08:00
Sean Parkinson
9750fc4485 X509 RSA PSS: fixes for OpenSSL compat layer
Add NIDs for RSA-PSS to OpenSSL compat layer.
Have wc_RsaPublicKeyDecode call wc_RsaPublicKeyDecode_ex where logic for
RSA-PSS handling is already done.
2023-02-10 10:25:49 +10:00