Commit Graph

18268 Commits

Author SHA1 Message Date
David Garske
09f4a94b24 Fixes for small stack in TLS v1.3, HKDF and SHA2. Add new WC_ASN_HASH_SHA256 build option to allow forcing SHA2-256 for the internal certificate calculations. Fixes for integer.c with small stack (allocate only the size needed, not the max). 2022-10-03 12:52:11 -07:00
David Garske
f9506dc05a Add small stack to DoClientHello Suites (360 bytes). Add small stack for DRBG health test. Refactor of the small stack into its own header, to allow easier use in other files. Minor build fixes. 2022-09-30 14:06:31 -07:00
David Garske
6506c45918 Merge pull request #5654 from douzzer/20220930-fixes-smallstack-shellcheck-etc
20220930-fixes-smallstack-shellcheck-etc
2022-09-30 12:13:00 -07:00
Daniel Pouzzner
acb35029a0 wolfssl/ssl.h: remove redundant prototype for wolfSSL_CTX_set_default_verify_paths(). 2022-09-30 12:06:31 -05:00
Daniel Pouzzner
548d432df3 wolfcrypt/test/test.c: fix gating, and smallstack refactors, for ecc_test_deterministic_k(), ecc384_test_deterministic_k(), and ecc521_test_deterministic_k(). 2022-09-30 12:06:15 -05:00
Daniel Pouzzner
ddad526e64 wolfcrypt/benchmark/benchmark.c: fix clang-tidy complaints around ungrouped string continuation and unparenthesized macro args. 2022-09-30 12:05:57 -05:00
Daniel Pouzzner
e9520fe131 shellcheck-guided fixes in IDE/XilinxSDK/bench.sh, IDE/XilinxSDK/combine.sh, IDE/XilinxSDK/graph.sh, and scripts/bench/bench_functions.sh. 2022-09-30 12:05:40 -05:00
Hayden Roche
5070994ae2 Merge pull request #5644 from tim-weller-wolfssl/crossworks-test-update 2022-09-30 08:00:01 -07:00
David Garske
bba3193f9c Merge pull request #5595 from haydenroche5/async_ticket_dec_fix
Handle WC_PENDING_E from ticketEncCb in DoClientTicket properly.
2022-09-29 14:41:35 -07:00
Hayden Roche
591d1ada94 Merge pull request #5615 from JacobBarthelmeh/RSAPSS 2022-09-29 14:39:05 -07:00
David Garske
5524500e85 Merge pull request #5166 from sjaeckel/versal-bringup
Versal bringup
2022-09-29 13:27:13 -07:00
David Garske
26f01168b5 Merge pull request #5645 from rizlik/fix_bad_heap_hint
fix: tls13: fix wrong heap hint argument of XFREE
2022-09-29 13:06:31 -07:00
David Garske
ab44c89ab4 Merge pull request #5626 from haydenroche5/load_system_root_certs
Add a function to load system CA certs into a WOLFSSL_CTX.
2022-09-29 11:03:26 -07:00
David Garske
a5a9ab96e6 Merge pull request #5524 from rizlik/protocol_version_alerts
Dtls13: improvements
2022-09-29 10:59:06 -07:00
David Garske
d0bf083050 Merge pull request #5643 from SparkiDev/gen_arm32_fixup
ARM32 assembly code: fixed scripts
2022-09-29 10:20:06 -07:00
Jacob Barthelmeh
e971bd7315 add FreeRTOS example to include.am 2022-09-29 09:57:23 -06:00
Marco Oliverio
32eca32c97 fix: tls13: fix wrong heap hint argument of XFREE 2022-09-29 17:56:59 +02:00
Steffen Jaeckel
0e57e9858f Integrate Xilinx Versal
* add Versal specific glue
   The same structure of an "XSecure client" is used throughout the API's,
   therefor define it once and re-use in all clients.
* integrate Versal AES-GCM engine
* integrate Versal SHA3-384 engine
* add versal support to tests
  - There's no intermediate-hash API for Versal.
* add specific test with large AAD
   Test only with `n*16 byte` wide chunks of AAD, so it gets processed in the
   hardware engine.
* add specific test with misaligned AES-GCM arguments
* integrate Versal RSA engine
* disable failing RSA test-case when Xilinx Crypto is enabled
* introduce define `WOLFSSL_XILINX_CRYPT_VERSAL`
* integrate Versal TRNG engine
* allow using Versal TRNG w/o wolfcrypt DRBG
   Versal TRNG already provides a HRNG mode which does the same as the
   wolfcrypt DRBG implementation.
* add support for user-supplied nonce to Versal TRNG
* add `wc_XsecureErrorToString()` to map PLM error codes to messages.
* integrate Versal EcDSA engine
* update tests to work with Versal EcDSA
   If deterministic K is enabled, the tests failed here since the Versal
   EcDSA engine doesn't support the SECP256R1 curve yet.
* Xilinx crypto engines like aligned memory very much
   Make this a default choice, not via the user configuration.
* add Xilinx-specific `WOLFSSL_MSG()` equivalent
   `WOLFSSL_XIL_MSG()` does the same as `WOLFSSL_MSG()` besides waiting for
   1 second before printing to stdout, since the PLM maybe prints to same and
   outputs would be mixed up.
   This waiting can be disabled by defining `WOLFSSL_XIL_MSG_NO_SLEEP`.
* add option to enable DPA CounterMeasures in AES-GCM crypto engine
* add "command mode" to Xilinx bare-metal example
* update Xilinx default user settings
* add script to execute benchmarks
* add scripts to create graphics
* add Vitis 2022.1 example projects

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2022-09-29 09:39:57 -06:00
Steffen Jaeckel
f24cf38f01 Update benchmarks
* add option to run benchmarks with and w/o AAD
   This adds the possibility to benchmark AES-GCM and AES-CCM both with and
   w/o AAD, with the option to also run both.
   The default behavior when wolfSSL provides the `main()` function is
   unchanged.
   The default behavior when wolfSSL doesn't provide the `main()` function has
   been changed to "run both benchmarks - with and w/o ADD".
* add option to run benchmarks against 4096bit RSA&DH keys
* remove `BENCH_SIZE` macro from benchmark.c
* pre-define benchmark sizes in a single place, before it had to be done in two places
* improve `benchmark_static_init()`
   - static variable doesn't need to be in global scope
   - add option to force re-init
   - add more static variables to be reset
* add `-blocks` option to benchmarks
* expose benchmark `main()` as `wolfcrypt_benchmark_main()`
* fix benchmark `-?` output
* use correct SI/Binary prefix in benchmarks
* use a separate column per detail in CSV output of benchmark
* add `-aad_size` option to benchmark
* don't always print symmetric CSV headers
* always use M[i]B/s when output format is CSV
* Versal specific patches for benchmarks
   This also removes the default define for `COUNTS_PER_SECOND` for Xilinx
   targets, since I prefer to have a build failure over wrongly calculated
   output.

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2022-09-29 09:39:57 -06:00
Steffen Jaeckel
f4e258d196 Generic changes
* fix compilation warning
* adjust SHA3-384 test error-codes
   The way the codes were constructed before, they were not unique.
* unify code
   Instead of having `ifdef`'s in the code, define our own wrapper around
   the keysource as required.
* add CMake option for help-text in wolfCrypt tests
* expose test `main()` as `wolfcrypt_test_main()`
* Don't overwrite previously set errors
* add FreeRTOS support for Xilinx demo
* move `fp_reverse` from `tfm.c` to `wolfmath.c` and rename to
  `mp_reverse`.

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2022-09-29 09:39:57 -06:00
tim-weller-wolfssl
14b776c9a4 Adding C library support furnction to write a buffer (always to UART) 2022-09-29 10:34:16 -05:00
Sean Parkinson
5a55ec6968 ARM32 assembly code: fixed scripts
Generation scripts fixed for ARM32.
Regenerated output inlcudes:
  - support for ARM32 architectures less than 7
  - SP code also ensures parameters are in specific registers
2022-09-29 09:04:05 +10:00
Sean Parkinson
754d274d8c Merge pull request #5593 from rizlik/ticket_nonce_size
tls13: support ticketNonce with size bigger than MAX_TICKET_NONCE_SZ
2022-09-29 08:11:22 +10:00
Sean Parkinson
cec6341e23 Merge pull request #5640 from kaleb-himes/ARMv8-FIPSv2-MOD-TEST
Do not perform IV Wrap test when using cert3389 inlined armasm
2022-09-29 08:01:54 +10:00
Marco Oliverio
ae4228f928 tests: add WOLFSSL_TICKE_NONCE_MALLOC tests 2022-09-28 19:54:14 +02:00
Marco Oliverio
c508ff3da9 internal.h: allow customization of MAX_TICKET_NONCE_STATIC_SZ 2022-09-28 19:54:14 +02:00
Marco Oliverio
56d6087749 tls13: support ticketNonce bigger than MAX_TICKET_NONCE_SZ
to enable it, use WOLFSSL_TICKET_NONCE_MALLOC define
2022-09-28 19:54:14 +02:00
Marco Oliverio
aa5d074d23 dtls13: abide g++ compiler errors
```
src/tls13.c:5330:72: error: invalid conversion from 'void*' to 'const byte*' {aka 'const unsigned char*'} [-fpermissive]
 5330 |             ret = wc_HmacUpdate(&cookieHmac, ssl->buffers.dtlsCtx.peer.sa,
      |                                              ~~~~~~~~~~~~~~~~~~~~~~~~~~^~
      |                                                                        |
      |                                                                        void*
./wolfssl/wolfcrypt/hmac.h:191:55: note:   initializing argument 2 of 'int wc_HmacUpdate(Hmac*, const byte*, word32)'
  191 | WOLFSSL_API int wc_HmacUpdate(Hmac* hmac, const byte* in, word32 sz);
```
2022-09-28 18:42:39 +02:00
Juliusz Sosinowicz
d8e10d8ef4 DTLS 1.3: Always reset state on HRR 2022-09-28 18:42:39 +02:00
Juliusz Sosinowicz
c72d315325 DTLS 1.3: Don't add HRR to ssl->dtls13Rtx
Signed-off-by: Marco Oliverio <marco@wolfssl.com>
2022-09-28 18:42:38 +02:00
Juliusz Sosinowicz
145086f776 DTLS 1.3: Clear ssl->dtls13SendingAckOrRtx in ssl.c 2022-09-28 18:42:38 +02:00
Marco Oliverio
3c60926bfa tests: silently dropping bad records after handshake in DTLS 2022-09-28 18:42:38 +02:00
Marco Oliverio
6e4a3ecdbd tests: add negative version negotation tests 2022-09-28 18:42:38 +02:00
Marco Oliverio
b3ecdd2ecb dtls13: support stateless cookie exchange on blocking socket 2022-09-28 18:42:38 +02:00
Marco Oliverio
0b525a52c4 tls13: send protocol_version alert on failed version negotiation 2022-09-28 18:42:38 +02:00
Marco Oliverio
88ec118e89 dtls13: drop unencrypted messages after epoch 1 2022-09-28 18:42:38 +02:00
Marco Oliverio
400671dc7c dtls: drop non-handshake messages before cookie exchange 2022-09-28 18:42:38 +02:00
Hayden Roche
8cae05348c Add a function to load system CA certs into a WOLFSSL_CTX.
This new function, wolfSSL_CTX_load_system_CA_certs, currently only supports
Linux-based OS's. It searches through conventional CA directories and once it
finds one, attempts to load CA certs from it. After the first directory is
found, we don't check the others.

This commit also adds a function wolfSSL_get_system_CA_dirs, which returns a
pointer to an array of directories where wolfSSL_CTX_load_system_CA_certs will
look for CA certs. This is used in a unit test, where we only want to expect
success if one of these directories actually exists on the test system.

Finally, this commit adds support for SSL_CTX_set_default_verify_paths to the
compatibility layer. It doesn't model the exact behavior of its OpenSSL
counterpart; it's mostly a wrapper around wolfSSL_CTX_load_system_CA_certs,
manipulating the return value of that function to conform to OpenSSL's
conventions.
2022-09-28 08:50:46 -07:00
David Garske
2d1f22c35a Merge pull request #5639 from Anthony-Tatowicz/master
Add Irq install for Aruix example
2022-09-28 06:55:56 -04:00
kaleb-himes
d61656d5e7 Do not perform IV Wrap test when using cert3389 inlined armasm 2022-09-27 17:15:19 -06:00
Hayden Roche
f1e2165c59 Merge pull request #5638 from JacobBarthelmeh/release v5.5.1-stable 2022-09-27 14:21:19 -07:00
Jacob Barthelmeh
eb5076bb89 update changelog for release 5.5.1 2022-09-27 13:40:00 -06:00
JacobBarthelmeh
ffe052e845 Merge pull request #5634 from douzzer/20220926-fixes
20220926-fixes
2022-09-27 11:49:20 -06:00
Anthony Tatowicz
13d53b5297 Add Irq install for Aruix example 2022-09-27 12:04:27 -05:00
JacobBarthelmeh
dde5ef558b Merge pull request #5633 from SparkiDev/sp_mod_fix
SP int all: sp_mod
2022-09-27 10:23:03 -06:00
Daniel Pouzzner
cc03e3fdab wolfcrypt/src/misc.c ByteReverseWords(): mollify MSVC re C4311. 2022-09-27 10:05:07 -05:00
Daniel Pouzzner
cfe0278d35 wolfcrypt/src/misc.c ByteReverseWords(): fix misaligned word accesses under armv7a-asm. 2022-09-27 02:02:31 -05:00
Daniel Pouzzner
1ffe4275ae fix whitespace 2022-09-26 23:32:59 -05:00
Sean Parkinson
34fd412fd6 SP int all: sp_mod
sp_mod wasn't checking return of sp_init_size.
Add _sp_init_size change and change calls.
2022-09-27 10:05:13 +10:00
Sean Parkinson
8617de86c1 Merge pull request #5632 from JacobBarthelmeh/Testing
Misc. testing items
2022-09-27 08:25:18 +10:00