Commit Graph

8344 Commits

Author SHA1 Message Date
JacobBarthelmeh
089e57371f remove a hard tab 2024-03-04 08:10:41 -07:00
Jacob Barthelmeh
b42a8b6c5d initial AutoSAR shim layer 2024-03-04 07:51:00 -07:00
JacobBarthelmeh
f05e47bc09 length of characters and extra sanity check on input 2024-03-04 07:05:07 -07:00
JacobBarthelmeh
66f419bd18 add user ctx to stream IO callbacks 2024-03-04 06:00:07 -07:00
Eric Blankenhorn
cf733c306c Merge pull request #7284 from douzzer/20240229-mutex-initializer-global-refactor
20240229-mutex-initializer-global-refactor
2024-03-01 16:43:10 -06:00
Daniel Pouzzner
b1edb08119 linuxkm/linuxkm_wc_port.h:
* fix WC_LINUXKM_ROUND_UP_P_OF_2() to not round up values that are already powers of 2, nor values larger than 8192.

linuxkm/lkcapi_glue.c:
* fix gating on km_AesSetKeyCommon().
* small stack refactors of Aes objects in self-test routines.
* change kmalloc/free to malloc/free in self-test routines.
* fix error-path "return"s to "goto exit"s in self-test routines.
* fix memory leak around large_input in aes_xts_128_test().

wolfcrypt/benchmark/benchmark.c:
* smallstack refactors in bench_chacha() and bench_chacha20_poly1305_aead().
* add error handling in bench_chacha().

wolfcrypt/src/chacha20_poly1305.c: smallstack refactor for wc_ChaCha20Poly1305_Encrypt() and wc_ChaCha20Poly1305_Decrypt().
2024-03-01 14:55:49 -06:00
David Garske
7c836c8371 Thumb2 AES GCM support for GCM_SMALL. ZD 17225 2024-03-01 11:10:21 -08:00
JacobBarthelmeh
05138154a9 check trailing 0's in signeeds check case 2024-03-01 22:57:10 +07:00
JacobBarthelmeh
95eb17944c Merge pull request #6961 from TakayukiMatsuo/pkcs7
Add streaming support for PKCS7_VerifySignedData.
2024-03-01 22:38:07 +07:00
JacobBarthelmeh
fbf1b783da initialize value to resolve warning 2024-03-01 21:39:27 +07:00
JacobBarthelmeh
c32d9c826c fix for check on hash with ECDSAk case 2024-03-01 21:14:15 +07:00
Daniel Pouzzner
52f003f5fc Merge pull request #7281 from philljj/zd17416
Fix Coverity issues.
2024-03-01 02:41:48 -05:00
jordan
b3c276bf0b Fix wc_SetExtKeyUsageOID buffer warning: update size of oid. 2024-02-29 13:17:31 -06:00
Daniel Pouzzner
dfbde4514b global refactor of static mutex initialization to use WOLFSSL_MUTEX_INITIALIZER, and adjustment of WOLFSSL_MUTEX_INITIALIZER macro to take an argument, for Linux kernel compatibility. 2024-02-29 02:11:32 -06:00
jordan
c24add5da9 Fix dataASN null pointer dereference in asn.c. 2024-02-28 15:37:55 -06:00
jordan
1768b03ecd Fix wc_SetExtKeyUsageOID buffer warning. 2024-02-28 11:13:33 -06:00
Daniel Pouzzner
af31fbc840 Merge pull request #7271 from bigbrett/cryptocb-random-wctestfix
add full support to wolfcrypt tests for random.c cryptocbs
2024-02-27 19:57:46 -05:00
Brett Nicholas
55421a11b9 review: removed WOLFSSL_ABI from and refactored args for wc_rng_new_ex, updated tests 2024-02-27 10:17:24 -07:00
TakayukiMatsuo
eeda0caeb9 Add streaming support for PKCS7_VerifySignedData. 2024-02-27 15:04:32 +09:00
JacobBarthelmeh
2044d6b7dd add callbacks for PKCS7 streaming input and output 2024-02-26 08:28:12 -07:00
gojimmypi
0775baa2e1 Introduce SHA256/SHA512 interleave, HAVE_DSA; revised ERROR_OUT, cleanup 2024-02-23 17:52:20 -08:00
David Garske
a77c6d1fa0 Merge pull request #7269 from JacobBarthelmeh/cryptocb
add support for crypto cb only with ECC and CAAM
2024-02-23 13:19:32 -08:00
Brett Nicholas
1a5064cf8c add full support to wolfcrypt tests for random.c cryptocbs 2024-02-23 13:02:05 -07:00
JacobBarthelmeh
2f6cd765f1 revert some macro guards for support with sp math 2024-02-24 01:07:05 +07:00
JacobBarthelmeh
2364b699ff add support for crypto cb only with ECC and CAAM 2024-02-23 08:09:19 -08:00
Daniel Pouzzner
06469a43bc wolfcrypt/benchmark/benchmark.c:
* remove redundant nullness checks covered by WC_ALLOC_VAR() via WC_ALLOC_DO_ON_FAILURE();
* add "exit:" logic to bench_sm4_gcm();
* add missing WC_ALLOC_VAR() in bench_sm4_ccm();
* fix early return in bench_ed448KeySign().
2024-02-23 01:07:26 -06:00
David Garske
4055b0d832 Fix for some variable null checks that are not needed. 2024-02-22 16:28:15 -08:00
David Garske
cd0301fc66 Fixes for benchmark with small stack (RSA was being skipped). Added Thumb2 benchmarks for STM32H753. 2024-02-22 14:56:51 -08:00
Sean Parkinson
d027b305ab Merge pull request #7257 from philljj/zd17540
Fix unchecked ge448_scalarmult_base return value.
2024-02-22 07:05:09 +10:00
JacobBarthelmeh
88e7d47930 Merge pull request #7230 from anhu/tests_gating
Fixup some gating in the tests.
2024-02-22 01:24:55 +07:00
jordan
5aa06c26ff Fix unchecked ge448_scalarmult_base return value. 2024-02-21 08:40:38 -06:00
Anthony Hu
00c3f5be2e A fixup 2024-02-20 21:50:03 -05:00
Juliusz Sosinowicz
4caef93346 Implement transient certs
Add wolfSSL_CertManagerUnloadIntermediateCerts API to clear intermediate certs added to store.
2024-02-20 14:33:36 +01:00
Sean Parkinson
af2b2dddb4 Merge pull request #7253 from julek-wolfssl/zd/17507
wc_ecc_shared_secret_ssh fix
2024-02-20 06:56:28 +10:00
Daniel Pouzzner
8d894fb01b wolfssl/wolfcrypt/types.h: add WC_ARRAY_ARG() and WC_HEAP_ARRAY_ARG() constructors, for passing arrays declared by WC_DECLARE_ARRAY() and WC_DECLARE_HEAP_ARRAY(). used this to refactor bench_rsa_helper() arg list, fixing a cppcheck argumentSize warning.
wolfcrypt/test/test.c: revert overeager constification of xmss_msg and xmss_sig.
2024-02-17 15:24:55 -06:00
David Garske
7f18338322 Merge pull request #7255 from ejohnstown/ocsp-date
OCSP Date Checks
2024-02-16 20:58:20 -08:00
John Safranek
52f4dcd7aa OCSP Date Checks
When calling DecodeResponseData(), no matter the return value, if it is
not success, it is assigned to ASN_PARSE_E. This isn't the pattern for
other branch parsing. Return the value returned.

This is seen when decoding an OCSP response that is past the
next-available time.
2024-02-16 12:12:27 -08:00
David Garske
e4ea2651a3 Merge pull request #7252 from douzzer/20240215-benchmark-smallstack-refactors
20240215-benchmark-smallstack-refactors
2024-02-16 11:45:59 -08:00
David Garske
815c290293 Merge pull request #7231 from anhu/maxqrng
Use the MAXQ1065/1080 rng when available.
2024-02-16 09:43:46 -08:00
Daniel Pouzzner
3676dc02a6 wolfcrypt/benchmark/benchmark.c: mollify scan-build with XMEMSET()s in several false positives around WC_DECLARE_ARRAY(). 2024-02-16 10:27:06 -06:00
Daniel Pouzzner
44e0ee1ecd wolfssl/wolfcrypt/types.h:
* fix overallocation in WC_DECLARE_ARRAY() macro in the !WOLFSSL_SMALL_STACK path.
* rename WC_INIT_ARRAY() to WC_ALLOC_ARRAY() for clarity (it doesn't initialize any memory).
* rename WC_DECLARE_ARRAY_DYNAMIC_DEC(), WC_DECLARE_ARRAY_DYNAMIC_EXE(), and WC_FREE_ARRAY_DYNAMIC() to WC_DECLARE_HEAP_ARRAY(), WC_ALLOC_HEAP_ARRAY(), and WC_FREE_HEAP_ARRAY(), respectively, also for clarity, and refactor out the duplicate definitions.
* add WC_ALLOC_VAR(), and move the XMALLOC() in smallstack WC_DECLARE_VAR() into it.  smallstack WC_DECLARE_VAR() now initializes the pointer to NULL, like smallstack WC_DECLARE_ARRAY(), assuring all pointers are valid upon shortcircuit to cleanup for a failed allocation (see WC_ALLOC_DO_ON_FAILURE below).
* add a new hook "WC_ALLOC_DO_ON_FAILURE" in WC_ALLOC_VAR(), WC_ALLOC_ARRAY(), and WC_DECLARE_ARRAY_DYNAMIC_EXE(), which is invoked when an allocation fails.  by default the hook is defined to WC_DO_NOTHING.
* add basic safety to WC_*_HEAP_ARRAY() by recording/detecting allocation state via idx##VAR_NAME.
* add macros WC_ARRAY_OK() and WC_HEAP_ARRAY_OK() to test if allocation succeeded.
* add macros WC_CALLOC_ARRAY() and WC_CALLOC_HEAP_ARRAY() which zero the objects.
* add macro WC_CALLOC_VAR() which zeros the object.

ED448: smallstack refactor of ge448_scalarmult_base().

src/tls.c tests/api.c wolfcrypt/test/test.c: update WC_DECLARE_VAR()s with now-required matching WC_ALLOC_VAR()s.

wolfcrypt/benchmark/benchmark.c:
* no functional changes in default error-free behavior.
* add definition of WC_ALLOC_DO_ON_FAILURE() that prints error message, sets ret, and does goto exit.
* add BENCH_NTIMES and BENCH_AGREETIMES overrideeable macros, to allow fast sanitizer runs and slow high-precision runs.
* smallstack refactor of all declarations of stack arrays of the form foo[BENCH_MAX_PENDING], using WC_DECLARE_ARRAY() (35 in all).
* additional smallstack refactors, using WC_DECLARE_VAR(), for bench_aesxts(), bench_ed448KeyGen(), bench_eccsi*(), and bench_sakke*().
* fixes for various unhandled error conditions around malloc failures.

wolfcrypt/test/test.c: opportunistically constify several (42) static constants, moving them to the readonly data segment.

linuxkm/Makefile: if ENABLED_LINUXKM_BENCHMARKS, add wolfcrypt/benchmark/benchmark.o to WOLFSSL_OBJ_FILES.

linuxkm/Kbuild: enable FPU for benchmark.o, and remove enablement for module_hooks.o.

linuxkm/module_hooks.c: remove inline include of benchmark.c.
2024-02-16 10:26:21 -06:00
Juliusz Sosinowicz
469760e186 wc_ecc_shared_secret_ssh fix
- wc_ecc_shared_secret_ssh should either be declared or not. Having two different signatures for the same function is error prone.
- Don't use wc_ecc_shared_secret_ssh in our code. Use wc_ecc_shared_secret directly.
2024-02-16 13:38:35 +01:00
Lealem Amedie
4cc960787f Fix for AES-ECB benchmark livelock with Async 2024-02-15 12:51:22 -07:00
David Garske
375415d042 Merge pull request #7229 from kaleb-himes/win-code-up
Windows doesn't like code before variables
2024-02-14 09:50:34 -08:00
David Garske
6f88ed0901 Merge pull request #7177 from gojimmypi/PR-Arduino-Update
Improved Arduino Support: ESP32, Due
2024-02-13 09:43:42 -08:00
David Garske
c8d0bb0bd8 Merge pull request #7212 from SparkiDev/eddsa_check_priv
EdDsa: check private value after sign
2024-02-13 09:27:34 -08:00
Sean Parkinson
e28d6a7b71 EdDsa: check private value after sign
Check the private value hasn't changed during signing with EdDSA.
2024-02-13 22:11:48 +10:00
gojimmypi
68fb183fa6 Update TLS client example for Espressif ESP8266 2024-02-13 03:01:40 -08:00
Daniel Pouzzner
9b7decada0 wolfcrypt/test/test.c: fix Aes init/free lifecycle in aes192_test() and aes256_test(). 2024-02-13 01:23:11 -06:00
David Garske
2ebc897e31 Merge pull request #7241 from ejohnstown/ocsp-revoke-reason
Decode OCSP Revocation Reason
2024-02-12 15:11:26 -08:00