Commit Graph

2680 Commits (387f36657c0806ca018c2441f093a60215034f1d)

Author SHA1 Message Date
jordan be24d68e5d Add EXTENDED_KEY_USAGE_free to OpenSSL compat layer. 2023-11-08 15:26:24 -06:00
Stanislav Klima 76d89a0c15 unused variable 2023-11-08 11:09:05 +01:00
Stanislav Klima f518a8f7d5 new build flag WOLFSSL_ALLOW_ENCODING_CA_FALSE 2023-11-08 10:51:25 +01:00
Sean Parkinson 54f2d56300 ssl.c: Move out crypto compat APIs
ssl_crypto.c contains OpenSSL compatibility APIS for:
 - MD4, MD5, SHA/SHA-1, SHA2, SHA3
 - HMAC, CMAC
 - DES, DES3, AES, RC4
API implementations reworked.
Tests added for coverage.
TODOs for future enhancements.
2023-11-08 19:43:18 +10:00
Stanislav Klima 4bbb0e3876 drafted ca false 2023-11-08 10:23:46 +01:00
Daniel Pouzzner ca694938fd tests/api.c: update response vector in test_wolfSSL_CertManagerCheckOCSPResponse(), reflecting regenerated keys in certs/ocsp/. 2023-11-07 19:25:52 -06:00
JacobBarthelmeh c5e2f414ea
Merge pull request #6929 from julek-wolfssl/dtls13-early-data-server-side
dtls 1.3: allow to skip cookie exchange on resumption
2023-11-06 13:30:21 -07:00
JacobBarthelmeh c92d25816a
Merge pull request #6887 from julek-wolfssl/zd/16849
Implement untrusted certs in wolfSSL_X509_STORE_CTX_init
2023-11-06 10:13:43 -07:00
Juliusz Sosinowicz 8c87920903 Address code review 2023-11-03 11:02:41 +01:00
JacobBarthelmeh 96977d1480
Merge pull request #6900 from julek-wolfssl/zd/16868
EVP_EncodeBlock should not append a newline
2023-11-02 09:20:39 -06:00
JacobBarthelmeh 21f34ef028
Merge pull request #6905 from bandi13/moreCodeSonarFixes
Don't nag about leaked resources
2023-11-01 14:46:02 -06:00
JacobBarthelmeh c920337f2f
Merge pull request #6891 from julek-wolfssl/zd/16849-i2d_x509
Advance pointer in wolfSSL_i2d_X509
2023-11-01 11:02:44 -06:00
JacobBarthelmeh 026c4bcbc7
Merge pull request #6902 from dgarske/various_20231020
Fixes for PKCS w/out RSA and Cert/CSR signing with unknown OID
2023-11-01 10:58:10 -06:00
JacobBarthelmeh 98843798c2
Merge pull request #6934 from SparkiDev/regression_fixes_8
Regression test fixes
2023-11-01 10:55:41 -06:00
Sean Parkinson 0eab70f806 Regression test fixes
Fixes for different configurations and memory allocation failure
testing.
2023-11-01 14:10:49 +10:00
Juliusz Sosinowicz aed715cb2c dtls 1.3: allow to skip cookie exchange on resumption
tls 1.3: do cookie exchange when asked too even when found a matching cipher
2023-10-31 14:29:04 +01:00
David Garske 0455224439 Fix build errors in API unit test without IO dependencies. 2023-10-30 17:04:36 -07:00
Andras Fekete 42c241dbbf Avoid use of uninitialized array 2023-10-27 15:38:46 -04:00
Juliusz Sosinowicz 8f60fb0053 Advance pointer in wolfSSL_i2d_X509 2023-10-24 10:25:06 +02:00
Daniel Pouzzner 501299bc31 fix null pointer derefs in examples/pem/pem.c:pemApp_ReadFile() and tests/api.c:LoadPKCS7SignedDataCerts() detected by clang-tidy. 2023-10-21 13:34:04 -05:00
David Garske 6887281361 Fix for `./configure --enable-pkcs7 --disable-rsa && make check`. 2023-10-20 16:27:54 -07:00
Juliusz Sosinowicz 8cd6cd175d EVP_EncodeBlock should not append a newline 2023-10-20 13:20:11 +02:00
Juliusz Sosinowicz d13d446c2e Add missing guard 2023-10-19 20:05:59 +02:00
Juliusz Sosinowicz 1ae248018f Implement untrusted certs in wolfSSL_X509_STORE_CTX_init 2023-10-18 22:24:19 +02:00
Daniel Pouzzner 3e9f8bc649 tests/api.c: gate test_wc_AesEaxVectors(), test_wc_AesEaxEncryptAuth(), and test_wc_AesEaxDecryptAuth(), on !FIPS || FIPS>=5.3.
wolfcrypt/src/eccsi.c: remove incorrect `(void)h` from eccsi_mulmod_base_add() in newly exposed WOLFSSL_SP_MATH code path.
2023-10-16 13:30:16 -05:00
JacobBarthelmeh c23559a91c
Merge pull request #6866 from bigbrett/aes-eax
Add more extensive AES EAX tests to api.c
2023-10-13 16:09:30 -06:00
Brett 87cffc8229 Added more extensive AES EAX tests to api.c 2023-10-13 11:38:16 -06:00
JacobBarthelmeh 79a6e1eb04
Merge pull request #6808 from SparkiDev/sp_sm2
SP updates for SM2
2023-10-13 10:17:17 -06:00
Sean Parkinson 0cc21a42f3 SP updates for SM2
Allow wolfSSL to build with SP implementations of SM2.
Updates to SP implementation of other code.
2023-10-13 08:14:15 +10:00
Juliusz Sosinowicz 8ac72750bc Fix linting issues 2023-10-09 12:54:11 +02:00
Juliusz Sosinowicz 948d7ae761 keyLog_callback: flush the descriptor to make sure it is written out 2023-10-09 12:54:11 +02:00
Juliusz Sosinowicz bec87e525f PQC TLS 1.3: test setting pqc with wolfSSL_CTX_set_groups 2023-10-09 12:54:11 +02:00
Juliusz Sosinowicz 2c6c52078a test_dtls13_frag_ch_pq: make sure kyber5 is used 2023-10-09 12:54:11 +02:00
Anthony Hu f640fdf91f Adding a post-quantum DTLS 1.3 test.
This exercises the fragmenting of ClientHello via large post-quantum key share.

./configure --enable-dtls-mtu --enable-dtls-frag-ch --enable-dtls \
            --enable-dtls13 --with-liboqs
2023-10-09 12:54:11 +02:00
Juliusz Sosinowicz 85a596e54a DTLS 1.3: allow fragmenting the second ClientHello message
- DTLS 1.3 pqc support
- Add --enable-dtls-frag-ch option to enable CH fragmenting
- Send an alert when we get an empty keyshare with a cookie present to not allow for multiple HRR in one connection
- Only update the DTLS window when we have successfully processed or stored a message
- Call ssl->chGoodCb as soon as we have processed a verified full or fragmented ClientHello cookie
2023-10-09 12:54:11 +02:00
JacobBarthelmeh 5cb80ea898
Merge pull request #6847 from embhorn/zd16767
Fix wolfSSL_set_verify_result to use correct value
2023-10-06 16:52:32 -06:00
Eric Blankenhorn b329c0d5f4 Fix wolfSSL_set_verify_result to use correct value 2023-10-06 16:34:31 -05:00
Juliusz Sosinowicz 7baf151c37 CRL verify the entire chain including loaded CA's
- Regen CRL's as most of them are expired
- certs/crl/extra-crls/ca-int-cert-revoked.pem: CRL that revokes certs/intermediate/ca-int-cert.pem signed by certs/ca-cert.pem
- Add CheckCertCRL_ex API to not depend on DecodedCert
- CheckCertCRLList: accept raw serial or hashed version to work with Signers
- Add XELEM_CNT to simplify pre-proc element counting
2023-10-03 11:45:43 +02:00
David Garske b72d02dd88
Merge pull request #6742 from embhorn/zd16187_2
Fixes for NO_FILESYSTEM and NO_BIO config
2023-09-19 11:19:07 -07:00
Anthony Hu 6bf716bd26
Merge pull request #6743 from JacobBarthelmeh/unit_tests
add test case for ignoring cert path error
2023-09-14 11:04:35 -04:00
JacobBarthelmeh 61f48eb5a1
Merge pull request #6763 from DimitriPapadopoulos/codespell
Fix residual typos found by codespell
2023-09-11 15:55:34 -06:00
JacobBarthelmeh 63477bcfdb
Merge pull request #6733 from gojimmypi/windows-gettime_secs
implement gettime_secs for Windows (_MSC_VER) in tests/api.c
2023-09-11 09:31:30 -06:00
Dimitri Papadopoulos d532833af9
Fix residual typos found by codespell 2023-09-11 11:34:28 +02:00
Sean Parkinson 90467aa578 Curve25519/Ed25519: align buffers
Make data structures align buffers.
Align buffers in functions.
Add versions that don't use umaal
2023-09-08 15:23:15 +10:00
gojimmypi e74b3ecdad revert to only original gettime_secs changes per code review 2023-09-06 17:55:15 -07:00
JacobBarthelmeh e748e1be32 add test case for ignoring cert path error 2023-08-30 12:45:29 -07:00
JacobBarthelmeh 2aefdfe9d5
Merge pull request #6737 from anhu/ignoreBadPath
Add new feature macro WOLFSSL_IGNORE_BAD_CERT_PATH.
2023-08-30 13:37:56 -06:00
Eric Blankenhorn 7262a30074 Fixes for NO_FILESYSTEM config 2023-08-30 13:54:49 -05:00
Eric Blankenhorn 4e86523624 Fix NO_BIO build error 2023-08-30 10:24:25 -05:00
Anthony Hu d7bb5aa367 Add new feature macro WOLFSSL_IGNORE_BAD_CERT_PATH. 2023-08-29 10:28:02 -04:00
JacobBarthelmeh c47600c52c update comment 2023-08-29 12:45:45 +02:00
Juliusz Sosinowicz a0fef66c3b Add test case for dropped ccs 2023-08-29 12:45:45 +02:00
gojimmypi d8fe8b9140 gettime_secs() in api.c now uses TimeNowInMilliseconds() 2023-08-28 18:14:29 -07:00
gojimmypi 4058dbec7c Merge branch 'master' of https://github.com/wolfssl/wolfssl into windows-gettime_secs 2023-08-28 11:40:51 -07:00
Juliusz Sosinowicz b02fe0853f CI fixes 2023-08-28 10:52:36 +02:00
Juliusz Sosinowicz 57ce894393 CRL refactor
- CheckCertCRLList: check all entries in case a single issuer has multiple CRL's loaded
- test_multiple_crls_same_issuer: testing two different certificates forcing the client to check both CRL's from the same issuer
- CRL_Entry
  - use a lock instead of a mutex to allow multiple threads to access the same list simultaneously
  - add a verifyMutex when doing verification so that we don't have to release the crlLock
- Add allocation and free functions for CRL_Entry
- DupCRL_Entry: simplify copying by copying all static fields in one memcpy
2023-08-28 10:52:36 +02:00
Juliusz Sosinowicz e85901c8e5 Only list supported sigalgs in certreq 2023-08-28 10:52:36 +02:00
gojimmypi 321f74869a implement gettime_secs for Windows (_MSC_VER) in tests/api.c 2023-08-25 18:30:05 -07:00
JacobBarthelmeh 14deb7afda
Merge pull request #6700 from julek-wolfssl/dtls13-downgrade-acks
DTLS 1.3: do not send ACKs until we negotiate 1.3 (through SH)
2023-08-25 09:34:53 -06:00
JacobBarthelmeh c9e9e0fc72
Merge pull request #6704 from icing/session-copy-on-write
Updating a shared session objects needs to do copy on write
2023-08-24 16:52:17 -06:00
JacobBarthelmeh a6257ca635
Merge pull request #6724 from julek-wolfssl/zd/16445
ZD16445
2023-08-24 13:46:49 -06:00
JacobBarthelmeh 5f44a73f8e
Merge pull request #6725 from julek-wolfssl/zd/16598
TLSX_CA_Names_Parse: Include header in length check
2023-08-24 10:30:07 -06:00
Juliusz Sosinowicz 82c5170659 TLSX_CA_Names_Parse: Include header in length check 2023-08-24 15:23:37 +02:00
Juliusz Sosinowicz 06d81f7f8f Add a test case that negotiates tickets during another handshake 2023-08-24 15:01:22 +02:00
Juliusz Sosinowicz b771b6ebf5 ZD16445
- Use unions for type punning in xor API
- Initialise potentially uninitialised variables
- Use `LL` suffix to specify a larger integer type
- Don't use `max` as it can shadow other definitions
2023-08-24 10:53:26 +02:00
Sean Parkinson 36b92a4cef Thumb2 ASM, Curve25519
Add support for compiling ASM for Thumb2
Add Curve25519 ASM for Thumb2
Limit assembly code compiled when Ed25519 not required.
Rework all assembly implementations to replace ge_*() functions instead
of having fe_ge_*() versions that take many parameters.
Get ARM32 inline asm working.
2023-08-24 17:43:03 +10:00
Juliusz Sosinowicz 9427bea275 DTLS 1.3: do not send ACKs until we negotiate 1.3 (through SH) 2023-08-23 22:18:21 +02:00
JacobBarthelmeh 9cc8cdcc30
Merge pull request #6712 from philljj/spelling_cleanup
Used codespell and fixed obvious typos.
2023-08-18 16:29:36 -06:00
Juliusz Sosinowicz b32ff0b0b8 Rename utils.c to utils.h
This better signals that this file is meant to be included directly in testing programs and also plays better with my IDE.
2023-08-18 15:05:23 +02:00
jordan d4ba2e50d4 Used codespell and fixed obvious typos. 2023-08-17 15:20:10 -05:00
JacobBarthelmeh cc4e327316
Merge pull request #6544 from TakayukiMatsuo/rpk
Add support for raw-public-key
2023-08-17 09:23:18 -06:00
TakayukiMatsuo 3a5739a8fa Add support for raw-public-key 2023-08-11 11:29:15 +09:00
jordan 5255b02fbb Fix define guards for X509 api tests. 2023-08-10 08:49:25 -05:00
JacobBarthelmeh 65b515aec8
Merge pull request #6655 from julek-wolfssl/threading-testing
Port testing to wolfSSL threading interface
2023-08-04 13:46:14 -06:00
Juliusz Sosinowicz 90a6a14878
Merge pull request #6446 from JacobBarthelmeh/session 2023-08-04 11:34:59 +02:00
Juliusz Sosinowicz 67d6d438c5 Port testing to wolfSSL threading interface 2023-08-04 10:49:39 +02:00
Juliusz Sosinowicz 8a9a363621 DTLS 1.3: move state machine forward when HVR received 2023-08-03 15:00:14 +02:00
Juliusz Sosinowicz 907a0201e7 Require HAVE_SECURE_RENEGOTIATION for API that perform SCR (not just indication) 2023-08-03 11:32:42 +02:00
Juliusz Sosinowicz 5a94dc961d DtlsShouldDrop: don't ignore app data sent before a SCR handshake 2023-08-03 11:32:03 +02:00
Juliusz Sosinowicz 158402ab03 Add logging prefixes to api.c client and server 2023-08-03 11:31:47 +02:00
Juliusz Sosinowicz bfe7bc0fcc Recover when the client sends a 0-length session ID when using tickets
Fixes ZD16477
2023-08-02 18:02:30 +02:00
Juliusz Sosinowicz 6f4fabaac9 Adjust DER size 2023-08-02 10:30:12 +02:00
Juliusz Sosinowicz 724fe53379 DoHelloVerifyRequest: only do DTLS 1.3 version check 2023-08-02 10:30:12 +02:00
JacobBarthelmeh 1468d77e50
Merge pull request #6644 from julek-wolfssl/zd/16441
TLSX_CA_Names_Parse: Verify the length of the extension
2023-07-31 16:03:23 -06:00
Juliusz Sosinowicz a495bb4e7f TLSX_CA_Names_Parse: make sure to do cleanup when smallstack is on 2023-07-28 16:34:35 +02:00
Dimitri Papadopoulos 6d9c85a762
Fix typos found by codespell 2023-07-27 23:38:44 +02:00
JacobBarthelmeh daa54f3d31 adjust wait times so that test can happen before timed out 2023-07-26 16:14:24 -07:00
Jacob Barthelmeh b16e7fd87b use Expect with test
fix for session expire check

better name for test function

rewrite test case

make new session also timeout in 1 second
2023-07-26 15:10:22 -07:00
JacobBarthelmeh 9cd7e59e6a add another session expire test case 2023-07-26 15:10:22 -07:00
Juliusz Sosinowicz 4a175ba280 Updates for Kerberos 5 1.21.1
- wolfssl_ec_point_mul: fix parameters being passed into ec_mul2add
- Compile in compressed ecc key parsing for OPENSSLALL
- Improve debugging around compat layer ecc operations
- wolfSSL_BN_div: dv can be NULL
- Add spake like computation test
- Add CI krb5 testing
- Add timeouts to CI
2023-07-26 16:40:38 +02:00
Juliusz Sosinowicz 5947c9ae8c TLSX_CA_Names_Parse: Verify the length of the extension 2023-07-26 13:32:37 +02:00
JacobBarthelmeh 1285ae7816
Merge pull request #6506 from DimitriPapadopoulos/codespell
Fix typos found by codespell
2023-07-24 10:34:29 -06:00
Juliusz Sosinowicz d3aa11bf87 Place manual memio helpers in utils.c and add macro for them 2023-07-24 09:14:21 +02:00
Juliusz Sosinowicz ab560aa6b8 Fix ClientHello parsing when no extensions are present 2023-07-24 09:14:21 +02:00
Lealem Amedie acac3fe479 Add testing and make jenkins happy 2023-07-21 13:57:45 -06:00
JacobBarthelmeh 8065ba18f9
Merge pull request #6620 from douzzer/20230714-WC_DO_NOTHING
20230714-WC_DO_NOTHING
2023-07-18 17:04:02 -06:00
Anthony Hu 3b773db728 Clean up after myself 2023-07-14 13:43:57 -04:00
Anthony Hu 31a02f194e Address review comments. 2023-07-14 12:09:14 -04:00
Daniel Pouzzner f6f8d2eda3 add WC_DO_NOTHING macro to wolfssl/wolfcrypt/types.h, with default expansion "do {} while (0)", and globally refactor to use the macro where appropriate, annotating intended-null macros-with-args with "/* null expansion */";
tweak several #includes of settings.h to include types.h instead (all of these are for clarity, as types.h is indirectly included by later #includes), and add #include <wolfssl/wolfcrypt/types.h> where missing;

remove trailing semicolons from PRAGMA*() macro invocations as they are unneeded and can be harmful (inducing frivolous -Wdeclaration-after-statement etc.).
2023-07-14 09:50:01 -05:00
JacobBarthelmeh b889b27b8c
Merge pull request #6585 from cconlon/x509Ext
Fixes for WOLFSSL_X509 cert gen, WOLFSSL_ALT_NAMES to --enable-jni
2023-07-12 16:55:08 -06:00
Chris Conlon ea7ea356a0 Fixes for WOLFSSL_X509 cert generation with key usage, extended key usage, and basic constraints 2023-07-12 14:33:42 -06:00
Daniel Pouzzner 648f474d83 configure.ac:
if ENABLED_LINUXKM_PIE, add -DWOLFSSL_NO_OCSP_ISSUER_CHECK to gate out backward dependency in asn.c;

  if ENABLE_LINUXKM, don't error on FIPS without thread_ls_on;

  for --enable-curl, set ENABLED_MD4="yes", and move --enable-md4 AC_ARG_ENABLE() clause up to a position adjacent to des3 handling;

scripts/sniffer-gen.sh: fix illegal exit code (SC2242);

src/internal.c: fix clang-analyzer-core.NonNullParamChecker in CreateTicket();

src/ocsp.c: fix readability-redundant-preprocessor;

src/tls.c: fix empty-body in TLSX_PskKeModes_Parse() and clang-diagnostic-unreachable-code-break in ALPN_Select();

tests/api.c: fix several clang-analyzer-core.NullDereference related to Expect*() refactor;

wolfcrypt/src/asn.c:

  fix -Wconversions in DecodeAuthKeyId() and ParseCertRelative();

  fix readability-redundant-declaration re GetCA() and GetCAByName();

  gate inclusion of wolfssl/internal.h on !defined(WOLFCRYPT_ONLY);

wolfssl/internal.h: add macro-detection gating around GetCA() and GetCAByName() prototypes matching gates in wolfcrypt/src/asn.c;

tests/utils.c: in create_tmp_dir(), use one-arg variant of mkdir() if defined(__CYGWIN__) || defined(__MINGW32__).
2023-07-12 13:47:40 -05:00
Lealem Amedie 5fbe319ce9 Remove references to config.h from test headers 2023-07-11 13:27:37 -06:00
Lealem Amedie 1329543b62 Other miscellaneous fixes 2023-07-11 13:27:37 -06:00
David Garske 8f36f78e6c
Merge pull request #6400 from bandi13/ARIA-cipher
Aria cipher
2023-07-11 09:50:42 -07:00
Sean Parkinson f26b8bdf62
Merge pull request #6584 from julek-wolfssl/issue/6554
Always enable tls13MiddleBoxCompat with WOLFSSL_TLS13_MIDDLEBOX_COMPAT
2023-07-11 07:53:56 +10:00
Andras Fekete a317ac280c PR comments 2023-07-10 16:50:54 -04:00
Kareem e871b1c04d Add hitch support to wolfSSL.
Add support for cipher aliases DHE, EDH and EECDH.

Add define SSL_CTRL_GET_CHAIN_CERTS to help hitch and other programs detect SSL_CTX_get0_chain_certs is supported.

Add wolfSSL_get_locking_callback.

Allow using ECDHE+RSA cipher suites when ECDHE alias is used while in OpenSSL compatibility mode.

Add more alerts for hitch.

SSL_CM should use the CTX's x509_store_pt if available.

Add support for SSL_CERT_FILE and SSL_CERT_DIR.  Load default OpenSSL TLS 1.3 ciphers when using OPENSSL_COMPATIBLE_DEFAULTS.

Use wolfSSL_sk_X509_new_null to allocate WOLFSSL_STACK in wolfSSL_CTX_get_extra_chain_certs.  Previous approach of malloc'ing without setting type/memsetting was leading to a segfault.

Add --enable-hitch.

hitch: Add unit tests for new APIs, fix a couple of issues uncovered by unit testing.

Correct behavior of wolfSSL_BIO_set_mem_buf for BIO_CLOSE/NOCLOSE and update unit test accordingly.

Add Github action test for hitch.
2023-07-10 10:06:10 -07:00
JacobBarthelmeh 2426cf14ca
Merge pull request #6583 from SparkiDev/certman_split
Moved CertManager APIs into own file
2023-07-10 09:20:09 -06:00
Juliusz Sosinowicz 86fd570e8c Remove MyKeyLog.txt 2023-07-10 13:23:35 +02:00
Sean Parkinson 9f6ef65e8f
Merge pull request #6557 from julek-wolfssl/zd/16332
Don't allow a resumption handshake inside of a SCR
2023-07-10 13:51:29 +10:00
Sean Parkinson 52a3d591b5 Fix check of date to respect VERIFY_SKIP_DATE in ASN.1 template
DecodeCertInternal was not recognizing VERIFY_SKIP_DATE.
2023-07-10 10:05:59 +10:00
JacobBarthelmeh 9d3a95a287 account for error return in test case when building without pkcs7 streaming 2023-07-09 12:42:29 -07:00
JacobBarthelmeh 0e2749eeb4 adjust test case for asn=original 2023-07-08 07:37:26 -07:00
JacobBarthelmeh 7866a40d06 resolve kari decode without recipient certificate 2023-07-08 07:37:26 -07:00
JacobBarthelmeh f0354b4cbe parse ASN1 only with SMIME_read_PKCS7 2023-07-08 07:36:10 -07:00
David Garske 770590a3be Rebase fix to add back set_verify call in CertManagerLoadCA. Fix API tests for bad date check. Various spelling fixes. 2023-07-07 15:08:08 -07:00
Sean Parkinson 3af87f6f93 Moved CertManager APIs into own file
Split out certificate manager APIs into ssl_certman.c.
ssl.c includes ssl_certman.c
Better test coverage.
Minor fixes.
wolfSSL_X509_chain_up_ref calls XFREE with name->heap but name may be
NULL. Check for NULL first.
2023-07-07 15:08:08 -07:00
David Garske 91fb24161b
Merge pull request #6515 from julek-wolfssl/nginx-1.25.0
Add support for nginx-1.25.0
2023-07-07 09:29:23 -07:00
Juliusz Sosinowicz 0abaa89787 Add support for nginx-1.25.0
- nginx: add necessary defines and function
- Implement Certificate Authorities for TLS 1.3
- Implement secret logging for TLS 1.3. Can be used for example with:
  ./configure CPPFLAGS="-DWOLFSSL_SSLKEYLOGFILE -DSHOW_SECRETS -DHAVE_SECRET_CALLBACK -DWOLFSSL_SSLKEYLOGFILE_OUTPUT='\"/tmp/secrets\"'"
- Implement session context checking for tickets
- Check for authorized responder in OCSP basic response
- Fix handling call to ocsp->statusCb
- compat: Translate SOCKET_PEER_CLOSED_E to WOLFSSL_ERROR_SYSCALL
- Fix wolfSSL_CTX_set_session_cache_mode
  - WOLFSSL_SESS_CACHE_OFF means nothing should be on
  - WOLFSSL_SESS_CACHE_NO_INTERNAL turns off only the internal cache
- Respect ssl->options.internalCacheOff
- Implement SSL_SESSION_set_time
- wolfSSL_SSL_in_init: fix detection for TLS 1.3
- Fix handling call to ssl->alpnSelect
- SendTls13NewSessionTicket: always generate new ID
  - When we send a new ticket for the same session (for example we resumed a connection and are sending a new ticket so that the client can resume in the future), we need to generate a new ID so that we don't overwrite the old session in the cache. Overwriting the session results in the `diff` calculation in `DoClientTicketCheck()` producing the wrong value and failing to resume.
Add nginx github action test
- Fix memory leaks
- wolfSSL_OCSP_basic_verify: implement OCSP_TRUSTOTHER flag
- AKID: implement matching on issuer name and serial number
- ocsp: check for a chain match for OCSP responder
- Split CreateTicket into CreateTicket and SetupTicket
- SendCertificateStatus: free response.buffer
- Use heap hint when allocating responseBuffer
- Remove responseBuffer from internal API's that don't use it anywhere
2023-07-07 11:22:58 +02:00
Juliusz Sosinowicz 57e53d1a43 Don't allow a resumption handshake inside of a SCR 2023-07-06 15:13:56 -07:00
Andras Fekete 266307da6c Add in ARIA wrappers
Address PR comments + other cleanup


Addressing PR comments


Minor change


Make sure the last line gets output as well


Add in ARIA SHA256 session to internal structure


Add in ARIA SHA384 session to internal structure


Add necessary function for ARIA to extract key


Fix unit tests


Rename HAVE_ARIAGCM to HAVE_ARIA


Move aria.* to wolfcrypt/port/aria


Separate out aria-crypt init functions


Adding in ECC+SHA callbacks


Avoid using AC_CHECK_FILE


Rename Aria to wc_Aria


Don't need special cases


Addressing PR comments


Code cleanup


C89 support


Remove TODO


Add documentation about buffer size


Clean up header files


Use ARIA_DEVID by default if available


Dummy update call to make MagicCrypto happy


Fix for detecting what algo type to use


Documentation


Use the appropriate sign/verify


Collect MagicCrypto functions together (and avoid leaks)


Fall back on other implementations on failure


Fix issue when compiling without CRYPTOCB


Addressing PR comments


Better cleanup


Addressing PR comments


Cleaner exit in case of error
2023-07-06 16:09:23 -04:00
Juliusz Sosinowicz d2642e329d Properly enforce the pathLenConstraint of the BasicConstraints extension
- move the testsuite file helps into a new tests/utils.c file so that they can be used across all tests
- dump the raw TLS stream when WOLFSSL_DUMP_MEMIO_STREAM is defined so that it can be examined in Wireshark
2023-07-06 19:00:11 +02:00
Daniel Pouzzner 1912f1bc2a fixes for clang-analyzer-core.NullDereference, clang-analyzer-core.NonNullParamChecker, clang-analyzer-deadcode.DeadStores, readability-redundant-preprocessor, clang-diagnostic-unreachable-code-break, -Werror=sign-conversion, bugprone-macro-parentheses, "Call to 'malloc' has an allocation size of 0 bytes", clang-diagnostic-declaration-after-statement re tests/unit.h:ExpectPtr() pragmas. 2023-07-06 00:53:37 -05:00
David Garske f00b5c3a1e
Merge pull request #6537 from SparkiDev/sm
SM2/SM3/SM4: Chinese cipher support
2023-07-04 10:03:37 -07:00
David Garske b682c2c4bb
Merge pull request #6437 from julek-wolfssl/windows-crl-monitor
Implement CRL monitor for Windows
2023-07-04 10:03:14 -07:00
Dimitri Papadopoulos 50752f5a2b
Fix typos found by codespell 2023-07-04 07:21:27 +02:00
Sean Parkinson e2424e6744 SM2/SM3/SM4: Chinese cipher support
Add support for:
 - SM2 elliptic curve and SM2 sign/verify
 - SM3 digest
 - SM4 cipher with modes ECB/CBC/CTR/GCM/CCM

Add APIs for SM3 and SM4.
Add SM2 sign and verify APIs.
Add support for SM3 in wc_Hash and wc_Hmac API.
Add support for SM3 and SM4 through EVP layer.
Add support for SM2-SM3 certificates. Support key ID and name hash being
with SHA-1/256 or SM3.
Add support for TLS 1.3 cipher suites: TLS-SM4-GCM-SM3, TLS-SM4-CCM-SM3
Add support for TLS 1.2 SM cipher suite: ECDHE-ECDSA-SM4-CBC-SM3
Add support for SM3 in wc_PRF_TLS.
Add SM2-SM3 certificates and keys. Generated with GmSSL-3.0.0 and
OpenSSL.
2023-07-04 13:36:28 +10:00
Daniel Pouzzner 214f9f55c4 fixes for bugprone-suspicious-missing-comma, clang-analyzer-core.NullDereference, and readability-redundant-preprocessor. 2023-07-03 11:30:08 -05:00
Juliusz Sosinowicz 3d68bcd6f7 Jenkins fixes 2023-07-03 14:02:51 +02:00
Juliusz Sosinowicz 8ab0050801 Init windows CRL monitor 2023-07-03 14:02:51 +02:00
David Garske 6052e01879 Fixes for SNI test with static memory enabled. Fixes for other minor static memory build combinations. 2023-06-30 13:04:05 -07:00
David Garske 95675c7e34
Merge pull request #6455 from lealem47/INIT_SSL_NO_CTX_KEY
Allow option to create SSL without key/cert in ctx
2023-06-30 10:35:52 -07:00
Sean Parkinson a1939d22b9 wolfBot fixes
Importing an EC point ordinate with one being zero will result in
different errors based on different implementations. Check both known
error codes.

Benchmark usage fixed.
2023-06-30 09:07:46 +10:00
Lealem Amedie 7720dac545 Allow option to create SSL without key/cert in ctx 2023-06-29 13:57:40 -06:00
David Garske 048083cfe3
Merge pull request #6329 from tmael/crl_off
Add support for enabling and disabling CRLs.
2023-06-28 16:03:25 -07:00
Sean Parkinson d029ba4d46
Merge pull request #6415 from julek-wolfssl/issue/6408
Ignore session ID's shorter than 32 bytes instead of erroring out
2023-06-29 08:20:48 +10:00
David Garske 145ca4ae9d
Merge pull request #6542 from SparkiDev/api_fixes_1
Tests api.c: fixes
2023-06-27 10:00:07 -07:00
Tesfa Mael 03e5d109c7 Add test_wolfSSL_dup_CA_list 2023-06-27 08:29:13 -07:00
Tesfa Mael fd17fa3e9c Implement the option to disable CRL check
Do leaf CRL check by default
Correct wolfSSL_sk_X509_NAME_push return check
Update OpenSSL compatibility errors for HAProxy
Change X509_V to literal constant values
Fix the compat layer with TLS session ticket reuse
Fix for tls1_2 session resume and cache miss
Save intitial wolfSSL ctx
Check for OpenSSL CRL error code 23
2023-06-27 08:26:02 -07:00
Juliusz Sosinowicz 291c538e5f Ignore session ID's shorter than 32 bytes instead of erroring out 2023-06-27 14:51:46 +02:00
Sean Parkinson 578f56e60c Test api.c: change more tests to use Expect instead of Assert
bio.c:
  wolfSSL_BIO_flush(): check allocation to bio->ip succeeded.

internal.c:
  InitSSL_Ctx(): set ctx->heap to heap if value passed in
ProcessPeerCerts(): check for error MEMORY_E too as a fatal parsing
error

ssl.c:
wolfSSL_shutdown(): SOCKET_ERROR_E is also an indication that the
socket is done, MEMORY_E is a fatal error
  wolfSSL_Cleanup(): move free of memory fail couting to wolfSSL API
  SessionTicketNoncePrealloc(): eror return must be non-zero
AddSessionToCache(): XFREE checks for NULL no need to do it before
call
wolfSSL_set_psk_use_session_callback(): ensure ssl is not NULL before
dereferencing
wolfSSL_SMIME_read_PKCS7(): check for error return from
wolfSSL_BIO_gets()

asn.c:
  wc_MIME_parse_headers(): check allocation succeeded into nextHdr

compress.c:
  wc_DeCompressDynamic(): free tmp on inflateInit2 failure

memory.c: rework where memory allocation failure counting code for when
WOFLSSL_STATIC_MEMORY is defined

wc_port.c:
wolfCrypt_Cleanup(): only call wc_MemFailCount_Free() when no
wolfSSL_Cleanup()
2023-06-27 08:01:33 +10:00
Sean Parkinson b7332e33c7 Tests api.c: fixes
NULL dereference.
Uninitialized variable use.
2023-06-26 16:04:24 +10:00
David Garske 6697181081
Merge pull request #6500 from SparkiDev/tests_api_expect_4
Test api.c: change more tests to use Expect instead of Assert
2023-06-21 17:17:37 -07:00
Sean Parkinson e467112a93 Test api.c: change more tests to use Expect instead of Assert
Changed EXPECT_DECL to start of as TEST_SKIPPED.
Modified other EXPECT macros appropriately.
Change test functions to not use 'res' when EXPECT_DECL is used.

memory.c:
  wc_MemFailCount_Init(): don't declare variable after a statement

conf.c:
wolfSSL_TXT_DB_read(): free the whole WOLFSSL_TXT_DB on failure
instead of just the memory
wolfSSL_CONF_add_string(): pop the value added into section->value
(sk) if it can't be pushed onto conf->data
  wolfSSL_NCONF_load(): free the new value if it wasn't able to be added

ocsp.c:
  wolfSSL_OCSP_cert_to_id():
free the decoded certificate if parsing failed (is freed after use
otherwise)
free the certificate id on failure and make it NULL and continue
freeing other variables

pk.c:
wolfSSL_RSA_set0_crt_params(): set dmp1, dmq1 and iqmp fields to NULL
if setting the internal failed - returns error and caller needs to free
the passed in BNs
wolfSSL_RSA_set0_factors(): set p and q fields to NULL if setting the
internal failed - returns error and caller needs to free the passed in
BNs
wolfSSL_RSA_set0_key(): set n, e abd d fields to NULL if setting the
internal failed - returns error and caller needs to free the passed in
BNs

x509.c:
wolfSSL_X509_set_serialNumber(): explicit NULL
checkwolfSSL_X509_REQ_add1_attr_by_NID(): check whether push succeeded
and on failure free attribute

asn.c:
ConfirmSignature(): for DSA, allocate separately to ensure no leak on
memory allocation failure.

dh.c:
wc_DhGenerateParams(): ensure tmp and tmp2 are able to be cleared on
error

evp.c:
wolfSSL_EVP_PKEY_CTX_add1_hkdf_info(): fix realloc use to no leak on
failure
  wolfSSL_EVP_CIPHER_CTX_iv_length(): handle ctx being NULL.
2023-06-22 08:21:17 +10:00
JacobBarthelmeh 0a860c793f adjust test case to handle error of peer closing down 2023-06-14 12:21:52 -07:00
John Safranek 7b0283fa04
Implicit Type Conversion Fix
1. Typecast the return of strlen() to int for the variable used.
2023-06-09 11:13:44 -07:00
Sean Parkinson e5bb09f281 Coverity fixes: api.c
Fixes from coverity scan in the file api.c.
2023-06-08 22:18:05 +10:00
JacobBarthelmeh 8583cc65fa
Merge pull request #6471 from SparkiDev/tests_api_expect_3
Test api.c: change more tests to use Expect instead of Assert
2023-06-07 11:22:23 -06:00
JacobBarthelmeh 1445a6a832
Merge pull request #6482 from SparkiDev/regression_fixes_7
Regression testing fixes
2023-06-07 11:18:36 -06:00
JacobBarthelmeh 2b054e223b
Merge pull request #6483 from SparkiDev/cppcheck_fixes_10
cppcheck: fixes from scan
2023-06-07 11:13:53 -06:00
Sean Parkinson ed01b14356 cppcheck: fixes from scan
wolfssl_sce_unit_test.c:
  sce_crypt_Sha_AesCbcGcm_multitest(): duplicate condition
ssl_asn1.c:
  wolfSSL_i2t_ASN1_OBJECT(): done is not needed
  MonthStr(): fix bounds check on i
woolfcrypt_test.c, test_main.c, wolfssl_tsip_unit_test.c, devices.c,
aes.c, des3.c:
  Variable not used.
asn.c:
DecodeSubjKeyId(): sz is unsigned - check for less than zero does
nothing
kcapi_rsa.c:
  KcapiRsa_Decrypt(): fix ret check by using else
  KcapiRsa_Encrypt(): make same change for consistency
kcapi_hash.c:
  KcapiHashFinal(): move ret into #ifdef where it is needed
stm32.c:
wc_Stm32_Hash_GetDigest(): i redeclared with different type - use ii
instead
bio.c, conf.c:
  XFREE checks for NULL

Reduce scope of varialbes.
Condition same.
2023-06-07 17:27:51 +10:00
Sean Parkinson b07c5d7ce8 Regression testing fixes
Fix: ./configure --disable-shared  --enable-smallstack --enable-all
CFLAGS=-DNO_ASN_TIME

Don't compile mp_test when compiling for SP Math All and RSA
verification only - very few functions available.

ssl.c:
wolfSSL_Rehandshake(): wolfSSL_UseSessionTicket only available when
not NO_WOLFSSL_CLIENT
api.c:
  test_wolfSSL_ticket_keys(): meant to be tested on server
2023-06-07 14:26:45 +10:00
Sean Parkinson e542e51d9f Test api.c: change more tests to use Expect instead of Assert
bio.c:
  wolfSSL_BIO_push(): handles NULL for top and append.

crl.c:
InitCRL_Entry(): set toBeSigned to NULL after freeing when allocation
fails.
  AddCRL(): free CRL entry properly on error.
wolfSSL_X509_STORE_add_crl(): check for NULL after
wolfSSL_X509_crl_new call.

ssl.c:
wolfSSL_CertManagerGetCerts(): free the certificate if it didn't get
pushed onto stack
  wolfSSL_RAND_Init(): returns success if global already initialized.

ssl_asn1.c: wolfSSL_ASN1_TYPE_set now avaiable when OPENSSL_EXTRA
defined for function wolfssl_dns_entry_othername_to_gn().

x509.c:
Added support for creating a valid General Name of type GEN_OTHERNAME.
Extracted some code out into wolfssl_x509_alt_names_to_gn().
  wolfSSL_X509_set_ext(): free data correctly on errors
wolfSSL_X509_PUBKEY_set(): free str if DSA parameters cannot be
retrieved; wolfSSL_OBJ_nid2obj() called separately to handle when
returning NULL.
wolfSSL_X509_NAME_copy(): check for failure when
wolfSSL_X509_NAME_add_entry() is called.

x509_str.c:
wolfSSL_X509_STORE_CTX_new(): check for error from calling
wolfSSL_X509_STORE_CTX_init().
wolfSSL_X509_STORE_get0_objects(): don't double free x509; free memory
correctly on error
2023-06-07 14:10:42 +10:00
Hideki Miyazaki 5624df95b5
fix uninit var 2023-06-07 07:43:02 +09:00
Daniel Pouzzner 6c4cc2a931 tests/api.c: fix a likely-spurious maybe-uninitialized from gcc-11 -m32 (all-sp-m32) in test_wolfSSL_PEM_PrivateKey(). 2023-06-03 10:41:15 -05:00
Daniel Pouzzner 291be53524 tests/api.c: fixes for clang-diagnostic-embedded-directive (also warned by gcc), clang-analyzer-core.UndefinedBinaryOperatorResult, and clang-analyzer-deadcode.DeadStores. 2023-06-02 11:06:16 -05:00
JacobBarthelmeh 35e59a3569
Merge pull request #6456 from SparkiDev/tests_api_expect_2
Test api.c: change more tests to use Expect instead of Assert
2023-06-01 10:29:52 -06:00
Chris Conlon 806c75d28b
Merge pull request #6450 from miyazakh/fix_jenkins_android
fix to cast diff type, int and uint
2023-06-01 08:33:02 -06:00
Sean Parkinson 7259351a3f Test api.c: change more tests to use Expect instead of Assert
Added a new version of 'nofail' handshaking that doesn't use threads.
More tests can be run in single threaded.

Changed tests over to use test_wolfSSL_client_server_nofail() or
test_wolfSSL_client_server_nofail_memio() to simplfy test cases.

Changed tests to use Expect.

CRL:
BufferLoadCRL wasn't freeing allocated data when currentEntry
couldn't be allocated.

ssl.c:
DecodeToX509(): Needs to call FreeDecodedCert even if
ParseCertRelative fails.
wolfSSL_PEM_read_PUBKEY(): Need to check result of
wolfSSL_d2i_PUBKEY is NULL rather than the passed in WOLFSSL_EVP_PKEY.

X509:
wolfSSL_X509_set_ext(): Must free allocated WOLFSSL_X509_EXTENSION
if not pushed on to stack regardless of stack being NULL.
wolfSSL_X509V3_EXT_i2d(): Don't free asn1str on error as it is the
data passed in.
wolfSSL_i2d_X509_NAME_canon(): free names and cano_data when call to
wolfSSL_ASN1_STRING_canon() fails.

PKCS7:
    wc_PKCS7_InitWithCert(): Check memory allocation of cert for NULL.
2023-06-01 14:22:00 +10:00
Daniel Pouzzner c45efd79af api.c: fix 3 missed EXPECT_RESULT() == WOLFSSL_SUCCESSes to use the succincter EXPECT_SUCCESS(). 2023-05-31 18:26:27 -05:00
Daniel Pouzzner 64c9026c77 wolfssl/wolfcrypt/types.h: add PRAGMA_DIAG_PUSH, PRAGMA(), and PRAGMA_DIAG_POP(), using the gcc or clang variants as applicable, to facilitate pragmas to be used on both gcc and clang;
tests/unit.h: fix ExpectPtr() to inhibit pedantic warnings on both gcc and clang;

wolfssl/test.h: in myVerify(), explicitly check for nullness when printing issuer/subject, to avoid cppcheck null-deref warning;

tests/api.c: fixes for:

* myriad "embedding a directive within macro arguments is not portable"
* an "ISO C forbids conversion of object pointer to function pointer type"
* some "stringop-overflow"s
* a clang-analyzer-core.uninitialized.Assign
* a clang-analyzer-core.CallAndMessage "2nd function call argument is an uninitialized value"
* a nullPointerRedundantCheck
* several clang-diagnostic-declaration-after-statement
* a spurious gcc sanitizer maybe-uninitialized in test_wolfSSL_CheckOCSPResponse()
2023-05-31 15:19:15 -05:00
JacobBarthelmeh 80311975ce
Merge pull request #6452 from anhu/no_rsa_sigalgs
For NO_RSA, don't advertise support for RSA.
2023-05-31 13:41:56 -06:00
Hideki Miyazaki 554e6472b5
addressed review comments 2023-05-31 06:54:14 +09:00
Chris Conlon 769c488d18
Merge pull request #6444 from night1rider/wolfssl-Onboarding
added test case for wolfSSL_configure_args
2023-05-30 13:03:05 -06:00
Anthony Hu ea6155c924 For NO_RSA, don't advertise support for RSA. 2023-05-30 12:34:23 -04:00
Hideki Miyazaki 63a5fe3229
fix to cast diff type, int and uint 2023-05-30 17:32:42 +09:00
Sean Parkinson 541ea51ad5 Tests api.c: rework for malloc failure testing
Modified number of tests to not crash on failure and cleanup allocations
on failure.
Added memory fail count option to set which memory allocation to start
failing on.
Fix issues found from testing.

bio.c:
BIO_new() move ref count up so that calls to wolfSSL_BIO_free()
work.
internal.c:
ImportCipherSpecState wasn't checking SetKeySide for failure. Crash
when pointer is NULL and accessed directly.
ocsp.c:
wolfSSL_OCSP_response_get1_basic() doesn't need to free vs->source
as it is freed in WOLFSSL_OCSP_RESPONSE_free().
ssl.c:
ProcessBuffer() Don't strip PKCS#8 header if failed to create DER.
Crasged as directly accessing 'der' which was NULL.
ssl_asn.c:
wolfssl_asn1_integer_require_len was checking wrong variable to see
if allocation failed.
x509,c:
wolfSSL_X509_ALGOR_set0 needs to set aobj only when no failure
possible.
wolfSSL_X509_chain_up_ref needs to call cleanup to ensure everything
is freed.
2023-05-30 12:01:21 +10:00
Sean Parkinson 37c03e3f11
Merge pull request #6442 from embedded-specialties/int-sequence
ASN.1 Integer sequence
2023-05-30 09:37:55 +10:00
Joe Hamman d340587035 Added valid ASN.1 integer value to test_asn1 2023-05-28 21:18:45 -04:00
dell5060 c0116d6026 added test case for wolfSSL_configure_args and added fix
new fix

removing redundant () in code
2023-05-26 16:45:13 -06:00
Anthony Hu 87bbcbb96a Fix a syntax error.
Tested with:
    ./configure --enable-debug --enable-all CFLAGS=-DDEBUG_WOLFSSL_VERBOSE
2023-05-26 16:12:14 -04:00
Joe Hamman 8bd3850e58 Added ASN.1 Integer sequencing 2023-05-24 17:28:53 -04:00
JacobBarthelmeh 1218cfb7f2
Merge pull request #6087 from rizlik/embed_recv_from_fix_peer
dtls: improve different peer recvfrom and better error reporting on ipv6
2023-05-24 13:54:40 -06:00
JacobBarthelmeh 188a99bd5a
Merge pull request #6438 from anhu/ext_cache
Without HAVE_EXT_CACHE session dup is not compiled in
2023-05-24 11:15:00 -06:00
Anthony Hu 87a7af05dd Without HAVE_EXT_CACHE session dup is not compiled in 2023-05-24 12:14:02 -04:00
Marco Oliverio f21c34b08d tests: EmbedRecvFrom/EmbedSendTo error if ipv6 w/o ipv6 compiled in 2023-05-22 15:33:06 +00:00
Marco Oliverio b4542ed270 tests: add dtls ignoring different peer test 2023-05-22 15:32:57 +00:00
Marco Oliverio 5f293bf736 tests: add test_wolfssl_client_server_no_fail(_ex) to set client cb 2023-05-22 15:31:58 +00:00
Marco Oliverio cff580b4f0 tests: api: error out on read error in test_server_nofail 2023-05-22 15:31:58 +00:00
JacobBarthelmeh a06bd777c0
Merge pull request #6423 from cconlon/pkcs7NoStream
Fix PKCS#7 build with NO_PKCS7_STREAM
2023-05-19 10:32:49 -06:00
Marco Oliverio 35185e1a59 tests: add dtls13 null cipher test 2023-05-19 08:10:26 +00:00
Chris Conlon 6ef580ca59 fix PKCS#7 build when using NO_PKCS7_STREAM 2023-05-18 14:50:03 -06:00
JacobBarthelmeh 53ef26bf3a
Merge pull request #6392 from rizlik/dtls13-fix-ch-epoch
DTLS v1.3: fix epoch 0 check on plaintext message
2023-05-16 10:07:14 -06:00
Lealem Amedie 3f795f2f47 Fixes for wolfcrypt test without ECC SECP 2023-05-15 14:12:24 -06:00
Kareem f1ad37919d Add test case for ASN1_TIME_to_tm fix. 2023-05-12 14:30:55 -07:00
Marco Oliverio 5773252e33 test: add check that CH with epoch != 0 are ignored 2023-05-10 13:54:25 +00:00
JacobBarthelmeh cdeba4e1b0
Merge pull request #6364 from anhu/compat_unknown_oid
Allow for unknown OIDs in extensions in wolfSSL_X509_set_ext()
2023-05-08 14:51:35 -06:00
Sean Parkinson d2afe9e5e0 Memory usage improvements
ECC: make private key field 'k' able to be smaller when ALT_ECC_SIZE is
defined.
WOLFSSL_SMALL_STACK_CACHE: allocate temps using new macros.
2023-05-04 10:26:57 +10:00
Anthony Hu 0ebe5819d0 Allow for unknown OIDs in extensions in wolfSSL_X509_set_ext()
...and add some testing to show we properly inserted the extensions.
2023-05-02 12:43:14 -04:00
Marco Oliverio 3e4b95eb4b test: fix test AEAD limit server set fds as nonblock 2023-05-02 16:34:01 +00:00
David Garske 52a20fc2b5
Merge pull request #6328 from julek-wolfssl/zd/16000
Allow cert callback to override skipAddCA
2023-04-28 10:25:13 -07:00
Juliusz Sosinowicz bf2c66a1cb Allow cert callback to override skipAddCA 2023-04-27 10:07:04 +02:00
TakayukiMatsuo 4c47934562 Fix issues in test_wolfSSL_dtls_fragments 2023-04-27 17:00:29 +09: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 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 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
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
Anthony Hu b0e90b6ffe Should not be an error to call wolfSSL_X509_REQ_add_extensions with empty stack. 2023-04-18 12:27:54 -04:00
Anthony Hu 120d1f0d1a Support in the compatibility layer for UPN and SID. 2023-04-17 14:42:27 -04:00
JacobBarthelmeh 36a9b9944c fix guard on ECC export 2023-04-13 16:12:08 -07:00
Chris Conlon bd02b9c29c
Merge pull request #6254 from miyazakh/fix_favouriteDrink 2023-04-06 09:39:23 -06:00
Daniel Pouzzner dcc8b5d7d5 eliminate XREWIND() macro, add XSEEK_SET definitions, and refactor all XREWIND()s to XFSEEK()s, to fix clang-tidy-17 bugprone-unsafe-functions warning on rewind();
add BENCH_DEVID_COLUMN_HEADER in wolfcrypt/benchmark/benchmark.c:bench_stats_sym_finish() to resolve clang-diagnostic-embedded-directive.
2023-04-05 20:28:51 -05:00
JacobBarthelmeh caf2749c8a
Merge pull request #6269 from julek-wolfssl/fix-test_wolfSSL_CTX_add_session
Fix intermittent failures in test_wolfSSL_CTX_add_session
2023-04-05 15:19:36 -06:00
Daniel Pouzzner cf173e7b7d
Merge pull request #6270 from julek-wolfssl/fix-test_wolfSSL_dtls_stateless_HashWOLFSSL
Ignore staticBuffer in test_wolfSSL_dtls_stateless_HashWOLFSSL
2023-04-05 12:53:11 -05:00
Juliusz Sosinowicz c5f03e43cf Ignore staticBuffer in test_wolfSSL_dtls_stateless_HashWOLFSSL 2023-04-05 14:23:19 +02:00
Juliusz Sosinowicz a51daf1bfa Fix intermittent failures in test_wolfSSL_CTX_add_session 2023-04-05 13:57:10 +02:00
Sean Parkinson 9eac521521 ASN.1 testing: restore 0 length BIO failure tests
Create a fixed buffer BIO of length 1 and then write one byte into it so
that there is 0 length to write into.
Test cases removed as setting fixed buffer BIO to length 0 allocated 0
length buffer that is sometimes returning NULL.
2023-04-05 10:29:46 +10:00
Hideki Miyazaki 9eb3c4d31a
fix unitest failure 2023-04-05 07:25:25 +09:00
JacobBarthelmeh cb422bfaf7
Merge pull request #6242 from julek-wolfssl/harden-tls
Implement TLS recommendations from RFC 9325
2023-04-04 10:13:27 -06:00
Daniel Pouzzner c08878ac94 configure.ac: include both -I. and -I$srcdir for "circular dependency" test, so that ${build_pwd}/wolfssl/options.h is found in out-of-tree builds; streamline scripting that dynamically sets $TRIM;
linuxkm/module_exports.c.template: include wolfssl/wolfcrypt/wolfmath.h, to bring in wc_GetMathInfo() prototype;

src/ssl.c: move "Global pointer to constant BN on" to src/ssl_bn.c; and in wolfSSL_Cleanup(), call the new wolfSSL_BN_free_one() rather than using ad hoc cleanup logic;

src/ssl_bn.c: add bn_one and wolfSSL_BN_free_one();

src/ssl_asn1.c: fix bugprone-macro-parentheses in bufLenOrNull(); refactor wolfSSL_ASN1_TIME_diff() to avoid floating point math; use intermediate tm_year variable in wolfssl_asn1_time_to_tm() to avoid target-specific type conflicts on tm->tm_year; use "FALL_THROUGH", not "/* fall-through */", in wolfSSL_ASN1_TYPE_set (clang-diagnostic-implicit-fallthrough);

wolfcrypt/src/ecc.c: fix identicalInnerCondition in ecc_mul2add();

wolfcrypt/src/integer.c: refactor OPT_CAST()s in mp_grow() to unconditional casts as elsewhere, to mollify a confused cppcheck-all-intmath;

tests/api.c: reformat some overlong lines.
2023-04-03 15:49:39 -05:00
Andras Fekete c56e58db5b Remove TODO+bad tests 2023-03-31 15:51:28 -04:00
Andras Fekete 18f4b45129 Fix object size 2023-03-31 15:44:25 -04:00
Andras Fekete 80a0fb548a Zero buffer size test should be implemented another way 2023-03-31 15:44:13 -04:00
Hideki Miyazaki 27f5f3a3e8
fix overwriting serialnum by favouriteDrink 2023-03-31 15:56:31 +09:00
Sean Parkinson 8489095057 Move ASN.1 APIs out to separate file: ssl_asn1.c
Implementations of ASN.1 APIs reworked.

Added tests.

Added wolfssl_bn_set_neg for ASN.1 code.
Added wolfssl_sk_new_type() and wolfssl_sk_pop_type() to generically
handle creating and popping a stack of elements of a type.

No longer freeing pathlen field of ASN1 OBJECT in
wolfSSL_X509_EXTENSION_free(). This is happening in
wolfSSL_ASN1_OBJECT_free().
Stop wolfSSL_i2d_X509_NAME_canon from double freeing ASN.1 STRING's data
field.

Fixed up GetFormattedTime() to be better code.
Added ASN_CLASS_MASK to mask off the class part of an ASN.1 tag.
NO_ASN_TIME means no implementation to get the current time. Disable
features that won'r work without time.
2023-03-31 09:36:01 +10:00
David Garske 22a5a5c45e Add introspection for math build and math cleanups:
* Add introspection for math build.
* Raise build error if more than one multi-precision math library used.
* Fix ESP32 to support using any multi-precision math option.
* Refactor math headers to use `wolfmath.h`
* Refactor of the opaque math variable type `MATH_INT_T` used by crypto hardware (QuickAssist, SE050, ESP32 and STM32).
* Cleanups for building with `WOLFCRYPT_ONLY` and `NO_BIG_INT`.
* Stop forcing use of fast math by default for platforms in settings.h. Note: For users that still want to use fast math (tfm.c) they will need to add USE_FAST_MATH to their build settings.

Applies To:
```
WOLFSSL_ESPWROOM32
WOLFSSL_ESPWROOM32SE
MICROCHIP_PIC32
WOLFSSL_PICOTCP_DEMO
WOLFSSL_UTASKER
WOLFSSL_NRF5x
FREERTOS_TCP
WOLFSSL_TIRTOS
EBSNET
FREESCALE_COMMON
FREESCALE_KSDK_BM
WOLFSSL_DEOS
MICRIUM
WOLFSSL_SGX
```
2023-03-30 14:42:55 -07:00
Lealem Amedie 8e730534d5 Free in drbg test when appropriate 2023-03-29 10:26:59 -06:00
Lealem Amedie 65f97482f3 Missed free's in api.c 2023-03-29 10:16:29 -06:00
Juliusz Sosinowicz f0ad01f552 Send secure renegotiation extension by default
- Add test for terminating the connection
- Add ProcessReplyEx(ssl, 1) to wolfSSL_accept
2023-03-28 12:43:53 +02:00
JacobBarthelmeh 7e8d027a17
Merge pull request #6217 from douzzer/20230321-fixes
20230321-fixes
2023-03-22 10:23:07 -06:00
Daniel Pouzzner 49cd3ff872 wolfssl/internal.h: fixes for -Wpedantic "redefinition of typedef" around typedef ... TLSX and Options;
src/internal.c: fix for -Wdeclaration-after-statement and clang-diagnostic-unreachable-code-break;

tests/api.c: fix for -Wunused-variable and clang-analyzer-deadcode.DeadStores;

olfcrypt/src/pkcs12.c: fixes for cppcheck uselessAssignmentPtrArg and arrayIndexThenCheck, and clang-tidy clang-analyzer-deadcode.DeadStores and clang-analyzer-core.NonNullParamChecker;

wolfssl/src/tls.c: fix for clang-analyzer-deadcode.DeadStores;

wolfcrypt/src/tfm.c: fix for clang-diagnostic-newline-eof;

src/tls13.c: fix for clang-analyzer-core.NonNullParamChecker.
2023-03-21 22:52:56 -05:00
JacobBarthelmeh 147395476f
Merge pull request #6213 from SparkiDev/regression_fixes_6
Regression testing fixes
2023-03-21 20:17:30 -06:00
Sean Parkinson 9ec742b11f Regression testing fixes
HAVE_ECH only used by TLS 1.3 add protection around all code.
ssl->options.onlyPskDheKe only available when HAVE_SUPPORTED_CURVES.
CleanupClientTickets() defined when HAVE_SUPPORTED_CURVES.
TLSX_KeyShare_DeriveSecret only defined when HAVE_SUPPORTED_CURVES.
DecodeResponseData - initialize variable single.
New OpenSSL compatibility BN code requires mp_read_radix - turn on in
integer.c, sp_int.c when OPENSSL_EXTRA defined.
rsa.c:_CheckProbablePrime - make sure tmp1 and tmp2 are initialized
before error handling jumps to freeing them.

test_remove_hs_message uses 1024-bit DH key which is not supported when
using SP math with SP.
2023-03-22 08:57:20 +10:00
Sean Parkinson 17e20b8c36 Server ID - long id, TLS 1.3 - cache client session for tickets
Long server IDs were being truncated. Hash long IDs instead.
TLS 1.3 session ticket on client side no longer added session to client
cache. Explicit call added.
2023-03-21 15:29:07 +10:00
JacobBarthelmeh 0e431c3eaa add given name test case 2023-03-17 13:07:15 -07:00
JacobBarthelmeh 06d970c999
Merge pull request #6181 from kareem-wolfssl/zd15767
Fix not ignoring date errors when VERIFY_SKIP_DATE is set
2023-03-17 10:53:41 -06:00
JacobBarthelmeh 042ceff08e
Merge pull request #6160 from lealem47/indefPKCS12
Adding support for indefinite length PKCS12
2023-03-17 10:45:46 -06:00
Sean Parkinson 21c5ecc371
Merge pull request #6179 from tim-weller-wolfssl/zd14527-pemtoder-return-size
zd14527 - Update `PubKey` and `Key` PEM-to-DER APIs to support return of needed DER size
2023-03-17 08:37:51 +10:00
Kareem cc51b2d52e Add additional fix for absolute URN issue from PR #5964 and add test. 2023-03-16 14:56:44 -07:00
Kareem 28f39f6b3d Fix unit test failure when building OPENSSL_EXTRA without HAVE_EXT_CACHE. 2023-03-16 14:25:42 -07:00
Marco Oliverio 94d983f94a tests: add WOLFSSL_EXTRA_ALERTS tests 2023-03-14 13:27:40 +00:00
tim-weller-wolfssl 52105a10c9 Add means to get size of DER buffer size needed for PEM-to-DER conversion to Key and PubKey APis 2023-03-14 06:33:12 -05:00
JacobBarthelmeh 694b527e67
Merge pull request #5910 from julek-wolfssl/dtls13-stateless
DTLS 1.3 stateless server ClientHello parsing
2023-03-13 09:22:58 -06:00
Lealem Amedie 1c9fa5c5ae Set some freed data to NULL 2023-03-10 13:40:25 -07:00
Chris Conlon d03347d79c fix GetAsnTimeString() to correctly increment data_ptr, fixes PKCS#7 signedData signingTime attribute 2023-03-08 16:39:49 -07:00
Juliusz Sosinowicz 335722c586 Async fixes 2023-03-07 12:04:54 +01:00
Juliusz Sosinowicz f5f67f43d7 Reset DTLS sequence number 2023-03-07 12:04:54 +01:00
Juliusz Sosinowicz b0d7656ad2 Rebase fixes 2023-03-07 12:04:54 +01:00
Juliusz Sosinowicz 885cca67fe Check for shared ctx in all configs 2023-03-07 12:04:54 +01:00
Juliusz Sosinowicz 5f39c594aa TLS 1.3: hold decrypted ticket to check which ciphersuite matches
DTLS 1.3: Move stateless ticket decoding to FindPskSuiteFromExt
2023-03-07 12:04:54 +01:00
Juliusz Sosinowicz aa9dcca624 Rebase and Jenkins fixes 2023-03-07 12:02:54 +01:00
Juliusz Sosinowicz 984d709db0 dtls 1.3: Stateless ClientHello parsing 2023-03-07 12:02:54 +01:00
Chris Conlon 9bc3b867e0
Merge pull request #6157 from miyazakh/add_favouriteDrinkNID 2023-03-06 16:45:14 -07:00
David Garske 86e1b0d8ab
Merge pull request #6165 from SparkiDev/bn_move
BN compatibility API: move implementation out to separate API
2023-03-06 09:27:24 -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 ab71f6fd4c extend C89 build to whole codebase including examples:
configure.ac: remove implied --disable-examples when --disable-inline;

tests/api.c: always include wolfcrypt/src/misc.c;

wolfcrypt/src/misc.c: use WC_MISC_STATIC to designate staticness of the misc functions;

wolfssl/wolfcrypt/misc.h: define WC_MISC_STATIC to empty or static depending on #ifdef NO_INLINE or not (respectively);

wolfssl/wolfcrypt/types.h: #ifdef NO_INLINE, #define WC_INLINE WC_MAYBE_UNUSED, and move the definitions of WARN_UNUSED_RESULT and WC_MAYBE_UNUSED above the definition of WC_INLINE for clarity;

wolfssl/wolfcrypt/mem_track.h: always declare TrackMalloc() et al static (no functional change, because the state and callback bindings were and remain unconditionally static, but previously #ifdef NO_INLINE the functions were globals, leading to multiple definitions.
2023-03-03 22:30:08 -06:00
Hideki Miyazaki 0693b66c44 fix init var in for-loop 2023-03-03 17:51:34 +09:00
Andras Fekete aff4d4a7d3 The size of the packet could vary by up to 5 bytes 2023-02-28 17:04:40 -05:00