Commit Graph

1677 Commits (f4c16d22a1e0c3562a00093b80cca59c4acd50cd)

Author SHA1 Message Date
Daniel Pouzzner a10260ca5f refactor AESNI implementations and *VECTOR_REGISTERS* macros to allow dynamic as-needed fallback to pure C, via WC_AES_C_DYNAMIC_FALLBACK.
wolfssl/wolfcrypt/aes.h: add key_C_fallback[] to struct Aes, and remove comment that "AESNI needs key first, rounds 2nd, not sure why yet" now that AES_128_Key_Expansion_AESNI no longer writes rounds after the expanded key.

wolfcrypt/src/aes.c:
* add _AESNI or _aesni suffixes/infixes to AESNI implementations that were missing them: AES_CBC_encrypt(), AES_CBC_decrypt_by*(), AES_ECB_encrypt(), AES_*_Key_Expansion(), AES_set_encrypt_key(), AES_set_decrypt_key(), AES_GCM_encrypt(), AES_GCM_decrypt(), AES_XTS_encrypt(), and AES_XTS_decrypt().
* move key size check from to start of wc_AesSetKeyLocal().
* refactor pure-C AES setkey and cipher implementations to use aes->key_C_fallback when defined(WC_AES_C_DYNAMIC_FALLBACK).
* refactor wc_AesSetKeyLocal() to set up both AESNI and pure-C expanded keys when defined(WC_AES_C_DYNAMIC_FALLBACK).
* refactor all (haveAESNI && aes->use_aesni) conditions to just (aes->use_aesni).
* add macros VECTOR_REGISTERS_PUSH and VECTOR_REGISTERS_POP, which do nothing but push a brace level when !defined(WC_AES_C_DYNAMIC_FALLBACK), but when defined(WC_AES_C_DYNAMIC_FALLBACK), they call SAVE_VECTOR_REGISTERS2() and on failure, temporarily clear aes->use_aesni and restore at _POP().
* refactor all invocations of SAVE_VECTOR_REGISTERS() and RESTORE_VECTOR_REGISTERS() to VECTOR_REGISTERS_PUSH and VECTOR_REGISTERS_POP, except in wc_AesSetKeyLocal(), wc_AesXtsEncrypt(), and wc_AesXtsDecrypt(), which are refactored to use SAVE_VECTOR_REGISTERS2(), with graceful failure concealment if defined(WC_AES_C_DYNAMIC_FALLBACK).
* orthogonalize cleanup code in wc_AesCbcEncrypt(),  wc_AesCcmEncrypt() and wc_AesCcmDecrypt().
* streamline fallthrough software definitions of wc_AesEncryptDirect() and wc_AesDecryptDirect(), and remove special-casing for defined(WOLFSSL_LINUXKM)&&defined(WOLFSSL_AESNI).

wolfcrypt/src/aes_asm.{S,asm}:
* remove errant "movl $10, 240(%rsi)" from AES_128_Key_Expansion_AESNI.
* add _AESNI suffixes/infixes to implementations that needed them.

wolfcrypt/src/{aes_gcm_asm.{S,asm},aes_xts_asm.S}: regenerate from revisions in scripts#357 -- adds _aesni suffixes to implementations that were missing them.

wolfssl/wolfcrypt/types.h: remove DEBUG_VECTOR_REGISTER_ACCESS macros, and add dummy fallthrough definitions for SAVE_VECTOR_REGISTERS2 and WC_DEBUG_SET_VECTOR_REGISTERS_RETVAL.

wolfssl/wolfcrypt/memory.h: adopt DEBUG_VECTOR_REGISTER_ACCESS code from types.h, and add definitions for WC_DEBUG_VECTOR_REGISTERS_RETVAL_INITVAL and WC_DEBUG_SET_VECTOR_REGISTERS_RETVAL.

linuxkm/linuxkm_wc_port.h: add arch-specific macro definitions for SAVE_VECTOR_REGISTERS2().

wolfcrypt/benchmark/benchmark.c: add missing gates around calls to RESTORE_VECTOR_REGISTERS().

configure.ac:
* cover various interdependencies in enable-all/enable-all-crypto, for better behavior in combination with --disable-aesgcm, --disable-ecc, --disable-ocsp, --disable-hmac, --disable-chacha, --disable-ed25519, and --disable-ed448.
* inhibit aesgcm_stream in enable-all/enable-all-crypto when ENABLED_LINUXKM_DEFAULTS, because it is currently incompatible with WC_AES_C_DYNAMIC_FALLBACK.
* add -DWC_AES_C_DYNAMIC_FALLBACK when ENABLED_LINUXKM_DEFAULTS.
* add 3 new interdependency checks: "ECCSI requires ECC.", "SAKKE requires ECC.", "WOLFSSH requires HMAC."

wolfcrypt/src/asn.c: tweak gating to accommodate defined(NO_RSA) && !defined(HAVE_ECC).

wolfcrypt/src/evp.c: tweak gating to accommodate defined(NO_HMAC).

wolfcrypt/src/logging.c: remove DEBUG_VECTOR_REGISTER_ACCESS code (moved to memory.c).

wolfcrypt/src/memory.c: change #include of settings.h to types.h; adopt DEBUG_VECTOR_REGISTER_ACCESS code from logging.c; add implementation of SAVE_VECTOR_REGISTERS2_fuzzer().

wolfcrypt/src/pwdbased.c: add explanatory #error scrypt requires HMAC.

wolfcrypt/test/test.c:
* add DEBUG_VECTOR_REGISTER_ACCESS clauses to aes_xts_128_test(), aesecb_test(), aesctr_test(), aes_test() CBC section, aes256_test() CBC section, and aesgcm_default_test_helper()
* remove duplicate wc_AesEcbDecrypt() in aesecb_test().
* add gating for pbkdf2_test().
* fix cleanup code in dsa_test().
* fix gating in pkcs7authenveloped_run_vectors() to accommodate !defined(HAVE_AESGCM).
* fix gating in cryptocb_test() to accommodate defined(NO_HMAC).

wolfssl/wolfcrypt/cryptocb.h: remove gates around "pk" sub-struct of struct wc_CryptoInfo -- wc_CryptoInfo.pk.type (an int) is used unconditionally when --enable-debug, and is used with DH.

wolfssl/wolfcrypt/error-crypt.h: fix whitespace.
2023-11-17 01:15:28 -06:00
Daniel Pouzzner 263973bde9 src/wolfio.c: fix stack allocations for cookie digests on NO_SHA builds;
configure.ac: fix dependencies for enable_dsa vs enable_sha in enable-all, enable-all-crypto, and ENABLED_DSA setup.
2023-11-15 14:43:23 -06:00
Daniel Pouzzner eaa66dc117 configure.ac: in enable-all, enable QUIC only if !ENABLED_LINUXKM_DEFAULTS, and enable aesgcm_stream only if enable_aesgcm. 2023-11-15 01:47:46 -06:00
Sean Parkinson 7eaff41e61 AES bitsliced, ARMASM: config needs WOLFSSL_AES_DIRECT defined
AES bitsliced needs WOLFSSL_AES_DIRECT defined when compiling for ARMASM
as there are different APIs used.
2023-11-13 07:40:40 +10:00
JacobBarthelmeh c903a8c4a6
Merge pull request #6854 from SparkiDev/aes_bit_sliced
AES bitsliced implementation added
2023-11-10 17:10:19 -07:00
Lealem Amedie e2bbacd548 Add QUIC to --enable-all 2023-11-09 14:44:02 -07:00
JacobBarthelmeh b6e5b36f35
Merge pull request #6946 from dgarske/nooldtls_v1.1
Turn off old TLS v1.1 by default
2023-11-07 13:30:03 -07:00
David Garske a46b6221b4 Turn off old TLS v1.1 by default (unless SSL v3.0 or TLS v1.0 enabled). 2023-11-07 09:23:59 -08:00
JacobBarthelmeh 8921a720a1
Merge pull request #6888 from SparkiDev/srtp_kdf
SRTP/SRTCP KDF: add implementation
2023-11-07 10:11:43 -07:00
Sean Parkinson 8c3e1dbf48 SRTP/SRTCP KDF: add implementation
Add implementation of SRTP KDF and SRTCP KDF.
One shot APIs compatible with SP 800-135 and ACVP testing.
Tests added to test.c.
Benchmarking added.
Doxygen added.
2023-11-07 10:33:14 +10:00
Sean Parkinson 5b863dcb12 AES bitsliced implementation added
AES bitsliced implementation that is cache attack safe.
Configure with:
  --enable-aes-bitslice
or define:
  WC_AES_BITSLICE
  HAVE_AES_ECB
  HAVE_AES_DIRECT
Very slow for CBC, CFB, OFB and any mode that uses a previous encrypt
block to calculate current.
CTR, GCM, XTS can parallelize the data and be much faster.

Added AES-ECB test to test.c.
2023-11-03 14:19:58 +10:00
JacobBarthelmeh 15fdf6eccc
Merge pull request #6910 from bigbrett/ios-ca-api
exercise --sys-ca-certs optionin external.test
2023-11-01 14:09:24 -06:00
JacobBarthelmeh 6cf75a7d42 prepare for release 5.6.4 2023-10-30 07:59:00 -06:00
Brett 60f75ea5a8 simplified apple header detection used in code 2023-10-25 15:13:06 -06:00
David Garske 22ab21749c
Merge pull request #6869 from bigbrett/ios-ca-api
Add support for new Apple trust APIs with WOLFSSL_SYS_CA_CERTS
2023-10-18 10:29:41 -07:00
Brett 0244c2a254 Add support for new Apple trust APIs with WOLFSSL_SYS_CA_CERTS 2023-10-16 14:37:21 -06:00
JacobBarthelmeh d35112064b
Merge pull request #6840 from philljj/xmss_hooks_support
Add XMSS/XMSSMT wolfCrypt hooks.
2023-10-16 10:58:12 -06:00
JacobBarthelmeh 7afd9810de
Merge pull request #6867 from cconlon/jniConfigExpand
Update "--enable-jni" to include additional defines
2023-10-13 15:13:32 -06:00
JacobBarthelmeh 79a6e1eb04
Merge pull request #6808 from SparkiDev/sp_sm2
SP updates for SM2
2023-10-13 10:17:17 -06:00
Chris Conlon 8cd89884ce update --enable-jni with KEEP_PEER_CERT, WOLFSSL_ALT_CERT_CHAINS, WOLFSSL_KEY_GEN 2023-10-13 10:07:04 -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
Daniel Pouzzner 0549dba3db configure.ac and src/tls.c: fix --enable-keylog-export to warn at configure time, then build cleanly. 2023-10-12 13:09:43 -05:00
jordan f32c6a0d25 XMSS/XMSSMT hooks support: fix build. 2023-10-09 10:13:32 -05: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 fd2d098566
Merge pull request #6821 from bigbrett/aes-eax
AES EAX mode
2023-10-06 14:14:28 -06:00
Brett Nicholas fafb9e81c0 Add support for AES EAX mode, as described in https://eprint.iacr.org/2003/069 2023-10-06 11:10:06 -06:00
jordan 33d4b331fb Add XMSS/XMSSMT wolfCrypt hooks. 2023-10-05 09:18:50 -05:00
Juliusz Sosinowicz 8ce8359bd7 Add option to disable OPENSSL_COMPATIBLE_DEFAULTS 2023-10-05 10:30:44 +02:00
Daniel Pouzzner 71649388a0 configure.ac: in options.h generation, fix order of flags to match Makefile order. 2023-10-03 21:11:59 -05:00
Sean Parkinson 3ea0fb30dd AES XTS x64 ASM: add AVX1 and AESNI implementations
Adding AES-XTS AVX1 and AESNI implementations.
Fix name in comment at top of x64 assembly files.
2023-09-28 14:44:23 -05:00
Andras Fekete ad9779cdc1 Explicitly define code with WOLFCRYPT_ASYNC_CRYPT_SW 2023-09-19 13:10:16 -04:00
Sean Parkinson 114c8cc681 SP ASM: improve performance
Thumb2/ARM32: use umaal instruction to speed up mulitplication, squaring
and reduction. umaal not always available so use umlal instead.
Implementations for architectures less than 4 still kept - no umull.
Cleanup point arithmetic to not take shortcuts.
Make masking for constant time faster.
Add alternate asm for different compilers.
Get ARMv4 and ARMv6 compiling.
Remove whitespace at end of lines.
2023-09-13 21:13:53 +10:00
JacobBarthelmeh 298b488bf1
Merge pull request #6749 from cconlon/jniCertReq
Add WOLFSSL_CERT_EXT to --enable-jni, minor CSR items
2023-09-01 16:15:10 -06:00
JacobBarthelmeh 0352b384a5
Merge pull request #6731 from SparkiDev/aes_arm32_thumb2
AES ARM32 and Thumb2 ASM: fixup ARM32 and add Thumb2
2023-09-01 15:56:12 -06:00
Chris Conlon a2e2a3e994 add --enable-certreq to --enable-jni, support extKeyUsage in X509_REQ_sign, add missing X509_REQ_print fields 2023-09-01 11:59:21 -06:00
jordan b36c312ef3 LMS verify-only support: fix clang warning, rename define. 2023-08-31 21:46:00 -05:00
David Garske 136cb98412 Force 32-bit alignment on `kCurve25519BasePoint` 2023-09-01 12:14:55 +10:00
Sean Parkinson 0638ec234b AES ARM32 and Thumb2 ASM: fixup ARM32 and add Thumb2
Fix which functions and data are compiled in depending on defines.
Better handing of constants.
Also fix Aarch64 ed25519 inline assembly.
2023-08-30 20:34:51 +10:00
jordan 8662312ecf LMS verify only support. 2023-08-29 15:46:18 -05:00
gojimmypi 8803510375 ARIA no longer needs OpenSSL enabled 2023-08-24 15:57:14 -07:00
JacobBarthelmeh 6b09b5c0cf
Merge pull request #6690 from julek-wolfssl/packaging
Init deb packaging
2023-08-24 10:28:24 -06: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 7a12202675 Init deb packaging
- rpm: Simplify script and list wolfSSL as packager
- add packaging github action
2023-08-23 22:01:12 +02:00
JacobBarthelmeh 3033371abc
Merge pull request #6717 from bigbrett/sniffer-keylogfile
sniffer keylog file support
2023-08-22 14:06:27 -06:00
Brett Nicholas 2ee6a01d91 Initial sniffer keylog file support for TLS 1.2 2023-08-22 11:23:46 -06:00
Anthony Hu 507ec9f7d2 Bring compat layer logic from configure.ac into settings.h 2023-08-11 00:11:36 -04:00
JacobBarthelmeh 6ea1e7d824
Merge pull request #6683 from dgarske/tpm_ecc
Enable math API's for wolfTPM
2023-08-09 17:11:33 -06:00
Anthony Hu 958113c070 Correct configure defaults for SM4-GCM and SM4-CCM (disabled) 2023-08-08 13:06:00 -04:00
David Garske 75f81db084 New TPM ECC encrypt needs access to the mp_ math functions. 2023-08-07 15:06:58 -07:00
JacobBarthelmeh 7f0cfcb27d
Merge pull request #6667 from bandi13/byebyeCyaSSL
Byebye cya ssl
2023-08-03 15:43:01 -06:00
Andras Fekete 25f542adb4 Clean up compile errors 2023-08-01 15:46:18 -04:00
Daniel Pouzzner d250eb8327 configure.ac: in FIPS builds, remove nullcipher from enable-all and enable-all-crypto, and error on explicit --enable-nullcipher with FIPS unless fips=dev. 2023-08-01 12:24:50 -05:00
Andras Fekete 2b2509c56c Drop code support 2023-07-31 15:36:38 -04: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
JacobBarthelmeh d3202600a4
Merge pull request #6525 from lealem47/san
Improve subjectAltName extension parsing and printing
2023-07-22 08:19:54 -06:00
Sean Parkinson 9b2345dc8e SM3 ASM file: protect with check for WOLFSSL_SM3
Protect sm3_asm.S with check for WOLFSSL_SM3.
Change configure.ac to define WOLFSSL_SM3 in ASM flags when SM3 enabled
and enabling intelasm.
2023-07-21 09:57:53 +10:00
Sean Parkinson dceb7c0122 SM2 and SP_MATH: don't enable SM2 with SP_MATH
No implementation of SM2 with SP so can't use SM2 with SP MATH.
2023-07-19 12:39:59 +10:00
JacobBarthelmeh a026d843cf
Merge pull request #6564 from philljj/add_lms_hooks
Add LMS/HSS wolfCrypt hooks.
2023-07-14 14:33:25 -06: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 a8ed78e012 define WOLFSSL_ALT_NAMES in --enable-jni build 2023-07-12 14:33:45 -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
David Garske b8119af455
Merge pull request #6594 from lealem47/curl
Fix for curl build
2023-07-11 17:13:59 -07:00
Sean Parkinson d6a6cbb83e
Merge pull request #6595 from dgarske/various
Fix for no malloc with SP and fix defaultdhparams typo
2023-07-12 07:19:52 +10:00
Lealem Amedie 1329543b62 Other miscellaneous fixes 2023-07-11 13:27:37 -06:00
David Garske 3e9bdb7671 Fix `defaultdhparams` typo fix logic. 2023-07-11 10:26:40 -07:00
David Garske 8f36f78e6c
Merge pull request #6400 from bandi13/ARIA-cipher
Aria cipher
2023-07-11 09:50:42 -07:00
jordan d7c3a176e2 LMS cleanup. 2023-07-10 23:43:07 -05: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
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
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
jordan 67bef21185 Add LMS/HSS wolfCrypt hooks. 2023-07-06 10:55:53 -05:00
David Garske 856b5c3f1b
Merge pull request #6566 from JacobBarthelmeh/soname
update soname to 40
2023-07-05 09:21:10 -07: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
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
Juliusz Sosinowicz 3d68bcd6f7 Jenkins fixes 2023-07-03 14:02:51 +02:00
JacobBarthelmeh 877979c5c2 update soname to 40 2023-06-30 14:40:26 -07:00
David Garske 79a7d21932 Turn on SNI by default on hosts with resources. 2023-06-30 13:04:05 -07:00
Lealem Amedie fdc95f9ba6 Handle registeredID correctly 2023-06-28 12:53:34 -06:00
jordan 41d248461b fix detection of cut tool in configure.ac 2023-06-27 13:18:25 -05:00
JacobBarthelmeh 2d28b492b0
Merge pull request #6501 from dgarske/ecc_comp
Fix for SP math all and ECC with compressed keys (missing sp_add_d)
2023-06-21 12:01:06 -07:00
Sean Parkinson 82cc988226
Merge pull request #6495 from JacobBarthelmeh/build
update check for stdatomic header file
2023-06-14 14:00:04 +10:00
JacobBarthelmeh 72536e0e10 prepare for 5.6.3 2023-06-13 14:47:06 -06:00
David Garske fe7502a50e Fix for SP math all and ECC with compressed keys (missing sp_add_d). Reproduce using: `./configure --disable-rsa --disable-dh --enable-compkey --disable-pkcs12 && make`. 2023-06-13 11:39:24 -07:00
JacobBarthelmeh 47036d0166 update check for stdatomic header file 2023-06-12 13:48:24 -06:00
JacobBarthelmeh 353a2926b6 add check for stdatomic.h 2023-06-09 09:52:01 -07:00
JacobBarthelmeh 032ac405db prepare for release 5.6.2 2023-06-09 05:51:18 -07:00
Sean Parkinson 9ca9c2ba6f Kyber: allow compilation with limited sizes with liboqs 2023-06-06 14:26:06 +10:00
John Bland 7e3aafb60c
Fix for FIPS ECC integrity check with crypto callback set (#6425)
Skip ECC private key check when the TPM is used to generate the key, since it doesn't release the private part. this option needs to be used with a FIPS approved TPM for the end result to be FIPS approved
2023-05-19 09:12:44 -07:00
John Safranek f9dcab956e
Configure Typo
1. The description text for the brainpool enable option in configure was
   using a shell variable that ended up in the output. Switched to the
   description pattern used in other options.
2023-05-18 10:51:04 -07:00
Daniel Pouzzner 42cce9d8e5 add --enable-linuxkm-benchmarks; add check for async.{c,h} when --enable-asynccrypt; update failure message for the opensslextra AC_CHECK_HEADER() test. 2023-05-17 01:03:26 -05:00
Sean Parkinson 55a91c2b55 Minor fixes
configure.ac: Don't use == in test.
client.c: Merge string to one line.
asn.c/asn_public.h:
  fix conversion warnings/errors.
  wc_Asn1_Print no longer public and doesn't need to check for NULL.
  wc_Asn1_PrintAll check all pointer parameters for NULL.
2023-05-05 08:43:50 +10:00
David Garske 6e572cc91d
Merge pull request #6352 from SparkiDev/asn1_print
ASN.1 print utility: asn1
2023-05-04 10:55:47 -07: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
Sean Parkinson 9cdee20a7d ASN.1 print: implementation to parse and print added
New API to parse and print DER/BER data from a buffer.
Add an example to parse DER, Base64 and PEM files and print out ASN.1 items.
2023-05-04 09:57:44 +10:00
John Bland 6369b1e9ec
Merge pull request #6371 from dgarske/lowres
Fixes and improvements for building with low footprint
2023-05-03 19:33:53 -04:00
David Garske 4b90afa37b Provide way to disable ASN but have `wc_RsaPublicKeyDecodeRaw`, which doesn't need ASN.1 parsing. 2023-05-02 18:10:25 -07:00
David Garske 61dfbf5ef2 Fixes and improvements for building with low footprint. Fix for ASN template with RSA verify only (was missing `mp_leading_bit`). Fix to allow disabling DRBG with crypto callbacks enabled. Updated the wolfTPM user_settings.h template with low resource option. 2023-05-02 16:51:41 -07:00
David Garske ceeda82906 Add option to support disabling thread local `--disable-threadlocal`. Useful for cross-compile situation where thread local storage is not desired. ZD 16062 2023-05-01 15:51:22 -07:00
Daniel Pouzzner 3f60fa8c3b configure.ac: escape backslashes when generating preprocessor directives for .build_params; delete backslashes and process parenthesized arguments correctly when generating options.h. 2023-04-27 17:38:29 -05:00
Daniel Pouzzner 800f4df7a3 fix typos in configure.ac (from shellcheck --severity=warning). 2023-04-21 16:05:43 -05:00
Jacob Barthelmeh cb9a121bd7 fix configure, compatibility layer needed big int. for BN use 2023-04-14 14:52:05 -06:00
JacobBarthelmeh 04ee247389 do not default to heapmath if no other math libraries found, add NO_BIG_INT as a math option in settings.h 2023-04-13 14:38:35 -07:00
JacobBarthelmeh 26a0142f51 add nomath option for builds without a math library 2023-04-12 15:33:59 -07:00
Sean Parkinson 10c1009bbd
Merge pull request #6127 from JacobBarthelmeh/qnx
IMX6Q CAAM Port
2023-04-05 08:44:00 +10: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
JacobBarthelmeh 30adcd58d8 IMX6Q CAAM Port 2023-04-03 16:41:08 -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
Juliusz Sosinowicz 505ab746c6 Tabs -> spaces 2023-04-03 18:24:01 +02:00
JacobBarthelmeh e1730c760c check if colrm is available for options.h creation 2023-03-29 14:11:56 -07:00
Lealem Amedie 6824166cf9 Add QAT flags to logic checking for dependencies 2023-03-28 12:44:22 -06:00
Juliusz Sosinowicz 7116f1e005 Add comment. 2023-03-28 14:14:40 +02: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
Juliusz Sosinowicz c0b0c14a15 Allow user to choose between 112 and 128 bits of security 2023-03-27 15:42:19 +02:00
Juliusz Sosinowicz e465089798 No old TLS check 2023-03-24 16:44:01 +01:00
Juliusz Sosinowicz 7791b8ff4d Add config option 2023-03-24 16:42:56 +01:00
JacobBarthelmeh 877e026da4 prepare for release 5.6.0 2023-03-23 21:44:18 -07:00
Daniel Pouzzner 0a90b2d354 configure.ac: further fix for header loop check -- construct header list while in $srcdir, so that -I${srcdir} works as expected. see earlier commits 7baddb04f8 a7d9ea7550 b3a1ac80dc . 2023-03-06 15:21:23 -06:00
Daniel Pouzzner b3a1ac80dc configure.ac: don't check for opensslextra circular header dependencies if ENABLED_LINUXKM (handcrafted linuxkm/Makefile and linuxkm/Kbuild set up paths to correctly find dependencies like linux/mutex.h). 2023-03-04 12:12:08 -06: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
Daniel Pouzzner a7d9ea7550 configure.ac: fix openssl header circular dependency detector to work on out-of-tree builds. 2023-03-03 21:56:42 -06:00
Juliusz Sosinowicz 7baddb04f8
Check for circular dependencies in compatibility headers (#6091)
* Check for circular dependencies in compatibility headers

* Run header check only when ENABLED_OPENSSLEXTRA

* Add missing include

* Pedantic compilers don't like empty translation units

* Fix macro guards
2023-03-02 08:51:13 -08:00
Sean Parkinson cc8493668b SP: WOLFSSL_SP_SMALL_STACK
Defined when WOLFSSL_SMALL_STACK and !WOLFSSL_SP_NO_MALLOC or on
configuration line as an option to --enable-sp: smallstack.
2023-03-01 09:35:05 +10:00
Daniel Pouzzner b133f6bbf7
20230223-refactor-test-c-error-codes (#6135)
* wolfcrypt/test/test.{c,h}: refactor to capture and encode error retvals using WC_TEST_RET_*() macros (based on line numbers), and print line and return code in err_sys().
* wolfcrypt/test/test.h: cast back to int in WC_TEST_RET_ENC(), to fix MSVC warning.
* configure.ac: add shake128 and shake256 to enable-all and enable-all-crypto;
* wolfcrypt/benchmark/benchmark.c: fix gating for bench_shake128() from !defined(WOLFSSL_NO_SHAKE128) to defined(WOLFSSL_SHAKE128).
* wolfcrypt/test/test.h: add WC_TEST_RET_TAG_* and WC_TEST_RET_DEC_TAG(), and refactor WC_TEST_RET_{ENC,DEC}_*() macros to implement the tag mechanism;
* add render_error_message() with tag-specific rendering of error strings;
* wolfcrypt/test/test.c: smallstack refactor of shake128_test() and shake128_absorb_test();
* wolfcrypt/test/test.c: change gating around mp_test() and related routines from defined(HAVE_VALGRIND) to defined(WOLFSSL_PUBLIC_MP);
* smallstack refactor of mp_test();
* refactor a slew of WC_TEST_RET_ENC_NC associated with XFOPEN/XFREAD to be WC_TEST_RET_ENC_ERRNO, and add error detection for XFREAD (previously silently tolerating zero retvals).
* wolfcrypt/test/test.c: build mp_test() only if WOLFSSL_SP_MATH_ALL or USE_FAST_MATH (in addition to WOLFSSL_PUBLIC_MP), because many general purpose functions such as sp_mulmod() are gated out in SP builds without WOLFSSL_SP_MATH_ALL.
* wolfcrypt/test/test.c: fix array bounds flubs in shake128_test();
* don't print_fiducials() in wolfcrypt_test() header, but rather, after render_error_message() in err_sys().
* wolfcrypt/test/test.{c,h}: wrap some overlong lines, and fix an unused-variable warning in mp_test_set_is_bit().
* wolfcrypt/test/test.c: fixes for several misplaced and several missing WC_TEST_RET_ENC_EC()s.
2023-02-28 13:02:37 -08:00
David Garske 5ec62c8d48
Merge pull request #6096 from SparkiDev/armv7a_neon_config
ARMv7a neon configure.ac
2023-02-20 15:22:20 -08:00
David Garske d488693f15 Allow `#define HAVE_LIBZ` support in `user_settings.h`. 2023-02-16 14:20:57 -08:00
Sean Parkinson 85314e6ba5 ARMv7a neon configure.ac
Support other CPUs that start with armv7a.
2023-02-16 10:36:38 +10:00
Kaleb Himes dead56b3cb
Merge pull request #6086 from julek-wolfssl/explicit-rwlock
Make rwlock an explicit enable option
2023-02-14 15:04:13 -07:00
Juliusz Sosinowicz 0cedc4e1ac
stunnel 5.67 support (#6020)
* stunnel 5.67 support

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

* Upref the session for stunnel instead of duplicating it

* Add small stack option for wolfSSL_parse_cipher_list
2023-02-14 09:38:28 -08:00
Juliusz Sosinowicz bcfd5fb66b Make rwlock an explicit enable option 2023-02-14 13:55:59 +01:00
tmael 55a7e24cfe
Support pthread_rwlock (#5952)
* Support rwlock

* Fix typo, ENABLE_SESSION_CACHE_ROW_LOCK with TITAN_SESSION_CACHE

* Implement read lock

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

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

* Detect rwlock support with PTHREAD_RWLOCK_INITIALIZER

* Implement explicit rwlocks

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

* Remove WOLFSSL_USE_RWLOCK guard around mutex condLock

* condLock not necessary after all

* Use configure.ac to check for pthread_rwlock_destroy support

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

* Check for pthread_rwlock_t to determine if rwlock is available

* Code review

---------

Co-authored-by: Juliusz Sosinowicz <juliusz@wolfssl.com>
2023-02-10 10:42:38 -08:00
David Garske 05f8abd524
Merge pull request #6064 from embhorn/gh6063
Add WOLFSSL_IP_ALT_NAME to --enable-curl; fix unused error in FindPsk
2023-02-09 08:38:38 -08:00
jordan cc791a7a53 Spelling cleanup: configure.ac, ssl.c, ssl.h 2023-02-07 21:45:06 -06:00
Eric Blankenhorn 2539ba3f3d Add WOLFSSL_IP_ALT_NAME to --enable-curl; fix unused error in FindPsk 2023-02-07 15:51:09 -06:00
Sean Parkinson bd155389e2 ASN: make template default for configure
When loading DH private key, create the public key if not found.
Failures fixed.
2023-02-07 08:49:46 +10:00
John Safranek 8e57ff08ab
Build Fixes
./configure --enable-wolfssh --enable-cryptonly \
        --disable-asn --disable-rsa --disable-ecc
./configure --disable-asn --disable-rsa --disable-ecc --enable-psk
./configure --enable-cryptonly --disable-asn --disable-rsa --disable-ecc

1. Fails compiling the KDF file, can't find c32toa inline function.
2. In configure, move the check for ECC when ASN is disabled up to the
   other ASN checks. It also needs to be checked with cryptonly is
   disabled.
2023-02-03 16:09:27 -08:00
Chris Conlon f14c27f644 Fix SE050 RSA public key loading and RSA/ECC SE050 usage from TLS with WOLF_PRIVATE_KEY_ID 2023-01-27 14:28:47 -07:00
Daniel Pouzzner 4b0e0b88fb configure.ac: restore CPPFLAGS and CFLAGS to list of iterated options rendered into options.h; delete stale .build_params when ENABLED_REPRODUCIBLE_BUILD. 2023-01-26 14:53:56 -06:00
Daniel Pouzzner c3a5698799 configure.ac/Makefile.am:
add support for EXTRA_CPPFLAGS, EXTRA_CCASFLAGS, and EXTRA_LDFLAGS;

fix typo in setup for CFLAG_VISIBILITY;

lightly refactor handling of CPPFLAGS/AM_CPPFLAGS in handlers for --with-liboqs, --with-wnr, and --with-cavium;

refactor+enhance options.h generation to handle -U directives.
2023-01-25 23:45:21 -06:00
David Garske f6ecc6ce4c
Merge pull request #5990 from philljj/gcmstream_kcapi_errmsg
Don't allow aesgcm-stream option with kcapi
2023-01-19 12:00:36 -08:00
jordan 04383bfb34 Don't allow aesgcm-stream option with kcapi 2023-01-19 10:54:48 -06:00
David Garske 6b6ad38e4f Adds support for TLS v1.3 Encrypted Client Hello (ECH) draft-ietf-tls-esni) and HPKE (Hybrid Public Key Encryption) RFC9180. 2023-01-18 11:37:27 -08:00
David Garske 023db01aca * Fixed some build configuration variations.
* Fixed `PEM_BUFSIZE` macro redefined when building with coexist.
* Updated the `user_settings_all.h` and `user_settings_wolfboot_keytools.h` to include latest options.
* Improved API unit test error case checking where `TEST_RES_CHECK` is not used.
* Changed `TEST_SKIPPED` to unique value.
* Added CI tests for enable-all, small stack, and user setting templates.
2023-01-03 10:59:59 -08:00
David Garske 49d23cf60a
Merge pull request #5913 from douzzer/20221219-no-sha-1-all-crypto
20221219-no-sha-1-all-crypto
2022-12-22 17:02:58 -08:00
David Garske 5c89719c51
Merge pull request #5916 from julek-wolfssl/dtls-srtp-keying-material
DTLS-SRTP: use wolfSSL_export_keying_material instead of wc_PRF_TLS
2022-12-22 17:01:37 -08:00
John Safranek 9ce79c4de8
Merge pull request #5921 from cconlon/libsuffix 2022-12-22 11:37:28 -08:00
Chris Conlon 9a7ff8773b add --with-libsuffix support, append suffix to library artifact name 2022-12-21 13:31:07 -07:00
Jacob Barthelmeh cca63a465d prepare for release 5.5.4 2022-12-20 14:19:59 -07:00
Juliusz Sosinowicz 6a8be960ba DTLS-SRTP: use wolfSSL_export_keying_material instead of wc_PRF_TLS 2022-12-20 16:42:28 +01:00
Daniel Pouzzner 91869f6028 minor fixes to accommodate --disable-sha in combination with --enable-all-crypto. 2022-12-20 00:42:05 -06:00
Anthony Hu 24d7f85016 ENABLED_FIPS doesn't hold the version; FIPS_VERSION does.
Found with:

./configure --enable-engine=fips=v2
2022-12-16 14:06:43 -05:00