Commit Graph

9093 Commits

Author SHA1 Message Date
Daniel Pouzzner
bfeb0ad48e expand opensslcoexist to all low level crypto APIs. 2024-11-22 19:27:56 -06:00
JacobBarthelmeh
033a2a08e9 Merge pull request #8212 from bandi13/fixTestFailure
Fix Renesas test
2024-11-22 10:42:21 -07:00
David Garske
401a64d112 Improve stdarg.h around uses of var_arg. Cleanup warning for XFREE/XMALLOC redef. 2024-11-22 08:11:32 -08:00
Daniel Pouzzner
d85c108952 wolfssl/wolfcrypt/error-crypt.h, wolfcrypt/src/error.c: add WC_FAILURE ("wolfCrypt generic failure") with value -1, for traceable error return of -1 in wolfCrypt.
configure.ac: add OPENSSL_EXTRA to --enable-wolfsentry.

linuxkm/linuxkm_wc_port.h, linuxkm/module_hooks.c, wolfssl/ssl.h: accommodate backward dependencies for wolfSSL_X509_NAME_add_entry_by_NID, wolfSSL_X509_NAME_free, and wolfSSL_X509_NAME_new_ex.

linuxkm/lkcapi_glue.c: if CONFIG_CRYPTO_MANAGER, assert match of CONFIG_CRYPTO_FIPS and HAVE_FIPS.

src/ssl_crypto.c, wolfcrypt/src/wc_lms.c, wolfcrypt/src/wc_lms_impl.c, wolfcrypt/src/wc_xmss.c, wolfcrypt/test/test.c: add missing casts for XMALLOC()s.

src/ssl_crypto.c: in wolfSSL_AES_decrypt(), fix gate for wc_AesDecryptDirect() return type.

wolfcrypt/test/test.c: smallstack refactor in test_dilithium_decode_level().

tests/api.c: fix uninited vars and "embedding a directive within macro arguments is not portable" in test_wc_dilithium_der().
2024-11-21 21:59:26 -06:00
Reda Chouk
378519d7fb Adding missing checks missing initialization of sp_int/mp_int initialization (
in case of MEMORY_E).

removed printf (added for previous debugging)
2024-11-21 23:55:34 +01:00
Brett Nicholas
cceeb776f7 gate dilithium OID autodetection on FIPS 204 draft mode 2024-11-21 09:38:11 -08:00
JacobBarthelmeh
04932dd97d Merge pull request #8206 from dgarske/rx_tsip
Fixes for RSA TSIP RSA Sign/Verify
2024-11-21 09:30:48 -07:00
JacobBarthelmeh
c06f65a8ac Merge pull request #8182 from dgarske/no_compat_headers
Support for building without wolfssl/openssl header files
2024-11-20 21:33:18 -07:00
David Garske
d109f38cbd Fixes for RSA TSIP RSA Sign/Verify. Tested on RX72N EnvisionKit. Added THREADX threading support.
```
Start wolf tsip crypt Test

 simple crypt test by using TSIP
 sha_test() passed
 sha256_test() passed
 tsip_aes_cbc_test()  passed
 tsip_aes256_test()  passed
 tsip_rsa_test(2048) passed
 tsip_rsa_SignVerify_test(2048) passed

End wolf tsip crypt Test
```
2024-11-20 13:08:26 -08:00
JacobBarthelmeh
be70bea687 Merge pull request #8202 from LinuxJedi/fix-cryptodev-debug
Fix cryptodev debug output
2024-11-20 14:00:05 -07:00
David Garske
ef67b1c06a Support for building without wolfssl/openssl header files. ZD 18465
* Fix for `TlsSessionCacheGetAndLock` that was not checking the sessionIDSz, so could return a pointer to an invalid session (if 0's). Resolves issue with `test_wolfSSL_CTX_sess_set_remove_cb` test.
* Fix cast warning with `HAVE_EX_DATA` in Windows VS.
* Fix openssl_extra without PKCS12.
* Refactor the EX data crypto and session API's to gate on `HAVE_EX_DATA_CRYPTO`.
* Grouped the EX data API's in ssl.h
* Moved API's in ssl.h to separate the compatibility ones from ours.
2024-11-20 12:32:32 -08:00
Andrew Hutchings
f5e6e17c7c Fix cryptodev debug output
Cryptodev has two sections for the session info struct, cipher and hash.
Our debug mode was using hash for the output even if we were using
cipher, so would output random data. Simple 'if' statement to do the
correct thing.
2024-11-20 06:41:58 +00:00
JacobBarthelmeh
42825e82d2 Merge pull request #8200 from anhu/crl-orig
Fix for github issue 8198
2024-11-19 09:35:59 -07:00
David Garske
18f52b2573 Merge pull request #8177 from bigbrett/dilithium-get-algo-from-der
ML-DSA/Dilithium: obtain security level from DER when decoding
2024-11-19 07:32:39 -08:00
David Garske
261ddc13ad Merge pull request #8006 from ColtonWilley/crl_update_cb
CRL improvements and update callback
2024-11-18 20:11:37 -08:00
Brett Nicholas
48dcbe9caf fix typo in comment 2024-11-18 16:50:35 -07:00
Brett Nicholas
9815fcd3ea make inOutKeyType parameter mandatory for DecodeAsymKey_Assign 2024-11-18 16:46:10 -07:00
Brett Nicholas
d50fb63071 add macros for dilithium DER export buffer sizes 2024-11-18 16:14:26 -07:00
Brett Nicholas
63deea57e0 properly protect test.c calls to dilithium public/private API 2024-11-18 15:47:00 -07:00
Anthony Hu
237bb24f87 Fix for github issue 8198 2024-11-18 17:33:13 -05:00
Colton Willey
55be5035a0 Merge branch 'master' of github.com:ColtonWilley/wolfssl into crl_update_cb 2024-11-18 09:52:51 -08:00
Daniel Pouzzner
18cc3e0c92 add .wolfssl_known_macro_extras;
src/wolfio.c: #include <errno.h> if necessary;

wolfcrypt/src/asn.c: gate WOLFSSL_MSG_EX() uses on defined(DEBUG_WOLFSSL), for pedantic C89 compatibility (no variadic macros);

wolfssl/wolfcrypt/wc_port.h: refine setup for XFENCE().
2024-11-16 18:23:11 -06:00
Daniel Pouzzner
ae0d73d9fd Merge pull request #8122 from miyazakh/tsip_rsa_private_enc
Implement TSIP RSA Public Enc/Private Dec
2024-11-16 16:12:51 -06:00
David Garske
649b78f460 Merge pull request #8193 from douzzer/20241115-macro-fixes
20241115-macro-fixes
2024-11-15 15:58:57 -08:00
David Garske
ada922be00 Merge pull request #8166 from philljj/fix_holder_entityname
acert: fix holder entityName parsing.
2024-11-15 14:49:00 -08:00
Daniel Pouzzner
ebfde75d91 fixes for misspelled/malformed macro names, and add missing BUILD_AESCCM setup in wolfssl/internal.h 2024-11-15 15:33:51 -06:00
jordan
c71fdc3ca2 acert: review cleanup. 2024-11-15 13:48:17 -06:00
Daniel Pouzzner
a95b759ffa peer review for #8187 and unrelated bug fixes:
return error code from wolfSSL_RefWithMutexUnlock() to expose result to caller;

fix endianness bug in src/x509.c:wolfSSL_X509_add_ext() (fixes failing test_wolfSSL_X509_add_ext on BE targets);

fix possible file handle leak in tests/api.c:test_wolfSSL_d2i_X509_REQ() (reported by clang-tidy);

in wolfssl/ssl.h, define CONST_NUM_ERR_WOLFSSL_SUCCESS, so that WOLFSSL_SUCCESS can be benignly miswrapped in WC_NO_ERR_TRACE().
2024-11-15 12:52:50 -06:00
Daniel Pouzzner
595f55eceb add struct wolfSSL_RefWithMutex, wolfSSL_RefWithMutexLock, and wolfSSL_RefWithMutexUnlock, and change WOLFSSL_CTX.ref from wolfSSL_Ref to wolfSSL_RefWithMutex.
in in wc_port.c, rename mutexful implementations of wolfSSL_Ref*() to wolfSSL_RefWithMutex*(), and build them even if defined(WOLFSSL_ATOMIC_OPS).

refactor wolfSSL_CTX_UnloadIntermediateCerts() to wrap the refcount check and deallocation with wolfSSL_RefWithMutexLock()...wolfSSL_RefWithMutexUnlock().

move port-specific setup for WARN_UNUSED_RESULT, WC_MAYBE_UNUSED, and WC_INLINE, from types.h to wc_port.h, to make them usable by port-specific definitions later in wc_port.h.

when defined(SINGLE_THREADED) and !defined(WOLFSSL_NO_ATOMICS), typedef int wolfSSL_Atomic_Int, so that access to wolfSSL_Atomic_Ints in SINGLE_THREADED builds is easy.

refactor fallback definitions of wolfSSL_Atomic_Int_FetchAdd and wolfSSL_Atomic_Int_FetchSub as WC_INLINE functions to avoid -Wunused-result.
2024-11-15 12:35:41 -06:00
jordan
622fc70d1e acert: fix holder entityName parsing, light cleanup, better testing. 2024-11-15 11:38:19 -06:00
Brett Nicholas
2207791aab removed DecodeAsymKeyXXX_Assign_ex function, functionality now included in original _Assign function 2024-11-15 10:25:10 -07:00
David Garske
5f06a7f732 Merge pull request #8188 from douzzer/20241114-wc_mp_sign_t
20241114-wc_mp_sign_t
2024-11-15 08:36:42 -08:00
David Garske
fcfd3be160 Merge pull request #8186 from SparkiDev/tfm_mask_cast
TFM: explicit cast of -1 to fp_digit
2024-11-14 17:57:00 -08:00
David Garske
54bdb39454 Merge pull request #8176 from SparkiDev/x509_coverage
X509: improve testing coverage
2024-11-14 17:49:33 -08:00
David Garske
8b1e9211b1 Merge pull request #8149 from SparkiDev/asn_getshortint
Make GetShortInt available with WOLFSSL_ASN_EXTRA
2024-11-14 17:47:11 -08:00
Daniel Pouzzner
154c5f0b56 rename mp_sign_t to wc_mp_sign_t and mp_size_t to wc_mp_size_t. 2024-11-14 18:14:45 -06:00
Daniel Pouzzner
dd9f6378cb rename WOLFSSL_GLOBAL to WC_THREADSHARED, and refactor mutex handling in src/sniffer.c for consistency and correctness, also adding gating on !SINGLE_THREADED for efficiency;
add wc_static_assert in wolfcrypt/test/test.h to assure that WC_TEST_RET_ENC() can correctly handle all error codes.
2024-11-14 16:35:04 -06:00
Sean Parkinson
9d8a3cc352 TFM: explicit cast of -1 to fp_digit
When -1 is needed as an fp_digit, as a mask. cast to fp_digit.
2024-11-15 08:25:44 +10:00
Brett Nicholas
f672105d55 - Move automatic OID detection from Dilithium code into ASN code 2024-11-13 15:31:59 -07:00
Daniel Pouzzner
0ebd86d668 add second wolfCrypt error code span, and add DEADLOCK_AVERTED_E. 2024-11-13 13:01:00 -06:00
Sean Parkinson
86ad96ca29 X509: improve testing coverage 2024-11-13 09:10:22 +10:00
Brett Nicholas
6b1b6ece00 guard use of dilithium_key->params on WC implementation 2024-11-12 16:08:11 -07:00
Brett Nicholas
0e6ac11d15 - Add ability to obtain Dilithium security level (parameters) from a DER
encoded key based on the algorithm type OID
- Add test coverage for decoding DER keys without level specified
2024-11-12 14:19:12 -07:00
Daniel Pouzzner
c5f1acf960 Merge pull request #8172 from SparkiDev/kyber_bench_fix
Kyber benchmark: allow ML-KEM and Kyber
2024-11-11 23:00:51 -06:00
JacobBarthelmeh
4996aed166 Merge pull request #8117 from rizlik/static_mem_fix_types
memory: fix types in wc_LoadStaticMemory_ex()
2024-11-11 09:48:25 -07:00
Sean Parkinson
cadafffb71 Kyber benchmark: allow ML-KEM and Kyber
Fix benchmark to use ML-KEM/Kyber depending on how code is built.
2024-11-11 10:34:32 +10:00
Daniel Pouzzner
9361603d8b Merge pull request #8071 from JacobBarthelmeh/static
display heap pointer with debug enabled
2024-11-09 00:20:32 -06:00
Daniel Pouzzner
165b4afbeb Merge pull request #8143 from SparkiDev/kyber_plus_mlkem
Kyber/ML-KEM: make both available
2024-11-09 00:09:51 -06:00
Daniel Pouzzner
23f46a1c3e Merge pull request #8140 from dgarske/wildcard
Fix for building sources (wildcard *.c). Add macro guard on new files.
2024-11-08 23:36:00 -06:00
Hideki Miyazaki
2831eb3ca7 Fix TSIP TLS. Call rsa_pad crypt cb in the case of TSIP 2024-11-09 14:23:57 +09:00