Commit Graph

17577 Commits

Author SHA1 Message Date
Daniel Pouzzner
dc231dc099 peer review: add explanatory comment for printf() macro in test.c; rearrange test.h to avoid awkward forward declaration and add some topical grouping. 2022-07-12 18:19:52 -05:00
Daniel Pouzzner
b64949d564 wolfcrypt/benchmark/benchmark.c: fix gating for #include <errno.h>, and add #include <unistd.h> for _exit(). 2022-07-11 23:15:43 -05:00
Daniel Pouzzner
ccc5952369 global fixup to check or explicitly ignore return values from failable library/system calls that weren't already being checked;
add wolfCrypt error codes IO_FAILED_E "Input/output failure" and SYSLIB_FAILED_E "System/library call failed";

tests/api.c and tests/unit.c: flush stdout for error message in Fail() macro, add fflush(stdout) after printf()s, print success message at end of unit_test(), and send several error messages to stderr instead of stdout;

wolfcrypt/test/test.c: add fallthrough macro definition of printf() that pairs it with fflush(stdout);

unit.h: in definition of macro AssertPtr(), add PRAGMA_GCC("GCC diagnostic ignored \"-Wpedantic\"");

sp_int.c: refactor several lingering instances of "if (0) { ... }" code pattern to #if 0 ... #endif.
2022-07-11 22:28:09 -05:00
David Garske
e30899b676 Merge pull request #5334 from LinuxJedi/se050-fixes
Fixes to SE050 port
2022-07-11 16:15:08 -07:00
JacobBarthelmeh
22c3a1fc6f Merge pull request #5346 from dgarske/async_rel_v5.4.0
Async release v5.4.0 patches
2022-07-11 17:11:06 -06:00
David Garske
34c576d2a7 Fixes for possible NULL dereference for heap hint in pk.c Fix typo in api.c test for dynamic type. 2022-07-11 14:41:11 -07:00
David Garske
57aac1c50b Merge pull request #5345 from JacobBarthelmeh/release
Release version 5.4.0
v5.4.0-stable
2022-07-11 11:10:10 -07:00
JacobBarthelmeh
a48129eb99 update README for release 2022-07-11 07:28:15 -07:00
JacobBarthelmeh
032d59b077 adjust sizeof type for getsockopt argument 2022-07-11 07:10:11 -07:00
JacobBarthelmeh
86662bca2f update library version to 5.4.0 2022-07-08 16:04:26 -07:00
JacobBarthelmeh
7379e377ab cast for g++ warning 2022-07-08 15:11:29 -07:00
JacobBarthelmeh
983b9fc5fb Merge pull request #5343 from dgarske/ecc_oid_coding
Fixes for ECC OID encoding/decoding
2022-07-08 15:38:47 -06:00
David Garske
4892435004 Fix for wc_ecc_get_curve_id_from_oid with combinations of HAVE_OID_ENCODING and HAVE_OID_DECODING. Fix in SetCurve for unused outSz with HAVE_OID_ENCODING. 2022-07-08 13:00:09 -07:00
JacobBarthelmeh
66aed8193a Merge pull request #5341 from dgarske/various_20220708
Various fixes and cleanups
2022-07-08 13:56:51 -06:00
David Garske
56325143f1 Merge pull request #5340 from anhu/micrium_alt_ecc_size
Gate ALT_ECC_SIZE on NO_MALLOC and STATIC_MEMORY since they conflict.
2022-07-08 09:53:07 -07:00
David Garske
720030b5a9 Improvements to error handling for AddSessionToClientCache. 2022-07-08 09:06:51 -07:00
David Garske
03a32250da Fix for KCAPI HMAC forcing use of software for HKDF. 2022-07-08 09:06:30 -07:00
David Garske
3d124c093e Fix PK function name in log. Remove the ECC logging (spams benchmark with --enable-debug). 2022-07-08 09:06:08 -07:00
David Garske
905f71d80d Fix with macro redefinition error if building with NO_WOLFSSL_ALLOC_ALIGN. 2022-07-08 09:05:29 -07:00
JacobBarthelmeh
f7595cc77d Merge pull request #5338 from julek-wolfssl/tcp-sendto
sendto can't specify addr on a TCP socket
2022-07-08 09:39:39 -06:00
Anthony Hu
2d6b6d62b2 Gate ALT_ECC_SIZE on NO_MALLOC and STATIC_MEMORY since they conflict. 2022-07-08 10:52:01 -04:00
David Garske
a2b75e313a Merge pull request #5339 from douzzer/20220708-DUW_TEST-bugprone-macro-parentheses
tests/api.c: fix bugprone-macro-parentheses in DUW_TEST().
2022-07-08 07:46:20 -07:00
Daniel Pouzzner
48d3cf593e tests/api.c: fix bugprone-macro-parentheses in DUW_TEST(). 2022-07-08 07:57:29 -05:00
Juliusz Sosinowicz
251642a44a sendto can't specify addr on a TCP socket
From the man page
       If  sendto()  is used on a connection-mode (SOCK_STREAM, SOCK_SEQPACKET) socket, the arguments dest_addr and
       addrlen are ignored (and the error EISCONN may be returned when they are not NULL  and  0),  and  the  error
       ENOTCONN  is  returned  when the socket was not actually connected.
2022-07-08 12:14:23 +02:00
David Garske
58cb91602d Merge pull request #5337 from douzzer/20220707-DtlsUpdateWindowGTSeq-overshift
20220707-DtlsUpdateWindowGTSeq-overshift
2022-07-07 21:53:26 -07:00
David Garske
c9e9a421e9 Merge pull request #5336 from SparkiDev/aes_ctr_opt
AES-CTR: improve performance when multiple blocks
2022-07-07 21:51:08 -07:00
Daniel Pouzzner
91438c1087 wolfssl/wolfcrypt/settings.h: refactor Math Library Selection for clarity, and to include WOLFSSL_SP_MATH as an available math back end. 2022-07-07 21:02:16 -05:00
David Garske
49d292ec4f Merge pull request #5335 from SparkiDev/ecc_imp_exp_fix
ECC import and export fixes
2022-07-07 17:52:20 -07:00
Daniel Pouzzner
b952c2f777 src/internal.c: add codepath in _DtlsUpdateWindowGTSeq() to avoid a word32 overshift. 2022-07-07 19:36:20 -05:00
Sean Parkinson
2bfac42d65 AES-CTR: improve performance when multiple blocks
When in and out aren't the same pointer, for multiples of block size
input:
  - generate the counters into the output buffer
  - encrypt output buffer
  - XOR in the input
Faster than encrypting a block at a time.
2022-07-08 09:56:20 +10:00
Sean Parkinson
70b9833e98 ECC import and export fixes
On raw import, don't import ordinates that are larger than the curve
size.
On export of compressed point, don't export ordinate if it is larger
than the curve size.
2022-07-08 08:54:53 +10:00
David Garske
4e1e1e922a Merge pull request #5278 from ejohnstown/dtls-seq
Refactor DTLS Window Update (Fix #5211)
2022-07-07 10:22:21 -07:00
Chris Conlon
5e453ad932 Merge pull request #5323 from SparkiDev/sha512_arm32_asm_align 2022-07-07 09:47:37 -06:00
Juliusz Sosinowicz
e295328436 Fix window handling around word32 boundary 2022-07-07 17:37:10 +02:00
Andrew Hutchings
34d897e433 Fixes to SE050 port
This fixes the following things:

* Memory leaks in SE050 SHA messages
* Add key to SE050 for ECC sign hash function
* Remove circular include
* Correct prototype for `se050_hash_final`
* A few defined check fixes
2022-07-07 16:11:54 +01:00
David Garske
a771baf551 Merge pull request #5332 from SparkiDev/memusage_fix_2
SP math: fix configure.ac to allow its use
2022-07-07 07:40:13 -07:00
David Garske
738d79c5d5 Merge pull request #5330 from SparkiDev/aesni_no_sse4
AESNI: fix configure to use minimal compiler flags
2022-07-06 20:44:40 -07:00
Daniel Pouzzner
2111d6b179 Merge pull request #5322 from SparkiDev/sp_math_all_arm32_div_word_fix
SP math all: fix div word for ARM32
2022-07-06 22:18:07 -05:00
Sean Parkinson
74baa0dafa SP math: fix configure.ac to allow its use
Choosing SP and SP math was resulting in only integer.c being used.
Fixed now.
Reorder realloc calls for memory logging to ensure scripts can match
allocate and free calls.
2022-07-07 12:16:12 +10:00
David Garske
644050a736 Merge pull request #5329 from douzzer/20220706-fips-and-aarch64-fixes
20220706-fips-and-aarch64-fixes
2022-07-06 18:39:38 -07:00
David Garske
cb6fa921a4 Merge pull request #5328 from haydenroche5/cmake_sp_math_all_default
Make changes to CMake to support SP math default.
2022-07-06 18:39:30 -07:00
John Safranek
8f3449ffea Refactor DTLS Window Update (Fix #5211)
1. Rename _DtlsUpdateWindow() as wolfSSL_Dtls_UpdateWindow() and make
   it public so it may be tested.
2. Rename the internal functions DtlsWindowUpdate(), DtlsWindowCheck(),
   and DtlsUpdateWindowGTSeq() as _DtlsWindowUpdate() and
   _DtlsWindowCheck(), and _DtlsUpdateWindowGTSeq().
3. When updating the DTLS sequence window, and the next sequence
   number (lo) wraps to zero, increment the next sequence number (hi)
   by 1.
4. Fix an off-by-one error that wrapped around when saving the
   packet sequence number in the bit-field window.
5. Adding a test for wolfSSL_DtlsUpdateWindow() function. With many test
   cases. It is set up in a table format with running check values.
6. Change location of incrementing the difference when calculating the
   location for setting the bit.
7. Updated the check of the sequence difference in the GT scenario.
8. In the DTLS window update functions remove newDiff and just use diff.
9. Handle the cases where the DTLS window crosses the high order word
   sequence number change.
10. Add a debug option to print out the state of the DTLS sequence number
   window.
2022-07-06 18:20:06 -07:00
David Garske
90c2f4ad00 Merge pull request #5327 from kareem-wolfssl/connectRetFix
Fix storage of SendBuffered's return code in wolfSSL_Connect.
2022-07-06 17:53:04 -07:00
Sean Parkinson
9ba77300f9 AESNI: fix configure to use minimal compiler flags 2022-07-07 09:30:48 +10:00
Sean Parkinson
992c7b3b6f SP math all: fix div word for ARM32
Fixup sp_mulmod NULL access.
2022-07-07 08:56:31 +10:00
Daniel Pouzzner
82b1dc0cd0 wolfcrypt/src/asn.c: move final return in DecodeECC_DSA_Sig() outside the NO_STRICT_ECDSA_LEN gate, to avoid no-return-from-non-void. 2022-07-06 17:39:59 -05:00
Daniel Pouzzner
eff4fe398b src/include.am: fix gating around sha* and BUILD_ARMASM, to avoid empty-translation-unit warnings for sha{256,512}.c on armasm builds. 2022-07-06 17:37:43 -05:00
Daniel Pouzzner
7c49449a79 wolfcrypt/src/port/arm/armv8-sha512.c: gate out Sha512_Family_GetHash() in builds that have 224 and 256 bit hashes gated out, to fix unused function warning. 2022-07-06 17:35:15 -05:00
Daniel Pouzzner
6b6abfac54 examples/client/client.c: remove break after err_sys() to mollify clang-tidy unreachable-break sensor. 2022-07-06 17:32:26 -05:00
Daniel Pouzzner
19106a9510 configure.ac and tests/api.c: lock out compkey on FIPS 140-3 RC12 and ready, and add backward-compat code in test_wc_ecc_export_x963_ex() to allow RC12 compkey builds to pass unit.test. 2022-07-06 17:31:56 -05:00