17448 Commits

Author SHA1 Message Date
Sean Parkinson
4fc709d2af
Merge pull request #5256 from dgarske/cert_chain_der
Fixes for loading a DER/ASN.1 certificate chain
2022-06-17 11:55:49 +10:00
David Garske
6795e1bf21 Attempt to fix issue with duplicate prototype wc_RsaKeyToPublicDer with FIPS v2 selftest. 2022-06-16 16:51:51 -07:00
David Garske
e34dda9383 Fix to expose the RSA public DER export function with certgen. The core function SetRsaPublicKey was being compiled, but the wrappers wc_RsaKeyToPublicDer and wc_RsaKeyToPublicDer_ex were not included. 2022-06-16 16:36:17 -07:00
David Garske
128ebf54e9 Fix for loading certificate DER chain longer than 2 deep. Fix to properly trap BUFFER_E in ProcessUserChain. ZD14048. 2022-06-16 16:19:37 -07:00
Hideki Miyazaki
fe8169c830
Add multi thread use case for RA6M4
fix devId conflict while using multi threads

update README

Fix TSIP examples bcause of updating user context
2022-06-17 07:44:12 +09:00
Sean Parkinson
2834c22ce0
Merge pull request #5204 from lealem47/basicConst
Encoding the X509 Basic Constraint when CA:FALSE
2022-06-17 08:33:57 +10:00
David Garske
f2abf1892c
Merge pull request #5255 from lealem47/i2d_RSA
Call RSA_To_Der instead of RSA_To_Der_ex in i2dd_RSA key funcs
2022-06-16 14:43:58 -07:00
David Garske
1322c1a0b2
Merge pull request #5248 from lealem47/no_aes
Fix build failure caused by missing NO_AES macro guard
2022-06-16 13:18:09 -07:00
Lealem Amedie
911f361285 Call RSA_To_Der instead of RSA_To_Der_ex in i2d_RSA key funcs 2022-06-16 12:26:47 -07:00
David Garske
8c0157c035
Merge pull request #5253 from rizlik/clang_uninit
kdf: fix clang uninitialized.Assign
2022-06-16 11:06:43 -07:00
John Safranek
8f7db87f01
Merge pull request #5249 from dgarske/rsa_ifc
Cleanup the RSA consistency check
2022-06-16 09:14:08 -07:00
Lealem Amedie
5e63740c6c Ensuring that X509 Basic Constraint is set when CA:FALSE 2022-06-16 08:46:52 -07:00
David Garske
7560199f18
Merge pull request #5254 from rizlik/nigthly_fixes
dtls: abide deadstore static analyzer warnings
2022-06-16 07:42:38 -07:00
David Garske
8f0da12824
Merge pull request #5252 from SparkiDev/mod_zero
TFM: mp_exptmod_ex didn't handle exceptional cases
2022-06-16 07:42:17 -07:00
Marco Oliverio
6a0c6049ce dtls: abide deadstore static analyzer warnings 2022-06-16 14:02:09 +02:00
Marco Oliverio
621f4f14af kdf: fix clang uninitialized.Assign
commit f1ce0cc95d22569640bc522354025fbc16c88e43 tigger static analyzer warnings
about unitialized assign.
2022-06-16 13:55:46 +02:00
David Garske
6d2a41b9fd Enable wolfSSL SP Math all (sp_int.c) by default. If --enable-fastmath or USE_FAST_MATH is set the older tfm.c fast math will be used. To use the old integer.c heap math use --enable-heapmath or USE_INTEGER_HEAP_MATH. 2022-06-16 10:57:30 +10:00
Sean Parkinson
8145ee6cef TFM: mp_exptmod_ex didn't handle exceptional cases
fp_exptmod_ex() changed to match execptional case handling in
fp_exptmod().
2022-06-16 10:47:00 +10:00
Sean Parkinson
1b29f7353a Check memory is zeroized
Add a define WOLFSSL_CHECK_MEM_ZERO to turn on code that checks that
memory that must be zeroized before going out of use is zero.
Everytime sensitive data is put into a allocated buffer or stack buffer;
the address, its length and a name is stored to be checked later.
Where the stack buffer is about to go out of use, a call is added to
check that the required parts are zero.

wc_MemZero_Add() adds an address with length and name to a table of
addressed to be checked later.
wc_MemZero_Check() checks that the memory associated with the address is
zeroized where required.
mp_memzero_add() adds mp_int's data pointer with length and name to
table.
mp_memzero_check() checks that the data pointer is zeroized where
required.

Freeing memory will check the address. The length was prepended on
allocation.
Realloction was changed for WOLFSSL_CHECK_MEM_ZERO to perform an
allocate, check, copy, free.
2022-06-16 10:22:32 +10:00
Takashi Kojo
8f68e32ef1 initial tranlation of API headers in JA 2022-06-16 08:24:18 +09:00
David Garske
7e1549c684 Cleanup the RSA consistency check. Should only be enabled for FIPS v2 (3389), FIPS v5 or later. Can be forcefully enabled for non-FIPS using WOLFSSL_RSA_KEY_CHECK. The existing WOLFSSL_NO_RSA_KEY_CHECK macro will also disable it. This change was introduced in PR #4359. 2022-06-15 14:46:23 -07:00
David Garske
fb704774a0
Merge pull request #4907 from rizlik/dtls13
DTLSv1.3 support
2022-06-15 13:57:02 -07:00
Lealem Amedie
9bcbd645d6 Fix build failure caused by missing NO_AES macro guard 2022-06-15 13:30:56 -07:00
David Garske
dab0d5a7b0
Merge pull request #5240 from SparkiDev/sp_armv6
SP ARM32: support for arch with no ldrd/strd and clz
2022-06-15 11:28:30 -07:00
David Garske
d9d8b7e2d8
Merge pull request #5245 from SparkiDev/force_zero
Memory zeroization fixes
2022-06-15 11:16:04 -07:00
David Garske
aa8df1af78 Fixes for building without DTLS v1.2 and TLS v1.2. Fixes for explicit cast warnings. 2022-06-15 10:49:18 -07:00
Marco Oliverio
3a9176bcc9 scripts: test for dtls13 retransmission
Co-authored-by: Juliusz Sosinowicz <juliusz@wolfssl.com>
2022-06-15 10:46:43 -07:00
Marco Oliverio
25cf98a417 test: add DTLSv1.3 test suites 2022-06-15 10:46:43 -07:00
Marco Oliverio
12a3efeca8 client/server: tolerate WANT_WRITE errors 2022-06-15 10:46:43 -07:00
Marco Oliverio
4e112419f5 examples: client/server: support DTLSv1.3 (-u -v4)
This commits add some new options to examples/[server,client] to support testing
of DTLS v1.3.

client: add waitTicket option

If this option is used, the client will wait until it receives a sessionTicket
from the server. This is useful when testing DTLS retransmission.

client: add waitKeyUpdate option

When this option is set, the client waits until the UpdateKey message is
acknowledged by the server. This is useful to test DTLS retransmission logic
2022-06-15 10:46:43 -07:00
Marco Oliverio
c1dc90d9b0 server: request cert only once if doing post-handshake auth 2022-06-15 10:46:43 -07:00
Marco Oliverio
ca05ad2dc0 dtls13: introduce wolfSSL_dtls_13_has_pending_msg() API 2022-06-15 10:46:43 -07:00
Marco Oliverio
e2abdf23a7 internal: return from wolfSSL_Peek() with sz 0 if we don't have data
This way we can use wolfSSL_Peek() invoked with sz == 0 to process pending
records and, if none of this records is an application data record, we will not
block.
2022-06-15 10:46:43 -07:00
Marco Oliverio
dfc9873c0f dtls13: support KeyUpdate messages 2022-06-15 10:46:43 -07:00
Marco Oliverio
d1924928c0 dtls13: support retransmission
Introduce ACK and retransmission logic, encapsulated in a Dtls13RtxFsm
object. The retransmission or the sending of an ACK is scheduled by setting the
appropriate flag inside the Dtls13RtxFSM object but the actual writing on the
socket is deferred and done in wolfSSL_Accept/Connect.

* Retransmission

Each sent message is encapsulated in a Dtl13RtxRecord and saved on a list. If we
receive an ACK for at record, we remove it from the list so it will be not
retransmitted further, then we will retransmit the remaining
ones. Retransmission is throttled: beside link congestion, this also avoid too
many sequence numbers bounded with a record.

* ACK

For each received record we save the record sequence number, so we can send an
ACK if needed. We send an ACK either if explicitly needed by the flight or if we
detect a disruption.

Co-authored-by: Juliusz Sosinowicz <juliusz@wolfssl.com>
2022-06-15 10:46:43 -07:00
Marco Oliverio
d079662765 dtls13: support fragmentation, sending and receiving
This commit implements the core of the header parsing, building, and the sending
and receiving routines that handle fragmentation and defragmentation.

* In DTLSv1.3 the header used for protected messages is a variable-length header,
and it is described RFC9147 Section 4.

* Fragmentation happens after building the full message, if necessary. If the
underlying I/O can't send a fragment because of a WANT_WRITE error, the sending
of fragments will continue in the next invocation of
wolfSSL_connect/wolfSSL_accept/wolfSSL_write. In this case the message is saved
in a buffer inside the WolfSSL object.

* Defragmentation works like DTLSv1.2 defragmentation, and re-use
most of the same code.

* The Dtls13AddHeaders() function does not add the record layer header, but it
lefts space for it. It is eventually placed by BuildTls13Message() to allow
easier management of sequence numbers.
2022-06-15 10:46:43 -07:00
Marco Oliverio
173077b142 dtls: refactor DtlsUpdateWindow() window
split the DtlsUpdateWindow() function, so part of the code can be reused by
DTLSv1.3 code.
2022-06-15 10:46:43 -07:00
Marco Oliverio
30fb664163 internal.c: add runProcessingOneRecord section
DTLSv1.3 needs to do some operation per-record, this commit adds an appropriate
section to ProcessReplyEx.
2022-06-15 10:46:43 -07:00
Marco Oliverio
2696c3cdd3 dtls13: change encryption keys dynamically based on the epoch
In DTLSv1.3, because of retransmission and reordering, we may need to encrypt or
decrypt records with older keys. As an example, if the server finished message
is lost, the server will need to retransmit that message using handshake traffic
keys, even if he already used the traffic0 ones (as, for example, to send
NewSessionTicket just after the finished message).

This commit implements a way to save the key bound to a DTLS epoch and setting
the right key/epoch when needed.
2022-06-15 10:46:43 -07:00
Marco Oliverio
de04973051 dtls13: record number encryption and decryption 2022-06-15 10:46:43 -07:00
Marco Oliverio
60834ba516 dtls13: new methods and version negotiation 2022-06-15 10:46:42 -07:00
Marco Oliverio
9d22e11776 misc.c: introduce w64wrapper to handle 64bit numbers
as word64 is not always available, introduce an abstract type and companion
operations. They use a word64 if available and fallback on word32[2] otherwise.
2022-06-15 10:46:42 -07:00
Marco Oliverio
7586851734 dtls13: export functions
They will be used by DTLSv1.3 code
2022-06-15 10:46:42 -07:00
Marco Oliverio
d8ac35579c dtls13: add autotools, cmake build options and vstudio paths 2022-06-15 10:46:42 -07:00
John Safranek
d51ba35ff9
Merge pull request #5246 from rizlik/dtls_header_fixes
dtls: handshake header parsing fixes
2022-06-15 09:33:41 -07:00
Marco Oliverio
6630a83182 dtls: handshake header parsing fixes 2022-06-15 12:00:26 +02:00
Sean Parkinson
e073500e8e SP ARM32 ASM: Improve performance of P-256 mont mul/sqr 2022-06-15 16:39:13 +10:00
Sean Parkinson
af4fff80db SP ARM32: support for arch with no ldrd/strd and clz
Defined WOLFSSL_SP_ARM_ARCH to be less than 7 to use alternative
instructions.
2022-06-15 12:07:49 +10:00
Sean Parkinson
f1ce0cc95d Memory zeroization fixes
Zeroize secrets in stack buffers and allocated memory.
mp_forcezero to ensure private MP integers are zeroized.
Fix whitespace and add some comments.
2022-06-15 11:26:11 +10:00
Sean Parkinson
9656963f61
Merge pull request #5231 from dgarske/glitch_harden
Added sanity check on TLS encrypt to trap against glitching
2022-06-15 09:48:18 +10:00