Commit Graph

122 Commits (b4e8e57b59cddab0e8fc4106449f2948a049f1c6)

Author SHA1 Message Date
Anthony Hu c2860cb311 Get rid of HC-128 2022-01-17 18:11:54 -05:00
David Garske 6ce248e2f9 Improve documentation for `wolfSSL_get1_session`. Add wolfSSL specific naming on the internal session functions to avoid possible user conflicts. ZD13363 and ZD13487. 2022-01-10 07:47:19 -08:00
Andrew Hutchings 231546dacc Fix more Doxygen typos 2021-11-10 17:26:33 +00:00
Andrew Hutchings afe8d74333 Fix up some Doxygen issues for 1.9
Some of the Doxygen content was not processed correctly by Doxygen.
This patch fixes all the issues found.
2021-11-10 16:20:13 +00:00
David Garske 5dac25f470 Eliminate `EIGHTK_BUF` use in asn. Cleanup uses of `0` in set_verify for callback. 2021-11-09 08:23:19 -08:00
Hayden Roche 0b6523d933 Rename pem_password_cb to wc_pem_password_cb.
Recently, we had a wolfEngine customer report a compilation error because
wolfSSL and OpenSSL both define the typedef pem_password_cb. The solution is to
namespace our typedef with the wc_ prefix. In order to not break existing code
that relies on wolfSSL providing pem_password_cb, if OPENSSL_COEXIST is not
defined, we define pem_password_cb as a macro that maps to wc_pem_password_cb.
2021-10-21 16:47:29 -07:00
David Garske 4e7ce45a8c Allow loading public key with PK callbacks also. 2021-10-19 17:04:18 -07: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
Jacob Barthelmeh cb4b57c5c7 add tls 1.3 test case 2021-09-30 10:08:47 -06:00
Jacob Barthelmeh ae47cb3bcd update check on is TLS, update macro guard for test case 2021-09-28 16:57:30 -06:00
Jacob Barthelmeh 6e7c6e8a66 add comments to dox header file 2021-09-27 14:01:15 -06: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
David Garske f08b1c49a9
Merge pull request #4371 from anhu/doc_update
Documentation fixup to reflect that we will error out if you set a ba…
2021-09-13 11:14:25 -07:00
elms 98f286d8cb
Consistent return value from SSL_CTX_load_verify_locations{,_ex} (#4341)
On any failure, return `WOLFSSL_FAILURE`

If there was a failure and a successful processing of certs from the
same directory, the return value depended on the last cert processed
which not guarenteed to be the same order. If the last cert load
failed, it would return the specific wolfSSL error code. If it
succeeded, then WOLFSSL_FAILURE would be returned as a generic failure
due to a previous cert error.
2021-09-10 08:45:13 +10:00
Anthony Hu 10a4cfae9d Documentation fixup to reflect that we will error out if you set a bad group identifier 2021-09-03 12:46:44 -04:00
David Garske c8926a45ab Improvements to session locking to allow per-row. Can manually be enabled with `ENABLE_SESSION_CACHE_ROW_LOCK` or forcefully disabled using `NO_SESSION_CACHE_ROW_LOCK`. Enabled by default for Titan cache. ZD 12715. 2021-08-20 13:03:50 -07:00
elms b2380069f0
Merge pull request #4261 from dgarske/rsa_der_pub 2021-08-13 13:36:01 -07:00
Juliusz Sosinowicz 7dea1dcd39 OpenResty 1.13.6.2 and 1.19.3.1 support
# New or Updated APIs
- wolfSSL_get_tlsext_status_type
- wolfSSL_X509_chain_up_ref
- wolfSSL_get0_verified_chain
- SSL_CTX_set_cert_cb
- SSL_certs_clear
- SSL_add0_chain_cert ssl_cert_add0_chain_cert
- SSL_add1_chain_cert ssl_cert_add1_chain_cert
- sk_X509_NAME_new_null
- SSL_CTX_set_cert_cb
- SSL_set0_verify_cert_store
- SSL_set_client_CA_list

# Other Changes
- Ignore gdbinit
- Add api.c tests for new API
- Add `WOLFSSL_X509_STORE* x509_store_pt` to `WOLFSSL`
- Add macro to select the `WOLFSSL` specific store when available and the associated `WOLFSSL_CTX` store otherwise. Calls to `ssl->ctx->cm` and `ssl->ctx->x509_store*` were replaced by macros.
- NO-OP when setting existing store
- Add reference counter to `WOLFSSL_X509_STORE`
- Cleanup MD5 redundant declarations
- WOLFSSL_ERROR may map to nothing so make assignment outside of it
- refMutex fields are excluded with SINGLE_THREADED macro
- Chain cert refactor
- Make `wolfSSL_add0_chain_cert` and `wolfSSL_add1_chain_cert` not affect the context associated with the SSL object
- `wolfSSL_CTX_add1_chain_cert` now updates the `ctx->certChain` on success and stores the cert in `ctx->x509Chain` for later free'ing
2021-08-12 23:58:22 +02:00
David Garske c69d6d2491 Added public API `wc_RsaKeyToPublicDer_ex` to allow getting RSA public key without ASN.1 header (can return only seq + n + e). Related to PR #4068. Cleanup documentation for RSA and wolfIO. Consolidate duplicate code in `wc_RsaPublicKeyDerSize`. 2021-07-29 09:27:50 -07:00
TakayukiMatsuo 567d8ed704 Make wolfSSL_set_session return success on timeout under WOLFSSL_ERROR_CODE_OPENSSL macro definition. 2021-07-02 10:50:00 +09:00
David Garske 4ef3c5d75c Added inline documentation for `wolfSSL_CTX_load_verify_buffer_ex`. 2021-06-24 10:38:34 -07:00
David Garske 9e48de9d42
Merge pull request #3970 from embhorn/zd12122
Clarify that units of size parameters are in bits
2021-04-30 14:28:50 -07:00
David Garske fa9f1f8012
Merge pull request #3977 from embhorn/zd12136
Improve PSK callback doc
2021-04-30 14:26:39 -07:00
Eric Blankenhorn 3c0a77485e Improve PSK callback doc 2021-04-22 10:47:46 -05:00
Eric Blankenhorn 1d50962889 Clarify that units of size parameters are in bits 2021-04-20 09:28:17 -05:00
David Garske e13c93d493 Added API's for getting pointer to load static ephemeral key. 2021-04-05 13:40:48 -07:00
Sean Parkinson fa7b5f55ee TLS 1.3: add API to tell if a KeyUpdate response is required 2021-02-19 10:21:08 +10:00
Eric Blankenhorn b7b07e1945 Adding wolfSSL_CTX_get_TicketEncCtx 2021-02-15 11:28:46 -06:00
Juliusz Sosinowicz a0a3a2b74c Review changes 2020-11-17 19:15:12 +01:00
David Garske b931b1bd4d Fix to not allow free for globally cached sessions. Resolves a false-positive scan-build warning. 2020-11-12 12:51:41 -08:00
Chris Conlon af92c531bf
Merge pull request #3168 from ethanlooney/16th_branch
Added semicolons to two functions to fix doxygen issues and deleted ssl param and replaced it with ctx param
2020-07-29 09:31:14 -06:00
Ethan Looney 0448004535 Added semicolons to two functions to fix doxygen issues and deleted ssl param and replaced it with ctx param 2020-07-28 08:39:23 -07:00
Chris Conlon 6b3b37604f
Merge pull request #3159 from ethanlooney/16th_branch
Added doxygen comments and changed footer date to 2020
2020-07-27 09:24:59 -06:00
Ethan Looney 7b357cff39 Changed param's, examples and brief's 2020-07-24 12:54:29 -07:00
Ethan Looney 6bc4bfd7f2 Added doxygen comments to include all missing ABI functions and changed footer date from 2017 to 2020 2020-07-23 13:25:18 -07:00
David Garske 1b051d9c5b TLS v1.3 sniffer support:
* Added TLS v1.3 sniffer support using static ephemeral key.
* Add support for using a static ephemeral DH and ECC keys with TLS v1.3 using `WOLFSSL_STATIC_EPHEMERAL`.
* Adds new API's `wolfSSL_CTX_set_ephemeral_key` and `wolfSSL_set_ephemeral_key`.
* Expanded TLS extension support in sniffer.
* Refactor of the handshake hashing code.
* Added parameter checking to the TLS v1.3 key derivations (protects use of "DoTls13Finished" if handshake resources have been free'd).
* Added support for loading DH keys via `wc_DhImportKeyPair` and `wc_DhExportKeyPair`, enabled with `WOLFSSL_DH_EXTRA`.
* Added sniffer documentation `sslSniffer/README.md`.
2020-07-17 15:22:35 -07:00
toddouska edf88c3da1
Merge pull request #3073 from SparkiDev/tls13_dox
Update TLS 1.3 function Doxygen documentation
2020-07-15 13:58:07 -07:00
Chris Conlon 7bd5da70a6
Merge pull request #3066 from kaleb-himes/DOX_UPDATES
Update v23 methods to reflect TLSv1.3
2020-06-26 10:59:04 -05:00
Sean Parkinson be5648986c Update TLS 1.3 function Doxygen documentation
Give parameters a name in function prototypes.
2020-06-24 12:35:47 +10:00
kaleb-himes 646ecb54c2 Update v23 methods to reflect TLSv1.3 2020-06-22 12:04:16 -06:00
David Garske 6ecb88da47 Fixes for dox SNI documentation / examples. 2020-06-22 07:37:04 -07:00
David Garske 8823a581d0 Add PSK user context support (Fixes #2952.). 2020-06-04 15:31:18 -07:00
Eric Blankenhorn 95f973a5be Adding test and dox for ERR_print_errors_cb 2020-02-20 17:28:34 -06:00
Eric Blankenhorn ba25161f6c Adding BIO and EVP api 2020-02-20 17:28:31 -06:00
Jacob Barthelmeh a9e9120fa0 change public Timeval to WOLFSSL_TIMEVAL 2020-01-28 17:11:46 -07:00
kaleb-himes 9b8d4e91c2 Fixing some typos. Thanks to Fossies for the report 2020-01-10 11:45:51 -07:00
toddouska abc96f20fb
Merge pull request #2696 from embhorn/cert_vfy_CB
CertManager verify callback
2019-12-30 11:57:44 -08:00
Eric Blankenhorn 8580bd9937 CertManager verify callback
Execute verify callback from wolfSSL_CertManagerLoadCA
2019-12-26 09:29:03 -06:00
Eric Blankenhorn b83804cb9d Correct misspellings and typos from codespell tool 2019-12-24 12:29:33 -06:00
David Garske 872d222b59 * Adds the following openssl compatibility API's:
- SSL_CIPHER_get_id
  - SSL_CIPHER_get_rfc_name
  - SSL_get_cipher_by_value
  - X509_print_ex
  - X509_NAME_add_entry_by_NID
  - X509_time_adj
  - X509_time_adj_ex
  - DTLSv1_get_timeout
  - DTLSv1_handle_timeout
  - DTLSv1_set_initial_timeout_duration
  - SSL_CTX_set_current_time_cb
  - PEM_write_bio_RSA_PUBKEY
  - PEM_read_bio_RSA_PUBKEY
  - PEM_write_bio_PUBKEY
  - EVP_PKEY_missing_parameters
  - EVP_PKEY_cmp
  - BN_is_negative
  - BIO_set_retry_write
* Improvements to the notBefore and notAfter date handling.
* Improvements to BIO and BIO_METHOD
  - Moved structure to public area to allow for dereferencing
  - Renamed members to provide compatibility.
  - Added support for custom BIO methods for read/write.
* Added advanced openssl compatibility test cases for key and certificate generation.
* Fix for `ASN1_STRING_set` to allow NULL data.
* Fix to populate public key information on `EVP_PKEY_assign_RSA` and `EVP_PKEY_assign_EC_KEY`.
* Fix naming for `X509_get_notBefore` and `X509_get_notAfter` functions.
* Added `wc_EccPublicKeyDerSize`.
* Improvements to `wc_RsaPublicKeyDerSize`, so dummy memory doesn't have to be allocated.
* Made the `wc_*PublicKeyDerSize` functions public.
* Eliminate use of snprintf for UTC to generalized time conversion in `wolfSSL_ASN1_TIME_to_generalizedtime`.
2019-09-26 08:42:35 -07:00
Eric Blankenhorn 0c9ba1b361 Adding compatibility API phase 2 2019-08-28 09:29:49 -05:00
Eric Blankenhorn 48fa6a458c Adding compatibility API phase 1 2019-08-13 17:09:56 -05:00
David Garske 621e1656b4 Fixes for data types, cast warnings and shift operations when using 16-bit platform. Added new `--enable-16bit` build option, which defines `WC_16BIT_CPU`. Fix build error when using `WOLFSSL_LEANPSK` and `NO_WOLFSSL_MEMORY`.
Tested using `avr-gcc` version 8.3.0 with: `./configure --host=avr --enable-16bit --disable-filesystem --enable-singlethreaded CFLAGS="-DWOLFSSL_GENSEED_FORTEST -DWOLFSSL_USER_CURRTIME -DWOLFSSL_USER_IO -DWOLFSSL_NO_SOCK -DNO_WRITEV -DUSER_TICKS" --enable-tls13 --enable-compkey --enable-certgen --enable-certext --enable-keygen --enable-session-ticket --enable-maxfragment`. Also with `--enable-fastmath`.
2019-03-01 15:54:08 -08:00
Eric Blankenhorn 02ff19a6c4 Moving PRF to wolfcrypt 2019-01-16 17:23:49 -06:00
abrahamsonn 1b5ac2ea8d Updated an API's documented return codes
Added ASN_BEFORE_DATE_E and ASN_AFTER_DATE_E to
wolfSSL_CTX_load_verify_locations
2018-11-29 10:03:38 -07:00
David Garske 4adaeb8585 Added new 256-byte max fragment option `WOLFSSL_MFL_2_8`. 2018-10-15 17:06:21 -07:00
David Garske f48e2067ae Added new API `wolfSSL_CTX_load_verify_chain_buffer_format` for loading CA cert chain as DER buffer list including API unit test. Support for device serial number OID. 2018-09-10 08:15:17 -07:00
David Garske ae3d8d3779 * Fixed `wolfSSL_CTX_load_verify_locations` to continue loading if there is an error (ZD 4265).
* Added new `wolfSSL_CTX_load_verify_locations_ex` that supports flags `WOLFSSL_LOAD_FLAG_IGNORE_ERR`, `WOLFSSL_LOAD_FLAG_DATE_ERR_OKAY` and `WOLFSSL_LOAD_FLAG_PEM_CA_ONLY`.
* Fix for `PemToDer` to handle PEM which may include a null terminator in length at end of file length causing wrong error code to be returned. Added test case for this. (ZD 4278)
* Added macro to override default flags for `wolfSSL_CTX_load_verify_locations` using `WOLFSSL_LOAD_VERIFY_DEFAULT_FLAGS`.
* Added tests for loading CA PEM's from directory using `wolfSSL_CTX_load_verify_locations` and `wolfSSL_CTX_load_verify_locations_ex` with flags.
* Added tests for `wolfSSL_CertManagerLoadCABuffer`.
* Updated the expired test certs and added them to `./certs/test/gen-testcerts.sh` script.
2018-09-06 12:51:22 -07:00
Sean Parkinson ffc6cf4eb8 Add support for maximum DH key size 2018-07-13 17:36:42 +10:00
abrahamsonn 765d97ae01 1. Trailing whitespace removal 2018-06-27 16:22:12 -06:00
connerwolfssl 13b7dad0fa documentation clean up, added check for asn generalized time 2018-06-27 10:22:47 -07:00
John Safranek 586874b997 Rename INLINE
1. Renamed the macro INLINE as WC_INLINE.
2. For FIPS and the "selftest" build, define INLINE as WC_INLINE. Allows the FIPS code to work unchanged.
2018-06-26 15:17:46 -07:00
Takashi Kojo 3ff8c45aa8 FILE to XFILE 2018-06-01 09:30:20 +09:00
John Safranek b1ed852f36 Fix TCP with Timeout
wolfSSL remains agnostic to network socket behavior be it blocking or non-blocking. The non-blocking flag was meant for the default EmbedRecvFrom() callback for use with UDP to assist the timing of the handshake.

1. Deprecate wolfSSL_set_using_nonblock() and wolfSSL_get_using_nonblock() for use with TLS sockets. They become don't-cares when used with TLS sessions.
2. Added functions wolfSSL_dtls_set_using_nonblock() and wolfSSL_dtls_get_using_nonblock().
3. Removed a test case from EmbedReceive() that only applied to UDP.
4. Removed the checks for non-blocking sockets from EmbedReceive().
5. Socket timeouts only apply to DTLS sessions.
2018-05-23 11:29:16 -07:00
connerWolfSSL e45f0efc3f Documentation Fixes (#1520)
* Fixed documentation errors found by check_api script
* Formatting changes so that comments/API pairs are more obvious
2018-04-27 09:50:34 -07:00
David Garske a38576146e * Added support for disabling PEM to DER functionality using `WOLFSSL_PEM_TO_DER`. This allows way to use with DER (ASN.1) certificates only in an embedded environment. This option builds, but internal make check requires PEM support for tests.
* More cleanup to move PEM functions from ssl.c to asn.c (`wolfSSL_CertPemToDer`, `wolfSSL_KeyPemToDer`, `wolfSSL_PubKeyPemToDer`). Renamed these API's to `wc_` and added backwards compatability macro for old function names.
2018-04-09 13:28:15 -07:00
David Garske 264496567a Improvements to EncryptedInfo. Added build option `WOLFSSL_ENCRYPTED_KEYS` to indicate support for EncryptedInfo. Improvements to `wc_PBKDF1` to support more hash types and the non-standard extra data option. 2018-04-09 13:28:15 -07:00
toddouska a92696edec
Merge pull request #1454 from dgarske/noprivkey
Support for not loading a private key when using `HAVE_PK_CALLBACKS`
2018-03-22 12:47:22 -07:00
David Garske e564c973b6 Refactor IO callback function names to use `_CTX_` to eliminate confusion about the first parameter. 2018-03-21 16:08:55 -07:00
David Garske dbb34126f6 * Added support for not loading a private key for server or client when `HAVE_PK_CALLBACK` is defined and the private PK callback is set. Tested with all cipher suites, TLS 1.2/1.3, client/server certs, RSA/ECC/ED25519.
* Added PK callback context tests for client/server examples (`SetupPkCallbackContexts`).
* Added new test define for `TEST_PK_PRIVKEY` to allows simulating hardware based private key.
* Added new test.h function for loading PEM key file and converting to DER (`load_key_file`).
* Added way to get private key signature size (`GetPrivateKeySigSize`).
* Added new ECC API `wc_ecc_sig_size_calc` to return max signature size for a key size.
* Added inline comments to help track down handshake message types.
* Cleanup of RSS PSS terminating byte (0xbc) to use enum value.
* Fixed bug with PK callback for `myEccVerify` public key format.
* Fixed bug with PK callback for ED25519 verify key buffer in DoServerKeyExchange.
2018-03-21 11:27:08 -07:00
connerwolfssl ba40a71a3c added script so ensure doxygen api documentation matches wolfssl api 2018-03-01 10:27:30 -07:00
connerwolfssl 17e88b47f6 Migrated documentation directory to doc. README updated. Error fixes. Moved make options to doc/include.am 2018-02-08 10:05:30 -07:00