Commit Graph

7502 Commits

Author SHA1 Message Date
Sean Parkinson
5be883a995 ASN: fix so that NO_CERTS configurations work
Moved code around and update #ifdefs so that --enable-cryptonly
CFLAGS=-DNO_CERTS compiles.
2023-07-03 09:16:44 +10:00
Sean Parkinson
da4424cd0c Merge pull request #6559 from dgarske/sni_defaults
Turn on SNI by default on hosts with resources
2023-07-03 08:07:45 +10:00
JacobBarthelmeh
a4c058649b Merge pull request #6560 from dgarske/stm32_nuttx
Support for using the Nuttx STM RNG register definitions
2023-06-30 16:15:49 -06:00
Chris Conlon
e1cb74f24a Merge pull request #6492 from night1rider/wolfssl-wolfcrypttest-statickeys
Added to cert buffer keys and updated testwolfcrypt
2023-06-30 14:21:40 -06:00
David Garske
6052e01879 Fixes for SNI test with static memory enabled. Fixes for other minor static memory build combinations. 2023-06-30 13:04:05 -07:00
David Garske
53c30f44a0 Support for using the Nuttx STM RNG register definitions, enabled with STM32_NUTTX_RNG. ZD 16315 2023-06-30 13:00:52 -07:00
David Garske
9fc68f4a80 Merge pull request #6558 from anhu/wolfSSL_X509_NAME_heap
Allocate WOLFSSL_X509_NAME with heap hint.
2023-06-30 10:35:08 -07:00
Sean Parkinson
a1939d22b9 wolfBot fixes
Importing an EC point ordinate with one being zero will result in
different errors based on different implementations. Check both known
error codes.

Benchmark usage fixed.
2023-06-30 09:07:46 +10:00
Anthony Hu
ed4774f606 Allocate WOLFSSL_X509_NAME with heap hint. 2023-06-29 12:04:32 -04:00
David Garske
dcfa410540 Merge pull request #6289 from jpbland1/nuttx-hw-acel
Nuttx hw acel benchmark with STM32_HW_CLOCK_AUTO
2023-06-28 09:32:48 -07:00
JacobBarthelmeh
78107b0f88 Merge pull request #6540 from dgarske/bench_fix
Fix for benchmark always using 4KB of memory for `gStats`
2023-06-27 16:18:29 -06:00
John Bland
c72d008a5c add STM32_HW_CLOCK_AUTO which turns the stm32 hw
accleration clock on and off automatically
2023-06-27 17:16:46 -04:00
John Bland
fbadcf67da add the STM32 peripheral clock enable and disable
calls to the benchmark program so the benchmark program can use hardware accleration
2023-06-27 17:16:46 -04:00
David Garske
0d0d2cf50c Merge pull request #6531 from bandi13/extraCMakeOptions
Extra c make options
2023-06-27 13:26:03 -07:00
David Garske
b1fe15dc70 Further refactor of the benchmark stats tracking. Always use the allocated list (avoids using a stack pointer for ECC descriptions). 2023-06-27 13:05:04 -07:00
David Garske
51ca7bb8e3 Fix to support using -print with WC_BENCH_TRACK_STATS. 2023-06-27 10:25:48 -07:00
David Garske
23c60b7b9c Merge pull request #6530 from SparkiDev/tests_api_expect_5
Test api.c: change more tests to use Expect instead of Assert
2023-06-26 16:10:52 -07:00
Sean Parkinson
578f56e60c Test api.c: change more tests to use Expect instead of Assert
bio.c:
  wolfSSL_BIO_flush(): check allocation to bio->ip succeeded.

internal.c:
  InitSSL_Ctx(): set ctx->heap to heap if value passed in
ProcessPeerCerts(): check for error MEMORY_E too as a fatal parsing
error

ssl.c:
wolfSSL_shutdown(): SOCKET_ERROR_E is also an indication that the
socket is done, MEMORY_E is a fatal error
  wolfSSL_Cleanup(): move free of memory fail couting to wolfSSL API
  SessionTicketNoncePrealloc(): eror return must be non-zero
AddSessionToCache(): XFREE checks for NULL no need to do it before
call
wolfSSL_set_psk_use_session_callback(): ensure ssl is not NULL before
dereferencing
wolfSSL_SMIME_read_PKCS7(): check for error return from
wolfSSL_BIO_gets()

asn.c:
  wc_MIME_parse_headers(): check allocation succeeded into nextHdr

compress.c:
  wc_DeCompressDynamic(): free tmp on inflateInit2 failure

memory.c: rework where memory allocation failure counting code for when
WOFLSSL_STATIC_MEMORY is defined

wc_port.c:
wolfCrypt_Cleanup(): only call wc_MemFailCount_Free() when no
wolfSSL_Cleanup()
2023-06-27 08:01:33 +10:00
Sean Parkinson
17bc833bd3 Merge pull request #6543 from embhorn/gh6506
Spelling fixes in script generated files
2023-06-27 07:28:35 +10:00
Eric Blankenhorn
51ffe9691f Spelling fixes in script generated files 2023-06-26 09:48:15 -05:00
gojimmypi
6b240fa41a Refactor HAVE_PTHREAD and _POSIX_THREADS (#6536)
* HAVE_PTHREAD gate in test.h
* add config.h and settings.h to test.h
* added config.h and settings.h to other test.h in wolfcrypt/test
* settings #ifdef _POSIX_THREADS HAVE_PTHREAD
* cyassl settings _POSIX_THREADS HAVE_PTHREAD
* undo cyassl _POSIX_THREADS HAVE_PTHREAD
* move settings.h #include in both test.h
* add !defined(SINGLE_THREADED) logic
* refactor  HAVE_PTHREAD, _POSIX_THREADS
2023-06-26 07:32:20 -07:00
David Garske
00719182d5 Fix for benchmark always using 4KB of memory for gStats, even when not required. Added new WC_BENCH_TRACK_STATS to enable feature is needed. Code cleanups for line length and headers. 2023-06-23 14:17:22 -07:00
David Garske
102cb1114a Merge pull request #6509 from douzzer/20230613-wc_test_ret_t
20230613-wc_test_ret_t
2023-06-23 11:47:20 -07:00
David Garske
ea68920b8b Merge pull request #6539 from JacobBarthelmeh/caam
fix for keymod with rt1170 blobs
2023-06-23 11:47:04 -07:00
lealem47
06c1dd171a Merge pull request #6466 from dgarske/keilmdk
Fixes and cleanups for Keil MDK examples
2023-06-23 08:41:04 -06:00
JacobBarthelmeh
2d87037e4b fix for keymod with rt1170 blobs 2023-06-23 00:50:25 -07:00
David Garske
a56fe30c2c Fixes and cleanups for Keil MDK examples. Combine duplicate user_settings.h. Use SP math all by default. Disable old/deprecated algorithms. Add CMSIS RTOS timer support for TLS and benchmark. 2023-06-22 16:48:17 -06:00
David Garske
2f44ece4d8 Merge pull request #6511 from JacobBarthelmeh/nightly
fix for nightly toolchain armv7 build warning
2023-06-22 15:25:57 -07:00
Andras Fekete
0ee198437a Get around issue with 'uint8_t' undefined 2023-06-22 11:03:56 -04:00
David Garske
3cb0b4ab29 Merge pull request #6410 from embhorn/zd15856
Update EBSNET port
2023-06-21 21:35:19 -07:00
David Garske
6697181081 Merge pull request #6500 from SparkiDev/tests_api_expect_4
Test api.c: change more tests to use Expect instead of Assert
2023-06-21 17:17:37 -07:00
Sean Parkinson
e467112a93 Test api.c: change more tests to use Expect instead of Assert
Changed EXPECT_DECL to start of as TEST_SKIPPED.
Modified other EXPECT macros appropriately.
Change test functions to not use 'res' when EXPECT_DECL is used.

memory.c:
  wc_MemFailCount_Init(): don't declare variable after a statement

conf.c:
wolfSSL_TXT_DB_read(): free the whole WOLFSSL_TXT_DB on failure
instead of just the memory
wolfSSL_CONF_add_string(): pop the value added into section->value
(sk) if it can't be pushed onto conf->data
  wolfSSL_NCONF_load(): free the new value if it wasn't able to be added

ocsp.c:
  wolfSSL_OCSP_cert_to_id():
free the decoded certificate if parsing failed (is freed after use
otherwise)
free the certificate id on failure and make it NULL and continue
freeing other variables

pk.c:
wolfSSL_RSA_set0_crt_params(): set dmp1, dmq1 and iqmp fields to NULL
if setting the internal failed - returns error and caller needs to free
the passed in BNs
wolfSSL_RSA_set0_factors(): set p and q fields to NULL if setting the
internal failed - returns error and caller needs to free the passed in
BNs
wolfSSL_RSA_set0_key(): set n, e abd d fields to NULL if setting the
internal failed - returns error and caller needs to free the passed in
BNs

x509.c:
wolfSSL_X509_set_serialNumber(): explicit NULL
checkwolfSSL_X509_REQ_add1_attr_by_NID(): check whether push succeeded
and on failure free attribute

asn.c:
ConfirmSignature(): for DSA, allocate separately to ensure no leak on
memory allocation failure.

dh.c:
wc_DhGenerateParams(): ensure tmp and tmp2 are able to be cleared on
error

evp.c:
wolfSSL_EVP_PKEY_CTX_add1_hkdf_info(): fix realloc use to no leak on
failure
  wolfSSL_EVP_CIPHER_CTX_iv_length(): handle ctx being NULL.
2023-06-22 08:21:17 +10:00
Eric Blankenhorn
53fe93430e Update EBSNET port 2023-06-21 15:52:42 -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
David Garske
aaf2408851 Merge pull request #6504 from SparkiDev/bench_embedded_scrypt
test.c, scrypt: bench embedded reduce heap usage
2023-06-21 11:06:26 -07:00
David Garske
0e2c32f726 Merge pull request #6505 from SparkiDev/alt_ecc_cryptocb
ECC, ALT_ECC_SIZE, CryptoCB: ensure err is 0 in _ecc_make_key_ex
2023-06-21 11:05:53 -07:00
David Garske
70c3e84735 Merge pull request #6503 from SparkiDev/mp_test_tfm_mips
TFM: fix big endian reading a zero length buffer
2023-06-21 11:05:40 -07:00
Sean Parkinson
e17f86d145 TFM: fix big endian reading a zero length buffer
Bail early as big endian implementation doesn't handle it.
2023-06-16 10:58:51 +10:00
Sean Parkinson
a1e8aa7269 test.c, scrypt: bench embedded reduce heap usage
Don't do scrypt test cases that allocate 1MB of memory when
BENCH_EMBEDDED is defined.
2023-06-16 10:16:34 +10:00
dell5060
7926ceb120 Updated Key gen to convert the keys located in /certs/statickeys to be used in buffers 2023-06-15 15:33:11 -06:00
Sean Parkinson
7153dd70a6 Math, Encrypted Memory: mod exp fix
The modular exponentiation implementations in sp_int.c and tfm.c are not
safe when using Encrypted Memory.
Cannot have two pieces of memory where one changes and the other doesn't
based on private value.
Use extra variable to hold the two new values and assign them both back
at the same time in a safe manner.

Alternative implementations used when WC_PROTECT_ENCRYPTED_MEM is
defined.
2023-06-16 07:28:47 +10:00
JacobBarthelmeh
8f29111aac fix for nightly toolchain armv7 build warning 2023-06-14 14:13:59 -06:00
Daniel Pouzzner
902d47aaa1 wolfcrypt/test/test.c: fix scoping of hkdf_test();
wolfcrypt/test/test.h: include <wolfssl/wolfcrypt/types.h> to be sure sword32 is available.
2023-06-14 15:06:13 -05:00
Daniel Pouzzner
e843a7bd1e wolfcrypt/test/test.{c,h}: add wc_test_ret_t, and 'L' long int suffixes on relevant numeric literals, to facilitate passing around 32 bit retvals in the WC_TEST_RET_*() system on 16 bit targets. 2023-06-14 12:28:50 -05:00
Daniel Pouzzner
131b7c2bcf wolfcrypt/src/chacha20_poly1305.c: refactor ssize_t uses in wc_XChaCha20Poly1305_crypt_oneshot() as long int, for portability. 2023-06-14 12:28:50 -05:00
Sean Parkinson
0db49ef83a ECC, ALT_ECC_SIZE, CryptoCB: ensure err is 0 in _ecc_make_key_ex
When CryptoCB is used and the key gen operation is not implemented, err
is CRYPTOCB_UNAVAILABLE and needs to be reset to 0.
2023-06-14 10:12:04 +10: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
Daniel Pouzzner
03a6eed037 wolfcrypt/src/{aes.c,blake2b.c,siphash.c}: fix W64LIT() arguments to not have improper 'U' suffix;
wolfssl/wolfcrypt/types.h: add 'U' suffix to W64LIT() macro defs, and add SW64LIT() macro defs (not yet used anywhere);

wolfcrypt/src/asn.c: add !WOLFSSL_ECC_CURVE_STATIC gate around DataToHexStringAlloc() to resolve -Wunused;

wolfcrypt/src/ecc.c: guard against zero-valued "len" arg to wc_ecc_get_curve_id_from_oid();

wolfcrypt/src/wc_port.c: fix several argument implicit sign changes in USE_WINDOWS_API paths;

wolfssl/wolfcrypt/ecc.h: remove const attribute from inline buffers in WOLFSSL_ECC_CURVE_STATIC struct ecc_set_type.
2023-06-12 23:15:08 -05:00
Sean Parkinson
897a865090 Merge pull request #6477 from JacobBarthelmeh/stm32
add sanity check on hash size with STM32 port
2023-06-08 22:21:19 +10:00
JacobBarthelmeh
fb5413cea0 account for null terminator with SEP serail number 2023-06-07 14:59:07 -06:00