1983 Commits

Author SHA1 Message Date
Sean Parkinson
f04380d624
Merge pull request #4475 from douzzer/fix-scan-build-UnreachableCode
scan-build LLVM-13 fixes and expanded coverage
2021-10-20 08:30:46 +10:00
Sean Parkinson
41eecd37e5
Merge pull request #4471 from embhorn/zd11886
Fix build errors with NO_BIO config
2021-10-20 08:06:42 +10:00
Eric Blankenhorn
c0b592ef82 Fix build error with WOLFSSL_USER_IO 2021-10-19 08:27:43 -05:00
Daniel Pouzzner
e341291d99 scan-build LLVM-13 fixes: tests/api.c: fix -Wunused-but-set-variable for drive_len in test_wolfSSL_EVP_Cipher_extra() by removing the unused drive_len code. 2021-10-18 21:46:10 -05:00
Daniel Pouzzner
816527e826 scan-build fixes: back out all "#ifndef __clang_analyzer__" wrappers added to suppress false and frivolous positives from alpha.deadcode.UnreachableCode, and rename new macro WC_UNUSED to WC_MAYBE_UNUSED to make its meaning more precisely apparent. build is still clean with -Wunreachable-code-break -Wunreachable-code-return under scan-build-13. 2021-10-18 21:46:09 -05:00
Daniel Pouzzner
62822be6ce scan-build LLVM-13 fixes and expanded coverage: add WC_UNUSED and PRAGMA_CLANG_DIAG_{PUSH,POP} macros; deploy "#ifndef __clang_analyzer__" as needed; fix violations and suppress false positives of -Wunreachable-code-break, -Wunreachable-code-return, and -enable-checker alpha.deadcode.UnreachableCode; expand scan-build clean build scope to --enable-all --enable-sp-math-all. 2021-10-18 21:46:09 -05:00
Jacob Barthelmeh
c07a7deec2 sanity check on q value with DSA sign 2021-10-18 10:17:49 -06:00
Eric Blankenhorn
17e0249a26 Fixing NO_BIO and OPENSSL_ALL errrors 2021-10-14 16:03:52 -05:00
David Garske
2aa2ef84b2
Merge pull request #4470 from LinuxJedi/md-cleanups
Cleanup markdown documentation
2021-10-14 11:04:48 -07:00
Eric Blankenhorn
61bab6f68b Fix test build errors with NO_BIO 2021-10-14 09:37:01 -05:00
Andrew Hutchings
11e3f867b0 Cleanup markdown documentation
* Add syntax highlighting where appropriate
* Fix some markdown compliance issues
* Add some links for things
* Add some inline code quoting
* Fix some headings
* Fix copyright date in doxygen html output
2021-10-13 16:39:46 +01:00
Jacob Barthelmeh
63c9fa7a37 add check on bit length of q with DSA 2021-10-11 09:52:57 -06:00
David Garske
a395305cab Refactor API unit test named initializer code for callback_functions, to avoid older g++ build issues. 2021-10-08 14:04:21 -07:00
David Garske
854512105f
Merge pull request #4314 from SparkiDev/libkcapi
KCAPI: add support for using libkcapi for crypto (Linux Kernel)
2021-10-07 21:23:05 -07:00
Sean Parkinson
e0abcca040 KCAPI: add support for using libkcapi for crypto (Linux Kernel)
RSA, DH and ECC not testable as no Linux Kernel driver to use.
ECC implementation is customer specific.
2021-10-08 09:07:22 +10:00
Sean Parkinson
dd6e4093b3
Merge pull request #4448 from JacobBarthelmeh/Compatibility-Layer
remove error queue from JNI build and set a default upper bound on it
2021-10-08 08:35:03 +10:00
David Garske
9d2082f7e1
Fixes and improvements for crypto callbacks with TLS (mutual auth) (#4437)
* This PR resolves issues with using TLS client authentication (mutual auth) with crypto callbacks. The TLS client auth will not be sent without a private key being set. The solution is to allow setting a public key only if crypto callbacks is enabled and a devId is set.

* Fix to allow using crypto callbacks with TLS mutual authentication where a private key is not available.
* Fix for ED25519 sign when only a private key is loaded.
* Fix to enable crypto callbacks for ED25519 and Curve25519 in TLS by using the _ex init functions.
* Fix for wc_PemToDer return code where a PKCS8 header does not exist.
* Remove duplicate logs in DoCertificateVerify.
* Doxygen API updates: Added crypto callback help and updated use_PrivateKey with info about public key use.

* * Added crypto callback tests for TLS client and server with mutual auth for RSA, ECC and ED25519.
* Enhanced the API unit test TLS code to allow setting CA, cert and key.

* Revert ED25519 changes. Opt to calculate public key directly when required for signing in the TLS crypto callback test. Build configuration fixes.

* Fix to use proper devId in `ProcessBufferTryDecode`.

* Various build fixes due to changes in PR. G++ issue with `missing-field-initializers`. Unused api.c func with DTLS and session export. Duplicate `eccKeyPubFile` def.

* Added crypto callback TLS tests at WOLFSSL object level. Fix for ED25519/ED448 with client mutual auth where the private key is not set till WOLFSSL object. Fix issues with  `wolfSSL_CTX_GetDevId` where devId is set on WOLFSSL object. Enable the `_id` API's for crypto callbacks.

* Proper fix for `eccKeyPubFile` name conflict. Was causing RSA test to fail (expected DER, not PEM).
2021-10-07 11:12:06 +10:00
JacobBarthelmeh
43ffe26133
Merge pull request #4430 from embhorn/zd12976
Add support for X9.42 header
2021-10-05 23:47:42 +07:00
Jacob Barthelmeh
b582e152ea add test case max error queue size 2021-10-04 14:52:05 -06:00
Eric Blankenhorn
1440b8966d Add test for X9.42 parsing 2021-10-04 11:05:58 -05:00
John Safranek
774bc36603
Merge pull request #4061 from JacobBarthelmeh/sessionExport 2021-10-01 10:21:42 -07:00
John Safranek
98b1e93429
Merge pull request #4402 from JacobBarthelmeh/Compatibility-Layer 2021-09-30 15:53:58 -07:00
Jacob Barthelmeh
ed8b87306d account for test case where psk and anon is off 2021-09-30 15:48:55 -06:00
Jacob Barthelmeh
cb4b57c5c7 add tls 1.3 test case 2021-09-30 10:08:47 -06:00
Chris Conlon
cf1ce3f073
Add get_default_cert_file/env() stubs, SSL_get/set_read_ahead(), SSL_SESSION_has_ticket/lifetime_hint() (#4349)
* add wolfSSL_X509_get_default_cert_file/file_env/dir/dir_env() stubs

* add SSL_get_read_ahead/SSL_set_read_ahead()

* add SSL_SESSION_has_ticket()

* add SSL_SESSION_get_ticket_lifetime_hint()

* address review feedback - comments, return values

* make SSL_get_read_ahead() arg const

* add unit tests for SESSION_has_ticket/get_ticket_lifetime_hint

* test for SESSION_TICKET_HINT_DEFAULT in api.c for wolfSSL_SESSION_get_ticket_lifetime_hint()

* fix variable shadow warning in api.c
2021-09-30 08:35:23 +10:00
Chris Conlon
95b9fae605
Add DIST_POINT compatibility functions (#4351)
* add DIST_POINT compatibility functions

* switch X509_LU_* from enum to define, prevent compiler type warnings

* refactoring, adding in comments, and formating

* refactoring and a memory leak fix

* cast return value for g++ warning

* refactor wolfSSL_sk_DIST_POINT_pop_free and remove NULL assign after free

* fix get next DIST_POINT node for free function

Co-authored-by: Jacob Barthelmeh <jacob@wolfssl.com>
2021-09-30 08:27:39 +10:00
Jacob Barthelmeh
707385724e adjust macro guard around test cases 2021-09-29 13:28:20 -06:00
Jacob Barthelmeh
5f9f6fd9fa add some test cases and use allocator 2021-09-29 12:02:26 -06:00
Jacob Barthelmeh
dd7b62d067 fix for use with idea enabled 2021-09-29 11:15:51 -06:00
Jacob Barthelmeh
ae47cb3bcd update check on is TLS, update macro guard for test case 2021-09-28 16:57:30 -06:00
Anthony Hu
0e80923fb3 Unit tests for post-quantum groups.
Also, fixes for the things they caught such as:

- ssl->arrays->preMasterSecret is pre-allocated so copy into it instead of
  moving ownership of buffer.
- server does not need to save the public key.
- in TLSX_KeyShare_Parse() don't call TLSX_KeyShare_Use() because its done in
  TLSX_PopulateExtensions().
- in TLSX_KeyShare_Use(), the server generates the ciphertext while the client
  generates the public key.
- in TLSX_PopulateExtensions(), prevent client from calling TLSX_KeyShare_Use()
  because its already been done.
- Support longer curve/group names.
2021-09-28 17:16:44 -04:00
Jacob Barthelmeh
21181f2437 canned test was made without the wolfssl_idea enum on 2021-09-27 14:01:15 -06:00
Jacob Barthelmeh
8b456b90e0 add test case for tls export/import 2021-09-27 14:01:15 -06:00
Jacob Barthelmeh
2871fc670f initial serialization of TLS session 2021-09-27 14:00:13 -06:00
David Garske
3bdce348e9
Added NID_pkcs9_contentType and ub_ to compatibility layer (#4408)
* Added `NID_pkcs9_contentType` and `ub_` values.  ZD 11742

* Improve the API unit test. Also only include when `WOLFSSL_CERT_REQ` defined.
2021-09-27 08:21:53 +10:00
Chris Conlon
9e4ab9b638
Add BIO_up_ref(), PEM_read_DHparam(), EVP_MD_nid() (#4348)
* add BIO_up_ref

* add PEM_read_DHparams()

* add EVP_MD_nid()

* exclude PEM_read_DHparams when NO_FILESYSTEM defined

* review feedback: single threaded, indents, EVP_MD_nid
2021-09-27 08:20:37 +10:00
Hayden Roche
24e2eded1e
Add to the OpenSSL compatibility layer. (#4404)
- X509_get_extension_flags
- X509_get_key_usage
- X509_get_extended_key_usage
- ASN1_TIME_to_tm
- ASN1_TIME_diff
- PEM_read_X509_REQ
- ERR_load_ERR_strings
- BIO_ssl_shutdown
- BIO_get_ssl
- BIO_new_ssl_connect
- BIO_set_conn_hostname
2021-09-24 12:26:53 +10:00
Anthony Hu
33cb823148
Remove legacy NTRU and OQS (#4418)
* Remove NTRU and OQS

* Keep the DTLS serialization format backwards compatible.

* Remove n from mygetopt_long() call.

* Fix over-zealous deletion.

* Resolve problems found by @SparkiDev
2021-09-24 08:37:53 +10:00
Eric Blankenhorn
e6e7795140
Make subj alt name order match openSSL (#4406) 2021-09-22 10:29:57 +10:00
John Safranek
df30a88dc6
Merge pull request #4414 from JacobBarthelmeh/devcrypto
update macro guard on SHA256 transform call
2021-09-21 10:03:51 -07:00
John Safranek
7ec7faddef
Merge pull request #4405 from anhu/truncating_last_char
Fix for `set1_curves_list` ignoring last character
2021-09-21 08:49:53 -07:00
Daniel Pouzzner
ec21dd6d13 miscellaneous buildability fixes:
configure.ac: fix ed25519/sha512 dependency test to not misfire when ENABLED_32BIT;

wolfssl/wolfcrypt/curve{25519,448}.h: fix redundant typedefs of curve{25519,448}_key (fixes -Wpedantic warnings);

configure.ac: fix for "ISO C forbids an empty translation unit [-Werror=pedantic]", re wolfcrypt/src/sp_c{32,64}.c;

configure.ac: fixes for --enable-32bit versus pedantic "ISO C forbids an empty translation unit", including explicit exclusion of 32bit-incompatible algorithms from enable-all and enable-all-crypto sets;

tests/api.c: fixes for a couple inadequately gated SHA2 dependencies;

tests/api.c:test_wolfSSL_set_alpn_protos(): fix prototype missing (void);

wolfcrypt/src/misc.c and wolfssl/wolfcrypt/misc.h: fix ForceZero() definition and NO_INLINE prototype to not counterfactually constify the mem ptr, to avoid -Wmaybe-uninitialized from gcc11;

wolfcrypt/src/des3.c: drop obsolete register qualifier from declaration in DesSetKey(), for c++17 compatibility;

src/ssl.c:wolfSSL_BN_mod_word(): fix cast of arg2 to mp_mod_d().
2021-09-20 13:38:52 -05:00
Daniel Pouzzner
1209908468 tests/api.c: fix key size in test_wc_ecc_shared_secret(). 2021-09-20 10:27:13 -05:00
Anthony Hu
c733be728f Trivial change to re-trigger jenkins. 2021-09-20 08:37:56 -04:00
Kaleb Himes
9bd300e07d
AESNI in FIPS mode does not support zero length inputs (#4411)
* AESNI in FIPS mode does not support zero length inputs

* Update note to specifically note AESNI
2021-09-20 08:29:15 +10:00
JacobBarthelmeh
f447e4c1fa update macro guard on SHA256 transform call 2021-09-17 15:06:13 -07:00
Anthony Hu
79cc6be806 Make jenkins happy 2021-09-17 15:50:06 -04:00
John Safranek
3503be2c13
Merge pull request #4362 from JacobBarthelmeh/wolfCLU
add wolfclu enable option and remove test macro guard
2021-09-15 13:57:50 -07:00
Anthony Hu
07656e371c Parameter sanity check and a unit test. 2021-09-15 16:29:55 -04:00
Juliusz Sosinowicz
4ad8b07c1c
wolfSSL_PEM_write_bio_PUBKEY needs to write only the public part (#4354)
* `wolfSSL_PEM_write_bio_PUBKEY` needs to write only the public part

The `wolfSSL_PEM_write_bio_PUBKEY` output can't contain the private portion of the key. This output could be used to distribute the public key and if it contains the private part then it gets leaked to others.

* Add heap hint to `wolfSSL_RSA_To_Der`

* Correct function name in logs
2021-09-15 17:34:43 +10:00