600 Commits

Author SHA1 Message Date
Sean Parkinson
901ee627fc Fixes from using cppcheck tool
Various fixes for uninitialized variable use.
sniffer.c: close file when seek fails
tls.c: fix QSH_GET_SIZE macro
wolfio.c: uIPGenerateCookie: use the parameter, _ctx, instead of self
referencing.
wolfssl_adds.c: check for equivalent to XBADFILE to indicate error.
SP: change right shift of signed value to unsigned
sp_int.h: define 128-bit types
types.h: change a XMALLOC define to not use (,,) - cppcheck doesn't like
it and is unnecessary.
2019-10-01 09:22:00 +10:00
David Garske
9d05e9c0b7 Fixes for minor nightly build tests. 2019-09-25 11:07:32 -07:00
John Safranek
b92509144b
Merge pull request #2475 from dgarske/qat_key
Fixes and improvements for async
2019-09-20 10:44:33 -07:00
cariepointer
2dafd2102c Add Apache HTTP Server compatibility and --enable-apachehttpd option (#2466)
* Added Apache httpd support `--enable-apachehttpd`.

* Added `SSL_CIPHER_get_version`, `BIO_new_fp`, `SSL_SESSION_print` and `SSL_in_connect_init` compatibility API's.

* Fix to expose `ASN1_UTCTIME_print` stub.

* Pulled in `wolfSSL_X509_get_ext_count` from QT.

* Added `X509_get_ext_count`, `BIO_set_callback`, `BIO_set_callback_arg` and `BIO_get_callback_arg`.

* Added `wolfSSL_ERR_print_errors`.

* Added `BIO_set_nbio` template.

* Fixes for building with Apache httpd.

* Added DH prime functions required for Apache httpd.

* Fix and move the BN DH prime macros.

* Fix for `SSL_CTX_set_tlsext_servername_arg` to have return code.

* Only add the `BN_get_rfc*_prime_*` macro's if older than 1.1.0.

* Added `ERR_GET_FUNC`, `SSL_CTX_clear_extra_chain_certs` prototypes.

* Added `wolfSSL_CTX_set_client_cert_cb` template and `OPENSSL_load_builtin_modules` stub macro.

* Added `X509_INFO` templates (`X509_INFO_new`, `X509_INFO_free`, `sk_X509_INFO_new_null`, `sk_X509_INFO_num`, `sk_X509_INFO_value`, `sk_X509_INFO_free`). Added `sk_X509_shift`.

* Added BIO_set_callback, BIO_get_callback, BIO_set_callback_arg, BIO_get_callback_arg

* add BIO_set_nbio, ERR_print_errors and tests

* add X509 INFO stack push function

* Add ASN1_UTCTIME_print and unit test

* Add X509_get_ext_count unit test

* initial commit of wolfSSL_PEM_X509_INFO_read_bio

* Added `sk_X509_NAME_new`, `sk_X509_NAME_push`, `sk_X509_NAME_find`, `sk_X509_NAME_set_cmp_func` and `sk_X509_NAME_free`. Grouped `sk_X509_NAME_*` functions.

* Cleanup sk X509 NAME/INFO pop free template.

* Advance openssl compatibility to v1.1.0 for Apache httpd. Added TLS version macros. Implemented sk X509 NAME/INFO pop and pop_free.

* Added `TLS_client_method` support.

* Added `SSL_get_server_tmp_key` and `EC_curve_nid2nist`.

* Added `SSL_CTX_set_min_proto_version` and `SSL_CTX_set_max_proto_version`. Fix for `BN_get_rfc*_prime_*` with the v1.1.0 change.

* add test cases for PEM_X509_INFO_read_bio

* Fixes for `BN_get_rfc*_prime_*` macros. Added template for `SSL_DH_set0_pqg`. Fix for `SSL_OP_NO_` to use Macro's (as is done in openssl). Added `SSL_set_verify_result`. Added stub for `OPENSSL_malloc_init`.

* Apache httpd compatibility functions. BIO setter/getters.

* implement ASN1_TIME_check and add test case

* add SSL_get_client_CA_list

* add initial implementation of wolfSSL_DH_set0_pqg

* Add apache support to OBJ_txt2nid and unit test, add stub for OBJ_create

* add X509_STORE_CTX_get1_chain, sk_free, sk_X509_dup

* Add sk_SSL_COMP_num and SSL_COMP struct

* implement and test of SSL_SESSION_print

* add SSL_CTX_set_client_cert_cb

* expand BIO_printf and add test case

* Added `OCSP_CERTID_dup`. Added `ASN1_TYPE`.

* add implementation for wolfSSL_get_server_tmp_key

* add wolfSSL_BIO_puts and test case

* Add X509_EXTENSION_get_object and X509_EXTENSION_get_data

* add helper for bio flag set and null x509 stack

* add test adn implementation for wolfSSL_i2d_PrivateKey

* Added `ASN1_OTHERNAME`, `ACCESS_DESCRIPTION` and `GENERAL_NAME`. Added `sk_ACCESS_DESCRIPTION_pop_free` and `ACCESS_DESCRIPTION_free` stubs.

* add wolfSSL_PEM_read_bio_ECPKParameters

* add BIO_vfree

* add X509_up_ref

* add X509_STORE_CTX_set_ex_data

* add _GNU_SOURCE macro and wolfSSL_EVP_read_pw_string

* add wolfSSL_EVP_PKEY_ref_up function

* X509_get_ext, X509V3_EXT_print, and d2i_DISPLAYTEXT stubs

* add X509_set_issuer_name

* add wolfSSL_sk_SSL_CIPHER_* functions and tests

* add prototype for sk_X509_EXTENSION and ACCESS_DESCRIPTION

* fix casting to avoid clang warning

* adjust test_wolfSSL_X509_STORE_CTX test case

* Added `OpenSSL_version`

* renegotiate functions and additional stack functions

* add aditional stub functions

* Add Apache httpd requirements for ALPN, CRL, Cert Gen/Req/Ext and SecRen. Fix for `sk_X509_INFO_new_null`.

* add ocsp stub functions

* Proper fix for `sk_X509_INFO_new_null`. Added templates for `X509_get_ext_by_NID` and `X509_add_ext`. Added templates for `ASN1_TIME_diff` and `ASN1_TIME_set`.

* x509 extension stack additions

* Fixed template for `OCSP_id_get0_info`.

* add X509 stub functions

* add X509_STORE_CTX_get0_store() and unit test

* Added `EVP_PKEY_CTX_new_id`, `EVP_PKEY_CTX_set_rsa_keygen_bits`, `EVP_PKEY_keygen_init`, `EVP_PKEY_keygen` and `BN_to_ASN1_INTEGER`.

* x509v3 stubs and req add extensions

* Add OBJ_txt2obj and unit test; add long name to wolfssl_object_info table for use by OBJ_* functions

* wolfSSL_set_alpn_protos implementation

* Added `EVP_SignInit_ex` and `TLS_server_method` implementation. Added stubs for  `RSA_get0_key` and `i2d_OCSP_REQUEST_bio`. Fix typo on `OCSP_response_create`. Fix warning in `wolfSSL_set_alpn_protos`.

* Added `X509_EXTENSION_free` stub. Fixed a few macro typos/adding missing.

* add X509_STORE_CTX_get0_current_issuer and unit test

* add OBJ_cmp and unit test

* add RSA_get0_key and unit test

* add OCSP_check_nonce

* Implement X509_set_notAfter/notBefore/serialNumber/version,X509_STORE_CTX_set_depth,X509V3_set_ctx.

* Modify wolfSSL_X509_set_notAfter/notBefore and add tests for each.

* Add test_wolfSSL_X509_set_version w/ fixes to _set_version and fix _set_notBefore/notAfter tests

* add OCSP_id_get0_info and unit test, move WOLFSSL_ASN1_INTEGER to asn_public.h from ssl.h

* inital implementation of wolfSSL_X509_sign

* add debugging messages and set data for BIO's

* Add i2d_OCSP_REQUEST_bio.

* implementation of some WOLFSSL_BIO_METHOD custom functions

* fix for ASN time structure and remove log node

* initial eNULL support and sanity checks

* fixes after rebasing code

* adjust test cases and ASN1_TIME print

* Various fixes for memory leaks

* Apache compatibility in CTX_set_client_CA_list for X509_NAME use; add X509_NAME_dup as supporting function

* Add initial X509_STORE_load_locations stub for Apache

* Updates to X509_get_ext_d2i to return GENERAL_NAME struct instead of ASN1_OBJECT for alternative names and add supporting GENERAL_NAME functions

* Add X509_STORE_load_locations implementation; add wolfSSL_CertManagerLoadCRL_ex; initial renegotiation fixes/updates

* Fix for freeing peer cert in wolfSSL_Rehandshake instead of FreeHandShakeResources during secure renegotiation

* Add X509_ALGOR and X509_PUBKEY structs for X509_PUBKEY_get0_param and X509_get_X509_PUBKEY implementation

* Initial implementation of wolfSSL_X509_get_X509_PUBKEY and wolfSSL_X509_PUBKEY_get0_param

* Add implementation for X509_get0_tbs_sigalg and X509_ALGOR_get0

* Add OBJ_nid2ln implementation

* Fix compile errors in tests/api.c for some build options

* Updates to X509_STORE_load_locations for non-CRL types; Add additional DETECT_CERT_TYPE enum and logic for detecting certificate type in ProcessFile

* Add X509_STORE_load_locations unit test and minor error handling fixes

* Add unit test for X509_sign

* Set correct alert type for revoked certificates; add/fix a few WOLFSSL_ENTER messages

* Add X509_ALGOR member to X509 struct; refactoring and unit tests for wolfSSL_X509_ALGOR_get0 and wolfSSL_X509_get0_tbs_sigalg

* Add X509_PUBKEY member to X509 struct; refactoring and unit tests for wolfSSL_X509_get_X509_PUBKEY and wolfSSL_X509_PUBKEY_get0_param

* Stack fixes after rebase

* Secure renegotiation refactoring: add ACCEPT_BEGIN_RENEG to AcceptState for use in wolfSSL_SSL_in_connect_init; free old peer cert when receiving new cert to fix memory leak

* Move enc-then-mac enable option in configure.ac for apache httpd compatibility

* Simplify wolfSSL_SSL_in_connect_init logic

* Remove unneeded wolfSSL_CertManagerLoadCRL_ex

* Fixes for jenkins test failures

* SSL_get_secure_renegotiation_support for print statement in Apache
2019-09-19 17:11:10 -07:00
toddouska
c16b02a265
Merge pull request #2471 from dgarske/test_date_override
Fix for verify callback override not adding to trusted CA list
2019-09-19 13:54:24 -07:00
David Garske
6aecdf59c1 Fixes for async build and tests. 2019-09-19 12:30:05 -07:00
David Garske
b7c08988dc Fix for verify callback override of intermediate CA provided by peer not being added to trusted CA list.
Feature: Added support for testing date override at build-time using `TEST_BEFORE_DATE`.

```
./examples/server/server -H overrideDateErr -A ./certs/ca-cert.pem -k ./certs/server-key.pem -c ./certs/intermediate/server-chain.pem &
./examples/client/client -D -A ./certs/ca-cert.pem -k ./certs/client-key.pem -c ./certs/intermediate/client-chain.pem
```
2019-09-16 14:47:55 -07:00
John Safranek
b70f22e21a 1. Use the session deallocator on the deserialized session in the client.
2. Free the flatten session if the size check fails.
2019-09-12 16:04:34 -07:00
John Safranek
852d50adcf DTLS Maintenance
To go with the fix for the functions wolfSSL_(i2d|d2i)_SSL_SESSION,
modify the example client to use a serialized session record for
resumption instead of the direct reference into the session cache. This
change only happens when OPENSSL_EXTRA and HAVE_EXT_CACHE are defined.
2019-09-11 15:29:57 -07:00
Sean Parkinson
24e98dd05e Add support for Encrypt-Then-MAC to TLS 1.2 and below
An extension is used to indicate that ETM is to be used.
Only used when doing block ciphers - HMAC performed on encrypted data.
2019-08-29 09:00:30 +10:00
David Garske
b4673344c0 Adds new wc_ecc_get_curve_params API for getting the ecc_set_type params for a curve index. Fix for example client and server using wrong macro for detecting ECC 256-bit enabled. 2019-08-02 05:50:00 -07:00
toddouska
d620433d1d
Merge pull request #2209 from tmael/maintenanceDefects
Increased ciphers buffer size for testsuite and ECC API for getting curve from dp
2019-07-15 16:49:13 -07:00
toddouska
bd40a59f3e
Merge pull request #2318 from SparkiDev/server_fuzz
Changes to server example for fuzz testing
2019-07-08 13:16:17 -07:00
David Garske
b2f919ec13 Fix to include errno.h in tls_bench.c 2019-07-01 13:41:17 -07:00
Sean Parkinson
373bbf6660 Changes to server example for fuzz testing 2019-07-01 13:35:33 +10:00
Hideki Miyazaki
efcf06ef7c use tlsv1_2 client method when tls13 is enabled 2019-06-07 19:13:46 +09:00
Hideki Miyazaki
292aa196fb minor fix to print stats in tls_bench 2019-06-07 12:05:19 +09:00
Tesfa Mael
3e7a6054a9 Use the macro instead of sizeof() 2019-05-02 14:13:48 -07:00
toddouska
547c09e1d7
Merge pull request #2210 from JacobBarthelmeh/Compatibility-Layer-Part2
JSSE additions
2019-04-24 11:04:05 -07:00
Tesfa Mael
f8c9285b92 Added a WOLFSSL_CIPHER_LIST_MAX_SIZE macro 2019-04-22 16:30:38 -07:00
Jacob Barthelmeh
efc96e40d1 add test cases 2019-04-18 10:41:51 -06:00
David Garske
364bf50a94 Fixed example server to not try and write on failure. 2019-04-11 11:30:41 -07:00
John Safranek
fbfd7a4dea Release Fixes
1. Rearrange the deprecation cryptodev option so it doesn't overwrite the cryptocb option, and so it doesn't break its case in the build-test.
2. Fix the content length in the sample HTTP used by the example server.
3. Disable OCSP stapling in the example server if RSA is disabled.
4. Fix a variable in asn.c that was declared in the middle of its scope.
5. Retag the xmalloc, xrealloc, xfree functions used in the memory test as WOLFSSL_API like all the other allocators, instead of extern.
2019-03-20 11:01:24 -07:00
John Safranek
22b2ae7358 Release Fixes
1. Fix for the enable-afalg option from Jacob Barthelmeh.
2. Client fix for enable-sp+enable-sp-math option from David Garske.
3. Added a couple of typecasts to some mallocs.
4. Modified the option guard for the mask member of Options for the webserver build.
5. Added some more padding to the opaque structures used for SHA_CTX and AES_KEY.
6. Added WOLFSSL_API to the stack logging functions.
2019-03-19 13:55:17 -07:00
John Safranek
246c444b93 Updates for v4.0.0
Update the copyright dates on all the source files to the current year.
2019-03-15 10:37:36 -07:00
David Garske
6ff2039b1f
Merge pull request #2163 from ejohnstown/config-fixes
Configuration Fixes
2019-03-14 15:21:41 -07:00
David Garske
d19c37de2e Fix for example client arg -4 not working. 2019-03-13 22:59:50 -07:00
John Safranek
27ea9d9bce Configure Fixes
1. The combination enable-all and disable-rsa breaks some of the
testing. Added the NO_RSA guards as appropriate.
2. Disabled the OCSP stapling and CRL tests when RSA is disabled as they
use test certificates with RSA keys.
2019-03-13 17:54:33 -07:00
toddouska
70490a4db6
Merge pull request #1855 from ejohnstown/trust-ca
Trusted CA Key Indication Extension
2019-03-12 13:52:27 -07:00
toddouska
554af3dcfa
Merge pull request #2151 from JacobBarthelmeh/Testing
path include adjustment, rename internal OBJ function, and client pri…
2019-03-11 16:48:19 -07:00
John Safranek
201c85478e Move the -5 option text into the localization array and add a Japanese translation. 2019-03-11 12:42:13 -07:00
John Safranek
a1ed8e7a67 Fix a fall-through bug in the server options parsing around a new
option.
2019-03-11 12:36:58 -07:00
John Safranek
b7663a940e Trusted CA Key Indication Extension
Added an API for enabling the Trusted CA Key Indication extension from
RFC6066 section 6. If the server doesn't have a match for the client,
the client will abandon the session.
2019-03-11 12:35:12 -07:00
toddouska
6e1b05316d
Merge pull request #2104 from ejohnstown/renegotiation-testing
Secure Renegotiation
2019-03-11 12:10:48 -07:00
Jacob Barthelmeh
9c9279817b path include adjustment, rename internal OBJ function, and client print outs added 2019-03-11 09:57:04 -06:00
toddouska
3be4682cda
Merge pull request #2134 from dgarske/fixes_nightly
Fixes for minor nightly build errors
2019-03-08 10:15:46 -08:00
David Garske
0e962aa6e5
Merge pull request #2130 from jrblixt/feature-WICED6_1-serverChange
examples server HTTP update needed for WICED HTTP parser.
2019-03-06 16:46:36 -08:00
Chris Conlon
d699b65a25
Merge pull request #2026 from kojo1/mdk-CMSISv2
MDK CMSIS RTOSv2
2019-03-06 09:36:49 -07:00
jrblixt
222f9f4f47 Adjust count. 2019-03-01 20:04:20 -07:00
David Garske
8569d14cb3 Fixes for minor nightly build errors. Missing wc_ecc_fp_free declaration and "Value stored to 'useSupCurve' is never read". 2019-03-01 16:12:08 -08:00
jrblixt
5f332fa29e review changes. 2019-03-01 14:06:27 -07:00
toddouska
e2e3b835d6
Merge pull request #2100 from SparkiDev/tls13_vers
Support FFDHE in TLS 1.2 and below. Better TLS 1.3 version support.
2019-02-27 14:55:29 -08:00
Sean Parkinson
8bb4e23f8d Various improvements for testing
Fix wc_ecc_fp_free() to be called when using HAVE_STACK_SIZE.
Increase size of replyin client.c so all HTTP reply is displayed.
Fix api.c to support only Ed25519 (not RSA and ECC)
Fix suites.c to detect when CA for client won't work (Ed25519 only)
For Static Memory add debugging and small profile.
Also allow realloc to be called with NULL.
Add more Ed25519 certs and keys.
Fix names of Ed25519 filenames for client and server.
Do NOT turn on ECC_SHAMIR by default with lowresource.
Enable WOLFSSL_STATIC_MEMORY_SMALL if low resource and no RSA.
2019-02-22 17:14:19 +10:00
John Safranek
39626bb349 1. Add a newline to the client's "non-blocking socket and renegotiation" notice.
2. Add suite test cases for more renegotiation setting combinations.
2019-02-21 10:06:55 -08:00
Hideki Miyazaki
b68eab6450 fixed to take additioanl option for -? 2019-02-21 13:44:08 +09:00
Sean Parkinson
b4996e35fa Set MAX_PRF_HALF bigger for large FFDHE parameters
Stack size measurement is in a thread - free local fp_cache
2019-02-21 08:09:52 +10:00
John Safranek
f78ba4649b Update the help text so the Japanese translations of the new options are printed. 2019-02-20 11:23:00 -08:00
John Safranek
1f6314746c Secure Renegotiation
1. Split the wolfSSL_Rehandshake() function into wolfSSL_Rehadshake()
which performs a full handshake on secure renegotiation and
wolfSSL_SecureResume() which performs a session resumption on a
secure renegotiation.
2. Add option to example client to perform a secure resumption instead
of a full secure handshake.
2019-02-19 15:50:55 -08:00
Sean Parkinson
7aa5cd6f10 Support FFDHE in TLS 1.2 and below. Better TLS 1.3 version support.
Add support for the fixed FFDHE curves to TLS 1.2. Same curves in TLS
1.3 already. On by default - no checking of prime required.
Add option to require client to see FFDHE parameters from server as per
'may' requirements in RFC 7919.

Change TLS 1.3 ClientHello and ServerHello parsing to find the
SupportedVersions extension first and process it. Then it can handle
other extensions knowing which protocol we are using.
2019-02-18 14:51:59 +10:00
jrblixt
6c3ed46542 examples server HTTP update. 2019-02-15 15:45:30 -07:00