Commit Graph

7168 Commits

Author SHA1 Message Date
Chris Conlon
9bc3b867e0 Merge pull request #6157 from miyazakh/add_favouriteDrinkNID 2023-03-06 16:45:14 -07:00
David Garske
86e1b0d8ab Merge pull request #6165 from SparkiDev/bn_move
BN compatibility API: move implementation out to separate API
2023-03-06 09:27:24 -08:00
Sean Parkinson
e4c2386b61 BN compatibility API: move implementation out to separate API
BN APIs from ssl.c have been moved out to ssl_bn.c that is included in
ssl.c.
Added defines for BN_rand() and BN_pseudo_rand() to indicate which bits
are to be set.
'internal' field now always maps to the ;mpi' field that is a MP
integer.
SetIndividualInternal/External renamed to wolfssl_bn_get/set_value.
Fixed BN APIs to work as closely to OpenSSL as possible.
Added tests.
Moved wolfssl_make_rng out to ssl.c as BN APIs are using it now.
SP int and TFM now check trials are in a valid range for
mp_prime_is_prime_ex().
2023-03-06 14:32:10 +10:00
Hideki Miyazaki
05b0796361 add favourite drink pilot attibute type to get it from the encoding 2023-03-04 14:20:48 +09: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
David Garske
35b68fb23d Merge pull request #5597 from Tathorack/add-renesas-rx64-rx72-sha-support
Add RX64/RX71 SHA hardware support
2023-03-03 13:14:32 -08:00
Rhys Hansen
4d81a06557 Update comment format and other minor changes 2023-03-03 13:57:44 -06:00
David Garske
4ebc896231 Merge pull request #6095 from SparkiDev/aes_gcm_win_asm
Aes gcm win asm
2023-03-02 15:02:55 -08:00
JacobBarthelmeh
9a54cea78b Fix AES-ECB with SECO 2023-03-02 07:55:05 -07:00
Daniel Pouzzner
51339edf47 wolfcrypt/src/asn.c: fix WOLFSSL_ASYNC_CRYPT codepath in SignCert() -- fall through to non-async certSignCtx_lcl for algs without async support. 2023-03-01 17:51:25 -06:00
Daniel Pouzzner
6a7674a146 wolfcrypt/test/test.c: improve strerror_r() flavor sensing (simpler gate randomly provoked cppcheck-all-async-quic). 2023-03-01 17:50:00 -06:00
David Garske
63b049814b Merge pull request #6136 from SparkiDev/armv7_aes_no_reloc_text
ARMv7a AES asm: don't have relocatable text
2023-03-01 14:36:41 -08:00
David Garske
7d049aa90a Merge pull request #6141 from SparkiDev/cert_name_enc_fix
Cert name encoding fix
2023-02-28 17:36:22 -08:00
Sean Parkinson
3aa1ef5907 ARMv7a AES asm: don't have relocatable text
For FIPS hash, don't have relocatable text in ARMv7's AES assembly code.
2023-03-01 11:32:00 +10:00
David Garske
91d77393b9 Merge pull request #6110 from SparkiDev/sp_small_stack
SP: WOLFSSL_SP_SMALL_STACK
2023-02-28 17:17:58 -08:00
Sean Parkinson
d1b8386d36 Cert name encoding fix
Only include extra name entries once when encoding.
Fix certDefaultName to not have \0 on strings of extra names.
2023-03-01 10:01:54 +10:00
Sean Parkinson
2a33f24dc9 RSA padding - no pad length check fix
Perform correct length check of input bytes based on bits in key in
wc_RsaPad_ex when no padding to be done.
2023-03-01 09:42:39 +10: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
47aad3fedb Merge pull request #6138 from dgarske/pkcs7_async
Fix for PKCS7 with asynchronous crypto enabled
2023-02-28 17:24:56 -06:00
David Garske
2420d5d3b6 Merge pull request #6144 from kareem-wolfssl/zd15741Gh6142
Fix for PIC32 crypto HW and unused `TLSX_SetResponse`
2023-02-28 15:10:37 -08:00
Kareem
08a3e2cb6e Avoid building TLSX_SetResponse unless it is being used. Initialize PIC32 UPDPTR register in all cases. 2023-02-28 14:37:45 -07:00
David Garske
58236632ca Fix for PKCS7 with asynchronous crypto enabled. The addition of the devId field will attempt to leverage crypto callbacks and async hardware, so convert WC_PENDING_E to blocking. 2023-02-28 13:22:39 -08: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
Sean Parkinson
397537e691 AES-GCM: MSVC use generated assembly instead of inline
AES-GCM for MSVC was using inline assembly.
Add MSVC version of AES-GCM assembly and use it instead.
Removed inline assembly.
2023-02-28 14:56:29 +10:00
Sean Parkinson
c7b4bb1b27 Merge pull request #6128 from tim-weller-wolfssl/zd15454-benchmark-windows-update
Update wolfCrypt benchmark windows build files to support x64 Platform
2023-02-28 08:28:20 +10:00
David Garske
950e0d100a Merge pull request #6133 from philljj/zd15662
Fix malloc of zero size in fast_s_mp_sqr and fast_s_mp_mul_digs.
2023-02-27 10:47:29 -08:00
David Garske
12ccd01127 Merge pull request #6131 from anhu/STM32_kyber
Changes that make kyber work on STM32
2023-02-27 08:14:02 -08:00
Anthony Hu
49ae7d4845 Make old compilers happy. 2023-02-24 17:13:47 -05:00
Tim Weller
fd3d8c407d Update wolfCrypt benchmark Windows / Visual Studio build files to include x64 Configuration/Platform combinations (e.g. Debug-x64) and fixed compilation errors in benchmark.c related to conditional-compilation. 2023-02-24 11:53:01 -06:00
jordan
22b1857bee Fix malloc of zero size in fast_s_mp_sqr and fast_s_mp_mul_digs. 2023-02-24 10:18:36 -06:00
Anthony Hu
1fcff5b30d Changes that make kyber work on STM32
(wolfcrypttest and benchmark)
2023-02-24 04:08:07 -05:00
JacobBarthelmeh
121ee7a6df fix spelling, refactor openssl extra struct, remove magic number, use static mutex 2023-02-22 14:31:16 -08:00
JacobBarthelmeh
b801a96f8c Port to RT1170 and expand CAAM driver 2023-02-22 08:26:25 -08:00
Rhys Hansen
fa41754b83 RX64/RX71 SHA hardware support updates
Made the following updates based on review feedback
Fixed mixed variable declaration and simplified cases by typedefing
wolfssl_RX64_HW_Hash to wc_Sha, wc_Sha224, & wc_Sha256
Added files to include.am so they are built when using make
Add WOLFSSL_RENESAS_RX64_HASH to settings.h and set WOLFSSL_NO_HASH_RAW
in settings.h based on value of WOLFSSL_RENESAS_RX64_HASH
Add and handle return value for rx64_hw_Open
Fix some minor formatting and comments
2023-02-21 15:46:25 -06:00
Rhys Hansen
e47633ad83 Add RX64/RX71 SHA hardware support
Adding support for SHA1, SHA224, and SHA256 hardware acceleration on
Renesas RX64 and RX71 microcontrollers.
This follows the a similar pattern as the Renesas TSIP support.

Speed comparison for hashing 64KB of data on a RX64M
| Hash Speed | SHA1 | SHA256 |
|:----------:|:----:|:------:|
| Hardware   | 4ms  | 4ms    |
| Software   | 11ms | 89ms   |

Update define for RX64/RX71 SHA hardware support

This will allow for different hardware acceleration modules to be
enabled individually.

Init & Close for the RX64/RX71 SHA subsystem for WolfCrypt

This ensures that the SHA subsystem is ready for use when WolfCrypt
needs access to it.

Shorten the max line length, clean up comments

This wraps code and comments at 80 characters and adds some  comments
2023-02-21 15:46:17 -06:00
David Garske
fc6d693dae Update logging enter, exit, msg to match function names. Fix some typos and improper use of "enter". Fix internal uses of SSL_SUCCESS and SSL_FAILURE. Add WOLFSSL_DEBUG_NONBLOCK option to allow printing iterations without debug enabled. 2023-02-21 12:02:15 -08:00
JacobBarthelmeh
da04e0fb4c Merge pull request #6115 from SKlimaRA/SKlimaRA/fix-decompress-dynamic
fixed heap corruption
2023-02-21 11:58:11 -07:00
Anthony Hu
a6114afb84 Merge pull request #6114 from dgarske/stm32_hash
Fix for STM32 hashing hardware
2023-02-21 18:37:03 +00:00
gojimmypi
821120e31c Add SHA512/224 and SHA512/256 benchmarks (#6113) 2023-02-21 09:27:03 -08:00
Stanislav Klima
208056b2da fixed heaap corruptions 2023-02-21 11:01:50 +01:00
Daniel Pouzzner
e0abb0e306 Merge pull request #6097 from gojimmypi/New_SHA512_Tests
Add new SHA-512/224 and SHA-512/256 tests
2023-02-21 01:39:38 -06:00
gojimmypi
136267d29c Add new SHA-512/224 and SHA-512/256 tests 2023-02-20 16:55:38 -08:00
David Garske
39e72630ce Proper fix for STM32 hashing. FIFO is always 32 bytes. The original U5/H7 proper fix is to make sure the hash is "done" before saving state. 2023-02-20 15:14:44 -08:00
Sean Parkinson
9a7cd7367a SP: fix point_add_qz1
Better detection of when add won't work and double needed.
Minor reorg of point operations.
2023-02-20 21:53:52 +10:00
Chris Conlon
588b694c7d Merge pull request #5709 from TakayukiMatsuo/ccv 2023-02-17 17:02:04 -07:00
David Garske
c476dd6e28 Merge pull request #6103 from SparkiDev/sp_ecdsa_sig_r0
SP ECC sign: reject random k when r is 0
2023-02-17 13:58:53 -08:00
Sean Parkinson
26b7052b3f SP ECC sign: reject random k when r is 0
SP ECC signing code was generating signatures with r of 0.
This is not allowed by the algorithm description.
Retry sig gen when r is 0 like when s is 0.
2023-02-17 08:55:59 +10:00
tim-weller-wolfssl
dea123f88e Minimal changes to avoid Out-of-Bounds write in ASN.1 parsing logic. Add unit tests for ParseCert() API passing badly formed ASN data (should error out gracefully). 2023-02-16 07:49:08 -06:00
Sean Parkinson
195ca1a20a AES GCM benchmark: separate aes-gcm streaming runs
Always to AES-GCM one-shot benchmark.
When WOLFSSL_AESGCM_STREAM, always perform AES-GCM streaming benchmark.
2023-02-16 09:37:00 +10:00
Daniel Pouzzner
a945017a88 wolfcrypt/test/test.c: around ecc_ctx_kdf_salt_test(): fix fips gating, fix length handling for "message", fix memory leaks;
in crypto_ecc_verify(), crypto_ecc_sign(), ecc_test_nonblock_dhe(), and ecc_test_nonblock_ecdsa(), add codepoint-specific retvals.
2023-02-13 14:21:50 -06:00