Commit e69bcd986aa for nodejs
commit e69bcd986aa2425b2281020572ff66694017fe25
Author: Node.js GitHub Bot <github-bot@iojs.org>
Date: Tue Dec 1 18:57:32 2026 +0000
deps: upgrade openssl sources to openssl-4.1.1
PR-URL: https://github.com/nodejs/node/pull/67949
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Richard Lau <richard.lau@ibm.com>
Reviewed-By: LiviaMedeiros <livia@cirno.name>
diff --git a/deps/openssl/openssl/CHANGES.md b/deps/openssl/openssl/CHANGES.md
index 5e17f0ac670..60f5214e3f3 100644
--- a/deps/openssl/openssl/CHANGES.md
+++ b/deps/openssl/openssl/CHANGES.md
@@ -31,6 +31,362 @@ OpenSSL Releases
OpenSSL 4.1
-----------
+### Changes between 4.1.0 and 4.1.1 [1 Dec 2026]
+
+ * Fixed ECH server name verification bypass after `HelloRetryRequest`.
+
+ Severity: Moderate
+
+ Issue summary: A TLS client using Encrypted Client Hello (ECH) can be made
+ to accept a certificate for a domain chosen by an attacker as valid
+ for the server name the application requested.
+
+ Impact summary: An attacker who can forge DNS responses to a client can
+ impersonate any server the client connects to using ECH. The client
+ then sends its application data to the attacker and accepts the attacker's
+ responses as coming from the requested server.
+
+ Reported by: Anthropic's OSS Scanner (finding ANT-2026-BG6NJO4U),
+ Laurent Gaffie (secorizon.com), Igor Morgensterni and Khaled Suliman (Aisle
+ Research), Sabith Saheb.
+
+ ([CVE-2026-120665])
+
+ *Sabith Saheb*
+
+ * Fixed heap buffer overflow when re-encoding cached ASN.1 items above
+ `INT_MAX`.
+
+ Severity: Moderate
+
+ Issue summary: An application that parses a maliciously crafted DER CRL,
+ certificate or CSR from a buffer larger than 4 GiB may trigger a heap buffer
+ overflow when OpenSSL re-encodes the item's cached encoding.
+
+ Impact summary: An attacker who supplies a crafted CRL, certificate or CSR
+ to an application that parses untrusted DER from a buffer larger than 4 GiB
+ causes a heap out-of-bounds write of attacker-controlled data, crashing
+ the process, resulting in Denial of Service.
+
+ Reported by: Bhabani Sankar Das.
+
+ ([CVE-2026-120667])
+
+ *Nikola Pajkovský and Bhabani Sankar Das*
+
+ * Fixed unbounded memory growth in ECH transcript buffer from repeated
+ `ClientHello`s.
+
+ Severity: Moderate
+
+ Issue summary: A peer that can make an OpenSSL TLS or DTLS server process
+ repeated `ClientHello`s on the same connection, causes the server to append
+ every message to a per-connection buffer without any limit. This happens
+ even if the server does not use ECH (Encrypted Client Hello) support.
+
+ Impact summary: An unauthenticated peer can exhaust a server's memory
+ by sending `ClientHello`s that the server retains, causing Denial of Service.
+ Servers in their default configuration are affected, including TLS-1.2-only
+ servers. The attacker must send as much data as is retained, and the memory
+ is released when the connection is freed.
+
+ Reported-by: Anthropic's OSS Scanner (finding ANT-2026-8IUPV8SB),
+ Areg Gasparyan.
+
+ ([CVE-2026-123780])
+
+ *Matt Caswell*
+
+ * Fixed out-of-bounds read in TLS 1.3 key-share processing with Suite B flag.
+
+ Severity: Low
+
+ Issue summary: A server configured with the Suite B certificate flag through
+ `SSL_CTX_set_cert_flags()` and with TLS 1.3 enabled may read past the end of
+ a fixed group list when it processes a `ClientHello` whose `supported_groups`
+ and `key_share` contain no Suite B group.
+
+ Impact summary: A remote client can send a `ClientHello` that makes
+ the server read past the end of a static array. The values read are never
+ returned to the client, so no memory is disclosed; on builds with sanitizers
+ or hardened allocators the read may crash the process, causing Denial
+ of Service.
+
+ Reported by: Laurent Gaffie (secorizon.com).
+
+ ([CVE-2026-35190])
+ <!-- https://github.com/openssl/openssl/pull/33617 -->
+
+ *Daniel Kubec*
+
+ * Fixed unbounded out-of-order fragment reassembly in QUIC streams.
+
+ Severity: Low
+
+ Issue summary: A QUIC peer that sends many small out-of-order `STREAM`
+ fragments while withholding the first byte of the stream may cause OpenSSL
+ QUIC stack to buffer a large number of reassembly nodes occupying much
+ larger memory than the actual data sent.
+
+ Impact summary: A remote peer can pin large amounts of memory on a server
+ that accepts incoming QUIC streams, potentially exhausting memory and
+ causing Denial of Service.
+
+ A receiver now buffers at most 1024 disjoint ranges of out-of-order
+ data per stream. A peer that exceeds the limit is treated as violating
+ flow control and the connection is closed with `FLOW_CONTROL_ERROR`.
+
+ Reported by: Duc Anh Luu (University of Melbourne) and Jiwoo Kim (Arpe).
+
+ ([CVE-2026-84785])
+ <!-- https://github.com/openssl/openssl/pull/33346 -->
+
+ *Duc Anh Luu*
+
+ * Fixed possible NULL dereference in non-SMTP DANE clients.
+
+ Severity: Low
+
+ Issue summary: A DANE-enabled TLS client may crash by dereferencing a NULL
+ pointer when processing an unusual combination of certificate and TLSA
+ records.
+
+ Impact summary: The impact is limited to a client crash (potential Denial
+ of Service).
+
+ Reported by: Sanjay Rawat and Mohammed Alquraini (HUMAIN).
+
+ ([CVE-2026-84786])
+ <!-- https://github.com/openssl/openssl/pull/33634 -->
+
+ *Viktor Dukhovni*
+
+ * Fixed use of uninitialized stack data in QUIC automated peer detection.
+
+ Severity: Low
+
+ Issue summary: `BIO_dgram_detect_peer_addr()` returns uninitialised stack
+ data as part of an address for non-IPv4 sockets, that is then used in QUIC
+ automatic peer detection code as the destination for outgoing packets.
+
+ Impact summary: Applications using QUIC's automated peer detection mechanism
+ may receive an invalid address, leading to connection loss and disclosure of
+ uninitialized stack data to an attacker observing the outgoing network
+ traffic.
+
+ Reported by: Jaehun Lee.
+
+ ([CVE-2026-88822])
+ <!-- https://github.com/openssl/openssl/pull/33566 -->
+
+ *Neil Horman*
+
+ * Fixed AES-GCM-SIV AAD forgery after a zero-length incremental AAD update.
+
+ Severity: Low
+
+ Issue summary: The AES-GCM-SIV implementation treats a zero-length
+ Additional Authenticated Data (AAD) update as a reset of all the AAD
+ supplied so far, instead of leaving the AAD unchanged. An application that
+ supplies its AAD in several fragments, one of which is empty, therefore
+ produces or verifies messages whose authentication tag does not cover
+ the AAD supplied before the empty fragment.
+
+ Impact summary: Data an application intended to authenticate alongside
+ a message is silently left unauthenticated. An attacker can forge the AAD
+ of such a message.
+
+ Reported by: Jérémy Jean (ANSSI), Bhargava Shastry, and Jonathan Bateman
+ (Rochester Institute of Technology).
+
+ ([CVE-2026-88823])
+ <!-- https://github.com/openssl/openssl/pull/33456 -->
+
+ *Daniel Kubec*
+
+ * Fixed use-after-free on retransmitted QUIC `CRYPTO` frames.
+
+ Severity: Low
+
+ Issue summary: A retransmitted QUIC `CRYPTO` frame can release packet storage
+ while the TLS record layer retains a direct pointer into that storage
+ causing use after free.
+
+ Impact summary: A malicious QUIC server can cause a heap-use-after-free read
+ in the OpenSSL QUIC client. The server can also identify one
+ allocator-adjacent byte through the client's protected Handshake response.
+
+ Reported by: Filipe Casal (Trail of Bits).
+
+ ([CVE-2026-95691])
+ <!-- https://github.com/openssl/openssl/pull/33543 -->
+
+ *Filipe Casal*
+
+ * Fixed out-of-bounds read and incorrect IV length handling in AES-GCM-SIV.
+
+ Severity: Low
+
+ Issue summary: Setting an AES-GCM-SIV IV shorter than the expected nonce
+ length via `EVP_CipherInit_ex()` may trigger a heap out-of-bounds read.
+ Supplying a longer IV is silently truncated instead of rejected.
+
+ Impact summary: An application passing a caller-supplied IV of the wrong
+ length may crash or read beyond its buffer. Because trailing IV bytes are
+ ignored, an attacker who knows one message and tag may forge messages under
+ a different IV.
+
+ Reported by: Billy Brumley (Rochester Institute of Technology).
+
+ ([CVE-2026-95692])
+ <!-- https://github.com/openssl/openssl/pull/33512 -->
+
+ *Billy Bob Brumley*
+
+ * Fixed use-after-free in `PEM_X509_INFO_read_bio_ex()` on stack append failure.
+
+ Severity: Low
+
+ Issue summary: When an application passes a stack to
+ `PEM_X509_INFO_read_bio_ex()` to add entries to, and reading fails, OpenSSL
+ frees every entry in the stack, both the old ones and any new ones, but
+ leaves them in the stack.
+
+ Impact summary: An application that passes an existing stack to
+ `PEM_X509_INFO_read_bio_ex()` and keeps using it after a failed read may use
+ memory that was already freed. This can cause a crash or, in principle,
+ memory corruption. Malformed PEM data can make the read fail, but only
+ applications that pass an existing stack are affected, and OpenSSL itself
+ does not do this.
+
+ Reported by: Filipe Casal (Trail of Bits).
+
+ ([CVE-2026-107493])
+ <!-- https://github.com/openssl/openssl/pull/33662 -->
+
+ *Viktor Dukhovni*
+
+ * Fixed unbounded QUIC `RETIRE_CONNECTION_ID` frame sending queue.
+
+ Severity: Low
+
+ Issue summary: The QUIC stack queues a `RETIRE_CONNECTION_ID` frame also
+ for retransmitted `NEW_CONNECTION_ID` frames. This allows a remote malicious
+ QUIC stack to queue an unlimited number of `RETIRE_CONNECTION_ID` frames.
+
+ Impact summary: A malicious remote QUIC peer can trigger an out-of-memory
+ condition causing a Denial of Service.
+
+ Reported by: moltenbit, Duc Anh Luu (University of Melbourne), and hataehoon.
+
+ ([CVE-2026-107494])
+ <!-- https://github.com/openssl/openssl/pull/33544 -->
+
+ *Alexandr Nedvědický*
+
+ * Fixed infinite loop in `CMS_encrypt()` with an EC group order of 1.
+
+ Severity: Low
+
+ Issue summary: Encrypting a CMS message to an EC certificate whose group
+ order is 1 may cause `CMS_encrypt()` or `CMS_encrypt_ex()` to loop
+ indefinitely.
+
+ Impact summary: An attacker able to supply the recipient certificate to an
+ application performing CMS encryption can cause that application to loop
+ indefinitely, consuming CPU and resulting in Denial of Service.
+
+ Reported by: Yinxi Liu.
+
+ ([CVE-2026-107496])
+ <!-- https://github.com/openssl/openssl/pull/33554 -->
+
+ *Jakub Zelenka*
+
+ * Fixed AES-SIV silently ignoring Additional Authenticated Data supplied
+ after plaintext.
+
+ Severity: Low
+
+ Issue summary: An application that passes additional authenticated data
+ to `EVP_EncryptUpdate()` or `EVP_DecryptUpdate()` after the plaintext
+ when using AES-SIV may have that data excluded from authentication,
+ while the call still reports success.
+
+ Impact summary: Data an application intended to authenticate within a message
+ is silently left unauthenticated. An attacker can forge the AAD in messages
+ sent or received by such an application.
+
+ Reported by: Jonathan Bateman (Rochester Institute of Technology).
+
+ ([CVE-2026-120666])
+ <!-- https://github.com/openssl/openssl/pull/33904 -->
+
+ *Jonathan Bateman*
+
+ * Fixed relative CRL distribution point names rebuilt per CRL in X.509
+ verification.
+
+ Severity: Low
+
+ Issue summary: Verifying a maliciously crafted CMS or PKCS#7 `SignedData`
+ message with CRL checking enabled may consume excessive CPU time, growing
+ with the square of the message size.
+
+ Impact summary: An attacker who can submit a CMS or PKCS#7 `SignedData`
+ message to an application that verifies it with CRL checking enabled can
+ occupy a CPU core for seconds to minutes, causing Denial of Service.
+ Applications that leave CRL checking disabled are not affected.
+
+ Reported by: Alex Gaynor (Anthropic).
+
+ ([CVE-2026-121482])
+ <!-- https://github.com/openssl/openssl/pull/33546 -->
+
+ *Neil Horman*
+
+ * Fixed unbounded memory retention in QUIC server for rejected streams.
+
+ Severity: Low
+
+ Issue summary: A QUIC server that rejects a stream opened by the peer may
+ retain that stream's state for the lifetime of the connection if the peer
+ resets the stream before the rejection is signalled, even though the peer's
+ stream credit is returned.
+
+ Impact summary: A remote client that completes a QUIC handshake can
+ repeatedly open and reset streams, causing server memory to grow without
+ bound until the process runs out of memory and every connection on it is
+ lost. This is a Denial of Service.
+
+ Reported by: Bhabani Sankar Das.
+
+ ([CVE-2026-124709])
+ <!-- https://github.com/openssl/openssl/pull/33718 -->
+
+ *Bhabani Sankar Das*
+
+ * Fixed handling of incoming DTLS 1.3 `KeyUpdate` messages with respect
+ to outstanding messages (such as `KeyUpdate`, `NewSessionTicket`,
+ or `CertificateRequest`), which resolves
+ [#32878, a 4.1.0 known issue](https://github.com/openssl/openssl/issues/32878).
+ <!-- https://github.com/openssl/openssl/pull/32934 -->
+
+ *Ryan Hooper*
+
+ * Fixed handling of a receiving an `ACK` of the first sent flight before receiving
+ the first flight in DTLS 1.3, which resolves
+ [#33242, a 4.1.0 known issue](https://github.com/openssl/openssl/issues/33242).
+ <!-- https://github.com/openssl/openssl/pull/33267 -->
+
+ *Ryan Hooper*
+
+ * Fixed printing of `INTEGER` attribute values in X.509 text output so they
+ are output as decimal numbers and not as sequences of bytes.
+ <!-- https://github.com/openssl/openssl/pull/33509 -->
+
+ *Kron Kastrati*
+
### Changes between 4.0 and 4.1.0 [23 Oct 2026]
* Changed the OpenSSL FIPS provider so that every algorithm advertised with
@@ -24485,6 +24841,7 @@ ndif
[CVE-2026-34183]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-34183
[CVE-2026-35188]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-35188
[CVE-2026-35189]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-35189
+[CVE-2026-35190]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-35190
[CVE-2026-35191]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-35191
[CVE-2026-42764]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-42764
[CVE-2026-42765]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-42765
@@ -24517,6 +24874,21 @@ ndif
[CVE-2026-84782]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-84782
[CVE-2026-84783]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-84783
[CVE-2026-84784]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-84784
+[CVE-2026-84785]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-84785
+[CVE-2026-84786]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-84786
+[CVE-2026-88822]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-88822
+[CVE-2026-88823]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-88823
+[CVE-2026-95691]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-95691
+[CVE-2026-95692]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-95692
+[CVE-2026-107493]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-107493
+[CVE-2026-107494]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-107494
+[CVE-2026-107496]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-107496
+[CVE-2026-120665]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-120665
+[CVE-2026-120666]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-120666
+[CVE-2026-120667]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-120667
+[CVE-2026-121482]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-121482
+[CVE-2026-123780]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-123780
+[CVE-2026-124709]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-124709
[ESV]: https://csrc.nist.gov/Projects/cryptographic-module-validation-program/entropy-validations
[RFC 2578 (STD 58), section 3.5]: https://datatracker.ietf.org/doc/html/rfc2578#section-3.5
[RFC 3211]: https://datatracker.ietf.org/doc/html/rfc3211
diff --git a/deps/openssl/openssl/Configurations/10-main.conf b/deps/openssl/openssl/Configurations/10-main.conf
index 3d044e8045f..c940eb4d5ab 100644
--- a/deps/openssl/openssl/Configurations/10-main.conf
+++ b/deps/openssl/openssl/Configurations/10-main.conf
@@ -5,8 +5,9 @@
my $vc_win64a_info = {};
sub vc_win64a_info {
unless (%$vc_win64a_info) {
+ my $devnull = File::Spec->devnull();
# Minimum NASM version is 2.09 otherwise SHA3 might be miscompiled
- if (`nasm -v 2>NUL` =~ /NASM version ([0-9]+)\.([0-9]+)/ && ($1 > 2 || ($1 == 2 && $2 >= 9))) {
+ if (`nasm -v 2>$devnull` =~ /NASM version ([0-9]+)\.([0-9]+)/ && ($1 > 2 || ($1 == 2 && $2 >= 9))) {
$vc_win64a_info = { AS => "nasm",
ASFLAGS => "-g",
asflags => "-Ox -f win64 -DNEAR",
@@ -34,8 +35,9 @@ sub vc_win64a_info {
my $vc_win32_info = {};
sub vc_win32_info {
unless (%$vc_win32_info) {
- my $ver=`nasm -v 2>NUL`;
- my $vew=`nasmw -v 2>NUL`;
+ my $devnull = File::Spec->devnull();
+ my $ver=`nasm -v 2>$devnull`;
+ my $vew=`nasmw -v 2>$devnull`;
if ($ver ne "" || $vew ne "") {
$vc_win32_info = { AS => $ver ge $vew ? "nasm" : "nasmw",
ASFLAGS => "",
@@ -1579,6 +1581,15 @@ my %targets = (
release => "-O3"),
cppflags => combine("-DUNICODE -D_UNICODE -DWIN32_LEAN_AND_MEAN",
threads("-D_MT")),
+ # GCC attaches an ms_printf format attribute to its printf() family
+ # builtins on mingw targets. Since mingw-w64 13 the headers declare
+ # these functions in a way that no longer hides the builtins, so C99
+ # conversions such as %zu are diagnosed even though the functions
+ # resolve to the C99 conforming __mingw_*printf() ones. Disabling
+ # the builtins leaves the gnu_printf format attribute from the
+ # headers in effect.
+ cflags => "-fno-builtin-printf -fno-builtin-fprintf "
+ . "-fno-builtin-sprintf -fno-builtin-snprintf",
lib_cppflags => "-DL_ENDIAN",
ex_libs => add("-lws2_32 -lgdi32 -lcrypt32 -lbcrypt"),
thread_scheme => "winthreads",
@@ -1592,7 +1603,7 @@ my %targets = (
"mingw" => {
inherit_from => [ "mingw-common" ],
CFLAGS => add(picker(release => "-fomit-frame-pointer")),
- cflags => "-m32",
+ cflags => add("-m32"),
sys_id => "MINGW32",
bn_ops => add("BN_LLONG"),
asm_arch => 'x86',
@@ -1611,7 +1622,7 @@ my %targets = (
# environment. And as mingw64 is always consistent with itself,
# Applink is never engaged and can as well be omitted.
inherit_from => [ "mingw-common" ],
- cflags => "-m64",
+ cflags => add("-m64"),
sys_id => "MINGW64",
bn_ops => add("SIXTY_FOUR_BIT"),
asm_arch => 'x86_64',
@@ -1623,7 +1634,6 @@ my %targets = (
"mingwarm64" => {
inherit_from => [ "mingw-common" ],
- cflags => "",
sys_id => "MINGWARM64",
bn_ops => add("SIXTY_FOUR_BIT"),
asm_arch => 'aarch64',
diff --git a/deps/openssl/openssl/Configurations/unix-Makefile.tmpl b/deps/openssl/openssl/Configurations/unix-Makefile.tmpl
index f8a5b1612ed..e10d424804e 100644
--- a/deps/openssl/openssl/Configurations/unix-Makefile.tmpl
+++ b/deps/openssl/openssl/Configurations/unix-Makefile.tmpl
@@ -4,8 +4,11 @@
## {- join("\n## ", @autowarntext) -}
{-
use Time::Piece;
+ use File::Basename;
+ use File::Path qw(mkpath);
use OpenSSL::Util;
+ use OpenSSL::Config::Query;
our $makedep_scheme = $config{makedep_scheme};
our $makedepcmd = platform->makedepcmd();
@@ -66,6 +69,35 @@
}
return @result;
}
+
+ # Write a list, one item per line, to a file while the build file is
+ # generated. The doc stamps hand such a file to mkpod2man.pl and
+ # mkpod2html.pl instead of having the shell expand nine hundred paths
+ # onto a single command line. The file is only rewritten when the list
+ # changes, and is left read-only like the other generated files.
+ sub write_list_file {
+ my $file = shift;
+ my $list = join('', map { "$_\n" } @_);
+ my $old;
+
+ if (open my $fh, '<', $file) {
+ local $/;
+ $old = <$fh>;
+ close $fh;
+ }
+ return if defined $old && $old eq $list;
+
+ mkpath(dirname($file));
+ open my $fh, '>', "$file.new"
+ or die "Trying to create $file.new: $!";
+ print $fh $list;
+ close $fh
+ or die "Trying to write $file.new: $!";
+ chmod 0444, "$file.new"
+ or die "Trying to change mode of $file.new: $!";
+ rename "$file.new", $file
+ or die "Trying to rename $file.new to $file: $!";
+ }
'';
-}
PLATFORM={- $config{target} -}
@@ -276,14 +308,16 @@ HTMLDOCS7={-
@{$unified_info{htmldocs}->{man7}})) -}
# The pods every HTML page is made from, which is what the whole set is
-# converted from in one go. Each page's pod is the first element of its
-# generator, the same place generatesrc() below takes it from.
+# converted from in one go. The list is also written to
+# doc/html/.htmldocs.files for the stamp's recipe, see write_list_file().
HTMLPODS={-
+ my @htmlpods =
+ @{OpenSSL::Config::Query->new(info => \%unified_info)
+ ->get_htmlpods()};
+
+ write_list_file('doc/html/.htmldocs.files', @htmlpods);
join(" \\\n" . ' ' x 9,
- fill_lines(" ", $COLUMNS - 9,
- map { $unified_info{generate}->{$_}->[0] }
- map { @{$unified_info{htmldocs}->{$_} // []} }
- qw(man1 man3 man5 man7))) -}
+ fill_lines(" ", $COLUMNS - 9, @htmlpods)) -}
MANDOCS1={-
join(" \\\n" . ' ' x 9,
@@ -303,14 +337,16 @@ MANDOCS7={-
@{$unified_info{mandocs}->{man7}})) -}
# The pods every manual page is made from, which is what the whole manual
-# is formatted from in one go. Each page's pod is the first element of its
-# generator, the same place generatesrc() below takes it from.
+# is formatted from in one go. The list is also written to
+# doc/man/.mandocs.files for the stamp's recipe, see write_list_file().
MANPODS={-
+ my @manpods =
+ @{OpenSSL::Config::Query->new(info => \%unified_info)
+ ->get_manpods()};
+
+ write_list_file('doc/man/.mandocs.files', @manpods);
join(" \\\n" . ' ' x 8,
- fill_lines(" ", $COLUMNS - 8,
- map { $unified_info{generate}->{$_}->[0] }
- map { @{$unified_info{mandocs}->{$_} // []} }
- qw(man1 man3 man5 man7))) -}
+ fill_lines(" ", $COLUMNS - 8, @manpods)) -}
APPS_OPENSSL="{- use File::Spec::Functions;
catfile("apps","openssl") -}"
@@ -587,16 +623,31 @@ build_man_docs: doc/man/.mandocs.stamp ## Create manpages
# as arguments -- so a stamp is enough to order the work, and the per-page
# rules below stay available for building one page by name.
doc/man/.mandocs.stamp: {- $config{manpage_format} eq "roff"
- ? '$(MANPODS)'
+ ? 'doc/man/.mandocs.files'
: '$(MANDOCS1) $(MANDOCS3) $(MANDOCS5) $(MANDOCS7)' -}
{- $config{manpage_format} eq "roff"
? "\t" . '@$(ECHO) "Formatting the manual pages"'
. "\n\t" . '@$(PERL) $(SRCDIR)/util/mkpod2man.pl -o doc/man \\'
. "\n\t\t" . '-m "$(MANSUFFIX)" -d "$(RELEASE_DATE)" -r "$(VERSION)" \\'
- . "\n\t\t" . '$(MANPODS)'
+ . "\n\t\t" . '-f doc/man/.mandocs.files'
. "\n\t" . '@touch $@'
: "\t" . '@touch $@' -}
+# The pod lists are written when the build file is generated, see
+# write_list_file(), which is also what keeps their contents current: the
+# list can only change when the configuration does, and that regenerates
+# this file. These rules make a missing list again, still without the list
+# ever reaching a command line, and remake it when one of its pods is
+# edited. That refreshes the list's timestamp, which is how the stamp,
+# depending only on the list, learns that a pod changed. They deliberately
+# don't depend on configdata.pm, write_list_file() leaves an unchanged list
+# older than it, and refreshing the list would make the stamps redo the
+# whole set for nothing.
+doc/man/.mandocs.files: $(MANPODS)
+ @$(PERL) $(SRCDIR)/util/mkdir-p.pl doc/man
+ @$(PERL) $(SRCDIR)/util/file-from-stdout.pl $@ \
+ $(PERL) configdata.pm --query 'get_manpods()'
+
build_html_docs: doc/html/.htmldocs.stamp ## Create HTML documentation
# As with the manual pages, Pod::Html is compiled before the first pod is
@@ -604,12 +655,17 @@ build_html_docs: doc/html/.htmldocs.stamp ## Create HTML documentation
# process per page. Nothing depends on an individual page -- the install
# recipe takes them as arguments -- so a stamp is enough to order the work,
# and the per-page rules below stay available for one page by name.
-doc/html/.htmldocs.stamp: $(HTMLPODS)
+doc/html/.htmldocs.stamp: doc/html/.htmldocs.files
@$(ECHO) "Converting the manual pages to HTML"
@$(PERL) $(SRCDIR)/util/mkpod2html.pl -o doc/html \
- -r "$(SRCDIR)/doc" $(HTMLPODS)
+ -r "$(SRCDIR)/doc" -f doc/html/.htmldocs.files
@touch $@
+doc/html/.htmldocs.files: $(HTMLPODS)
+ @$(PERL) $(SRCDIR)/util/mkdir-p.pl doc/html
+ @$(PERL) $(SRCDIR)/util/file-from-stdout.pl $@ \
+ $(PERL) configdata.pm --query 'get_htmlpods()'
+
build_generated: $(GENERATED_MANDATORY)
build_libs_nodep: $(LIBS) {- join(" ",map { platform->sharedlib_simple($_) // platform->sharedlib_import($_) // platform->sharedlib($_) // () } @{$unified_info{libraries}}) -}
build_modules_nodep: $(MODULES)
@@ -727,6 +783,8 @@ clean: libclean ## Clean the workspace, keep the configuration
distclean: clean cov-clean ## Clean and remove the configuration
$(RM) include/openssl/configuration.h
+ $(RM) doc/man/.mandocs.files
+ $(RM) doc/html/.htmldocs.files
$(RM) configdata.pm
$(RM) Makefile
diff --git a/deps/openssl/openssl/HOWTO.md b/deps/openssl/openssl/HOWTO.md
index 8ee3be5e05c..0a4182e1637 100644
--- a/deps/openssl/openssl/HOWTO.md
+++ b/deps/openssl/openssl/HOWTO.md
@@ -4,5 +4,5 @@ MODIFYING OPENSSL SOURCE
This is a collection of pointers to parts of the documentation that will help
people doing modifications.
-* [doc/HOWTO/adding-functions.md](Adding new Functions)
-* [doc/HOWTO/documenting-functions-macros.md](Documenting Functions and Macros)
+* [Adding new Functions](doc/HOWTO/adding-functions.md)
+* [Documenting Functions and Macros](doc/HOWTO/documenting-functions-and-macros.md)
diff --git a/deps/openssl/openssl/INSTALL.md b/deps/openssl/openssl/INSTALL.md
index 6dc586d4a7f..4a5d0c927c1 100644
--- a/deps/openssl/openssl/INSTALL.md
+++ b/deps/openssl/openssl/INSTALL.md
@@ -1044,6 +1044,10 @@ Build with support for TCP Fast Open (RFC7413). Supported on Linux, macOS and Fr
Don't build with QUIC support.
+This only disables OpenSSL's built-in QUIC stack, instead of the QUIC TLS API.
+3rd-party applications with their own QUIC stack can still use OpenSSL to integrate TLS
+even in the event of `no-quic`.
+
### no-threads
Don't build with support for multi-threaded applications.
@@ -1171,13 +1175,13 @@ accompanied by a corresponding compiler-specific option.
### no-{protocol}
- no-{ssl|ssl3|tls|tls1|tls1_1|tls1_2|tls1_3|dtls|dtls1|dtls1_2}
+ no-{ssl|ssl3|tls|tls1|tls1_1|tls1_2|tls1_3|dtls|dtls1|dtls1_2|dtls1_3}
Don't build support for negotiating the specified SSL/TLS protocol.
If `no-tls` is selected then all of `tls1`, `tls1_1`, `tls1_2` and `tls1_3`
are disabled.
-Similarly `no-dtls` will disable `dtls1` and `dtls1_2`.
+Similarly `no-dtls` will disable `dtls1`, `dtls1_2` and `dtls1_3`.
`no-ssl` and `no-ssl3` are deprecated and do nothing.
OpenSSL will still provide the methods for applications to explicitly select
the individual protocol versions.
@@ -1194,7 +1198,7 @@ Analogous to `no-{protocol}` but in addition do not build the methods for
applications to explicitly select individual protocol versions. Note that there
is no `no-tls1_3-method` option because there is no application method for
TLSv1.3.
-`no-ssl3` is deprecated and does nothing.
+`no-ssl3-method` is deprecated and does nothing.
Using individual protocol methods directly is deprecated. Applications should
use `TLS_method()` instead.
diff --git a/deps/openssl/openssl/NEWS.md b/deps/openssl/openssl/NEWS.md
index dc72ef2a7aa..e6f6ee4019a 100644
--- a/deps/openssl/openssl/NEWS.md
+++ b/deps/openssl/openssl/NEWS.md
@@ -26,6 +26,75 @@ OpenSSL Releases
OpenSSL 4.1
-----------
+### Major changes between OpenSSL 4.1.0 and OpenSSL 4.1.1 [1 Dec 2026]
+
+OpenSSL 4.1.1 is a security patch release. The most severe CVE fixed
+in this release is Moderate.
+
+This release incorporates the following bug fixes and mitigations:
+
+ * Fixed ECH server name verification bypass after `HelloRetryRequest`.
+ ([CVE-2026-120665])
+
+ * Fixed heap buffer overflow when re-encoding cached ASN.1 items above
+ `INT_MAX`.
+ ([CVE-2026-120667])
+
+ * Fixed unbounded memory growth in ECH transcript buffer from repeated
+ `ClientHello`s.
+ ([CVE-2026-123780])
+
+ * Fixed out-of-bounds read in TLS 1.3 key-share processing with Suite B flag.
+ ([CVE-2026-35190])
+
+ * Fixed unbounded out-of-order fragment reassembly in QUIC streams.
+ ([CVE-2026-84785])
+
+ * Fixed possible NULL dereference in non-SMTP DANE clients.
+ ([CVE-2026-84786])
+
+ * Fixed use of uninitialized stack data in QUIC automated peer detection.
+ ([CVE-2026-88822])
+
+ * Fixed AES-GCM-SIV AAD forgery after a zero-length incremental AAD update.
+ ([CVE-2026-88823])
+
+ * Fixed use-after-free on retransmitted QUIC `CRYPTO` frames.
+ ([CVE-2026-95691])
+
+ * Fixed out-of-bounds read and incorrect IV length handling in AES-GCM-SIV.
+ ([CVE-2026-95692])
+
+ * Fixed use-after-free in `PEM_X509_INFO_read_bio_ex()` on stack append
+ failure.
+ ([CVE-2026-107493])
+
+ * Fixed unbounded QUIC `RETIRE_CONNECTION_ID` frame sending queue.
+ ([CVE-2026-107494])
+
+ * Fixed infinite loop in `CMS_encrypt()` with an EC group order of 1.
+ ([CVE-2026-107496])
+
+ * Fixed AES-SIV silently ignoring Additional Authenticated Data supplied
+ after plaintext.
+ ([CVE-2026-120666])
+
+ * Fixed relative CRL distribution point names rebuilt per CRL in X.509
+ verification.
+ ([CVE-2026-121482])
+
+ * Fixed unbounded memory retention in QUIC server for rejected streams.
+ ([CVE-2026-124709])
+
+ * Fixed handling of incoming DTLS 1.3 `KeyUpdate` messages with respect
+ to outstanding messages (such as `KeyUpdate`, `NewSessionTicket`,
+ or `CertificateRequest`), resolves
+ [#32878, a 4.1.0 known issue](https://github.com/openssl/openssl/issues/32878).
+
+ * Fixed handling of a receiving an `ACK` of the first sent flight before receiving
+ the first flight in DTLS 1.3, resolves
+ [#33242, a 4.1.0 known issue](https://github.com/openssl/openssl/issues/33242).
+
### Major changes between OpenSSL 4.0 and OpenSSL 4.1.0 [23 Oct 2026]
OpenSSL 4.1.0 is a feature release adding significant new functionality
@@ -2637,6 +2706,7 @@ OpenSSL 0.9.x
[CVE-2026-34183]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-34183
[CVE-2026-35188]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-35188
[CVE-2026-35189]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-35189
+[CVE-2026-35190]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-35190
[CVE-2026-35191]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-35191
[CVE-2026-42764]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-42764
[CVE-2026-42765]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-42765
@@ -2669,6 +2739,21 @@ OpenSSL 0.9.x
[CVE-2026-84782]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-84782
[CVE-2026-84783]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-84783
[CVE-2026-84784]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-84784
+[CVE-2026-84785]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-84785
+[CVE-2026-84786]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-84786
+[CVE-2026-88822]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-88822
+[CVE-2026-88823]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-88823
+[CVE-2026-95691]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-95691
+[CVE-2026-95692]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-95692
+[CVE-2026-107493]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-107493
+[CVE-2026-107494]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-107494
+[CVE-2026-107496]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-107496
+[CVE-2026-120665]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-120665
+[CVE-2026-120666]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-120666
+[CVE-2026-120667]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-120667
+[CVE-2026-121482]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-121482
+[CVE-2026-123780]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-123780
+[CVE-2026-124709]: https://openssl-library.org/news/vulnerabilities/#CVE-2026-124709
[ESV]: https://csrc.nist.gov/Projects/cryptographic-module-validation-program/entropy-validations
[OpenSSL Guide]: https://docs.openssl.org/master/man7/ossl-guide-introduction
[README-QUIC.md]: ./README-QUIC.md
diff --git a/deps/openssl/openssl/README.md b/deps/openssl/openssl/README.md
index 97e804076a7..fd5e009425a 100644
--- a/deps/openssl/openssl/README.md
+++ b/deps/openssl/openssl/README.md
@@ -150,11 +150,10 @@ The manual pages for the master branch and all current stable releases are
available online.
- [OpenSSL master](https://docs.openssl.org/master/)
+- [OpenSSL 4.1](https://docs.openssl.org/4.1/)
- [OpenSSL 4.0](https://docs.openssl.org/4.0/)
- [OpenSSL 3.6](https://docs.openssl.org/3.6/)
- [OpenSSL 3.5](https://docs.openssl.org/3.5/)
-- [OpenSSL 3.4](https://docs.openssl.org/3.4/)
-- [OpenSSL 3.0](https://docs.openssl.org/3.0/)
Demos
-----
diff --git a/deps/openssl/openssl/REVIEW.md b/deps/openssl/openssl/REVIEW.md
new file mode 100644
index 00000000000..1a3babe1681
--- /dev/null
+++ b/deps/openssl/openssl/REVIEW.md
@@ -0,0 +1,239 @@
+Review instructions
+===================
+
+This file configures Claude Code Review, the automated reviewer started
+with `@claude review`. "Important" and "Nit" are its severity labels:
+Important (🔴) marks security issues only, and Nit (🟡) marks everything
+else, including functional bugs that still need fixing. They are not a
+ranking for human reviewers.
+
+Every review covers, in this order of priority:
+
+1. Bugs that a tool cannot find, above all those that can lead to a
+ vulnerability.
+2. Changes to documented or long-standing behaviour.
+3. Conformance with `STYLE.md` and `DOCUMENTATION.md` at the repository
+ root.
+
+The checks below come from the CVEs, post-merge regression fixes and
+maintainer reviews between October 2023 and October 2026. Most security
+bugs and regressions in that period were visible in the diff that
+introduced them.
+
+What Important means here
+-------------------------
+
+Reserve Important for security issues: problems an attacker can trigger
+through untrusted input, such as a TLS or QUIC peer, a certificate, key
+or message being parsed, or a file or network stream, and problems that
+break a security property: memory safety, secrecy of keys and secrets,
+authentication or verification results, constant-time behaviour, or
+enforcement of mandatory properties such as `fips=yes`. The first
+sentence of an Important finding says who can trigger it and what they
+gain.
+
+Functional bugs, behaviour changes, performance regressions, misuse of a
+public API by the calling application, and `STYLE.md` and
+`DOCUMENTATION.md` violations are Nit at most, however likely they are
+to cause failures. Start each Nit with its kind, such as "Functional:",
+"Performance:" or "Documentation:".
+
+Evidence
+--------
+
+Each finding states the inputs or state that trigger it and what goes
+wrong, with a `file:line` citation for every claim about code outside the
+diff. Read the callee before claiming what it returns or who owns its
+result. A finding that cannot name a trigger is not reported.
+
+Error paths and ownership
+-------------------------
+
+- For every new allocation, find the free on every exit after it. A new
+ `return` in a function that otherwise uses `goto err` usually leaks.
+- Code after a shared `err:` or `end:` label only touches objects that
+ are initialised on every path reaching it.
+- `sk_*_push()`, `*_set0_*()` and `*_add*()` take ownership only on
+ success; `set1` copies. State who frees the object on success and on
+ failure, and check the pointer is set to `NULL` after a transfer.
+- A pointer freed inside a loop or retry path is not freed again at the
+ common exit.
+- Each type is released with its own free function, not
+ `OPENSSL_free()`. `dup` and `free` functions cover every new owned
+ field; a struct-copying `dupctx` must not alias owned pointers.
+- Free functions accept `NULL`; do not guard calls to them.
+
+Untrusted input
+---------------
+
+- Every access to an `ASN1_TYPE`, CHOICE or union member is preceded by
+ a check of the discriminant on the same object (`->type`, the `ptype`
+ from `X509_ALGOR_get0()`). Never select the member by what the caller
+ expects.
+- Every OPTIONAL field is checked for `NULL` before use, including
+ `X509_ALGOR->parameter`. Use the ASN.1 template (`ASN1_OPT`,
+ `ASN1_EXP_OPT`), not the RFC text, to find which fields are optional.
+- Before reading N bytes of peer data, `remaining >= N` holds. Prefer
+ `PACKET` and `WPACKET` helpers to hand-written length handling.
+- A length returned by a size query bounds the later write on success
+ and on failure.
+- Sizes computed from caller or peer input are checked for overflow,
+ including the `+ 1` for a terminator, and `size_t` to `int`
+ conversions are checked against `INT_MAX`.
+- `int`-returning sizes such as `EVP_MD_get_size()` are checked for
+ `<= 0` before use as `size_t`. Such a check must not reject inputs the
+ manual page allows, such as a `NULL` digest.
+- Allocations, queues and work driven by peer input have an explicit
+ bound that does not depend on the peer acknowledging or the
+ application draining. Watch for quadratic work in peer-chosen sizes.
+
+Return values and errors
+------------------------
+
+- For every changed condition on a call's result, check the callee's
+ documented convention: 0, -1 or `<= 0` for failure.
+- Trace `ret` through every new label. A function that raises an error
+ returns failure, and a success path does not fall into error
+ reporting.
+- Errors are raised once, where they occur, with the most specific
+ reason code.
+- A check that exists only as `assert()` disappears in release builds.
+
+Security semantics
+------------------
+
+- Attacker-supplied data is not stored in a shared or cached object,
+ such as an `SSL_SESSION`, before it is verified. Verification results
+ are reset on every failure path.
+- Trust flags such as `*_TRUSTOTHER` are not applied to peer-supplied
+ certificate sets.
+- Parameters an attacker chooses (key and tag lengths, whether a cipher
+ is AEAD, domain parameters) have security minimums as well as
+ memory-safety maximums. Peer domain parameters are checked against
+ local ones.
+- A change that disables or weakens a countermeasure, such as implicit
+ rejection, is a finding.
+- Secret data is not used in branches, memory indexing or early exits.
+ BIGNUMs holding keys or nonces stay constant-time through every
+ operation, including platform-specific EC code and assembly.
+- Secrets are cleansed on every path. Zeroisation does not depend on
+ `OPENSSL_PEDANTIC_ZEROIZATION`.
+
+Parallel paths and new modes
+----------------------------
+
+- A new entry point or constructor that duplicates an existing one sets
+ up the same state. Compare it with its sibling.
+- Paths that must agree do the same security work: `EVP_Cipher()`
+ one-shot and update/final; assembly and generic code; check, generate
+ and verify entry points. Zero-length input does not skip
+ finalisation.
+- A new check is not bypassed by a platform fast path or early return
+ above it.
+- A new mode or flag (RPK, `PARTIAL_CHAIN`, QUIC without address
+ validation) keeps every invariant that consumers of the default path
+ rely on, such as a certificate being present.
+- A fix or check applied to one function is applied to its siblings:
+ the same structure in CMS, PKCS#7, PKCS#12, TS, CMP and CRMF; other
+ RecipientInfo types; other functions in the file.
+
+Refactors
+---------
+
+Treat "mechanical" changes as semantic ones.
+
+- When a condition is split, moved or rewritten, every term of the old
+ condition survives.
+- After a rename, no reader of the old name is left, including `#if`
+ lines.
+- After a lock is dropped and retaken, values computed under the earlier
+ lock are stale. Shared state is read and written under the lock that
+ guards it elsewhere.
+- A refactor or optimisation does not change results through the public
+ API, including inputs that used to fail.
+
+Compatibility
+-------------
+
+- Changes to a public function's return values, error-queue behaviour,
+ flag semantics or `const` qualifiers are compared against its manual
+ page. Say which existing callers break.
+- A restriction added to a generic helper applies to all its callers.
+- Behaviour changes and large refactors are not suitable for stable
+ branches.
+
+Providers and the FIPS module
+-----------------------------
+
+- Fetches use the caller's library context and property query; no
+ fallback to legacy global lookups such as `EVP_get_digestbyname()`.
+- Provider operations can be reached with no key or cipher set; check
+ that `update`, `final` and `get_params` handle that.
+- `ossl_prov_is_running()` is checked at operation entry points, not on
+ per-update paths.
+- Files added to or removed from the FIPS provider are reflected in the
+ FIPS source lists and checksums.
+
+Build configurations and platforms
+----------------------------------
+
+- Code and tests are guarded by exactly the `OPENSSL_NO_*` or platform
+ conditions they need, and build with `no-deprecated`.
+- Assembly dispatch checks every capability it uses. Constant tables go
+ in `.rodata`.
+- New public headers have `extern "C"` guards and use `ossl_inline`.
+
+Tests
+-----
+
+- A regression test fails without the fix and passes with it.
+- Each `TEST_*` result is acted on, assertions check expected values,
+ and negative tests fail for the reason they claim.
+- Tests of behaviour that differs between FIPS provider versions are
+ gated on the provider version.
+
+Performance
+-----------
+
+Report per-call allocation, locking or repeated lookups added to hot
+paths, such as per-record or per-update code.
+
+Project standards
+-----------------
+
+Read `STYLE.md` and `DOCUMENTATION.md` and report violations in lines the
+pull request adds or changes. Each finding cites the section it
+violates.
+
+- Documentation and comments state what the code does now. A change
+ that makes a manual page, `CHANGES.md` entry or comment inaccurate
+ updates it.
+- New public symbols have a POD page in `doc/man3` with a `HISTORY`
+ entry naming the release, and are removed from
+ `util/missingcrypto*.txt` if listed. Public manual pages do not
+ describe internal functions.
+- New commands and options are documented in `doc/man1`, and new
+ Configure options in `INSTALL.md`.
+- User-visible changes have a `CHANGES.md` entry written for users.
+- Internal and file-local items are documented as `DOCUMENTATION.md`
+ requires, unless trivial.
+- Pointers are compared explicitly with `NULL`. Magic numbers are named
+ or explained.
+
+Cap the nits
+------------
+
+Report at most ten Nits per review, functional bugs first. Important
+findings are not limited.
+
+Do not report
+-------------
+
+- What CI already reports: compiler warnings, clang-format, codespell,
+ `make doc-nits`, `make md-nits`.
+- Commit messages, CLA status, rebasing and target branches; maintainers
+ and bots handle these.
+- Questions about intent with no defect behind them.
+- `STYLE.md` and `DOCUMENTATION.md` non-conformance in code the pull
+ request does not touch.
+- Files regenerated by `make update`.
diff --git a/deps/openssl/openssl/VERSION.dat b/deps/openssl/openssl/VERSION.dat
index b4d468b383e..d40db87953a 100644
--- a/deps/openssl/openssl/VERSION.dat
+++ b/deps/openssl/openssl/VERSION.dat
@@ -1,7 +1,7 @@
MAJOR=4
MINOR=1
-PATCH=0
+PATCH=1
PRE_RELEASE_TAG=
BUILD_METADATA=
-RELEASE_DATE="23 Oct 2026"
+RELEASE_DATE="1 Dec 2026"
SHLIB_VERSION=4
diff --git a/deps/openssl/openssl/apps/include/configuration.h.in b/deps/openssl/openssl/apps/include/app_conf.h.in
similarity index 100%
rename from deps/openssl/openssl/apps/include/configuration.h.in
rename to deps/openssl/openssl/apps/include/app_conf.h.in
diff --git a/deps/openssl/openssl/apps/lib/cmp_mock_srv.c b/deps/openssl/openssl/apps/lib/cmp_mock_srv.c
index c538c04d287..e8a289f3134 100644
--- a/deps/openssl/openssl/apps/lib/cmp_mock_srv.c
+++ b/deps/openssl/openssl/apps/lib/cmp_mock_srv.c
@@ -274,8 +274,11 @@ static int refcert_cmp(const X509 *refcert,
return 1;
ref_issuer = X509_get_issuer_name(refcert);
ref_serial = X509_get0_serialNumber(refcert);
- return (ref_issuer == NULL || X509_NAME_cmp(issuer, ref_issuer) == 0)
- && (ref_serial == NULL || ASN1_INTEGER_cmp(serial, ref_serial) == 0);
+ if (ref_issuer != NULL
+ && (issuer == NULL || X509_NAME_cmp(issuer, ref_issuer) != 0))
+ return 0;
+ return ref_serial == NULL
+ || (serial != NULL && ASN1_INTEGER_cmp(serial, ref_serial) == 0);
}
/* reset the state that belongs to a transaction */
diff --git a/deps/openssl/openssl/apps/list.c b/deps/openssl/openssl/apps/list.c
index a9a55fadee5..8245e1b5f59 100644
--- a/deps/openssl/openssl/apps/list.c
+++ b/deps/openssl/openssl/apps/list.c
@@ -33,7 +33,7 @@
#include "progs.h"
#include "opt.h"
#include "names.h"
-#include "configuration.h"
+#include "app_conf.h"
static int verbose = 0;
static const char *select_name = NULL;
diff --git a/deps/openssl/openssl/apps/passwd.c b/deps/openssl/openssl/apps/passwd.c
index a2fff324aaf..c909a912510 100644
--- a/deps/openssl/openssl/apps/passwd.c
+++ b/deps/openssl/openssl/apps/passwd.c
@@ -837,7 +837,10 @@ static int do_passwd(int passed_salt, char **salt_p, char **salt_malloc_p,
hash = md5crypt(passwd, "", *salt_p);
if (mode == passwd_sha256 || mode == passwd_sha512)
hash = shacrypt(passwd, (mode == passwd_sha256 ? "5" : "6"), *salt_p);
- assert(hash != NULL);
+ if (hash == NULL) {
+ BIO_printf(bio_err, "Error computing password hash\n");
+ goto end;
+ }
if (table && !reverse)
BIO_printf(out, "%s\t%s\n", passwd, hash);
diff --git a/deps/openssl/openssl/apps/pkcs12.c b/deps/openssl/openssl/apps/pkcs12.c
index 2deb87a1f87..bbaba3b75b9 100644
--- a/deps/openssl/openssl/apps/pkcs12.c
+++ b/deps/openssl/openssl/apps/pkcs12.c
@@ -952,6 +952,7 @@ static int jdk_trust(PKCS12_SAFEBAG *bag, void *cbarg)
{
STACK_OF(X509_ATTRIBUTE) *attrs = NULL;
X509_ATTRIBUTE *attr = NULL;
+ ASN1_OBJECT *obj = NULL;
/* Nothing to do */
if (cbarg == NULL)
@@ -960,8 +961,17 @@ static int jdk_trust(PKCS12_SAFEBAG *bag, void *cbarg)
/* Get the current attrs */
attrs = (STACK_OF(X509_ATTRIBUTE) *)PKCS12_SAFEBAG_get0_attrs(bag);
- /* Create a new attr for the JDK Trusted Usage and add it */
- attr = X509_ATTRIBUTE_create(NID_oracle_jdk_trustedkeyusage, V_ASN1_OBJECT, (ASN1_OBJECT *)cbarg);
+ /*
+ * Create a new attr for the JDK Trusted Usage and add it. The attr owns
+ * its value, so give it a copy: cbarg stays owned by the caller.
+ */
+ if ((obj = OBJ_dup((ASN1_OBJECT *)cbarg)) == NULL)
+ return -1;
+ attr = X509_ATTRIBUTE_create(NID_oracle_jdk_trustedkeyusage, V_ASN1_OBJECT, obj);
+ if (attr == NULL) {
+ ASN1_OBJECT_free(obj);
+ return -1;
+ }
/* Add the new attr, if attrs is NULL, it'll be initialised */
X509at_add1_attr(&attrs, attr);
diff --git a/deps/openssl/openssl/apps/x509.c b/deps/openssl/openssl/apps/x509.c
index c8cd9229f4c..19704c0617d 100644
--- a/deps/openssl/openssl/apps/x509.c
+++ b/deps/openssl/openssl/apps/x509.c
@@ -1051,10 +1051,12 @@ cert_loop:
goto err;
if (!noout) {
if (outformat == FORMAT_ASN1) {
- X509_REQ_print_ex(out, rq, get_nameopt(), X509_FLAG_COMPAT);
- i = i2d_X509_bio(out, x);
- } else {
+ i = i2d_X509_REQ_bio(out, rq);
+ } else if (outformat == FORMAT_PEM) {
i = PEM_write_bio_X509_REQ(out, rq);
+ } else {
+ BIO_puts(bio_err, "Bad output format specified for outfile\n");
+ goto err;
}
if (!i) {
BIO_puts(bio_err,
@@ -1215,19 +1217,32 @@ cert_loop:
int error;
if ((vpm = X509_VERIFY_PARAM_new()) == NULL) {
- BIO_puts(out, "Malloc failed\n");
- goto end_cert_loop;
+ BIO_puts(bio_err, "Malloc failed\n");
+ goto err;
}
X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_USE_CHECK_TIME);
X509_VERIFY_PARAM_set_time(vpm, tcheck);
- if (!X509_check_certificate_times(vpm, x, &error)) {
- if (error == X509_V_ERR_CERT_HAS_EXPIRED) {
- BIO_puts(out, "Certificate will expire\n");
- expired = 1;
- }
- } else {
+ if (X509_check_certificate_times(vpm, x, &error)) {
BIO_puts(out, "Certificate will not expire\n");
+ } else if (error == X509_V_ERR_CERT_HAS_EXPIRED) {
+ BIO_puts(out, "Certificate will expire\n");
+ expired = 1;
+ } else if (error == X509_V_ERR_CERT_NOT_YET_VALID) {
+ /*
+ * The certificate only becomes valid after the check time,
+ * so it cannot expire before it.
+ */
+ BIO_puts(out, "Certificate will not expire\n");
+ } else {
+ /*
+ * A notBefore or notAfter field that cannot be parsed must not
+ * be reported as "will not expire", see issue #11772.
+ */
+ BIO_printf(bio_err, "Cannot check certificate expiry: %s\n",
+ X509_verify_cert_error_string(error));
+ X509_VERIFY_PARAM_free(vpm);
+ goto err;
}
if (multi && k > 0)
ret |= expired;
diff --git a/deps/openssl/openssl/build.info b/deps/openssl/openssl/build.info
index 0f119268db8..3449aa77b3e 100644
--- a/deps/openssl/openssl/build.info
+++ b/deps/openssl/openssl/build.info
@@ -571,7 +571,7 @@ DEPEND[openssl.pc]=libcrypto.pc libssl.pc
GENERATE[builddata.pm]=util/mkinstallvars.pl \
COMMENT="This file should be used when building against this OpenSSL build, and should never be installed" \
- PREFIX=. BINDIR=apps APPLINKDIR=ms \
+ PREFIX=. BINDIR=apps "APPLINKDIR=$(SRCDIR)/ms" \
LIBDIR= INCLUDEDIR=include "INCLUDEDIR=$(SRCDIR)/include" \
MODULESDIR=providers \
libdir= CMAKECONFIGDIR= PKGCONFIGDIR= \
diff --git a/deps/openssl/openssl/configdata.pm.in b/deps/openssl/openssl/configdata.pm.in
index a21fe686d96..41664b9afe3 100644
--- a/deps/openssl/openssl/configdata.pm.in
+++ b/deps/openssl/openssl/configdata.pm.in
@@ -155,7 +155,7 @@ _____
my ($configuration_file, $configuration_file_in) = @_;
open CONFIGURATION, ">${configuration_file}.new"
- or die "Trying to create ${configuration_file_in}.new: $!";
+ or die "Trying to create ${configuration_file}.new: $!";
$tmpl = OpenSSL::Template->new(TYPE => 'FILE',
SOURCE => $configuration_file_in);
$tmpl->fill_in(FILENAME => $_,
@@ -211,15 +211,21 @@ _____
catfile($config{sourcedir}, 'include', 'openssl', 'configuration.h.in');
my $apps_configuration_h =
- catfile('apps', 'include', 'configuration.h');
+ catfile('apps', 'include', 'app_conf.h');
my $apps_configuration_h_in =
- catfile($config{sourcedir}, 'apps', 'include', 'configuration.h.in');
+ catfile($config{sourcedir}, 'apps', 'include', 'app_conf.h.in');
$create_configuration->($configuration_h, $configuration_h_in);
$update_configuration->($configuration_h, $configuration_h_in);
- $create_configuration->($apps_configuration_h, $apps_configuration_h_in);
- $update_configuration->($apps_configuration_h, $apps_configuration_h_in);
+ # With no-apps, the apps directory is skipped when the build tree
+ # is populated, so out of source there is no directory to write
+ # this file in. It isn't needed either, as nothing gets built
+ # in apps/ in that case.
+ unless ($disabled{apps}) {
+ $create_configuration->($apps_configuration_h, $apps_configuration_h_in);
+ $update_configuration->($apps_configuration_h, $apps_configuration_h_in);
+ }
exit(0);
}
diff --git a/deps/openssl/openssl/crypto/armcap.c b/deps/openssl/openssl/crypto/armcap.c
index f4f6b0d7f9b..50da659a32c 100644
--- a/deps/openssl/openssl/crypto/armcap.c
+++ b/deps/openssl/openssl/crypto/armcap.c
@@ -458,10 +458,17 @@ void OPENSSL_cpuid_setup(void)
|| MIDR_IS_CPU_MODEL(OPENSSL_arm_midr, ARM_CPU_IMP_APPLE, APPLE_CPU_PART_M2_AVALANCHE_MAX)
|| MIDR_IS_CPU_MODEL(OPENSSL_arm_midr, ARM_CPU_IMP_APPLE, APPLE_CPU_PART_M2_BLIZZARD_MAX)
|| MIDR_IS_CPU_MODEL(OPENSSL_arm_midr, ARM_CPU_IMP_QCOMM, QCOM_CPU_PART_ORYON_X1)
- || MIDR_IS_CPU_MODEL(OPENSSL_arm_midr, ARM_CPU_IMP_NVIDIA, NVIDIA_CPU_PART_OLYMPUS)))
+ || MIDR_IS_CPU_MODEL(OPENSSL_arm_midr, ARM_CPU_IMP_NVIDIA, NVIDIA_CPU_PART_OLYMPUS)
+ || MIDR_IS_CPU_MODEL(OPENSSL_arm_midr, ARM_CPU_IMP_ARM, ARM_CPU_PART_N3)
+ || MIDR_IS_CPU_MODEL(OPENSSL_arm_midr, ARM_CPU_IMP_ARM, ARM_CPU_PART_V3)))
OPENSSL_armcap_P |= ARMV8_HAVE_SHA3_AND_WORTH_USING;
- if (OPENSSL_armcap_P & ARMV9_SVE2) {
+ /*
+ * _armv8_sve_get_vl_bytes() executes an SVE instruction. Some kernels and
+ * hypervisors report SVE2 without SVE (e.g. guests on Apple M4, which has
+ * SME but no SVE), so require both before probing the vector length.
+ */
+ if ((OPENSSL_armcap_P & ARMV8_SVE) && (OPENSSL_armcap_P & ARMV9_SVE2)) {
uint64_t vl_bytes = _armv8_sve_get_vl_bytes();
if (vl_bytes > 16 && (vl_bytes & (vl_bytes - 1)) == 0) {
diff --git a/deps/openssl/openssl/crypto/asn1/asn1_lib.c b/deps/openssl/openssl/crypto/asn1/asn1_lib.c
index a216525f8df..dfd48b69f1e 100644
--- a/deps/openssl/openssl/crypto/asn1/asn1_lib.c
+++ b/deps/openssl/openssl/crypto/asn1/asn1_lib.c
@@ -433,7 +433,7 @@ int ossl_asn1_string_set_internal(ASN1_STRING *str, const uint8_t *data,
if ((size_t)str->length != alloc_len) {
uint8_t *c;
- c = OPENSSL_realloc(str->length == 0 ? NULL : str->data, alloc_len);
+ c = OPENSSL_realloc(str->data, alloc_len);
if (c == NULL)
return 0;
str->data = c;
diff --git a/deps/openssl/openssl/crypto/asn1/d2i_pr.c b/deps/openssl/openssl/crypto/asn1/d2i_pr.c
index 59ba8f909b8..23da86d25de 100644
--- a/deps/openssl/openssl/crypto/asn1/d2i_pr.c
+++ b/deps/openssl/openssl/crypto/asn1/d2i_pr.c
@@ -1,5 +1,5 @@
/*
- * Copyright 1995-2025 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1995-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -133,6 +133,8 @@ ossl_d2i_PrivateKey_legacy(int keytype, EVP_PKEY **a, const unsigned char **pp,
goto err;
}
EVP_PKEY_free(ret);
+ if (a != NULL)
+ *a = NULL;
ret = tmp;
ERR_pop_to_mark();
if (EVP_PKEY_type(keytype) != EVP_PKEY_get_base_id(ret))
diff --git a/deps/openssl/openssl/crypto/asn1/tasn_utl.c b/deps/openssl/openssl/crypto/asn1/tasn_utl.c
index ab1bb67b304..ddbfd787b69 100644
--- a/deps/openssl/openssl/crypto/asn1/tasn_utl.c
+++ b/deps/openssl/openssl/crypto/asn1/tasn_utl.c
@@ -7,6 +7,7 @@
* https://www.openssl.org/source/license.html
*/
+#include <limits.h>
#include <stddef.h>
#include <string.h>
#include "internal/cryptlib.h"
@@ -169,11 +170,20 @@ int ossl_asn1_enc_save(ASN1_VALUE **pval, const unsigned char *in, long inlen,
if (enc == NULL)
return 1;
+ /* A failure below leaves the item without a cached encoding */
OPENSSL_free(enc->enc);
- if (inlen <= 0) {
- enc->enc = NULL;
+ enc->enc = NULL;
+ enc->len = 0;
+ enc->modified = 1;
+
+ if (inlen <= 0)
+ return 0;
+#if LONG_MAX > INT_MAX
+ if (inlen > INT_MAX) {
+ ERR_raise(ERR_LIB_ASN1, ASN1_R_TOO_LONG);
return 0;
}
+#endif
if ((enc->enc = OPENSSL_malloc(inlen)) == NULL)
return 0;
memcpy(enc->enc, in, inlen);
@@ -190,6 +200,11 @@ int ossl_asn1_enc_restore(int *len, unsigned char **out, const ASN1_VALUE **pval
if (enc == NULL || enc->modified)
return 0;
+ /* Decline a length the int out-parameter cannot represent */
+#if LONG_MAX > INT_MAX
+ if (enc->len > INT_MAX)
+ return 0;
+#endif
if (out) {
memcpy(*out, enc->enc, enc->len);
*out += enc->len;
diff --git a/deps/openssl/openssl/crypto/bio/bf_readbuff.c b/deps/openssl/openssl/crypto/bio/bf_readbuff.c
index 36971a40c69..1b55ac64fd0 100644
--- a/deps/openssl/openssl/crypto/bio/bf_readbuff.c
+++ b/deps/openssl/openssl/crypto/bio/bf_readbuff.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2021-2024 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2021-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -87,18 +87,26 @@ static int readbuffer_free(BIO *a)
static int readbuffer_resize(BIO_F_BUFFER_CTX *ctx, int sz)
{
char *tmp;
+ size_t newsize;
- /* Figure out how many blocks are required */
- sz += (ctx->ibuf_off + DEFAULT_BUFFER_SIZE - 1);
- sz = DEFAULT_BUFFER_SIZE * (sz / DEFAULT_BUFFER_SIZE);
+ /*
+ * Do the arithmetic in size_t and fail if the required size does
+ * not fit in the int size/offset fields: ibuf_off only grows as
+ * data is cached, so the int calculation overflowed near INT_MAX.
+ */
+ newsize = (size_t)ctx->ibuf_off + (size_t)sz;
+ if (newsize > (size_t)(INT_MAX - (DEFAULT_BUFFER_SIZE - 1)))
+ return 0;
+ newsize += DEFAULT_BUFFER_SIZE - 1;
+ newsize = DEFAULT_BUFFER_SIZE * (newsize / DEFAULT_BUFFER_SIZE);
/* Resize if the buffer is not big enough */
- if (sz > ctx->ibuf_size) {
- tmp = OPENSSL_realloc(ctx->ibuf, sz);
+ if (newsize > (size_t)ctx->ibuf_size) {
+ tmp = OPENSSL_realloc(ctx->ibuf, newsize);
if (tmp == NULL)
return 0;
ctx->ibuf = tmp;
- ctx->ibuf_size = sz;
+ ctx->ibuf_size = (int)newsize;
}
return 1;
}
diff --git a/deps/openssl/openssl/crypto/bio/bio_addr.c b/deps/openssl/openssl/crypto/bio/bio_addr.c
index f1adbf99b44..9784246c0b6 100644
--- a/deps/openssl/openssl/crypto/bio/bio_addr.c
+++ b/deps/openssl/openssl/crypto/bio/bio_addr.c
@@ -146,7 +146,7 @@ int BIO_ADDR_rawmake(BIO_ADDR *ap, int family,
memset(&ap->s_in, 0, sizeof(ap->s_in));
ap->s_in.sin_family = family;
ap->s_in.sin_port = port;
- ap->s_in.sin_addr = *(struct in_addr *)where;
+ memcpy(&ap->s_in.sin_addr, where, sizeof(struct in_addr));
return 1;
}
#if OPENSSL_USE_IPV6
@@ -156,7 +156,7 @@ int BIO_ADDR_rawmake(BIO_ADDR *ap, int family,
memset(&ap->s_in6, 0, sizeof(ap->s_in6));
ap->s_in6.sin6_family = family;
ap->s_in6.sin6_port = port;
- ap->s_in6.sin6_addr = *(struct in6_addr *)where;
+ memcpy(&ap->s_in6.sin6_addr, where, sizeof(struct in6_addr));
return 1;
}
#endif
diff --git a/deps/openssl/openssl/crypto/bio/bss_dgram.c b/deps/openssl/openssl/crypto/bio/bss_dgram.c
index 0ef973c195d..94fa9eb8204 100644
--- a/deps/openssl/openssl/crypto/bio/bss_dgram.c
+++ b/deps/openssl/openssl/crypto/bio/bss_dgram.c
@@ -745,8 +745,8 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr)
BIO_ADDR_make(&data->peer, BIO_ADDR_sockaddr((BIO_ADDR *)ptr));
break;
case BIO_CTRL_DGRAM_DETECT_PEER_ADDR: {
- BIO_ADDR xaddr, *p = &data->peer;
- socklen_t xaddr_len = sizeof(xaddr.sa);
+ BIO_ADDR xaddr = { 0 }, *p = &data->peer;
+ socklen_t xaddr_len = sizeof(xaddr);
if (BIO_ADDR_family(p) == AF_UNSPEC) {
if (getpeername(b->num, (void *)&xaddr.sa, &xaddr_len) == 0
diff --git a/deps/openssl/openssl/crypto/bsearch.c b/deps/openssl/openssl/crypto/bsearch.c
index 201bc6e5f3e..a5d76c839c6 100644
--- a/deps/openssl/openssl/crypto/bsearch.c
+++ b/deps/openssl/openssl/crypto/bsearch.c
@@ -8,6 +8,7 @@
*/
#include <stddef.h>
+#include <limits.h>
#include "internal/cryptlib.h"
typedef int (*cmpthunk_fn)(const void *, const void *);
@@ -20,7 +21,7 @@ const void *ossl_bsearch(const void *key, const void *base, int num,
int l, h, i = 0, c = 0;
const char *p = NULL;
- if (num == 0)
+ if (num <= 0 || size <= 0 || num > INT_MAX / size)
return NULL;
l = 0;
h = num;
diff --git a/deps/openssl/openssl/crypto/camellia/build.info b/deps/openssl/openssl/crypto/camellia/build.info
index f13cd8c958b..7a559d8e302 100644
--- a/deps/openssl/openssl/crypto/camellia/build.info
+++ b/deps/openssl/openssl/crypto/camellia/build.info
@@ -16,6 +16,7 @@ ENDIF
SOURCE[../../libcrypto]=cmll_ecb.c cmll_ofb.c cmll_cfb.c cmll_ctr.c $CMLLASM
DEFINE[../../libcrypto]=$CMLLDEF
+DEFINE[../../providers/libdefault.a]=$CMLLDEF
GENERATE[cmll-x86.S]=asm/cmll-x86.pl
DEPEND[cmll-x86.S]=../perlasm/x86asm.pl
diff --git a/deps/openssl/openssl/crypto/chacha/build.info b/deps/openssl/openssl/crypto/chacha/build.info
index 41c22f7a981..4c93c5d0d6b 100644
--- a/deps/openssl/openssl/crypto/chacha/build.info
+++ b/deps/openssl/openssl/crypto/chacha/build.info
@@ -39,6 +39,7 @@ ENDIF
SOURCE[../../libcrypto]=$CHACHAASM
DEFINE[../../libcrypto]=$CHACHADEF
+DEFINE[../../providers/libdefault.a]=$CHACHADEF
GENERATE[chacha-x86.S]=asm/chacha-x86.pl
GENERATE[chacha-x86_64.s]=asm/chacha-x86_64.pl
diff --git a/deps/openssl/openssl/crypto/cmp/cmp_asn.c b/deps/openssl/openssl/crypto/cmp/cmp_asn.c
index 740e4466a1a..58a03d6ebf4 100644
--- a/deps/openssl/openssl/crypto/cmp/cmp_asn.c
+++ b/deps/openssl/openssl/crypto/cmp/cmp_asn.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2007-2025 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2007-2026 The OpenSSL Project Authors. All Rights Reserved.
* Copyright Nokia 2007-2019
* Copyright Siemens AG 2015-2019
*
@@ -462,9 +462,10 @@ int OSSL_CMP_ITAV_get1_certReqTemplate(const OSSL_CMP_ITAV *itav,
err:
OSSL_CRMF_CERTTEMPLATE_free(*certTemplate);
*certTemplate = NULL;
- sk_OSSL_CMP_ATAV_pop_free(*keySpec, OSSL_CMP_ATAV_free);
- if (keySpec != NULL)
+ if (keySpec != NULL) {
+ sk_OSSL_CMP_ATAV_pop_free(*keySpec, OSSL_CMP_ATAV_free);
*keySpec = NULL;
+ }
return 0;
}
diff --git a/deps/openssl/openssl/crypto/des/build.info b/deps/openssl/openssl/crypto/des/build.info
index 5a13e4f9beb..0fe2066fcc0 100644
--- a/deps/openssl/openssl/crypto/des/build.info
+++ b/deps/openssl/openssl/crypto/des/build.info
@@ -28,6 +28,7 @@ IF[{- !$disabled{module} && !$disabled{shared} -}]
ENDIF
DEFINE[../../libcrypto]=$DESDEF
+DEFINE[../../providers/libdefault.a]=$DESDEF
DEFINE[../../providers/libfips.a]=$DESDEF
# When all deprecated symbols are removed, libcrypto doesn't export the
diff --git a/deps/openssl/openssl/crypto/ec/ec_key.c b/deps/openssl/openssl/crypto/ec/ec_key.c
index d8640a4bca1..6e53f245a83 100644
--- a/deps/openssl/openssl/crypto/ec/ec_key.c
+++ b/deps/openssl/openssl/crypto/ec/ec_key.c
@@ -276,6 +276,11 @@ static int ec_generate_key(EC_KEY *eckey, int pairwise_test)
goto err;
}
+ if (BN_cmp(order, BN_value_one()) <= 0) {
+ ERR_raise(ERR_LIB_EC, EC_R_INVALID_GROUP_ORDER);
+ goto err;
+ }
+
do
if (!BN_priv_rand_range_ex(priv_key, order, 0, ctx))
goto err;
diff --git a/deps/openssl/openssl/crypto/ec/ec_lib.c b/deps/openssl/openssl/crypto/ec/ec_lib.c
index 6df9774ed90..e9fc64b6c7b 100644
--- a/deps/openssl/openssl/crypto/ec/ec_lib.c
+++ b/deps/openssl/openssl/crypto/ec/ec_lib.c
@@ -699,10 +699,17 @@ int EC_GROUP_cmp(const EC_GROUP *a, const EC_GROUP *b, BN_CTX *ctx)
if (r || BN_cmp(a1, b1) != 0 || BN_cmp(a2, b2) != 0 || BN_cmp(a3, b3) != 0)
r = 1;
- /* XXX EC_POINT_cmp() assumes that the methods are equal */
/* return 1 if the generators are different */
- if (r || EC_POINT_cmp(a, EC_GROUP_get0_generator(a), EC_GROUP_get0_generator(b), ctx) != 0)
- r = 1;
+ if (!r) {
+ const EC_POINT *ag = EC_GROUP_get0_generator(a);
+ const EC_POINT *bg = EC_GROUP_get0_generator(b);
+
+ if (ag == NULL || bg == NULL)
+ r = -1;
+ /* XXX EC_POINT_cmp() assumes that the methods are equal */
+ else if (EC_POINT_cmp(a, ag, bg, ctx) != 0)
+ r = 1;
+ }
if (!r) {
const BIGNUM *ao, *bo, *ac, *bc;
diff --git a/deps/openssl/openssl/crypto/evp/bio_enc.c b/deps/openssl/openssl/crypto/evp/bio_enc.c
index 4b12e49359f..0ba8857a13b 100644
--- a/deps/openssl/openssl/crypto/evp/bio_enc.c
+++ b/deps/openssl/openssl/crypto/evp/bio_enc.c
@@ -322,6 +322,10 @@ static long enc_ctrl(BIO *b, int cmd, long num, void *ptr)
case BIO_CTRL_RESET:
ctx->ok = 1;
ctx->finished = 0;
+ ctx->cont = 1;
+ ctx->buf_len = 0;
+ ctx->buf_off = 0;
+ ctx->read_end = ctx->read_start = &(ctx->buf[BUF_OFFSET]);
if (!EVP_CipherInit_ex(ctx->cipher, NULL, NULL, NULL, NULL,
EVP_CIPHER_CTX_is_encrypting(ctx->cipher)))
return 0;
diff --git a/deps/openssl/openssl/crypto/evp/keymgmt_lib.c b/deps/openssl/openssl/crypto/evp/keymgmt_lib.c
index 108601e939e..fc90ae238f5 100644
--- a/deps/openssl/openssl/crypto/evp/keymgmt_lib.c
+++ b/deps/openssl/openssl/crypto/evp/keymgmt_lib.c
@@ -98,6 +98,7 @@ void *evp_keymgmt_util_export_to_provider(EVP_PKEY *pk, EVP_KEYMGMT *keymgmt,
{
struct evp_keymgmt_util_try_import_data_st import_data;
OP_CACHE_ELEM *op;
+ size_t gen;
/* Export to where? */
if (keymgmt == NULL)
@@ -119,23 +120,28 @@ void *evp_keymgmt_util_export_to_provider(EVP_PKEY *pk, EVP_KEYMGMT *keymgmt,
&& pk->keymgmt->prov == keymgmt->prov))
return pk->keydata;
+retry:
if (!CRYPTO_THREAD_read_lock(pk->lock))
return NULL;
/*
- * If the provider native "origin" hasn't changed since last time, we
- * try to find our keymgmt in the operation cache. If it has changed
- * and our keymgmt isn't found, we will clear the cache further down.
+ * If this key is already exported to |keymgmt|, and the "origin" hasn't
+ * changed since that export, no more to do. Entries exported before the
+ * last change are never freed here, because operation contexts may still
+ * be using them. They stay in the cache, unused, until the key is
+ * released (see the comment on OP_CACHE_ELEM).
*/
- if (pk->dirty_cnt == pk->dirty_cnt_copy) {
- /* If this key is already exported to |keymgmt|, no more to do */
- op = evp_keymgmt_util_find_operation_cache(pk, keymgmt, selection);
- if (op != NULL && op->keymgmt != NULL) {
- void *ret = op->keydata;
-
- CRYPTO_THREAD_unlock(pk->lock);
- return ret;
- }
+ op = evp_keymgmt_util_find_operation_cache(pk, keymgmt, selection);
+ if (op != NULL && op->gen == pk->dirty_cnt) {
+ void *ret = op->keydata;
+
+ CRYPTO_THREAD_unlock(pk->lock);
+ return ret;
}
+ /*
+ * Note the dirty count before reading the "origin". The new entry is
+ * only cached if the count is the same when the export is done.
+ */
+ gen = pk->dirty_cnt;
CRYPTO_THREAD_unlock(pk->lock);
/* If the "origin" |keymgmt| doesn't support exporting, give up */
@@ -175,7 +181,7 @@ void *evp_keymgmt_util_export_to_provider(EVP_PKEY *pk, EVP_KEYMGMT *keymgmt,
}
/* Check to make sure some other thread didn't get there first */
op = evp_keymgmt_util_find_operation_cache(pk, keymgmt, selection);
- if (op != NULL && op->keydata != NULL) {
+ if (op != NULL && op->gen == pk->dirty_cnt) {
void *ret = op->keydata;
CRYPTO_THREAD_unlock(pk->lock);
@@ -190,11 +196,14 @@ void *evp_keymgmt_util_export_to_provider(EVP_PKEY *pk, EVP_KEYMGMT *keymgmt,
}
/*
- * If the dirty counter changed since last time, then clear the
- * operation cache. In that case, we know that |i| is zero.
+ * The "origin" changed while we were exporting, so the export may
+ * not match the current key. Discard it and export again.
*/
- if (pk->dirty_cnt != pk->dirty_cnt_copy)
- evp_keymgmt_util_clear_operation_cache(pk);
+ if (gen != pk->dirty_cnt) {
+ CRYPTO_THREAD_unlock(pk->lock);
+ evp_keymgmt_freedata(keymgmt, import_data.keydata);
+ goto retry;
+ }
/* Add the new export to the operation cache */
if (!evp_keymgmt_util_cache_keydata(pk, keymgmt, import_data.keydata,
@@ -204,9 +213,6 @@ void *evp_keymgmt_util_export_to_provider(EVP_PKEY *pk, EVP_KEYMGMT *keymgmt,
return NULL;
}
- /* Synchronize the dirty count */
- pk->dirty_cnt_copy = pk->dirty_cnt;
-
CRYPTO_THREAD_unlock(pk->lock);
return import_data.keydata;
@@ -232,16 +238,18 @@ OP_CACHE_ELEM *evp_keymgmt_util_find_operation_cache(EVP_PKEY *pk,
EVP_KEYMGMT *keymgmt,
int selection)
{
- int i, end = sk_OP_CACHE_ELEM_num(pk->operation_cache);
+ int i;
OP_CACHE_ELEM *p;
/*
* A comparison and sk_P_CACHE_ELEM_find() are avoided to not cause
* problems when we've only a read lock.
* A keymgmt is a match if the |keymgmt| pointers are identical or if the
- * provider and the name ID match
+ * provider and the name ID match.
+ * The newest entry is found first, so that an entry exported from the
+ * current "origin" is preferred over older ones for the same keymgmt.
*/
- for (i = 0; i < end; i++) {
+ for (i = sk_OP_CACHE_ELEM_num(pk->operation_cache) - 1; i >= 0; i--) {
p = sk_OP_CACHE_ELEM_value(pk->operation_cache, i);
if ((p->selection & selection) == selection
&& (keymgmt == p->keymgmt
@@ -270,6 +278,7 @@ int evp_keymgmt_util_cache_keydata(EVP_PKEY *pk, EVP_KEYMGMT *keymgmt,
p->keydata = keydata;
p->keymgmt = keymgmt;
p->selection = selection;
+ p->gen = pk->dirty_cnt;
if (!EVP_KEYMGMT_up_ref(keymgmt)) {
OPENSSL_free(p);
diff --git a/deps/openssl/openssl/crypto/evp/p_lib.c b/deps/openssl/openssl/crypto/evp/p_lib.c
index 5fdcebf55ca..f8e6e05d679 100644
--- a/deps/openssl/openssl/crypto/evp/p_lib.c
+++ b/deps/openssl/openssl/crypto/evp/p_lib.c
@@ -2352,8 +2352,25 @@ int EVP_PKEY_set_params(EVP_PKEY *pkey, OSSL_PARAM params[])
{
if (pkey != NULL) {
if (evp_pkey_is_provided(pkey)) {
+ int ret;
+
+ /* Without a set_params method the key cannot change */
+ if (pkey->keymgmt->set_params == NULL)
+ return 1;
+
+ ret = evp_keymgmt_set_params(pkey->keymgmt, pkey->keydata, params);
+
+ /*
+ * Increment the dirty count after the key has changed, under
+ * the lock the export code uses. An export that read the key
+ * before or during the change carries an older count, so it
+ * is never used as current.
+ */
+ if (!CRYPTO_THREAD_write_lock(pkey->lock))
+ return 0;
pkey->dirty_cnt++;
- return evp_keymgmt_set_params(pkey->keymgmt, pkey->keydata, params);
+ CRYPTO_THREAD_unlock(pkey->lock);
+ return ret;
}
#ifndef FIPS_MODULE
/*
diff --git a/deps/openssl/openssl/crypto/evp/pmeth_lib.c b/deps/openssl/openssl/crypto/evp/pmeth_lib.c
index 963e0615c2c..3ffe51d822f 100644
--- a/deps/openssl/openssl/crypto/evp/pmeth_lib.c
+++ b/deps/openssl/openssl/crypto/evp/pmeth_lib.c
@@ -230,6 +230,7 @@ void evp_pkey_ctx_free_old_ops(EVP_PKEY_CTX *ctx)
} else if (EVP_PKEY_CTX_IS_GEN_OP(ctx)) {
if (ctx->op.keymgmt.genctx != NULL && ctx->keymgmt != NULL)
evp_keymgmt_gen_cleanup(ctx->keymgmt, ctx->op.keymgmt.genctx);
+ ctx->op.keymgmt.genctx = NULL;
}
}
diff --git a/deps/openssl/openssl/crypto/hashtable/hashtable.c b/deps/openssl/openssl/crypto/hashtable/hashtable.c
index 1cce15ed244..132e3ada475 100644
--- a/deps/openssl/openssl/crypto/hashtable/hashtable.c
+++ b/deps/openssl/openssl/crypto/hashtable/hashtable.c
@@ -590,8 +590,9 @@ static ossl_inline int match_key(HT_KEY *a, HT_KEY *b)
*/
PREFETCH(a->keybuf);
PREFETCH(b->keybuf);
- if (a->keybuf != NULL && b->keybuf != NULL && a->keysize == b->keysize)
- return !memcmp(a->keybuf, b->keybuf, a->keysize);
+ if (a->keybuf != NULL && b->keybuf != NULL)
+ return a->keysize == b->keysize
+ && !memcmp(a->keybuf, b->keybuf, a->keysize);
return 1;
}
diff --git a/deps/openssl/openssl/crypto/hmac/build.info b/deps/openssl/openssl/crypto/hmac/build.info
index 90b43cf42b3..b8471c6c5a1 100644
--- a/deps/openssl/openssl/crypto/hmac/build.info
+++ b/deps/openssl/openssl/crypto/hmac/build.info
@@ -17,6 +17,7 @@ IF[{- !$disabled{asm} -}]
ENDIF
DEFINE[../../libcrypto]=$HMACDEF
+DEFINE[../../providers/libdefault.a]=$HMACDEF
DEFINE[../../providers/libfips.a]=$HMACDEF
SOURCE[../../libcrypto]=$COMMON $HMACASM
diff --git a/deps/openssl/openssl/crypto/hpke/hpke.c b/deps/openssl/openssl/crypto/hpke/hpke.c
index 0a301e462fb..fd1ab198703 100644
--- a/deps/openssl/openssl/crypto/hpke/hpke.c
+++ b/deps/openssl/openssl/crypto/hpke/hpke.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2022-2025 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2022-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -149,7 +149,7 @@ static int hpke_aead_dec(OSSL_HPKE_CTX *hctx, const unsigned char *iv,
size_t taglen;
taglen = hctx->aead_info->taglen;
- if (ctlen <= taglen || *ptlen < ctlen - taglen
+ if (ctlen < taglen || *ptlen < ctlen - taglen
|| aadlen > INT_MAX || ctlen > INT_MAX) {
ERR_raise(ERR_LIB_CRYPTO, ERR_R_PASSED_INVALID_ARGUMENT);
return 0;
@@ -180,9 +180,13 @@ static int hpke_aead_dec(OSSL_HPKE_CTX *hctx, const unsigned char *iv,
goto err;
}
}
- if (EVP_DecryptUpdate(ctx, pt, &len, ct, (int)(ctlen - taglen)) != 1) {
- ERR_raise(ERR_LIB_CRYPTO, ERR_R_INTERNAL_ERROR);
- goto err;
+ if (ctlen > taglen) {
+ if (EVP_DecryptUpdate(ctx, pt, &len, ct, (int)(ctlen - taglen)) != 1) {
+ ERR_raise(ERR_LIB_CRYPTO, ERR_R_INTERNAL_ERROR);
+ goto err;
+ }
+ } else {
+ len = 0;
}
*ptlen = len;
if (!EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG,
@@ -190,11 +194,19 @@ static int hpke_aead_dec(OSSL_HPKE_CTX *hctx, const unsigned char *iv,
ERR_raise(ERR_LIB_CRYPTO, ERR_R_INTERNAL_ERROR);
goto err;
}
- /* Finalise decryption. */
- if (EVP_DecryptFinal_ex(ctx, pt + len, &len) <= 0) {
+ /*
+ * Finalise decryption, which checks the tag. Ideally, we would simply write
+ * pt + len here, but the caller may have passed a zero-length output buffer
+ * if ctlen == taglen. pt may be NULL for a zero-length buffer. However,
+ * before C2y, NULL + 0 was undefined. While this will be fixed and applied
+ * to old C versions retroactively, we support old compilers and sanitizers.
+ * https://developers.redhat.com/articles/2024/12/11/making-memcpynull-null-0-well-defined
+ */
+ if (EVP_DecryptFinal_ex(ctx, len ? pt + len : pt, &len) <= 0) {
ERR_raise(ERR_LIB_CRYPTO, ERR_R_INTERNAL_ERROR);
goto err;
}
+ *ptlen += len;
erv = 1;
err:
@@ -228,7 +240,7 @@ static int hpke_aead_enc(OSSL_HPKE_CTX *hctx, const unsigned char *iv,
unsigned char tag[EVP_MAX_AEAD_TAG_LENGTH];
taglen = hctx->aead_info->taglen;
- if (*ctlen <= taglen || ptlen > *ctlen - taglen
+ if (*ctlen < taglen || ptlen > *ctlen - taglen
|| aadlen > INT_MAX || ptlen > INT_MAX) {
ERR_raise(ERR_LIB_CRYPTO, ERR_R_PASSED_INVALID_ARGUMENT);
return 0;
@@ -263,9 +275,13 @@ static int hpke_aead_enc(OSSL_HPKE_CTX *hctx, const unsigned char *iv,
goto err;
}
}
- if (EVP_EncryptUpdate(ctx, ct, &len, pt, (int)ptlen) != 1) {
- ERR_raise(ERR_LIB_CRYPTO, ERR_R_INTERNAL_ERROR);
- goto err;
+ if (ptlen != 0) {
+ if (EVP_EncryptUpdate(ctx, ct, &len, pt, (int)ptlen) != 1) {
+ ERR_raise(ERR_LIB_CRYPTO, ERR_R_INTERNAL_ERROR);
+ goto err;
+ }
+ } else {
+ len = 0;
}
*ctlen = len;
/* Finalise the encryption. */
@@ -1171,7 +1187,7 @@ int OSSL_HPKE_seal(OSSL_HPKE_CTX *ctx,
size_t seqlen = 0;
if (ctx == NULL || ct == NULL || ctlen == NULL || *ctlen == 0
- || pt == NULL || ptlen == 0) {
+ || (pt == NULL && ptlen != 0)) {
ERR_raise(ERR_LIB_CRYPTO, ERR_R_PASSED_INVALID_ARGUMENT);
return 0;
}
@@ -1212,7 +1228,7 @@ int OSSL_HPKE_open(OSSL_HPKE_CTX *ctx,
unsigned char seqbuf[OSSL_HPKE_MAX_NONCELEN];
size_t seqlen = 0;
- if (ctx == NULL || pt == NULL || ptlen == NULL || *ptlen == 0
+ if (ctx == NULL || ptlen == NULL || (pt == NULL && *ptlen != 0)
|| ct == NULL || ctlen == 0) {
ERR_raise(ERR_LIB_CRYPTO, ERR_R_PASSED_INVALID_ARGUMENT);
return 0;
diff --git a/deps/openssl/openssl/crypto/http/http_client.c b/deps/openssl/openssl/crypto/http/http_client.c
index db0aaf6d8bd..d4946813044 100644
--- a/deps/openssl/openssl/crypto/http/http_client.c
+++ b/deps/openssl/openssl/crypto/http/http_client.c
@@ -70,6 +70,17 @@ struct ossl_http_req_ctx_st {
time_t max_total_time; /* Maximum end time of total transfer, or 0 */
char *redirection_url; /* Location obtained from HTTP status 301/302 */
size_t max_hdr_lines; /* Max. number of response header lines, or 0 */
+ /*
+ * Parsing state of the response being received, reset when reading of
+ * the response starts and kept across OSSL_HTTP_REQ_CTX_nbio() calls
+ * that return -1
+ */
+ int status_code; /* HTTP status code of response being received */
+ int got_text; /* Response Content-Type is (likely) text */
+ int found_expected_ct; /* Expected Content-Type was found in response */
+ int found_keep_alive; /* Response indicates persistent connection */
+ size_t resp_hdr_lines; /* Number of response header lines received */
+ size_t err_content_len; /* Length of error response content received */
};
/* HTTP client OSSL_HTTP_REQ_CTX_nbio() internal states, in typical order */
@@ -567,14 +578,11 @@ static int may_still_retry(time_t max_time, int *ptimeout)
*/
int OSSL_HTTP_REQ_CTX_nbio(OSSL_HTTP_REQ_CTX *rctx)
{
- int i, found_expected_ct = 0, found_keep_alive = 0;
- int status_code = 0;
- int got_text = 1;
+ int i;
long n;
- size_t resp_len = 0;
+ size_t resp_len;
const unsigned char *p;
char *buf, *key, *value, *line_end = NULL;
- size_t resp_hdr_lines = 0;
if (rctx == NULL) {
ERR_raise(ERR_LIB_HTTP, ERR_R_PASSED_NULL_PARAMETER);
@@ -606,7 +614,8 @@ next_io:
if (OSSL_TRACE_ENABLED(HTTP))
OSSL_TRACE(HTTP, "]\n"); /* end of error response content */
/* in addition, throw error on inconsistent length: */
- (void)check_set_resp_len("error response content", rctx, resp_len);
+ (void)check_set_resp_len("error response content", rctx,
+ rctx->err_content_len);
return 0;
}
if (BIO_should_retry(rctx->rbio))
@@ -695,6 +704,13 @@ next_io:
i = BIO_flush(rctx->wbio);
if (i > 0) {
+ /* start of response: reset response-wide parsing state */
+ rctx->status_code = 0;
+ rctx->got_text = 1;
+ rctx->found_expected_ct = 0;
+ rctx->found_keep_alive = 0;
+ rctx->resp_hdr_lines = 0;
+ rctx->err_content_len = 0;
rctx->state = OHS_FIRSTLINE;
goto next_io;
}
@@ -738,16 +754,18 @@ next_io:
}
if (rctx->state == OHS_ERROR_CONTENT) {
- resp_len += n;
- if (!check_max_len("error response content", rctx->max_resp_len, resp_len))
+ rctx->err_content_len += n;
+ if (!check_max_len("error response content", rctx->max_resp_len,
+ rctx->err_content_len))
return 0;
if (OSSL_TRACE_ENABLED(HTTP)) /* dump response content line */
- OSSL_TRACE_STRING(HTTP, got_text, 1, (unsigned char *)buf, n);
+ OSSL_TRACE_STRING(HTTP, rctx->got_text, 1, (unsigned char *)buf, n);
goto next_line;
}
- resp_hdr_lines++;
- if (rctx->max_hdr_lines != 0 && rctx->max_hdr_lines < resp_hdr_lines) {
+ rctx->resp_hdr_lines++;
+ if (rctx->max_hdr_lines != 0
+ && rctx->max_hdr_lines < rctx->resp_hdr_lines) {
ERR_raise(ERR_LIB_HTTP, HTTP_R_RESPONSE_TOO_MANY_HDRLINES);
rctx->state = OHS_ERROR;
return 0;
@@ -769,8 +787,8 @@ next_io:
/* First line in response header */
if (rctx->state == OHS_FIRSTLINE) {
- status_code = parse_http_line1(buf, &found_keep_alive);
- switch (status_code) {
+ rctx->status_code = parse_http_line1(buf, &rctx->found_keep_alive);
+ switch (rctx->status_code) {
case HTTP_STATUS_CODE_OK:
rctx->state = OHS_HEADERS;
goto next_line;
@@ -785,7 +803,7 @@ next_io:
/* fall through */
default:
/* must return content if status >= 400 */
- rctx->state = status_code < HTTP_STATUS_CODES_NONFATAL_ERROR
+ rctx->state = rctx->status_code < HTTP_STATUS_CODES_NONFATAL_ERROR
? OHS_HEADERS_ERROR
: OHS_HEADERS;
goto next_line; /* continue parsing, also on HTTP error */
@@ -814,15 +832,15 @@ next_io:
return 0;
}
if (OPENSSL_strcasecmp(key, "Content-Type") == 0) {
- got_text = HAS_CASE_PREFIX(value, "text/");
- if (got_text
+ rctx->got_text = HAS_CASE_PREFIX(value, "text/");
+ if (rctx->got_text
&& rctx->state == OHS_HEADERS
&& rctx->expect_asn1
- && (status_code >= HTTP_STATUS_CODES_NONFATAL_ERROR
- || status_code == HTTP_STATUS_CODE_OK)) {
+ && (rctx->status_code >= HTTP_STATUS_CODES_NONFATAL_ERROR
+ || rctx->status_code == HTTP_STATUS_CODE_OK)) {
ERR_raise_data(ERR_LIB_HTTP, HTTP_R_CONTENT_TYPE_MISMATCH,
"expected ASN.1 content but got http code %d with Content-Type: %s",
- status_code, value);
+ rctx->status_code, value);
rctx->state = OHS_HEADERS_ERROR;
goto next_line;
}
@@ -844,16 +862,16 @@ next_io:
rctx->expected_ct, value);
return 0;
}
- found_expected_ct = 1;
+ rctx->found_expected_ct = 1;
}
}
/* https://tools.ietf.org/html/rfc7230#section-6.3 Persistence */
if (OPENSSL_strcasecmp(key, "Connection") == 0) {
if (OPENSSL_strcasecmp(value, "keep-alive") == 0)
- found_keep_alive = 1;
+ rctx->found_keep_alive = 1;
else if (OPENSSL_strcasecmp(value, "close") == 0)
- found_keep_alive = 0;
+ rctx->found_keep_alive = 0;
} else if (OPENSSL_strcasecmp(key, "Content-Length") == 0) {
size_t content_len = (size_t)strtoul(value, &line_end, 10);
@@ -881,7 +899,7 @@ next_io:
OSSL_TRACE(HTTP, "]\n"); /* end of response header */
if (rctx->keep_alive != 0 /* do not let server initiate keep_alive */
- && !found_keep_alive /* otherwise there is no change */) {
+ && !rctx->found_keep_alive /* otherwise there is no change */) {
if (rctx->keep_alive == 2) {
rctx->keep_alive = 0;
ERR_raise(ERR_LIB_HTTP, HTTP_R_SERVER_CANCELED_CONNECTION);
@@ -894,7 +912,7 @@ next_io:
rctx->state = OHS_ERROR_CONTENT;
if (OSSL_TRACE_ENABLED(HTTP)) {
OSSL_TRACE1(HTTP, "Receiving error response content (likely %s): [\n",
- got_text ? "text" : "ASN.1");
+ rctx->got_text ? "text" : "ASN.1");
goto next_line;
}
/* discard response content when trace not enabled */
@@ -902,7 +920,7 @@ next_io:
return 0;
}
- if (rctx->expected_ct != NULL && !found_expected_ct) {
+ if (rctx->expected_ct != NULL && !rctx->found_expected_ct) {
ERR_raise_data(ERR_LIB_HTTP, HTTP_R_MISSING_CONTENT_TYPE,
"expected=%s", rctx->expected_ct);
return 0;
diff --git a/deps/openssl/openssl/crypto/lhash/lhash.c b/deps/openssl/openssl/crypto/lhash/lhash.c
index ad8c7a6280c..df1442811da 100644
--- a/deps/openssl/openssl/crypto/lhash/lhash.c
+++ b/deps/openssl/openssl/crypto/lhash/lhash.c
@@ -1,5 +1,5 @@
/*
- * Copyright 1995-2025 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1995-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -203,10 +203,22 @@ static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg,
a = lh->b[i];
while (a != NULL) {
n = a->next;
- if (use_arg)
- wfunc_arg(a->data, arg, func_arg);
- else
- wfunc(a->data, func);
+ /*
+ * Tables created with OPENSSL_LH_new() have no thunks, so fall
+ * back to calling the caller supplied function directly, as
+ * getrn() does for the hash and compare functions.
+ */
+ if (use_arg) {
+ if (wfunc_arg != NULL)
+ wfunc_arg(a->data, arg, func_arg);
+ else
+ func_arg(a->data, arg);
+ } else {
+ if (wfunc != NULL)
+ wfunc(a->data, func);
+ else
+ func(a->data);
+ }
a = n;
}
}
diff --git a/deps/openssl/openssl/crypto/md5/build.info b/deps/openssl/openssl/crypto/md5/build.info
index 9a73db39516..4ae2df98303 100644
--- a/deps/openssl/openssl/crypto/md5/build.info
+++ b/deps/openssl/openssl/crypto/md5/build.info
@@ -33,6 +33,7 @@ ENDIF
# Implementations are now spread across several libraries, so the defines
# need to be applied to all affected libraries and modules.
DEFINE[../../libcrypto]=$MD5DEF
+DEFINE[../../providers/libdefault.a]=$MD5DEF
DEFINE[../../providers/liblegacy.a]=$MD5DEF
GENERATE[md5-586.S]=asm/md5-586.pl
diff --git a/deps/openssl/openssl/crypto/mem_clr.c b/deps/openssl/openssl/crypto/mem_clr.c
index d76ef73179d..b349791bc0d 100644
--- a/deps/openssl/openssl/crypto/mem_clr.c
+++ b/deps/openssl/openssl/crypto/mem_clr.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2002-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -21,5 +21,13 @@ static volatile memset_t memset_func = memset;
void OPENSSL_cleanse(void *ptr, size_t len)
{
- memset_func(ptr, 0, len);
+ /*
+ * If len is zero, ptr may be NULL. However, due to a C language bug, memset
+ * cannot be called with NULL and zero. This will be fixed in C2y and
+ * retroactively applied to older versions of C, but we still support older
+ * compilers and sanitizers, so explicitly check len. See
+ * https://developers.redhat.com/articles/2024/12/11/making-memcpynull-null-0-well-defined
+ */
+ if (len != 0)
+ memset_func(ptr, 0, len);
}
diff --git a/deps/openssl/openssl/crypto/ml_kem/build.info b/deps/openssl/openssl/crypto/ml_kem/build.info
index e5937019185..b1b5ef07fe6 100644
--- a/deps/openssl/openssl/crypto/ml_kem/build.info
+++ b/deps/openssl/openssl/crypto/ml_kem/build.info
@@ -26,4 +26,5 @@ ENDIF
# Implementations are now spread across several libraries, so the defines
# need to be applied to all affected libraries and modules.
DEFINE[../../libcrypto]=$MLKEMDEF
+DEFINE[../../providers/libdefault.a]=$MLKEMDEF
DEFINE[../../providers/libfips.a]=$MLKEMDEF
diff --git a/deps/openssl/openssl/crypto/modes/build.info b/deps/openssl/openssl/crypto/modes/build.info
index cd4e0330dac..6fcd1994292 100644
--- a/deps/openssl/openssl/crypto/modes/build.info
+++ b/deps/openssl/openssl/crypto/modes/build.info
@@ -68,6 +68,7 @@ SOURCE[../../providers/libfips.a]=$COMMON
# Implementations are now spread across several libraries, so the defines
# need to be applied to all affected libraries and modules.
DEFINE[../../libcrypto]=$MODESDEF
+DEFINE[../../providers/libdefault.a]=$MODESDEF
DEFINE[../../providers/libfips.a]=$MODESDEF
diff --git a/deps/openssl/openssl/crypto/objects/objects.txt b/deps/openssl/openssl/crypto/objects/objects.txt
index b9d627e0742..c3da703a891 100644
--- a/deps/openssl/openssl/crypto/objects/objects.txt
+++ b/deps/openssl/openssl/crypto/objects/objects.txt
@@ -473,7 +473,7 @@ ms-corp 21 10 : ms-app-policies : Microsoft Application Policies Extension
!Cname idea-ofb64
: IDEA-OFB : idea-ofb
-1 3 6 1 4 1 3029 1 2 : BF-CBC : bf-cbc
+1 3 6 1 4 1 3029 1 1 2 : BF-CBC : bf-cbc
: BF-ECB : bf-ecb
!Cname bf-cfb64
: BF-CFB : bf-cfb
diff --git a/deps/openssl/openssl/crypto/pem/pem_info.c b/deps/openssl/openssl/crypto/pem/pem_info.c
index 281dfd69ed2..67c963c8ee5 100644
--- a/deps/openssl/openssl/crypto/pem/pem_info.c
+++ b/deps/openssl/openssl/crypto/pem/pem_info.c
@@ -68,7 +68,7 @@ STACK_OF(X509_INFO) *PEM_X509_INFO_read_bio_ex(BIO *bp, STACK_OF(X509_INFO) *sk,
unsigned char *data = NULL;
const unsigned char *p;
long len, error = 0;
- int ok = 0;
+ int ok = 0, preserve_cnt = 0;
STACK_OF(X509_INFO) *ret = NULL;
unsigned int i, raw, ptype;
pem_info_type itype = PEM_INFO_NONE;
@@ -78,8 +78,10 @@ STACK_OF(X509_INFO) *PEM_X509_INFO_read_bio_ex(BIO *bp, STACK_OF(X509_INFO) *sk,
ERR_raise(ERR_LIB_PEM, ERR_R_CRYPTO_LIB);
goto err;
}
- } else
+ } else {
ret = sk;
+ preserve_cnt = sk_X509_INFO_num(sk);
+ }
if ((xi = X509_INFO_new()) == NULL)
goto err;
@@ -229,10 +231,8 @@ STACK_OF(X509_INFO) *PEM_X509_INFO_read_bio_ex(BIO *bp, STACK_OF(X509_INFO) *sk,
err:
X509_INFO_free(xi);
if (!ok) {
- for (i = 0; ((int)i) < sk_X509_INFO_num(ret); i++) {
- xi = sk_X509_INFO_value(ret, i);
- X509_INFO_free(xi);
- }
+ while (sk_X509_INFO_num(ret) > preserve_cnt)
+ X509_INFO_free(sk_X509_INFO_pop(ret));
if (ret != sk)
sk_X509_INFO_free(ret);
ret = NULL;
diff --git a/deps/openssl/openssl/crypto/perlasm/x86asm.pl b/deps/openssl/openssl/crypto/perlasm/x86asm.pl
index 05b5ff94c54..2ec16c5571d 100644
--- a/deps/openssl/openssl/crypto/perlasm/x86asm.pl
+++ b/deps/openssl/openssl/crypto/perlasm/x86asm.pl
@@ -174,9 +174,9 @@ sub ::vprotd
sub ::endbranch
{
- &::generic("%ifdef __CET__\n");
+ &::generic("#ifdef __CET__\n");
&::data_byte(0xf3,0x0f,0x1e,0xfb);
- &::generic("%endif\n");
+ &::generic("#endif\n");
}
# label management
diff --git a/deps/openssl/openssl/crypto/pkcs12/p12_utl.c b/deps/openssl/openssl/crypto/pkcs12/p12_utl.c
index dd8e9697677..3013ef81f02 100644
--- a/deps/openssl/openssl/crypto/pkcs12/p12_utl.c
+++ b/deps/openssl/openssl/crypto/pkcs12/p12_utl.c
@@ -8,25 +8,37 @@
*/
#include <stdio.h>
+#include <limits.h>
#include "internal/cryptlib.h"
+#include "internal/safe_math.h"
#include <openssl/pkcs12.h>
#include "p12_local.h"
#include "crypto/pkcs7/pk7_local.h"
#include <crypto/asn1.h>
+OSSL_SAFE_MATH_SIGNED(int, int)
+
/* Cheap and nasty Unicode stuff */
unsigned char *OPENSSL_asc2uni(const char *asc, int asclen,
unsigned char **uni, int *unilen)
{
- int ulen, i;
+ int ulen, i, err = 0;
unsigned char *unitmp;
- if (asclen == -1)
- asclen = (int)strlen(asc);
+ if (asclen == -1) {
+ size_t len = strlen(asc);
+
+ if (len > INT_MAX)
+ return NULL;
+ asclen = (int)len;
+ }
if (asclen < 0)
return NULL;
- ulen = asclen * 2 + 2;
+ /* If this changes, revisit test_safe_math_asc2uni_boundary() */
+ ulen = safe_add_int(safe_mul_int(asclen, 2, &err), 2, &err);
+ if (err)
+ return NULL;
if ((unitmp = OPENSSL_malloc(ulen)) == NULL)
return NULL;
for (i = 0; i < ulen - 2; i += 2) {
diff --git a/deps/openssl/openssl/crypto/pkcs7/pk7_doit.c b/deps/openssl/openssl/crypto/pkcs7/pk7_doit.c
index 3799dec1dab..c46d9e23489 100644
--- a/deps/openssl/openssl/crypto/pkcs7/pk7_doit.c
+++ b/deps/openssl/openssl/crypto/pkcs7/pk7_doit.c
@@ -263,6 +263,10 @@ BIO *PKCS7_dataInit(PKCS7 *p7, BIO *bio)
switch (i) {
case NID_pkcs7_signed:
md_sk = p7->d.sign->md_algs;
+ if (p7->d.sign->contents == NULL) {
+ ERR_raise(ERR_LIB_PKCS7, PKCS7_R_NO_CONTENT);
+ goto err;
+ }
os = pkcs7_get1_data(p7->d.sign->contents,
(p7->state & PKCS7_STATE_STREAMING) != 0);
break;
@@ -287,6 +291,10 @@ BIO *PKCS7_dataInit(PKCS7 *p7, BIO *bio)
break;
case NID_pkcs7_digest:
xa = p7->d.digest->md;
+ if (p7->d.digest->contents == NULL) {
+ ERR_raise(ERR_LIB_PKCS7, PKCS7_R_NO_CONTENT);
+ goto err;
+ }
os = pkcs7_get1_data(p7->d.digest->contents,
(p7->state & PKCS7_STATE_STREAMING) != 0);
break;
@@ -470,6 +478,10 @@ BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert)
* data_body is NULL if that structure has no (=detached) content
* or if the contentType is wrong (i.e., not "data").
*/
+ if (p7->d.sign->contents == NULL) {
+ ERR_raise(ERR_LIB_PKCS7, PKCS7_R_NO_CONTENT);
+ goto err;
+ }
data_body = PKCS7_get_octet_string(p7->d.sign->contents);
if (!PKCS7_is_detached(p7) && data_body == NULL) {
ERR_raise(ERR_LIB_PKCS7, PKCS7_R_INVALID_SIGNED_DATA_TYPE);
diff --git a/deps/openssl/openssl/crypto/pkcs7/pk7_lib.c b/deps/openssl/openssl/crypto/pkcs7/pk7_lib.c
index 539bb1633b8..da2abc5ac54 100644
--- a/deps/openssl/openssl/crypto/pkcs7/pk7_lib.c
+++ b/deps/openssl/openssl/crypto/pkcs7/pk7_lib.c
@@ -28,7 +28,7 @@ long PKCS7_ctrl(PKCS7 *p7, int cmd, long larg, char *parg)
/* NOTE(emilia): does not support detached digested data. */
case PKCS7_OP_SET_DETACHED_SIGNATURE:
if (nid == NID_pkcs7_signed) {
- if (p7->d.sign == NULL) {
+ if (p7->d.sign == NULL || p7->d.sign->contents == NULL) {
ERR_raise(ERR_LIB_PKCS7, PKCS7_R_NO_CONTENT);
ret = 0;
break;
diff --git a/deps/openssl/openssl/crypto/poly1305/asm/poly1305-armv9-sve2.pl b/deps/openssl/openssl/crypto/poly1305/asm/poly1305-armv9-sve2.pl
index 1ba59c796d5..aa35299494f 100755
--- a/deps/openssl/openssl/crypto/poly1305/asm/poly1305-armv9-sve2.pl
+++ b/deps/openssl/openssl/crypto/poly1305/asm/poly1305-armv9-sve2.pl
@@ -1418,4 +1418,4 @@ foreach my $line (split("\n",$code)) {
}
}
- STDOUT or die "error closing STDOUT: $!";
+close STDOUT or die "error closing STDOUT: $!";
diff --git a/deps/openssl/openssl/crypto/poly1305/build.info b/deps/openssl/openssl/crypto/poly1305/build.info
index 5c35c8eceea..5cf114b577d 100644
--- a/deps/openssl/openssl/crypto/poly1305/build.info
+++ b/deps/openssl/openssl/crypto/poly1305/build.info
@@ -34,6 +34,7 @@ SOURCE[../../libcrypto]=poly1305.c $POLY1305ASM
# Implementations are now spread across several libraries, so the defines
# need to be applied to all affected libraries and modules.
DEFINE[../../libcrypto]=$POLY1305DEF
+DEFINE[../../providers/libdefault.a]=$POLY1305DEF
GENERATE[poly1305-sparcv9.S]=asm/poly1305-sparcv9.pl
INCLUDE[poly1305-sparcv9.o]=..
diff --git a/deps/openssl/openssl/crypto/provider_core.c b/deps/openssl/openssl/crypto/provider_core.c
index 127cb4a23c2..8da05e582b9 100644
--- a/deps/openssl/openssl/crypto/provider_core.c
+++ b/deps/openssl/openssl/crypto/provider_core.c
@@ -1306,6 +1306,10 @@ static int provider_activate(OSSL_PROVIDER *prov, int lock, int upcalls)
if (count == 1 && store != NULL) {
ret = create_provider_children(prov);
+ if (!ret
+ && CRYPTO_atomic_add(&prov->activatecnt, -1, &count,
+ prov->activatecnt_lock))
+ prov->flag_activated = 0;
}
}
if (lock) {
@@ -1445,6 +1449,9 @@ static int provider_activate_fallbacks(struct provider_store_st *store)
int activated_fallback_count = 0;
int ret = 0;
const OSSL_PROVIDER_INFO *p;
+ OSSL_PROVIDER tmpl = {
+ 0,
+ };
if (!CRYPTO_THREAD_read_lock(store->lock))
return 0;
@@ -1467,10 +1474,39 @@ static int provider_activate_fallbacks(struct provider_store_st *store)
OSSL_PROVIDER_INFO *info = store->provinfo;
STACK_OF(INFOPAIR) *params = NULL;
size_t i;
+ int idx;
if (!p->is_fallback)
continue;
+ /*
+ * Reuse an explicitly loaded fallback and take the activation
+ * reference normally owned by automatic fallback loading.
+ */
+ tmpl.name = (char *)p->name;
+ idx = sk_OSSL_PROVIDER_find(store->providers, &tmpl);
+ if (idx != -1) {
+ int activate_count;
+
+ prov = sk_OSSL_PROVIDER_value(store->providers, idx);
+ /*
+ * store->lock is held. Take flag_lock in order and suppress
+ * internal locking. Fallback entries cannot require parent upcalls.
+ */
+#ifndef FIPS_MODULE
+ if (!ossl_assert(!prov->ischild))
+ goto err;
+#endif
+ if (!CRYPTO_THREAD_write_lock(prov->flag_lock))
+ goto err;
+ activate_count = provider_activate(prov, 0, 0);
+ CRYPTO_THREAD_unlock(prov->flag_lock);
+ if (activate_count < 0)
+ goto err;
+ activated_fallback_count++;
+ continue;
+ }
+
for (i = 0; i < store->numprovinfo; info++, i++) {
if (strcmp(info->name, p->name) != 0)
continue;
diff --git a/deps/openssl/openssl/crypto/rand/prov_seed.c b/deps/openssl/openssl/crypto/rand/prov_seed.c
index d0c7c635511..e2dc76e2d71 100644
--- a/deps/openssl/openssl/crypto/rand/prov_seed.c
+++ b/deps/openssl/openssl/crypto/rand/prov_seed.c
@@ -14,6 +14,7 @@
#include "internal/core.h"
#include <openssl/core_dispatch.h>
#include <openssl/err.h>
+#include <string.h>
size_t ossl_rand_get_entropy(ossl_unused OSSL_LIB_CTX *ctx,
unsigned char **pout, int entropy,
@@ -41,6 +42,33 @@ size_t ossl_rand_get_entropy(ossl_unused OSSL_LIB_CTX *ctx,
return ret;
}
+/*
+ * Copy the seed into a buffer of our own and hand the original straight back
+ * to the seed source. Otherwise ossl_rand_cleanup_user_entropy() would have
+ * to work out who allocated |buf|, but a seed source may be created between
+ * taking entropy from the operating system sources and cleaning it up, so
+ * the seed source present at cleanup time does not tell.
+ */
+static size_t rand_get_seed_copy(EVP_RAND_CTX *rng, unsigned char **pout,
+ int entropy, size_t min_len, size_t max_len)
+{
+ unsigned char *seed = NULL, *buf;
+ size_t ret;
+
+ ret = evp_rand_get_seed(rng, &seed, entropy, min_len, max_len,
+ 0, NULL, 0);
+ if (ret == 0)
+ return 0;
+ buf = OPENSSL_secure_malloc(ret);
+ if (buf != NULL)
+ memcpy(buf, seed, ret);
+ evp_rand_clear_seed(rng, seed, ret);
+ if (buf == NULL)
+ return 0;
+ *pout = buf;
+ return ret;
+}
+
size_t ossl_rand_get_user_entropy(OSSL_LIB_CTX *ctx,
unsigned char **pout, int entropy,
size_t min_len, size_t max_len)
@@ -64,8 +92,7 @@ size_t ossl_rand_get_user_entropy(OSSL_LIB_CTX *ctx,
if (rng == NULL || !evp_rand_can_seed(rng))
return ossl_rand_get_entropy(ctx, pout, entropy, min_len, max_len);
}
- return evp_rand_get_seed(rng, pout, entropy, min_len, max_len,
- 0, NULL, 0);
+ return rand_get_seed_copy(rng, pout, entropy, min_len, max_len);
}
void ossl_rand_cleanup_entropy(ossl_unused OSSL_LIB_CTX *ctx,
@@ -74,15 +101,11 @@ void ossl_rand_cleanup_entropy(ossl_unused OSSL_LIB_CTX *ctx,
OPENSSL_secure_clear_free(buf, len);
}
+/* See rand_get_seed_copy() */
void ossl_rand_cleanup_user_entropy(OSSL_LIB_CTX *ctx,
unsigned char *buf, size_t len)
{
- EVP_RAND_CTX *rng = ossl_rand_get0_seed_noncreating(ctx);
-
- if (rng != NULL && evp_rand_can_seed(rng))
- evp_rand_clear_seed(rng, buf, len);
- else
- OPENSSL_secure_clear_free(buf, len);
+ ossl_rand_cleanup_entropy(ctx, buf, len);
}
size_t ossl_rand_get_nonce(ossl_unused OSSL_LIB_CTX *ctx,
diff --git a/deps/openssl/openssl/crypto/ripemd/build.info b/deps/openssl/openssl/crypto/ripemd/build.info
index 17acec0bedc..938a554e739 100644
--- a/deps/openssl/openssl/crypto/ripemd/build.info
+++ b/deps/openssl/openssl/crypto/ripemd/build.info
@@ -17,6 +17,7 @@ ENDIF
SOURCE[../../libcrypto]=rmd_dgst.c rmd_one.c $RMD160ASM
DEFINE[../../libcrypto]=$RMD160DEF
+DEFINE[../../providers/libdefault.a]=$RMD160DEF
# When all deprecated symbols are removed, libcrypto doesn't export the
# RIPEMD160 functions, so we must include them directly in liblegacy.a
diff --git a/deps/openssl/openssl/crypto/sm3/build.info b/deps/openssl/openssl/crypto/sm3/build.info
index e58916d3178..5579014ea3e 100644
--- a/deps/openssl/openssl/crypto/sm3/build.info
+++ b/deps/openssl/openssl/crypto/sm3/build.info
@@ -21,6 +21,7 @@ IF[{- !$disabled{sm3} -}]
SOURCE[../../libcrypto]=sm3.c legacy_sm3.c $SM3ASM
DEFINE[../../libcrypto]=$SM3DEF
+ DEFINE[../../providers/libdefault.a]=$SM3DEF
GENERATE[sm3-armv8.S]=asm/sm3-armv8.pl
INCLUDE[sm3-armv8.o]=..
diff --git a/deps/openssl/openssl/crypto/sm4/build.info b/deps/openssl/openssl/crypto/sm4/build.info
index 2f36b6b595e..940a9d9e5f4 100644
--- a/deps/openssl/openssl/crypto/sm4/build.info
+++ b/deps/openssl/openssl/crypto/sm4/build.info
@@ -24,7 +24,6 @@ SOURCE[../../libcrypto]= $SM4ASM sm4.c
# Implementations are now spread across several libraries, so the defines
# need to be applied to all affected libraries and modules.
DEFINE[../../libcrypto]=$SM4DEF
-DEFINE[../../providers/libfips.a]=$SM4DEF
DEFINE[../../providers/libdefault.a]=$SM4DEF
# We only need to include the SM4DEF stuff in the legacy provider when it's a
# separate module and it's dynamically linked with libcrypto. Otherwise, it
diff --git a/deps/openssl/openssl/crypto/store/store_meth.c b/deps/openssl/openssl/crypto/store/store_meth.c
index 5b2b6ac57fe..b0c5121319d 100644
--- a/deps/openssl/openssl/crypto/store/store_meth.c
+++ b/deps/openssl/openssl/crypto/store/store_meth.c
@@ -58,7 +58,8 @@ void OSSL_STORE_LOADER_free(OSSL_STORE_LOADER *loader)
#ifdef OPENSSL_NO_CACHED_FETCH
free_loader(loader);
#else
- if (loader != NULL && (loader->no_store != 0))
+ /* Legacy loaders have no provider and are never in the method store */
+ if (loader != NULL && (loader->no_store != 0 || loader->prov == NULL))
free_loader(loader);
#endif
}
diff --git a/deps/openssl/openssl/crypto/store/store_result.c b/deps/openssl/openssl/crypto/store/store_result.c
index a47eb2a601f..b979363f334 100644
--- a/deps/openssl/openssl/crypto/store/store_result.c
+++ b/deps/openssl/openssl/crypto/store/store_result.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2020-2025 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2020-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -709,6 +709,8 @@ static int try_skey(struct extracted_param_data_st *data, OSSL_STORE_INFO **v,
params[1] = OSSL_PARAM_construct_end();
skey = EVP_SKEY_import_SKEYMGMT(libctx, skeymgmt, OSSL_SKEYMGMT_SELECT_ALL, params);
+ /* The EVP_SKEY holds its own reference to the SKEYMGMT */
+ EVP_SKEYMGMT_free(skeymgmt);
}
if (skey != NULL)
diff --git a/deps/openssl/openssl/crypto/uid.c b/deps/openssl/openssl/crypto/uid.c
index c0c62909fdf..edc6f3f98fa 100644
--- a/deps/openssl/openssl/crypto/uid.c
+++ b/deps/openssl/openssl/crypto/uid.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2001-2023 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2001-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -17,7 +17,7 @@ int OPENSSL_issetugid(void)
return 0;
}
-#elif defined(__OpenBSD__) || (defined(__FreeBSD__) && __FreeBSD__ > 2) || defined(__DragonFly__) || (defined(__GLIBC__) && defined(__FreeBSD_kernel__))
+#elif defined(__OpenBSD__) || (defined(__FreeBSD__) && __FreeBSD__ > 2) || defined(__DragonFly__) || (defined(__GLIBC__) && defined(__FreeBSD_kernel__)) || defined(__NetBSD__)
#include <unistd.h>
diff --git a/deps/openssl/openssl/crypto/x509/v3_san.c b/deps/openssl/openssl/crypto/x509/v3_san.c
index 0defca074d8..b5e7aa3bc5f 100644
--- a/deps/openssl/openssl/crypto/x509/v3_san.c
+++ b/deps/openssl/openssl/crypto/x509/v3_san.c
@@ -380,7 +380,7 @@ static int copy_issuer(X509V3_CTX *ctx, GENERAL_NAMES *gens)
return 1;
err:
- sk_GENERAL_NAME_free(ialt);
+ sk_GENERAL_NAME_pop_free(ialt, GENERAL_NAME_free);
return 0;
}
diff --git a/deps/openssl/openssl/crypto/x509/x509_local.h b/deps/openssl/openssl/crypto/x509/x509_local.h
index a3433336ca0..1f194145881 100644
--- a/deps/openssl/openssl/crypto/x509/x509_local.h
+++ b/deps/openssl/openssl/crypto/x509/x509_local.h
@@ -127,10 +127,9 @@ struct x509_lookup_st {
X509_STORE *store_ctx; /* who owns us */
};
-HT_START_KEY_DEFN(objs_key)
-HT_DEF_KEY_FIELD(xn_canon, unsigned char *)
-HT_DEF_KEY_FIELD(xn_canon_enclen, int)
-HT_END_KEY_DEFN(OBJS_KEY)
+typedef struct {
+ HT_KEY key_header;
+} OBJS_KEY;
/*
* This is used to hold everything. It is used for all certificate
diff --git a/deps/openssl/openssl/crypto/x509/x509_lu.c b/deps/openssl/openssl/crypto/x509/x509_lu.c
index 94c12475431..be7bc5d27e2 100644
--- a/deps/openssl/openssl/crypto/x509/x509_lu.c
+++ b/deps/openssl/openssl/crypto/x509/x509_lu.c
@@ -10,7 +10,6 @@
#include <stdio.h>
#include "internal/cryptlib.h"
#include "internal/hashtable.h"
-#include "internal/hashfunc.h"
#include "internal/refcount.h"
#include <openssl/x509.h>
#include "crypto/x509.h"
@@ -190,11 +189,12 @@ static void objs_ht_free(HT_VALUE *v)
sk_X509_OBJECT_pop_free(objs, X509_OBJECT_free);
}
-static uint64_t obj_ht_hash(HT_KEY *key)
+static void objs_ht_init_key(OBJS_KEY *key, const X509_NAME *xn)
{
- OBJS_KEY *k = (OBJS_KEY *)key;
-
- return ossl_fnv1a_hash(k->keyfields.xn_canon, k->keyfields.xn_canon_enclen);
+ /* Empty names have no canonical buffer, but the hash table copies the key. */
+ HT_INIT_KEY(key);
+ key->key_header.keybuf = xn->canon_enc != NULL ? xn->canon_enc : (unsigned char *)"";
+ key->key_header.keysize = xn->canon_enclen;
}
X509_STORE *X509_STORE_new(void)
@@ -202,7 +202,7 @@ X509_STORE *X509_STORE_new(void)
X509_STORE *ret = OPENSSL_zalloc(sizeof(*ret));
HT_CONFIG htconf = {
.ht_free_fn = objs_ht_free,
- .ht_hash_fn = obj_ht_hash,
+ .collision_check = 1,
.init_neighborhoods = X509_OBJS_HT_BUCKETS,
.no_rcu = 1,
};
@@ -353,9 +353,7 @@ STACK_OF(X509_OBJECT) *ossl_x509_store_ht_get_by_name(const X509_STORE *store,
return NULL;
}
- HT_INIT_KEY(&key);
- HT_SET_KEY_FIELD(&key, xn_canon, xn->canon_enc);
- HT_SET_KEY_FIELD(&key, xn_canon_enclen, xn->canon_enclen);
+ objs_ht_init_key(&key, xn);
v = ossl_ht_get(store->objs_ht, TO_HT_KEY(&key));
if (v == NULL)
return NULL;
@@ -392,9 +390,7 @@ static int x509_name_objs_ht_insert(const X509_STORE *store, const X509_NAME *xn
return 0;
}
- HT_INIT_KEY(&key);
- HT_SET_KEY_FIELD(&key, xn_canon, xn->canon_enc);
- HT_SET_KEY_FIELD(&key, xn_canon_enclen, xn->canon_enclen);
+ objs_ht_init_key(&key, xn);
val.value = (void *)objs;
ret = ossl_ht_insert(store->objs_ht, TO_HT_KEY(&key), &val, NULL);
if (ret != 1) {
@@ -942,16 +938,24 @@ STACK_OF(X509) *X509_STORE_CTX_get1_certs(const X509_STORE_CTX *ctx,
sk = sk_X509_new_null();
if (idx < 0 || sk == NULL)
goto end;
- for (i = idx; i < sk_X509_OBJECT_num(objs); i++) {
+ for (i = idx; cnt > 0 && i < sk_X509_OBJECT_num(objs); i++) {
obj = sk_X509_OBJECT_value(objs, i);
- x = obj->data.x509;
if (obj->type != X509_LU_X509)
continue;
+ x = obj->data.x509;
+ /*
+ * x509_object_idx_cnt() returns the exact number of matches, but they
+ * need not be contiguous in the unsorted flat store. Check the
+ * subject name and stop once all |cnt| matches have been added.
+ */
+ if (X509_NAME_cmp(X509_get_subject_name(x), nm) != 0)
+ continue;
if (X509_add_cert(sk, x, X509_ADD_FLAG_UP_REF) == 0) {
X509_STORE_unlock(store);
OSSL_STACK_OF_X509_free(sk);
return NULL;
}
+ cnt--;
}
end:
@@ -992,11 +996,14 @@ STACK_OF(X509_CRL) *X509_STORE_CTX_get1_crls(const X509_STORE_CTX *ctx,
if (idx < 0)
goto end;
- for (i = idx; i < sk_X509_OBJECT_num(objs); i++) {
+ for (i = idx; cnt > 0 && i < sk_X509_OBJECT_num(objs); i++) {
obj = sk_X509_OBJECT_value(objs, i);
- x = obj->data.crl;
if (obj->type != X509_LU_CRL)
continue;
+ x = obj->data.crl;
+ /* See the comment in X509_STORE_CTX_get1_certs() */
+ if (X509_NAME_cmp(X509_CRL_get_issuer(x), nm) != 0)
+ continue;
if (!X509_CRL_up_ref(x)) {
X509_STORE_unlock(store);
sk_X509_CRL_pop_free(sk, X509_CRL_free);
@@ -1008,6 +1015,7 @@ STACK_OF(X509_CRL) *X509_STORE_CTX_get1_crls(const X509_STORE_CTX *ctx,
sk_X509_CRL_pop_free(sk, X509_CRL_free);
return NULL;
}
+ cnt--;
}
end:
X509_STORE_unlock(store);
@@ -1017,7 +1025,7 @@ end:
X509_OBJECT *X509_OBJECT_retrieve_match(STACK_OF(X509_OBJECT) *h,
X509_OBJECT *x)
{
- int idx, i, num;
+ int idx, i, num, sorted;
X509_OBJECT *obj;
idx = sk_X509_OBJECT_find(h, x);
@@ -1025,11 +1033,16 @@ X509_OBJECT *X509_OBJECT_retrieve_match(STACK_OF(X509_OBJECT) *h,
return NULL;
if ((x->type != X509_LU_X509) && (x->type != X509_LU_CRL))
return sk_X509_OBJECT_value(h, idx);
+ sorted = sk_X509_OBJECT_is_sorted(h);
for (i = idx, num = sk_X509_OBJECT_num(h); i < num; i++) {
obj = sk_X509_OBJECT_value(h, i);
if (x509_object_cmp((const X509_OBJECT **)&obj,
- (const X509_OBJECT **)&x))
- return NULL;
+ (const X509_OBJECT **)&x)) {
+ /* Matching objects are contiguous only in a sorted stack. */
+ if (sorted)
+ return NULL;
+ continue;
+ }
if (x->type == X509_LU_X509) {
if (!X509_cmp(obj->data.x509, x->data.x509))
return obj;
diff --git a/deps/openssl/openssl/crypto/x509/x509_vfy.c b/deps/openssl/openssl/crypto/x509/x509_vfy.c
index 032a86d03ab..046242e9aa5 100644
--- a/deps/openssl/openssl/crypto/x509/x509_vfy.c
+++ b/deps/openssl/openssl/crypto/x509/x509_vfy.c
@@ -31,8 +31,13 @@
#include "crypto/x509.h"
#include "x509_local.h"
-/* CRL score values */
+/*
+ * Defines the maximum number of relative dist points
+ * a certificate allows
+ */
+#define MAX_DP_NAMES 16
+/* CRL score values */
#define CRL_SCORE_NOCRITICAL 0x100 /* No unhandled critical extensions */
#define CRL_SCORE_SCOPE 0x080 /* certificate is within CRL scope */
#define CRL_SCORE_TIME 0x040 /* CRL times valid */
@@ -71,9 +76,10 @@ static int check_sig_level(X509_STORE_CTX *ctx, X509 *cert);
static int check_curve(X509 *cert);
static int get_crl_score(X509_STORE_CTX *ctx, X509 **pissuer,
- unsigned int *preasons, X509_CRL *crl, X509 *x);
+ unsigned int *preasons, X509_CRL *crl, X509 *x, STACK_OF(X509_NAME) **crldp_names,
+ int *vfy_cb_err);
static int get_crl_delta(X509_STORE_CTX *ctx,
- X509_CRL **pcrl, X509_CRL **pdcrl, X509 *x);
+ X509_CRL **pcrl, X509_CRL **pdcrl, X509 *x, int *vfy_cb_err);
static void get_delta_sk(X509_STORE_CTX *ctx, X509_CRL **dcrl,
int *pcrl_score, X509_CRL *base,
STACK_OF(X509_CRL) *crls);
@@ -82,13 +88,15 @@ static void crl_akid_check(X509_STORE_CTX *ctx, X509_CRL *crl, X509 **pissuer,
static int matching_crl_issuer_and_akid(const X509_CRL *crl,
const X509 *issuer, const X509_NAME *crl_issuer_name);
static int crl_crldp_check(X509 *x, X509_CRL *crl, int crl_score,
- unsigned int *preasons);
+ unsigned int *preasons, STACK_OF(X509_NAME) **crldp_names,
+ int *vfy_cb_err);
static int check_crl_path(X509_STORE_CTX *ctx, X509 *x);
static int check_crl_chain(X509_STORE_CTX *ctx,
STACK_OF(X509) *cert_path,
STACK_OF(X509) *crl_path);
static int internal_verify(X509_STORE_CTX *ctx);
+static X509_NAME *crldp_full_name(const X509 *x, const DIST_POINT *dp);
static int null_callback(int ok, X509_STORE_CTX *e)
{
@@ -1389,6 +1397,49 @@ end:
}
#endif
+/**
+ * @brief builds a stack of crldp full names from relative distribution points
+ * @param cert - The certificate to build full crldp names for
+ * @returns - a stack of X509_NAME structs, indexed in parallel with cert->crldp
+ * @returns NULL if an error occurred, such as trying to build more than MAX_DP_NAMES
+ * full names from relative distribution points
+ */
+static STACK_OF(X509_NAME) *get_crldp_full_names(const X509 *cert)
+{
+ int i;
+ STACK_OF(X509_NAME) *crldp_names = NULL;
+ DIST_POINT *dp;
+ X509_NAME *dp_name;
+ int full_names = 0;
+
+ crldp_names = sk_X509_NAME_new_reserve(NULL, sk_DIST_POINT_num(cert->crldp));
+ if (crldp_names == NULL)
+ return NULL;
+
+ for (i = 0; i < sk_DIST_POINT_num(cert->crldp); i++) {
+ dp = sk_DIST_POINT_value(cert->crldp, i);
+ if (dp->distpoint != NULL && dp->distpoint->type == 1) {
+ if (full_names >= MAX_DP_NAMES) {
+ ERR_raise_data(ERR_LIB_X509, X509_R_INVALID_DISTPOINT, "Too many relative dist points in certificate");
+ goto err;
+ }
+ full_names++;
+ dp_name = crldp_full_name(cert, dp);
+ if (dp_name == NULL)
+ goto err;
+ } else {
+ dp_name = NULL;
+ }
+
+ if (!sk_X509_NAME_push(crldp_names, dp_name))
+ goto err;
+ }
+ return crldp_names;
+err:
+ sk_X509_NAME_pop_free(crldp_names, X509_NAME_free);
+ return NULL;
+}
+
/* Sadly, returns 0 also on internal error. */
static int check_cert_crl(X509_STORE_CTX *ctx)
{
@@ -1396,6 +1447,8 @@ static int check_cert_crl(X509_STORE_CTX *ctx)
int ok = 0;
int cnum = ctx->error_depth;
X509 *x = sk_X509_value(ctx->chain, cnum);
+ STACK_OF(X509_NAME) *crldp_names = NULL;
+ int vfy_cb_err = X509_V_OK;
ctx->current_cert = x;
ctx->current_issuer = NULL;
@@ -1419,16 +1472,23 @@ static int check_cert_crl(X509_STORE_CTX *ctx)
ok = ctx->get_crl(ctx, &crl, x);
if (crl != NULL) {
ctx->current_crl_score = get_crl_score(ctx, &crl_issuer,
- &reasons, crl, x);
+ &reasons, crl, x, &crldp_names, &vfy_cb_err);
+ if (vfy_cb_err != X509_V_OK) {
+ ok = verify_cb_crl(ctx, vfy_cb_err);
+ goto done;
+ }
ctx->current_issuer = crl_issuer;
ctx->current_reasons = reasons;
}
} else {
- ok = get_crl_delta(ctx, &crl, &dcrl, x);
+ ok = get_crl_delta(ctx, &crl, &dcrl, x, &vfy_cb_err);
}
/* If error looking up CRL, nothing we can do except notify callback */
if (!ok) {
- ok = verify_cb_crl(ctx, X509_V_ERR_UNABLE_TO_GET_CRL);
+ if (vfy_cb_err == X509_V_OK)
+ vfy_cb_err = X509_V_ERR_UNABLE_TO_GET_CRL;
+
+ ok = verify_cb_crl(ctx, vfy_cb_err);
goto done;
}
@@ -1471,7 +1531,7 @@ static int check_cert_crl(X509_STORE_CTX *ctx)
done:
X509_CRL_free(crl);
X509_CRL_free(dcrl);
-
+ sk_X509_NAME_pop_free(crldp_names, X509_NAME_free);
ctx->current_crl = NULL;
return ok;
}
@@ -1531,7 +1591,8 @@ int ossl_x509_check_crl_time(X509_STORE_CTX *ctx, X509_CRL *crl, int notify)
static int get_crl_sk(X509_STORE_CTX *ctx, X509_CRL **pcrl, X509_CRL **pdcrl,
X509 **pissuer, int *pscore, unsigned int *preasons,
- STACK_OF(X509_CRL) *crls)
+ STACK_OF(X509_CRL) *crls, STACK_OF(X509_NAME) **crldp_names,
+ int *vfy_cb_err)
{
int i, crl_score, best_score = *pscore;
unsigned int reasons, best_reasons = 0;
@@ -1542,7 +1603,11 @@ static int get_crl_sk(X509_STORE_CTX *ctx, X509_CRL **pcrl, X509_CRL **pdcrl,
for (i = 0; i < sk_X509_CRL_num(crls); i++) {
crl = sk_X509_CRL_value(crls, i);
reasons = *preasons;
- crl_score = get_crl_score(ctx, &crl_issuer, &reasons, crl, x);
+
+ crl_score = get_crl_score(ctx, &crl_issuer, &reasons, crl, x, crldp_names, vfy_cb_err);
+ if (*vfy_cb_err != X509_V_OK)
+ return 0;
+
if (crl_score < best_score || crl_score == 0)
continue;
/* If current CRL is equivalent use it if it is newer */
@@ -1678,15 +1743,64 @@ static void get_delta_sk(X509_STORE_CTX *ctx, X509_CRL **dcrl, int *pscore,
*dcrl = NULL;
}
-/*
- * For a given CRL return how suitable it is for the supplied certificate
- * 'x'. The return value is a mask of several criteria. If the issuer is not
- * the certificate issuer this is returned in *pissuer. The reasons mask is
- * also used to determine if the CRL is suitable: if no new reasons the CRL
- * is rejected, otherwise reasons is updated.
+/**
+ * @brief Score a candidate CRL for suitability in checking a certificate.
+ *
+ * Evaluates @p crl as a possible base CRL for determining the revocation
+ * status of @p x and returns a bitmask of CRL_SCORE_* flags describing how
+ * well it matches. A return of 0 means the CRL is unusable and must not be
+ * selected.
+ *
+ * The CRL is rejected outright (score 0) if any of the following hold:
+ * - its issuingDistributionPoint extension is invalid (IDP_INVALID);
+ * - it is a delta CRL (has a BaseCRLNumber). Deltas are considered
+ * separately by get_delta_sk() once a base CRL has been chosen;
+ * - it is indirect or carries onlySomeReasons, and
+ * X509_V_FLAG_EXTENDED_CRL_SUPPORT is not set in @p ctx;
+ * - it carries onlySomeReasons that add nothing to @p *preasons;
+ * - its issuer name differs from the certificate's issuer and it is not
+ * an indirect CRL;
+ * - its issuing certificate cannot be located via the AKID check;
+ * - its distribution point scope covers no reasons not already in
+ * @p *preasons.
+ *
+ * Otherwise the following bits may be set in the result:
+ * - CRL_SCORE_ISSUER_NAME: CRL issuer name equals the cert issuer name;
+ * - CRL_SCORE_NOCRITICAL: CRL has no unhandled critical extensions;
+ * - CRL_SCORE_TIME: CRL is within its validity period;
+ * - CRL_SCORE_AKID (and related issuer bits): set by crl_akid_check();
+ * - CRL_SCORE_SCOPE: CRL distribution point scope matches @p x.
+ *
+ * Callers compare scores across candidates and keep the highest. A CRL
+ * scoring CRL_SCORE_VALID covers all criteria.
+ *
+ * @param[in] ctx Verification context. Supplies the
+ * verification flags and validation time.
+ * @param[out] pissuer On success, set to the certificate that issued
+ * @p crl, as located by crl_akid_check().
+ * @param[in,out] preasons Reason codes already covered by previously
+ * selected CRLs. On a non-zero return, updated
+ * with the reasons this CRL newly covers.
+ * @param[in] crl Candidate CRL to score.
+ * @param[in] x Certificate whose revocation status is being
+ * checked.
+ * @param[in, out] crldp_names Receives the CRL distribution point names
+ * matched for @p x, for use when checking
+ * indirect CRL entries. It is passed in as a pointer
+ * to a pointer, so multiple calls to this function
+ * can reuse the constructed stack of crldp names for
+ * multiple CRL's without having to rebuild it multiple
+ * times.
+ * @param[out] vfy_cb_err Receives an X509_V_ERR_* code to report through
+ * the verify callback when scoring fails for a
+ * reportable reason.
+ *
+ * @return A bitmask of CRL_SCORE_* flags, or 0 if @p crl cannot be used.
+ * @p *preasons is modified only on a non-zero return.
*/
static int get_crl_score(X509_STORE_CTX *ctx, X509 **pissuer,
- unsigned int *preasons, X509_CRL *crl, X509 *x)
+ unsigned int *preasons, X509_CRL *crl, X509 *x, STACK_OF(X509_NAME) **crldp_names,
+ int *vfy_cb_err)
{
int crl_score = 0;
unsigned int tmp_reasons = *preasons, crl_reasons;
@@ -1734,7 +1848,7 @@ static int get_crl_score(X509_STORE_CTX *ctx, X509 **pissuer,
return 0;
/* Check cert for matching CRL distribution points */
- if (crl_crldp_check(x, crl, crl_score, &crl_reasons)) {
+ if (crl_crldp_check(x, crl, crl_score, &crl_reasons, crldp_names, vfy_cb_err)) {
/* If no new reasons reject */
if ((crl_reasons & ~tmp_reasons) == 0)
return 0;
@@ -2030,7 +2144,8 @@ end:
/* Check CRLDP and IDP */
static int crl_crldp_check(X509 *x, X509_CRL *crl, int crl_score,
- unsigned int *preasons)
+ unsigned int *preasons, STACK_OF(X509_NAME) **crldp_names,
+ int *vfy_cb_err)
{
int i;
@@ -2046,7 +2161,7 @@ static int crl_crldp_check(X509 *x, X509_CRL *crl, int crl_score,
*preasons = crl->idp_reasons;
for (i = 0; i < sk_DIST_POINT_num(x->crldp); i++) {
DIST_POINT *dp = sk_DIST_POINT_value(x->crldp, i);
- X509_NAME *dpname = NULL;
+ X509_NAME *dpname;
int match;
if (!crldp_check_crlissuer(dp, crl, crl_score))
@@ -2054,16 +2169,18 @@ static int crl_crldp_check(X509 *x, X509_CRL *crl, int crl_score,
if (crl->idp == NULL) {
match = 1;
} else {
- /*
- * A relative distribution point name is only comparable in
- * full form. Build it for this one comparison and discard it;
- * if that fails the entry simply does not match.
- */
- if (dp->distpoint != NULL && dp->distpoint->type == 1
- && (dpname = crldp_full_name(x, dp)) == NULL)
- continue;
+ if (dp->distpoint != NULL && dp->distpoint->type == 1) {
+ if (*crldp_names == NULL) {
+ *crldp_names = get_crldp_full_names(x);
+ if (*crldp_names == NULL) {
+ *vfy_cb_err = X509_V_ERR_UNSPECIFIED;
+ return 0;
+ }
+ }
+ }
+
+ dpname = sk_X509_NAME_value(*crldp_names, i);
match = idp_check_dp(dp->distpoint, dpname, crl->idp->distpoint);
- X509_NAME_free(dpname);
}
if (match) {
*preasons &= dp->dp_reasons;
@@ -2087,21 +2204,25 @@ static int crl_crldp_check(X509 *x, X509_CRL *crl, int crl_score,
* to find a delta CRL too
*/
static int get_crl_delta(X509_STORE_CTX *ctx,
- X509_CRL **pcrl, X509_CRL **pdcrl, X509 *x)
+ X509_CRL **pcrl, X509_CRL **pdcrl, X509 *x,
+ int *vfy_cb_err)
{
int ok;
X509 *issuer = NULL;
int crl_score = 0;
unsigned int reasons;
X509_CRL *crl = NULL, *dcrl = NULL;
- STACK_OF(X509_CRL) *skcrl;
+ STACK_OF(X509_CRL) *skcrl = NULL;
const X509_NAME *nm = X509_get_issuer_name(x);
+ STACK_OF(X509_NAME) *crldp_names = NULL;
reasons = ctx->current_reasons;
ok = get_crl_sk(ctx, &crl, &dcrl,
- &issuer, &crl_score, &reasons, ctx->crls);
+ &issuer, &crl_score, &reasons, ctx->crls, &crldp_names, vfy_cb_err);
if (ok)
goto done;
+ if (*vfy_cb_err != X509_V_OK)
+ goto done;
/* Lookup CRLs from store */
skcrl = ctx->lookup_crls(ctx, nm);
@@ -2110,11 +2231,16 @@ static int get_crl_delta(X509_STORE_CTX *ctx,
if (skcrl == NULL && crl != NULL)
goto done;
- get_crl_sk(ctx, &crl, &dcrl, &issuer, &crl_score, &reasons, skcrl);
-
- sk_X509_CRL_pop_free(skcrl, X509_CRL_free);
+ ok = get_crl_sk(ctx, &crl, &dcrl, &issuer, &crl_score, &reasons, skcrl, &crldp_names, vfy_cb_err);
done:
+ sk_X509_CRL_pop_free(skcrl, X509_CRL_free);
+ sk_X509_NAME_pop_free(crldp_names, X509_NAME_free);
+ if (*vfy_cb_err != X509_V_OK) {
+ X509_CRL_free(crl);
+ X509_CRL_free(dcrl);
+ crl = dcrl = NULL;
+ }
/* If we got any kind of CRL use it and return success */
if (crl != NULL) {
ctx->current_issuer = issuer;
@@ -3569,14 +3695,26 @@ static int check_dane_issuer(X509_STORE_CTX *ctx, int depth)
return X509_TRUST_UNTRUSTED;
}
+/*
+ * As a last resort, check whether the last untrusted certificate is signed by
+ * an explicit DANE-TA(2) SPKI(1) Full(0) public key in the TLSA RRset.
+ */
static int check_dane_pkeys(X509_STORE_CTX *ctx)
{
SSL_DANE *dane = ctx->dane;
danetls_record *t;
- int num = ctx->num_untrusted;
- X509 *cert = sk_X509_value(ctx->chain, num - 1);
+ X509 *cert;
int recnum = sk_danetls_record_num(dane->trecs);
- int i;
+ int ix, i;
+
+ /*
+ * When a self-signed leaf was replaced by its trust store copy,
+ * num_untrusted is 0 and the leaf itself is checked against the keys.
+ */
+ ix = ctx->num_untrusted > 0 ? ctx->num_untrusted - 1 : 0;
+ cert = sk_X509_value(ctx->chain, ix);
+ if (!ossl_assert(cert != NULL))
+ return X509_TRUST_UNTRUSTED;
for (i = 0; i < recnum; ++i) {
t = sk_danetls_record_value(dane->trecs, i);
@@ -3589,12 +3727,11 @@ static int check_dane_pkeys(X509_STORE_CTX *ctx)
/* Record match via a bare TA public key */
ctx->bare_ta_signed = 1;
- dane->mdpth = num - 1;
+ dane->mdpth = ix;
dane->mtlsa = t;
/* Prune any excess chain certificates */
- num = sk_X509_num(ctx->chain);
- for (; num > ctx->num_untrusted; --num)
+ for (i = sk_X509_num(ctx->chain) - 1; i > ix; --i)
X509_free(sk_X509_pop(ctx->chain));
return X509_TRUST_TRUSTED;
diff --git a/deps/openssl/openssl/crypto/x509/x509_vpm.c b/deps/openssl/openssl/crypto/x509/x509_vpm.c
index 44b116923b2..ebc969c35f9 100644
--- a/deps/openssl/openssl/crypto/x509/x509_vpm.c
+++ b/deps/openssl/openssl/crypto/x509/x509_vpm.c
@@ -78,11 +78,16 @@ err:
return ret;
}
-static X509_BUFFER *buffer_copy(const X509_BUFFER *b)
+static X509_BUFFER *buffer_copy_bytes(const X509_BUFFER *b)
{
return buffer_from_bytes(b->data, b->len);
}
+static X509_BUFFER *buffer_copy_string(const X509_BUFFER *b)
+{
+ return buffer_from_string(b->data, b->len);
+}
+
static void buffer_free(X509_BUFFER *b)
{
if (b == NULL)
@@ -91,13 +96,26 @@ static void buffer_free(X509_BUFFER *b)
OPENSSL_free(b);
}
-static int replace_buffer_stack(STACK_OF(X509_BUFFER) **dest,
+static int replace_buffer_stack_bytes(STACK_OF(X509_BUFFER) **dest,
+ STACK_OF(X509_BUFFER) *const *src)
+{
+ sk_X509_BUFFER_pop_free(*dest, buffer_free);
+ *dest = NULL;
+ if (*src != NULL) {
+ *dest = sk_X509_BUFFER_deep_copy(*src, buffer_copy_bytes, buffer_free);
+ if (*dest == NULL)
+ return 0;
+ }
+ return 1;
+}
+
+static int replace_buffer_stack_string(STACK_OF(X509_BUFFER) **dest,
STACK_OF(X509_BUFFER) *const *src)
{
sk_X509_BUFFER_pop_free(*dest, buffer_free);
*dest = NULL;
if (*src != NULL) {
- *dest = sk_X509_BUFFER_deep_copy(*src, buffer_copy, buffer_free);
+ *dest = sk_X509_BUFFER_deep_copy(*src, buffer_copy_string, buffer_free);
if (*dest == NULL)
return 0;
}
@@ -466,25 +484,25 @@ int X509_VERIFY_PARAM_inherit(X509_VERIFY_PARAM *dest,
x509_verify_param_copy(hostflags, 0);
if (test_x509_verify_param_copy(hosts, NULL)) {
- if (!replace_buffer_stack(&dest->hosts, &src->hosts))
+ if (!replace_buffer_stack_string(&dest->hosts, &src->hosts))
return 0;
}
x509_verify_param_copy(validate_host, NULL);
if (test_x509_verify_param_copy(ips, NULL)) {
- if (!replace_buffer_stack(&dest->ips, &src->ips))
+ if (!replace_buffer_stack_bytes(&dest->ips, &src->ips))
return 0;
}
x509_verify_param_copy(validate_ip, NULL);
if (test_x509_verify_param_copy(rfc822s, NULL)) {
- if (!replace_buffer_stack(&dest->rfc822s, &src->rfc822s))
+ if (!replace_buffer_stack_string(&dest->rfc822s, &src->rfc822s))
return 0;
}
x509_verify_param_copy(validate_rfc822, NULL);
if (test_x509_verify_param_copy(smtputf8s, NULL)) {
- if (!replace_buffer_stack(&dest->smtputf8s, &src->smtputf8s))
+ if (!replace_buffer_stack_string(&dest->smtputf8s, &src->smtputf8s))
return 0;
}
x509_verify_param_copy(validate_smtputf8, NULL);
diff --git a/deps/openssl/openssl/crypto/x509/x509aset.c b/deps/openssl/openssl/crypto/x509/x509aset.c
index 17b988c67c9..f32648a543f 100644
--- a/deps/openssl/openssl/crypto/x509/x509aset.c
+++ b/deps/openssl/openssl/crypto/x509/x509aset.c
@@ -145,22 +145,24 @@ void X509_ACERT_set0_holder_digest(X509_ACERT *x,
int X509_ACERT_set1_issuerName(X509_ACERT *x, const X509_NAME *name)
{
+ X509_ACERT_ISSUER *issuer = &x->acinfo->issuer;
X509_ACERT_ISSUER_V2FORM *v2Form;
- v2Form = x->acinfo->issuer.u.v2Form;
-
/* only v2Form is supported, so always create that version */
- if (v2Form == NULL) {
+ if (issuer->type != X509_ACERT_ISSUER_V2 || issuer->u.v2Form == NULL) {
v2Form = X509_ACERT_ISSUER_V2FORM_new();
if (v2Form == NULL) {
ERR_raise(ERR_LIB_X509, ERR_R_ASN1_LIB);
return 0;
}
- x->acinfo->issuer.u.v2Form = v2Form;
- x->acinfo->issuer.type = X509_ACERT_ISSUER_V2;
+ /* a decoded certificate may hold a v1Form issuer in the same union */
+ if (issuer->type != X509_ACERT_ISSUER_V2)
+ GENERAL_NAMES_free(issuer->u.v1Form);
+ issuer->u.v2Form = v2Form;
+ issuer->type = X509_ACERT_ISSUER_V2;
}
- return replace_dirName(&v2Form->issuerName, name);
+ return replace_dirName(&issuer->u.v2Form->issuerName, name);
}
int X509_ACERT_set1_serialNumber(X509_ACERT *x, const ASN1_INTEGER *serial)
diff --git a/deps/openssl/openssl/crypto/x509/x_attrib.c b/deps/openssl/openssl/crypto/x509/x_attrib.c
index 98a99cc43b7..a8bc9786570 100644
--- a/deps/openssl/openssl/crypto/x509/x_attrib.c
+++ b/deps/openssl/openssl/crypto/x509/x_attrib.c
@@ -95,15 +95,21 @@ int ossl_print_attribute_value(BIO *out,
}
case V_ASN1_INTEGER:
- case V_ASN1_ENUMERATED:
if (BIO_printf(out, "%*s", indent, "") < 0)
return 0;
- if (ASN1_ENUMERATED_get_int64(&int_val, av->value.integer) > 0) {
+ if (ASN1_INTEGER_get_int64(&int_val, av->value.integer) > 0)
return BIO_printf(out, "%lld", (long long int)int_val) > 0;
- }
str = av->value.integer;
return ossl_bio_print_hex(out, str->data, str->length);
+ case V_ASN1_ENUMERATED:
+ if (BIO_printf(out, "%*s", indent, "") < 0)
+ return 0;
+ if (ASN1_ENUMERATED_get_int64(&int_val, av->value.enumerated) > 0)
+ return BIO_printf(out, "%lld", (long long int)int_val) > 0;
+ str = av->value.enumerated;
+ return ossl_bio_print_hex(out, str->data, str->length);
+
case V_ASN1_BIT_STRING:
if (BIO_printf(out, "%*s", indent, "") < 0)
return 0;
diff --git a/deps/openssl/openssl/exporters/cmake/OpenSSLConfig.cmake.in b/deps/openssl/openssl/exporters/cmake/OpenSSLConfig.cmake.in
index e4356053211..aa3b20e4b2f 100644
--- a/deps/openssl/openssl/exporters/cmake/OpenSSLConfig.cmake.in
+++ b/deps/openssl/openssl/exporters/cmake/OpenSSLConfig.cmake.in
@@ -131,7 +131,7 @@ set(OPENSSL_FOUND YES)
# Directories and names
set(OPENSSL_LIBRARY_DIR "${_ossl_prefix}/{- unixify($OpenSSL::safe::installdata::LIBDIR_REL_PREFIX[0], 1); -}")
set(OPENSSL_INCLUDE_DIR{- $OUT = '';
- $OUT .= ' "${_ossl_prefix}/' . $_ . '"'
+ $OUT .= ' "${_ossl_prefix}/' . unixify($_, 1) . '"'
foreach (@OpenSSL::safe::installdata::INCLUDEDIR_REL_PREFIX); -})
set(OPENSSL_MODULES_DIR "${_ossl_prefix}/{- unixify($OpenSSL::safe::installdata::LIBDIR_REL_PREFIX[0], 1); -}/{- unixify($OpenSSL::safe::installdata::MODULESDIR_REL_LIBDIR[0], 1); -}")
set(OPENSSL_RUNTIME_DIR "${_ossl_prefix}/{- unixify($OpenSSL::safe::installdata::BINDIR_REL_PREFIX[0], 1); -}")
diff --git a/deps/openssl/openssl/fuzz/oids.txt b/deps/openssl/openssl/fuzz/oids.txt
index f4c1979113c..9844f171430 100644
--- a/deps/openssl/openssl/fuzz/oids.txt
+++ b/deps/openssl/openssl/fuzz/oids.txt
@@ -84,7 +84,7 @@ OBJ_basic_constraints="\x55\x1D\x13"
OBJ_crl_number="\x55\x1D\x14"
OBJ_certificate_policies="\x55\x1D\x20"
OBJ_authority_key_identifier="\x55\x1D\x23"
-OBJ_bf_cbc="\x2B\x06\x01\x04\x01\x97\x55\x01\x02"
+OBJ_bf_cbc="\x2B\x06\x01\x04\x01\x97\x55\x01\x01\x02"
OBJ_mdc2="\x55\x08\x03\x65"
OBJ_mdc2WithRSA="\x55\x08\x03\x64"
OBJ_givenName="\x55\x04\x2A"
diff --git a/deps/openssl/openssl/fuzz/test-corpus.c b/deps/openssl/openssl/fuzz/test-corpus.c
index a908f69644c..06f43d9e58f 100644
--- a/deps/openssl/openssl/fuzz/test-corpus.c
+++ b/deps/openssl/openssl/fuzz/test-corpus.c
@@ -22,6 +22,7 @@
#include <openssl/crypto.h>
#include <openssl/err.h>
#include "fuzzer.h"
+#include "internal/e_os.h"
#include "internal/o_dir.h"
#include "mfail.h"
@@ -82,14 +83,16 @@ static void testfile(const char *pathname, int file_idx)
unsigned char *buf;
size_t s;
- if (stat(pathname, &st) < 0 || !S_ISREG(st.st_mode))
+ f = fopen(pathname, "rb");
+ if (f == NULL)
+ return;
+ if (fstat(fileno(f), &st) < 0 || !S_ISREG(st.st_mode)) {
+ fclose(f);
return;
+ }
fprintf(stderr, "# CORPUS_FILE file_idx=%d size=%lld path=%s\n",
file_idx, (long long)st.st_size, pathname);
- f = fopen(pathname, "rb");
- if (f == NULL)
- return;
buf = malloc(st.st_size);
if (buf == NULL) {
fclose(f);
diff --git a/deps/openssl/openssl/include/arch/riscv_arch.h b/deps/openssl/openssl/include/arch/riscv_arch.h
index b83d3b62c6f..0bbfc0671c1 100644
--- a/deps/openssl/openssl/include/arch/riscv_arch.h
+++ b/deps/openssl/openssl/include/arch/riscv_arch.h
@@ -26,7 +26,7 @@
#include <asm/hwcap.h>
extern unsigned int OPENSSL_riscv_hwcap_P;
#define VECTOR_CAPABLE (OPENSSL_riscv_hwcap_P & COMPAT_HWCAP_ISA_V)
-#define ZVX_MIN 15
+#define ZVX_MIN 14
#define ZVX_MAX 23
#define IS_IN_DEPEND_VECTOR(offset) ((ZVX_MIN <= offset) && (offset <= ZVX_MAX))
#endif
diff --git a/deps/openssl/openssl/include/crypto/asn1err.h b/deps/openssl/openssl/include/crypto/asn1err.h
deleted file mode 100644
index 6e8445dbaf1..00000000000
--- a/deps/openssl/openssl/include/crypto/asn1err.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/crypto_asn1err.h"
diff --git a/deps/openssl/openssl/include/crypto/asyncerr.h b/deps/openssl/openssl/include/crypto/asyncerr.h
deleted file mode 100644
index 06e2c3d516d..00000000000
--- a/deps/openssl/openssl/include/crypto/asyncerr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/crypto_asyncerr.h"
diff --git a/deps/openssl/openssl/include/crypto/bioerr.h b/deps/openssl/openssl/include/crypto/bioerr.h
deleted file mode 100644
index eac5fc5a1cd..00000000000
--- a/deps/openssl/openssl/include/crypto/bioerr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/crypto_bioerr.h"
diff --git a/deps/openssl/openssl/include/crypto/bnerr.h b/deps/openssl/openssl/include/crypto/bnerr.h
deleted file mode 100644
index 31350fcfc65..00000000000
--- a/deps/openssl/openssl/include/crypto/bnerr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/crypto_bnerr.h"
diff --git a/deps/openssl/openssl/include/crypto/buffererr.h b/deps/openssl/openssl/include/crypto/buffererr.h
deleted file mode 100644
index a4992433266..00000000000
--- a/deps/openssl/openssl/include/crypto/buffererr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/crypto_buffererr.h"
diff --git a/deps/openssl/openssl/include/crypto/cmperr.h b/deps/openssl/openssl/include/crypto/cmperr.h
deleted file mode 100644
index 3ab6808b521..00000000000
--- a/deps/openssl/openssl/include/crypto/cmperr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/crypto_cmperr.h"
diff --git a/deps/openssl/openssl/include/crypto/cmserr.h b/deps/openssl/openssl/include/crypto/cmserr.h
deleted file mode 100644
index dd77cb22a1e..00000000000
--- a/deps/openssl/openssl/include/crypto/cmserr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/crypto_cmserr.h"
diff --git a/deps/openssl/openssl/include/crypto/comperr.h b/deps/openssl/openssl/include/crypto/comperr.h
deleted file mode 100644
index 8286efb07ab..00000000000
--- a/deps/openssl/openssl/include/crypto/comperr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/crypto_comperr.h"
diff --git a/deps/openssl/openssl/include/crypto/conferr.h b/deps/openssl/openssl/include/crypto/conferr.h
deleted file mode 100644
index d6522b7f659..00000000000
--- a/deps/openssl/openssl/include/crypto/conferr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/crypto_conferr.h"
diff --git a/deps/openssl/openssl/include/crypto/crmferr.h b/deps/openssl/openssl/include/crypto/crmferr.h
deleted file mode 100644
index bc291452e46..00000000000
--- a/deps/openssl/openssl/include/crypto/crmferr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/crypto_crmferr.h"
diff --git a/deps/openssl/openssl/include/crypto/cryptoerr.h b/deps/openssl/openssl/include/crypto/cryptoerr.h
deleted file mode 100644
index c8fda8d4389..00000000000
--- a/deps/openssl/openssl/include/crypto/cryptoerr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/crypto_cryptoerr.h"
diff --git a/deps/openssl/openssl/include/crypto/cterr.h b/deps/openssl/openssl/include/crypto/cterr.h
deleted file mode 100644
index afe7fbfe76a..00000000000
--- a/deps/openssl/openssl/include/crypto/cterr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/crypto_cterr.h"
diff --git a/deps/openssl/openssl/include/crypto/decodererr.h b/deps/openssl/openssl/include/crypto/decodererr.h
deleted file mode 100644
index f76d68c84f0..00000000000
--- a/deps/openssl/openssl/include/crypto/decodererr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/crypto_decodererr.h"
diff --git a/deps/openssl/openssl/include/crypto/dherr.h b/deps/openssl/openssl/include/crypto/dherr.h
deleted file mode 100644
index a0a9b7dbaee..00000000000
--- a/deps/openssl/openssl/include/crypto/dherr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/crypto_dherr.h"
diff --git a/deps/openssl/openssl/include/crypto/dsaerr.h b/deps/openssl/openssl/include/crypto/dsaerr.h
deleted file mode 100644
index 2f88424f877..00000000000
--- a/deps/openssl/openssl/include/crypto/dsaerr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/crypto_dsaerr.h"
diff --git a/deps/openssl/openssl/include/crypto/dso_conf.h b/deps/openssl/openssl/include/crypto/dso_conf.h
deleted file mode 100644
index 6d7e803d673..00000000000
--- a/deps/openssl/openssl/include/crypto/dso_conf.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/crypto_dso_conf.h"
diff --git a/deps/openssl/openssl/include/crypto/ec_params.h b/deps/openssl/openssl/include/crypto/ec_params.h
deleted file mode 100644
index a9ce1f28032..00000000000
--- a/deps/openssl/openssl/include/crypto/ec_params.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/crypto_ec_params.h"
diff --git a/deps/openssl/openssl/include/crypto/ecerr.h b/deps/openssl/openssl/include/crypto/ecerr.h
deleted file mode 100644
index bad2f6f7f90..00000000000
--- a/deps/openssl/openssl/include/crypto/ecerr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/crypto_ecerr.h"
diff --git a/deps/openssl/openssl/include/crypto/encodererr.h b/deps/openssl/openssl/include/crypto/encodererr.h
deleted file mode 100644
index f8836a6fe8f..00000000000
--- a/deps/openssl/openssl/include/crypto/encodererr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/crypto_encodererr.h"
diff --git a/deps/openssl/openssl/include/crypto/esserr.h b/deps/openssl/openssl/include/crypto/esserr.h
deleted file mode 100644
index 0e611562590..00000000000
--- a/deps/openssl/openssl/include/crypto/esserr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/crypto_esserr.h"
diff --git a/deps/openssl/openssl/include/crypto/evp.h b/deps/openssl/openssl/include/crypto/evp.h
index eca29a74382..309113ed55b 100644
--- a/deps/openssl/openssl/include/crypto/evp.h
+++ b/deps/openssl/openssl/include/crypto/evp.h
@@ -334,10 +334,19 @@ int evp_cipher_asn1_to_param_ex(EVP_CIPHER_CTX *c, ASN1_TYPE *type,
* This requires that the "origin" backend (whether it's a legacy or a
* provider "origin") implements exports, and that the target provider
* has an EVP_KEYMGMT that implements import.
+ * Operation contexts hold the cached keydata without owning it, so for a
+ * provider "origin" entries are only freed when its key is released: when
+ * the EVP_PKEY is freed, or when its key is replaced (for example by
+ * generating or importing into an existing EVP_PKEY). Replacing the key
+ * also frees the "origin" keydata, so it is not safe while operation
+ * contexts use that EVP_PKEY.
+ * |gen| is the "origin"'s dirty count when the entry was exported, and the
+ * entry is current only while that still matches.
*/
typedef struct {
EVP_KEYMGMT *keymgmt;
void *keydata;
+ size_t gen;
int selection;
} OP_CACHE_ELEM;
@@ -455,8 +464,9 @@ struct evp_pkey_st {
STACK_OF(OP_CACHE_ELEM) *operation_cache;
/*
- * We keep a copy of that "origin"'s dirty count, so we know if the
- * operation cache needs flushing.
+ * For a legacy "origin", we keep a copy of its dirty count, so we know
+ * if the operation cache needs flushing. Not used with a provider
+ * "origin", whose cache entries carry their own dirty count.
*/
size_t dirty_cnt_copy;
diff --git a/deps/openssl/openssl/include/crypto/evperr.h b/deps/openssl/openssl/include/crypto/evperr.h
deleted file mode 100644
index cc229473023..00000000000
--- a/deps/openssl/openssl/include/crypto/evperr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/crypto_evperr.h"
diff --git a/deps/openssl/openssl/include/crypto/httperr.h b/deps/openssl/openssl/include/crypto/httperr.h
deleted file mode 100644
index f8f38bfd281..00000000000
--- a/deps/openssl/openssl/include/crypto/httperr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/crypto_httperr.h"
diff --git a/deps/openssl/openssl/include/crypto/objectserr.h b/deps/openssl/openssl/include/crypto/objectserr.h
deleted file mode 100644
index c1dd6c11244..00000000000
--- a/deps/openssl/openssl/include/crypto/objectserr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/crypto_objectserr.h"
diff --git a/deps/openssl/openssl/include/crypto/ocsperr.h b/deps/openssl/openssl/include/crypto/ocsperr.h
deleted file mode 100644
index 63fe3bffffa..00000000000
--- a/deps/openssl/openssl/include/crypto/ocsperr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/crypto_ocsperr.h"
diff --git a/deps/openssl/openssl/include/crypto/pemerr.h b/deps/openssl/openssl/include/crypto/pemerr.h
deleted file mode 100644
index fc7e37bb82a..00000000000
--- a/deps/openssl/openssl/include/crypto/pemerr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/crypto_pemerr.h"
diff --git a/deps/openssl/openssl/include/crypto/pkcs12err.h b/deps/openssl/openssl/include/crypto/pkcs12err.h
deleted file mode 100644
index 8ca8d874ac1..00000000000
--- a/deps/openssl/openssl/include/crypto/pkcs12err.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/crypto_pkcs12err.h"
diff --git a/deps/openssl/openssl/include/crypto/pkcs7err.h b/deps/openssl/openssl/include/crypto/pkcs7err.h
deleted file mode 100644
index f38e910a941..00000000000
--- a/deps/openssl/openssl/include/crypto/pkcs7err.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/crypto_pkcs7err.h"
diff --git a/deps/openssl/openssl/include/crypto/randerr.h b/deps/openssl/openssl/include/crypto/randerr.h
deleted file mode 100644
index 75b9af553f6..00000000000
--- a/deps/openssl/openssl/include/crypto/randerr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/crypto_randerr.h"
diff --git a/deps/openssl/openssl/include/crypto/rsa_params.h b/deps/openssl/openssl/include/crypto/rsa_params.h
deleted file mode 100644
index e02e0cb2241..00000000000
--- a/deps/openssl/openssl/include/crypto/rsa_params.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/crypto_rsa_params.h"
diff --git a/deps/openssl/openssl/include/crypto/rsaerr.h b/deps/openssl/openssl/include/crypto/rsaerr.h
deleted file mode 100644
index 33dc5856b89..00000000000
--- a/deps/openssl/openssl/include/crypto/rsaerr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/crypto_rsaerr.h"
diff --git a/deps/openssl/openssl/include/crypto/sm2err.h b/deps/openssl/openssl/include/crypto/sm2err.h
deleted file mode 100644
index be1f07eb2fd..00000000000
--- a/deps/openssl/openssl/include/crypto/sm2err.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/crypto_sm2err.h"
diff --git a/deps/openssl/openssl/include/crypto/storeerr.h b/deps/openssl/openssl/include/crypto/storeerr.h
deleted file mode 100644
index 8b89be564c3..00000000000
--- a/deps/openssl/openssl/include/crypto/storeerr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/crypto_storeerr.h"
diff --git a/deps/openssl/openssl/include/crypto/tserr.h b/deps/openssl/openssl/include/crypto/tserr.h
deleted file mode 100644
index bfef11ae263..00000000000
--- a/deps/openssl/openssl/include/crypto/tserr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/crypto_tserr.h"
diff --git a/deps/openssl/openssl/include/crypto/uierr.h b/deps/openssl/openssl/include/crypto/uierr.h
deleted file mode 100644
index a2049e9f3a9..00000000000
--- a/deps/openssl/openssl/include/crypto/uierr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/crypto_uierr.h"
diff --git a/deps/openssl/openssl/include/crypto/x509err.h b/deps/openssl/openssl/include/crypto/x509err.h
deleted file mode 100644
index e535dd2b983..00000000000
--- a/deps/openssl/openssl/include/crypto/x509err.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/crypto_x509err.h"
diff --git a/deps/openssl/openssl/include/crypto/x509v3err.h b/deps/openssl/openssl/include/crypto/x509v3err.h
deleted file mode 100644
index e107984829a..00000000000
--- a/deps/openssl/openssl/include/crypto/x509v3err.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/crypto_x509v3err.h"
diff --git a/deps/openssl/openssl/include/internal/dsoerr.h b/deps/openssl/openssl/include/internal/dsoerr.h
deleted file mode 100644
index 6a3c4abb91a..00000000000
--- a/deps/openssl/openssl/include/internal/dsoerr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/internal_dsoerr.h"
diff --git a/deps/openssl/openssl/include/internal/packet_quic.h b/deps/openssl/openssl/include/internal/packet_quic.h
index 783ede37715..79214bd8204 100644
--- a/deps/openssl/openssl/include/internal/packet_quic.h
+++ b/deps/openssl/openssl/include/internal/packet_quic.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2022-2023 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2022-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -110,6 +110,7 @@ __owur static ossl_inline int PACKET_get_quic_length_prefixed(PACKET *pkt,
*pkt = tmp;
subpkt->curr = data;
+ subpkt->msgstart = pkt->msgstart;
subpkt->remaining = (size_t)length;
return 1;
diff --git a/deps/openssl/openssl/include/internal/propertyerr.h b/deps/openssl/openssl/include/internal/propertyerr.h
deleted file mode 100644
index be7929f49a1..00000000000
--- a/deps/openssl/openssl/include/internal/propertyerr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/internal_propertyerr.h"
diff --git a/deps/openssl/openssl/include/internal/quic_channel.h b/deps/openssl/openssl/include/internal/quic_channel.h
index 47a6202164c..2ae0f848e6a 100644
--- a/deps/openssl/openssl/include/internal/quic_channel.h
+++ b/deps/openssl/openssl/include/internal/quic_channel.h
@@ -548,6 +548,20 @@ void ossl_quic_channel_set_tcause(QUIC_CHANNEL *ch, uint64_t app_error_code,
void ossl_ch_reset_rx_state(QUIC_CHANNEL *ch);
uint64_t ossl_quic_channel_get_path_challenge_count(const QUIC_CHANNEL *ch);
uint64_t ossl_quic_channel_get_path_response_count(const QUIC_CHANNEL *ch);
+/**
+ * ossl_quic_channel_get_on_new_conn_id_handled() is just for testing purposes
+ * @param ch pointer to channel
+ * @returns number of NEW_CONNECTION_ID frames handled. Handling means
+ * how many RETIRE_CONN_ID frames we dispatched on behalf of reception
+ * of NEW_CONNECTION_ID.
+ */
+uint64_t ossl_quic_channel_get_on_new_conn_id_handled(const QUIC_CHANNEL *ch);
+/**
+ * ossl_quic_channel_get_init_dcid() is just for testing purposes
+ * @param ch pointer to channel which initial connection id is to be retrieved
+ * @returns pointer to initial destination connection id used by connect()
+ */
+const QUIC_CONN_ID *ossl_quic_channel_get_init_dcid(const QUIC_CHANNEL *ch);
#endif
#endif
diff --git a/deps/openssl/openssl/include/internal/quic_strm_reas.h b/deps/openssl/openssl/include/internal/quic_strm_reas.h
index a2d958a7adc..30d37035125 100644
--- a/deps/openssl/openssl/include/internal/quic_strm_reas.h
+++ b/deps/openssl/openssl/include/internal/quic_strm_reas.h
@@ -17,6 +17,15 @@
#ifndef OPENSSL_NO_QUIC
#include "internal/ossl_rbtree.h"
+/*
+ * Maximum number of disjoint ranges buffered per stream. Flow control
+ * bounds only the highest offset a peer may send, so without this
+ * limit tiny fragments separated by gaps could make the receiver keep
+ * one range per fragment. A legitimate sender retransmits lost data
+ * and stays well below this limit.
+ */
+#define QUIC_SFRAME_SET_MAX_RANGES 1024
+
typedef struct sframe_set_t {
OSSL_RBT_HEAD(srange, sframe_set_t)
ranges;
@@ -28,6 +37,9 @@ typedef struct sframe_set_t {
size_t stream_chunks;
/* Offset of data not yet dropped */
uint64_t offset;
+ /* Range returned to a zero-copy caller and not released yet. */
+ UINT_RANGE locked_range;
+ unsigned int range_locked;
/* Cleanse data on release? */
int cleanse;
int move_buffers;
@@ -74,6 +86,30 @@ int ossl_sframe_set_peek(SFRAME_SET *fs, void **iter,
UINT_RANGE *range, const unsigned char **data,
int *fin);
+/**
+ * ossl_sframe_set_lock_range() locks the first range of stream chunks
+ * so zero-copy caller can access them safely. While range is locked
+ * its chunks are protected from memory relocations which may occur
+ * during stream reassembly process. The stream reassembly process
+ * continues to work making sure following stream chunks are always
+ * appended.
+ * @param fs stream frame set that holds ranges.
+ * @param range range caller wants to lock, the range must be reachable
+ * for read operation.
+ * @returns 1 on success, 0 on failure (when range cannot be locked, because
+ * its end offset is past the gap, or range is locked)
+ */
+int ossl_sframe_set_lock_range(SFRAME_SET *fs, const UINT_RANGE *range);
+
+/**
+ * ossl_sframe_set_unlock_range() unlocks the stream chunks in the
+ * first range previously locked by ossl_sframe_set_lock_range().
+ * Stream reassembly is free to reallocate those chunks again.
+ * @param fs point to stream frame set with range collection
+ * @returns void
+ */
+void ossl_sframe_set_unlock_range(SFRAME_SET *fs);
+
/*
* moves reading offset to new position, discarding all consumed
* chunks (which end offset is less than offset).
diff --git a/deps/openssl/openssl/include/internal/safe_math.h b/deps/openssl/openssl/include/internal/safe_math.h
index dda5cc48f01..73480ba4449 100644
--- a/deps/openssl/openssl/include/internal/safe_math.h
+++ b/deps/openssl/openssl/include/internal/safe_math.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2021-2022 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2021-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -154,7 +154,7 @@
if (!__builtin_mul_overflow(a, b, &r)) \
return r; \
*err |= 1; \
- return a * b; \
+ return r; \
}
#else /* has(__builtin_mul_overflow) */
@@ -175,6 +175,9 @@
\
if (x <= max / y) \
return a * b; \
+ /* A negative product can also equal the minimum. */ \
+ if (((a < 0) ^ (b < 0)) && -x == min / y) \
+ return min; \
} \
*err |= 1; \
return (a < 0) ^ (b < 0) ? min : max; \
@@ -187,7 +190,12 @@
{ \
if (b != 0 && a > max / b) \
*err |= 1; \
- return a * b; \
+ /* \
+ * With 16-bit short and 32-bit int, unsigned short \
+ * operands of 65535 promote to int and overflow when \
+ * multiplied. Adding 0U forces unsigned arithmetic. \
+ */ \
+ return a * (b + 0U); \
}
#endif /* has(__builtin_mul_overflow) */
@@ -297,32 +305,26 @@
/*
* Safe fused multiply divide helpers
*
- * These are a bit obscure:
- * . They begin by checking the denominator for zero and getting rid of this
- * corner case.
+ * First try the multiplication directly. If it overflows, add and double
+ * quotient/remainder pairs while consuming the bits of b. For unsigned
+ * inputs, (x, y) describes the current term as x * c + y, and (q, r)
+ * describes the accumulated sum. Remainders stay below c: test against
+ * c - y before adding y so that the remainder addition cannot overflow.
*
- * . Second is an attempt to do the multiplication directly, if it doesn't
- * overflow, the quotient is returned (for signed values there is a
- * potential problem here which isn't present for unsigned).
+ * Signed inputs use negative magnitudes so that the minimum value remains
+ * representable. The quotient and remainder bounds are reversed, and the
+ * result sign is restored at the end.
*
- * . Finally, the multiplication/division is transformed so that the larger
- * of the numerators is divided first. This requires a remainder
- * correction:
- *
- * a b / c = (a / c) b + (a mod c) b / c, where a > b
- *
- * The individual operations need to be overflow checked (again signed
- * being more problematic).
- *
- * The algorithm used is not perfect but it should be "good enough".
+ * Quotient magnitudes only increase, and a term is doubled only if a higher
+ * bit of b is still needed. Thus an intermediate quotient overflow implies
+ * that the final quotient cannot fit. No wider integer type is needed.
*/
-#define OSSL_SAFE_MATH_MULDIVS(type_name, type, max) \
+
+#define OSSL_SAFE_MATH_MULDIVS(type_name, type, min, max) \
static ossl_inline ossl_unused type safe_muldiv_##type_name(type a, \
- type b, \
- type c, \
- int *err) \
+ type b, type c, int *err) \
{ \
- int e2 = 0; \
+ int e2 = 0, negative; \
type q, r, x, y; \
\
if (c == 0) { \
@@ -332,27 +334,58 @@
x = safe_mul_##type_name(a, b, &e2); \
if (!e2) \
return safe_div_##type_name(x, c, err); \
- if (b > a) { \
- x = b; \
- b = a; \
- a = x; \
+ \
+ /* Use negative magnitudes: MIN need never be negated. */ \
+ negative = (a < 0) ^ (b < 0) ^ (c < 0); \
+ if (a > 0) \
+ a = -a; \
+ if (b > 0) \
+ b = -b; \
+ if (c > 0) \
+ c = -c; \
+ x = c == -1 ? a : -(a / c); \
+ y = c == -1 ? 0 : a % c; \
+ q = r = 0; \
+ e2 = 0; \
+ while (b != 0) { \
+ if (b % 2 != 0) { \
+ q = safe_add_##type_name(q, x, &e2); \
+ if (r <= c - y) { \
+ r -= c - y; \
+ q = safe_add_##type_name(q, -1, &e2); \
+ } else { \
+ r += y; \
+ } \
+ if (e2) \
+ goto overflow; \
+ } \
+ b /= 2; \
+ if (b == 0) \
+ break; \
+ /* Double the current quotient/remainder pair. */ \
+ x = safe_add_##type_name(x, x, &e2); \
+ if (y <= c - y) { \
+ y -= c - y; \
+ x = safe_add_##type_name(x, -1, &e2); \
+ } else { \
+ y += y; \
+ } \
+ if (e2) \
+ goto overflow; \
} \
- q = safe_div_##type_name(a, c, err); \
- r = safe_mod_##type_name(a, c, err); \
- x = safe_mul_##type_name(r, b, err); \
- y = safe_mul_##type_name(q, b, err); \
- q = safe_div_##type_name(x, c, err); \
- return safe_add_##type_name(y, q, err); \
+ return negative ? q : safe_neg_##type_name(q, err); \
+ \
+ overflow: \
+ *err |= 1; \
+ return negative ? min : max; \
}
#define OSSL_SAFE_MATH_MULDIVU(type_name, type, max) \
static ossl_inline ossl_unused type safe_muldiv_##type_name(type a, \
- type b, \
- type c, \
- int *err) \
+ type b, type c, int *err) \
{ \
int e2 = 0; \
- type x, y; \
+ type q, r, x, y; \
\
if (c == 0) { \
*err |= 1; \
@@ -361,14 +394,42 @@
x = safe_mul_##type_name(a, b, &e2); \
if (!e2) \
return x / c; \
- if (b > a) { \
- x = b; \
- b = a; \
- a = x; \
+ \
+ x = a / c; \
+ y = a % c; \
+ q = r = 0; \
+ e2 = 0; \
+ while (b != 0) { \
+ if (b % 2 != 0) { \
+ q = safe_add_##type_name(q, x, &e2); \
+ if (r >= c - y) { \
+ r -= c - y; \
+ q = safe_add_##type_name(q, 1, &e2); \
+ } else { \
+ r += y; \
+ } \
+ if (e2) \
+ goto overflow; \
+ } \
+ b /= 2; \
+ if (b == 0) \
+ break; \
+ /* Double the current quotient/remainder pair. */ \
+ x = safe_add_##type_name(x, x, &e2); \
+ if (y >= c - y) { \
+ y -= c - y; \
+ x = safe_add_##type_name(x, 1, &e2); \
+ } else { \
+ y += y; \
+ } \
+ if (e2) \
+ goto overflow; \
} \
- x = safe_mul_##type_name(a % c, b, err); \
- y = safe_mul_##type_name(a / c, b, err); \
- return safe_add_##type_name(y, x / c, err); \
+ return q; \
+ \
+ overflow: \
+ *err |= 1; \
+ return max; \
}
/*
@@ -405,9 +466,9 @@
}
/* Calculate ranges of types */
-#define OSSL_SAFE_MATH_MINS(type) ((type)1 << (sizeof(type) * 8 - 1))
-#define OSSL_SAFE_MATH_MAXS(type) (~OSSL_SAFE_MATH_MINS(type))
-#define OSSL_SAFE_MATH_MAXU(type) (~(type)0)
+#define OSSL_SAFE_MATH_MAXS(type) ((type)((((type)1 << (sizeof(type) * 8 - 2)) - 1) * 2 + 1))
+#define OSSL_SAFE_MATH_MINS(type) (-OSSL_SAFE_MATH_MAXS(type) - 1)
+#define OSSL_SAFE_MATH_MAXU(type) ((type) ~(type)0)
/*
* Wrapper macros to create all the functions of a given type
@@ -425,8 +486,9 @@
OSSL_SAFE_MATH_MAXS(type)) \
OSSL_SAFE_MATH_DIV_ROUND_UP(type_name, type, \
OSSL_SAFE_MATH_MAXS(type)) \
- OSSL_SAFE_MATH_MULDIVS(type_name, type, OSSL_SAFE_MATH_MAXS(type)) \
OSSL_SAFE_MATH_NEGS(type_name, type, OSSL_SAFE_MATH_MINS(type)) \
+ OSSL_SAFE_MATH_MULDIVS(type_name, type, OSSL_SAFE_MATH_MINS(type), \
+ OSSL_SAFE_MATH_MAXS(type)) \
OSSL_SAFE_MATH_ABSS(type_name, type, OSSL_SAFE_MATH_MINS(type))
#define OSSL_SAFE_MATH_UNSIGNED(type_name, type) \
diff --git a/deps/openssl/openssl/include/internal/statem.h b/deps/openssl/openssl/include/internal/statem.h
index 027853eccd6..517ecb6fe03 100644
--- a/deps/openssl/openssl/include/internal/statem.h
+++ b/deps/openssl/openssl/include/internal/statem.h
@@ -121,6 +121,11 @@ struct ossl_statem_st {
OSSL_HANDSHAKE_STATE deferred_ack_state;
/* The handshake state before receiving an ACK */
OSSL_HANDSHAKE_STATE pre_ack_hand_state;
+ /*
+ * The handshake state to continue to, once our own KeyUpdate is
+ * acknowledged and the ACK held back behind it has finally been sent
+ */
+ OSSL_HANDSHAKE_STATE deferred_key_update_state;
ERROR_STATE error_state;
int in_init;
int read_state_first_init;
diff --git a/deps/openssl/openssl/include/openssl/asn1.h b/deps/openssl/openssl/include/openssl/asn1.h
deleted file mode 100644
index f9e6384547b..00000000000
--- a/deps/openssl/openssl/include/openssl/asn1.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_asn1.h"
diff --git a/deps/openssl/openssl/include/openssl/asn1err.h b/deps/openssl/openssl/include/openssl/asn1err.h
deleted file mode 100644
index e55001bb5ee..00000000000
--- a/deps/openssl/openssl/include/openssl/asn1err.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_asn1err.h"
diff --git a/deps/openssl/openssl/include/openssl/asn1t.h b/deps/openssl/openssl/include/openssl/asn1t.h
deleted file mode 100644
index f8d620062d9..00000000000
--- a/deps/openssl/openssl/include/openssl/asn1t.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_asn1t.h"
diff --git a/deps/openssl/openssl/include/openssl/asyncerr.h b/deps/openssl/openssl/include/openssl/asyncerr.h
deleted file mode 100644
index 034ef9b8689..00000000000
--- a/deps/openssl/openssl/include/openssl/asyncerr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_asyncerr.h"
diff --git a/deps/openssl/openssl/include/openssl/bio.h b/deps/openssl/openssl/include/openssl/bio.h
deleted file mode 100644
index 725f64ff5dc..00000000000
--- a/deps/openssl/openssl/include/openssl/bio.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_bio.h"
diff --git a/deps/openssl/openssl/include/openssl/bioerr.h b/deps/openssl/openssl/include/openssl/bioerr.h
deleted file mode 100644
index c2fec406372..00000000000
--- a/deps/openssl/openssl/include/openssl/bioerr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_bioerr.h"
diff --git a/deps/openssl/openssl/include/openssl/bnerr.h b/deps/openssl/openssl/include/openssl/bnerr.h
deleted file mode 100644
index 56493de3c17..00000000000
--- a/deps/openssl/openssl/include/openssl/bnerr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_bnerr.h"
diff --git a/deps/openssl/openssl/include/openssl/buffererr.h b/deps/openssl/openssl/include/openssl/buffererr.h
deleted file mode 100644
index e5bb3ac0541..00000000000
--- a/deps/openssl/openssl/include/openssl/buffererr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_buffererr.h"
diff --git a/deps/openssl/openssl/include/openssl/cmp.h b/deps/openssl/openssl/include/openssl/cmp.h
deleted file mode 100644
index 4354f7ecd3f..00000000000
--- a/deps/openssl/openssl/include/openssl/cmp.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_cmp.h"
diff --git a/deps/openssl/openssl/include/openssl/cmperr.h b/deps/openssl/openssl/include/openssl/cmperr.h
deleted file mode 100644
index 789b90a29e6..00000000000
--- a/deps/openssl/openssl/include/openssl/cmperr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_cmperr.h"
diff --git a/deps/openssl/openssl/include/openssl/cms.h b/deps/openssl/openssl/include/openssl/cms.h
deleted file mode 100644
index e1353cb0e89..00000000000
--- a/deps/openssl/openssl/include/openssl/cms.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_cms.h"
diff --git a/deps/openssl/openssl/include/openssl/cmserr.h b/deps/openssl/openssl/include/openssl/cmserr.h
deleted file mode 100644
index 4fa689e50ff..00000000000
--- a/deps/openssl/openssl/include/openssl/cmserr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_cmserr.h"
diff --git a/deps/openssl/openssl/include/openssl/comp.h b/deps/openssl/openssl/include/openssl/comp.h
deleted file mode 100644
index 70f44bfb019..00000000000
--- a/deps/openssl/openssl/include/openssl/comp.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_comp.h"
diff --git a/deps/openssl/openssl/include/openssl/comperr.h b/deps/openssl/openssl/include/openssl/comperr.h
deleted file mode 100644
index 6fd018272df..00000000000
--- a/deps/openssl/openssl/include/openssl/comperr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_comperr.h"
diff --git a/deps/openssl/openssl/include/openssl/conf.h b/deps/openssl/openssl/include/openssl/conf.h
deleted file mode 100644
index d02acf1f8c2..00000000000
--- a/deps/openssl/openssl/include/openssl/conf.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_conf.h"
diff --git a/deps/openssl/openssl/include/openssl/conferr.h b/deps/openssl/openssl/include/openssl/conferr.h
deleted file mode 100644
index 4ac8cd1f864..00000000000
--- a/deps/openssl/openssl/include/openssl/conferr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_conferr.h"
diff --git a/deps/openssl/openssl/include/openssl/configuration.h b/deps/openssl/openssl/include/openssl/configuration.h
deleted file mode 100644
index 60f0f9c7290..00000000000
--- a/deps/openssl/openssl/include/openssl/configuration.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_configuration.h"
diff --git a/deps/openssl/openssl/include/openssl/core_names.h b/deps/openssl/openssl/include/openssl/core_names.h
deleted file mode 100644
index 4f0c4bf8fa9..00000000000
--- a/deps/openssl/openssl/include/openssl/core_names.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_core_names.h"
diff --git a/deps/openssl/openssl/include/openssl/crmf.h b/deps/openssl/openssl/include/openssl/crmf.h
deleted file mode 100644
index d54e9baa4ad..00000000000
--- a/deps/openssl/openssl/include/openssl/crmf.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_crmf.h"
diff --git a/deps/openssl/openssl/include/openssl/crmferr.h b/deps/openssl/openssl/include/openssl/crmferr.h
deleted file mode 100644
index 32e13444034..00000000000
--- a/deps/openssl/openssl/include/openssl/crmferr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_crmferr.h"
diff --git a/deps/openssl/openssl/include/openssl/crypto.h b/deps/openssl/openssl/include/openssl/crypto.h
deleted file mode 100644
index ec7363a3eb1..00000000000
--- a/deps/openssl/openssl/include/openssl/crypto.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_crypto.h"
diff --git a/deps/openssl/openssl/include/openssl/cryptoerr.h b/deps/openssl/openssl/include/openssl/cryptoerr.h
deleted file mode 100644
index fedf532255f..00000000000
--- a/deps/openssl/openssl/include/openssl/cryptoerr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_cryptoerr.h"
diff --git a/deps/openssl/openssl/include/openssl/ct.h b/deps/openssl/openssl/include/openssl/ct.h
deleted file mode 100644
index 641a789f537..00000000000
--- a/deps/openssl/openssl/include/openssl/ct.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_ct.h"
diff --git a/deps/openssl/openssl/include/openssl/cterr.h b/deps/openssl/openssl/include/openssl/cterr.h
deleted file mode 100644
index 70108125c10..00000000000
--- a/deps/openssl/openssl/include/openssl/cterr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_cterr.h"
diff --git a/deps/openssl/openssl/include/openssl/decodererr.h b/deps/openssl/openssl/include/openssl/decodererr.h
deleted file mode 100644
index 6628a881f5c..00000000000
--- a/deps/openssl/openssl/include/openssl/decodererr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_decodererr.h"
diff --git a/deps/openssl/openssl/include/openssl/dherr.h b/deps/openssl/openssl/include/openssl/dherr.h
deleted file mode 100644
index 66fc3e7bc42..00000000000
--- a/deps/openssl/openssl/include/openssl/dherr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_dherr.h"
diff --git a/deps/openssl/openssl/include/openssl/dsaerr.h b/deps/openssl/openssl/include/openssl/dsaerr.h
deleted file mode 100644
index 2d31775d952..00000000000
--- a/deps/openssl/openssl/include/openssl/dsaerr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_dsaerr.h"
diff --git a/deps/openssl/openssl/include/openssl/ecerr.h b/deps/openssl/openssl/include/openssl/ecerr.h
deleted file mode 100644
index 31799efbe11..00000000000
--- a/deps/openssl/openssl/include/openssl/ecerr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_ecerr.h"
diff --git a/deps/openssl/openssl/include/openssl/encodererr.h b/deps/openssl/openssl/include/openssl/encodererr.h
deleted file mode 100644
index 901c6dad560..00000000000
--- a/deps/openssl/openssl/include/openssl/encodererr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_encodererr.h"
diff --git a/deps/openssl/openssl/include/openssl/err.h b/deps/openssl/openssl/include/openssl/err.h
deleted file mode 100644
index f84333f7518..00000000000
--- a/deps/openssl/openssl/include/openssl/err.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_err.h"
diff --git a/deps/openssl/openssl/include/openssl/ess.h b/deps/openssl/openssl/include/openssl/ess.h
deleted file mode 100644
index 7ffd5a800c1..00000000000
--- a/deps/openssl/openssl/include/openssl/ess.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_ess.h"
diff --git a/deps/openssl/openssl/include/openssl/esserr.h b/deps/openssl/openssl/include/openssl/esserr.h
deleted file mode 100644
index 7b94d71f16d..00000000000
--- a/deps/openssl/openssl/include/openssl/esserr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_esserr.h"
diff --git a/deps/openssl/openssl/include/openssl/evperr.h b/deps/openssl/openssl/include/openssl/evperr.h
deleted file mode 100644
index f32c002eee6..00000000000
--- a/deps/openssl/openssl/include/openssl/evperr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_evperr.h"
diff --git a/deps/openssl/openssl/include/openssl/fipskey.h b/deps/openssl/openssl/include/openssl/fipskey.h
deleted file mode 100644
index d31237b9e97..00000000000
--- a/deps/openssl/openssl/include/openssl/fipskey.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_fipskey.h"
diff --git a/deps/openssl/openssl/include/openssl/httperr.h b/deps/openssl/openssl/include/openssl/httperr.h
deleted file mode 100644
index b3fb51afb9b..00000000000
--- a/deps/openssl/openssl/include/openssl/httperr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_httperr.h"
diff --git a/deps/openssl/openssl/include/openssl/lhash.h b/deps/openssl/openssl/include/openssl/lhash.h
deleted file mode 100644
index 8afa640f230..00000000000
--- a/deps/openssl/openssl/include/openssl/lhash.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_lhash.h"
diff --git a/deps/openssl/openssl/include/openssl/obj_mac.h b/deps/openssl/openssl/include/openssl/obj_mac.h
deleted file mode 100644
index 91901a7cc42..00000000000
--- a/deps/openssl/openssl/include/openssl/obj_mac.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_obj_mac.h"
diff --git a/deps/openssl/openssl/include/openssl/objectserr.h b/deps/openssl/openssl/include/openssl/objectserr.h
deleted file mode 100644
index 3692bb7d3bf..00000000000
--- a/deps/openssl/openssl/include/openssl/objectserr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_objectserr.h"
diff --git a/deps/openssl/openssl/include/openssl/ocsp.h b/deps/openssl/openssl/include/openssl/ocsp.h
deleted file mode 100644
index 91d9c3f44c3..00000000000
--- a/deps/openssl/openssl/include/openssl/ocsp.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_ocsp.h"
diff --git a/deps/openssl/openssl/include/openssl/ocsperr.h b/deps/openssl/openssl/include/openssl/ocsperr.h
deleted file mode 100644
index 023be01ddf0..00000000000
--- a/deps/openssl/openssl/include/openssl/ocsperr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_ocsperr.h"
diff --git a/deps/openssl/openssl/include/openssl/opensslv.h b/deps/openssl/openssl/include/openssl/opensslv.h
deleted file mode 100644
index f6207b33de9..00000000000
--- a/deps/openssl/openssl/include/openssl/opensslv.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_opensslv.h"
diff --git a/deps/openssl/openssl/include/openssl/pemerr.h b/deps/openssl/openssl/include/openssl/pemerr.h
deleted file mode 100644
index 90956c72e29..00000000000
--- a/deps/openssl/openssl/include/openssl/pemerr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_pemerr.h"
diff --git a/deps/openssl/openssl/include/openssl/pkcs12.h b/deps/openssl/openssl/include/openssl/pkcs12.h
deleted file mode 100644
index f80e1367adf..00000000000
--- a/deps/openssl/openssl/include/openssl/pkcs12.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_pkcs12.h"
diff --git a/deps/openssl/openssl/include/openssl/pkcs12err.h b/deps/openssl/openssl/include/openssl/pkcs12err.h
deleted file mode 100644
index 5d49bf87bd3..00000000000
--- a/deps/openssl/openssl/include/openssl/pkcs12err.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_pkcs12err.h"
diff --git a/deps/openssl/openssl/include/openssl/pkcs7.h b/deps/openssl/openssl/include/openssl/pkcs7.h
deleted file mode 100644
index e5dca017d24..00000000000
--- a/deps/openssl/openssl/include/openssl/pkcs7.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_pkcs7.h"
diff --git a/deps/openssl/openssl/include/openssl/pkcs7err.h b/deps/openssl/openssl/include/openssl/pkcs7err.h
deleted file mode 100644
index a4b43a193c9..00000000000
--- a/deps/openssl/openssl/include/openssl/pkcs7err.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_pkcs7err.h"
diff --git a/deps/openssl/openssl/include/openssl/proverr.h b/deps/openssl/openssl/include/openssl/proverr.h
deleted file mode 100644
index d30c44e20f4..00000000000
--- a/deps/openssl/openssl/include/openssl/proverr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_proverr.h"
diff --git a/deps/openssl/openssl/include/openssl/randerr.h b/deps/openssl/openssl/include/openssl/randerr.h
deleted file mode 100644
index bdf73345110..00000000000
--- a/deps/openssl/openssl/include/openssl/randerr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_randerr.h"
diff --git a/deps/openssl/openssl/include/openssl/rsaerr.h b/deps/openssl/openssl/include/openssl/rsaerr.h
deleted file mode 100644
index 92df3845fb3..00000000000
--- a/deps/openssl/openssl/include/openssl/rsaerr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_rsaerr.h"
diff --git a/deps/openssl/openssl/include/openssl/safestack.h b/deps/openssl/openssl/include/openssl/safestack.h
deleted file mode 100644
index 1c69d6bba49..00000000000
--- a/deps/openssl/openssl/include/openssl/safestack.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_safestack.h"
diff --git a/deps/openssl/openssl/include/openssl/srp.h b/deps/openssl/openssl/include/openssl/srp.h
deleted file mode 100644
index f5ef80308e8..00000000000
--- a/deps/openssl/openssl/include/openssl/srp.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_srp.h"
diff --git a/deps/openssl/openssl/include/openssl/ssl.h b/deps/openssl/openssl/include/openssl/ssl.h
deleted file mode 100644
index 96ce4b3e5a9..00000000000
--- a/deps/openssl/openssl/include/openssl/ssl.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_ssl.h"
diff --git a/deps/openssl/openssl/include/openssl/sslerr.h b/deps/openssl/openssl/include/openssl/sslerr.h
deleted file mode 100644
index a225f8296e1..00000000000
--- a/deps/openssl/openssl/include/openssl/sslerr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_sslerr.h"
diff --git a/deps/openssl/openssl/include/openssl/storeerr.h b/deps/openssl/openssl/include/openssl/storeerr.h
deleted file mode 100644
index fcf47cb2ff8..00000000000
--- a/deps/openssl/openssl/include/openssl/storeerr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_storeerr.h"
diff --git a/deps/openssl/openssl/include/openssl/tserr.h b/deps/openssl/openssl/include/openssl/tserr.h
deleted file mode 100644
index 60981011a59..00000000000
--- a/deps/openssl/openssl/include/openssl/tserr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_tserr.h"
diff --git a/deps/openssl/openssl/include/openssl/ui.h b/deps/openssl/openssl/include/openssl/ui.h
deleted file mode 100644
index 325f64526e0..00000000000
--- a/deps/openssl/openssl/include/openssl/ui.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_ui.h"
diff --git a/deps/openssl/openssl/include/openssl/uierr.h b/deps/openssl/openssl/include/openssl/uierr.h
deleted file mode 100644
index f743c305402..00000000000
--- a/deps/openssl/openssl/include/openssl/uierr.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_uierr.h"
diff --git a/deps/openssl/openssl/include/openssl/x509.h b/deps/openssl/openssl/include/openssl/x509.h
deleted file mode 100644
index 5ad2fec601c..00000000000
--- a/deps/openssl/openssl/include/openssl/x509.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_x509.h"
diff --git a/deps/openssl/openssl/include/openssl/x509_acert.h b/deps/openssl/openssl/include/openssl/x509_acert.h
deleted file mode 100644
index b2f08bcd967..00000000000
--- a/deps/openssl/openssl/include/openssl/x509_acert.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_x509_acert.h"
diff --git a/deps/openssl/openssl/include/openssl/x509_vfy.h b/deps/openssl/openssl/include/openssl/x509_vfy.h
deleted file mode 100644
index e4e1d3a18d8..00000000000
--- a/deps/openssl/openssl/include/openssl/x509_vfy.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_x509_vfy.h"
diff --git a/deps/openssl/openssl/include/openssl/x509err.h b/deps/openssl/openssl/include/openssl/x509err.h
deleted file mode 100644
index 8b7944213fb..00000000000
--- a/deps/openssl/openssl/include/openssl/x509err.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_x509err.h"
diff --git a/deps/openssl/openssl/include/openssl/x509v3.h b/deps/openssl/openssl/include/openssl/x509v3.h
deleted file mode 100644
index 6debee35a24..00000000000
--- a/deps/openssl/openssl/include/openssl/x509v3.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_x509v3.h"
diff --git a/deps/openssl/openssl/include/openssl/x509v3err.h b/deps/openssl/openssl/include/openssl/x509v3err.h
deleted file mode 100644
index bb505601c5b..00000000000
--- a/deps/openssl/openssl/include/openssl/x509v3err.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../config/openssl_x509v3err.h"
diff --git a/deps/openssl/openssl/providers/fips-sources.checksums b/deps/openssl/openssl/providers/fips-sources.checksums
index d5088b01f99..b0aa6ad8102 100644
--- a/deps/openssl/openssl/providers/fips-sources.checksums
+++ b/deps/openssl/openssl/providers/fips-sources.checksums
@@ -46,7 +46,7 @@ ef0f2fdd6a0b21d7aa594c2a1f83d2e6bc0f3c61655a1571c2ecb1d2eb193542 crypto/aes/asm
132c91241e571ea360250d28f8ae368a9efa07cd11afe014e316be07da38de8f crypto/aligned_alloc.c
46fe58bf9bd1b4a3e4b7688abc85fdd38328fe6baaf1db85bfd84cb0710d5914 crypto/alphacpuid.pl
92ce22da9063dc3ca88b5ef643b9ca02b72ec08bfe713b982370c1290a043f93 crypto/arm64cpuid.pl
-e0e8987948f3c2e2ca6e3d08a77ec3dfa9836e505dfd9f15c205cf2198b06a3d crypto/armcap.c
+85f432e71bcfed6240fe398737e56388f57984878dfd5fda5c9dd5acee3a2da7 crypto/armcap.c
68bfc2d78fe2c7607d4e7df04929666cb8100f149a593603f383911980bd4261 crypto/armv4cpuid.pl
779ea664cd73b8bf2e286cd4d01bfa04ff1543dbed821c79978b98fb80f76576 crypto/array_alloc.c
e886d814c34492504cc9a2451c67fd8c0b4e83e8618f931632400cfe522b6e4d crypto/asn1_dsa.c
@@ -125,7 +125,7 @@ f42996cdd94f18fe0858552be7123e75cb3ced0ebd7dcb90a0c73740090dcac9 crypto/bn/bn_w
2f048ca8e8ddc5e2b8b82775197f79334381dd90bab417b2855bfeee07b99db8 crypto/bn/rsaz_exp.c
45f7212a616e33db1310126e213fdaded8e3dc8a200b0520306cf423c485e58d crypto/bn/rsaz_exp.h
40a6f24c3575238dbb47958b613684d46c8c442f203cf07ef02f6cadcbebc31d crypto/bn/rsaz_exp_x2.c
-72b85ca219bfdc7f990e07cc15decd9f46a12fd71cdc7c2331916c5009e5f48e crypto/bsearch.c
+f3b706e4856aeb5ddcd4eec25897e75fe4c129a09a08048aea26850f577a025b crypto/bsearch.c
82117f6a7cfc31fc86ecd9629bd3bf614126b8e8b2c23717a03ff5c1db7c3c5c crypto/buffer/buffer.c
b99af1c5b04b34af14774966372dd90651c462797753b5f0576822671cd5c40f crypto/c64xpluscpuid.pl
63835e57e16d3e463dc3ec8d1dbf907aa0824b59cbbc309983ff62546655d644 crypto/cmac/cmac.c
@@ -194,9 +194,9 @@ a1f22814f501780591da20de5e724895438094824fce440fd026850c46ad8149 crypto/ec/ec_a
3a3c4f4767513b4fbbabdea2918d7c7d105eb573334a7fd893b866989463c4d2 crypto/ec/ec_check.c
236f02fe2602088a3ffdb3fcd6a8211db4f2014246bc90c134ce472b80a15208 crypto/ec/ec_curve.c
8cfd0dcfb5acbf6105691a2d5e2826dba1ff3906707bc9dd6ff9bffcc306468f crypto/ec/ec_cvt.c
-040b00015f640eeb9db5e1589b0a314d80421a3cdd09fa92ba4939cb6d6486ac crypto/ec/ec_key.c
+449d30aaf42e0d632b2c292ebc0b28e1d111ffa03a9dbac218ef9f9f8500e418 crypto/ec/ec_key.c
62bed8d5fd7389e991bdc4a6f0ab4a7dcd929952b2ee34e567c06b25bb06cfd9 crypto/ec/ec_kmeth.c
-53414114df475556b196c24498e52dccee35ed0353e708c7444a3a35475ba527 crypto/ec/ec_lib.c
+242124fd75d1884a01a84fc00d2f72e13aa415781a1a809e70fed6ccfdd49fe2 crypto/ec/ec_lib.c
ebe9ca2a6d10c484a65e8106e657b495873c1a34c9d5a1e8b78d7d9f360e2bdc crypto/ec/ec_local.h
f250770ab269bbc4a8113e873dbab6166c1058905bba2c5aa4a55eb2c5a0b2f7 crypto/ec/ec_mult.c
c2a81f5f56d304038183ba6b02fdcba8767833f61773ec483e73b330b67ae59b crypto/ec/ec_oct.c
@@ -228,14 +228,14 @@ dff5f95e7ce972915f260b6e0bb542b57c8a7771e1db9376b2fe8181915d2a35 crypto/evp/evp
c55e3b0a2e8e9fab282343463909b4c4139a40449e9c2eaf1c81aad2b9001f17 crypto/evp/kdf_lib.c
d2f75dcd0f0194a464b8ed4035c988599e8cdc1cb63711b9a30939401c671c22 crypto/evp/kdf_meth.c
955b84ca25e9118fcf0b9dfdfa77c57cd0c8608c431c71e1a0a05a2a27f81d0c crypto/evp/kem.c
-a7ed6f797fe62f950f549aab6c13bc7357bd59de140feb8af9437c7a3117422e crypto/evp/keymgmt_lib.c
+b31425fdbf48b27a031863f6894b5786c88b507dcf64ea3a189f647243eb302d crypto/evp/keymgmt_lib.c
94ef431b1bb2c96cca3806b8fdb100bb9d9f7afc1fbf417d6f03b7043657eeae crypto/evp/keymgmt_meth.c
b68fa4796b20a4735f4779371859b27b5d55f145f791d7cade8ef90c7d85bca7 crypto/evp/mac_lib.c
9b812a03bf763f3fe2dc9b86daeef05d8b9946f7efe43b6d312bc487340f8aed crypto/evp/mac_meth.c
-b09d2c6cb6307a287af190aa744ea6ac78618cb9522e7cedf324de76d24bbab3 crypto/evp/p_lib.c
+83ac5b810252435c80e2bb1f367e347bebcf94f96d3944b306a33518eb7dba06 crypto/evp/p_lib.c
eb7ad84686854874250101adf52a3498c7e08ea63e5de17845d35f2a66461148 crypto/evp/pmeth_check.c
05c6934d0d8befa8f551323db31a9a908bba7e9cfebe1161a2bfb0eb4c3b36a5 crypto/evp/pmeth_gn.c
-10de135d3bf315ea2f1e97a2aff46e0911dd074a3af5fd429a437192ea72f2c3 crypto/evp/pmeth_lib.c
+2bb5dbf7ecc6a27ceb23503bb99371a915a089a038dc9f39482fd7f582e83b7b crypto/evp/pmeth_lib.c
1d4ac1c4a0bf0a5e7a99d98dcfc96f8569bbc718df3a2ae208f776dc681e4eb8 crypto/evp/signature.c
82738dd892e0cfa1897f58ed21a8ba66b5505ad774a484eaa0edf70d1b69b359 crypto/evp/skeymgmt_meth.c
d40ee57a311a8aed79b1995e4667c6191d4a6d073eec343a6d9ce432830e9a16 crypto/ex_data.c
@@ -247,16 +247,16 @@ f4f84cade98907fa9905334b6c3c046b430b12b1460edac0617d82ca763620ab crypto/ffc/ffc
56c52c6df6cd9282296f24b395e6a78deb35248e79a26186a75fc508262c47f7 crypto/ffc/ffc_params_generate.c
e9a500ddbe96cb5b302fd2db74fac0924a6ac45732df5ee1c09e82b19d06ccfd crypto/ffc/ffc_params_validate.c
f172c8c2112ee82716a7bc3a3e05d5cc26188c66b9d768ac1ff906845063d2cc crypto/hashtable/hashfunc.c
-21b74f0abd0f84390c90398bb2812565e183e0f35b2561ff20a52941ae67a86b crypto/hashtable/hashtable.c
+14f9310c0a6b4dd26682ceddee36d74d144364a02d44b520e0102fdd398ba528 crypto/hashtable/hashtable.c
95cbfbdd853f415d886928834f59d01a5fd08c71a154268c881dcbcc1131abc0 crypto/hmac/hmac.c
f1e386f65db354b5a0c4248d3df6ee690881aaa3fd4049fdc443f9eeb635f8e7 crypto/hmac/hmac_local.h
f9743f1646fbd8b61a2dd0422f42934912c1bfc95f6dcc38fa0a567e3e6b4e95 crypto/ia64cpuid.S
99727373714d17bfaadf837581cb82b95100604fabb5926c22dc68e4fda08d57 crypto/initthread.c
-863a23d7441e71e065c4d1a29c17eb2e575bbb03ab31407ead9e7ad2c16a2c9a crypto/lhash/lhash.c
+4cb48e869d09e020d338ae0834eb2b41d161809fbf078372eb77c2d4d31f15e7 crypto/lhash/lhash.c
256d8ee6275df46ba94b882cdb7b3c7210ac1b4b0602748ff6fe8af3b27981f5 crypto/lhash/lhash_local.h
f66ff2d5e6fcf5c858b46bce16ee991126d362df0bc0ebe26213272c7f02db7f crypto/loongarch64cpuid.pl
d3ae6c0273dc6e955fb878ae689460a72dd9fdac93b2c9e19b79d2c78a304a37 crypto/loongarchcap.c
-f866aafae928db1b439ac950dc90744a2397dfe222672fe68b3798396190c8b0 crypto/mem_clr.c
+b674d1491c72a410778ac65a12c103046c9f8ce9673ff8a59e91cc0935554402 crypto/mem_clr.c
5e33547e2f6775a89701b311712e6a3ee6e2a64a8f283eae9e61a4a01c392e69 crypto/ml_dsa/asm/ml_dsa_ntt-x86_64.pl
023bf73b6e04d9c999815d7ec84297943aa9766e1ab5a72a1869c95a377ce851 crypto/ml_dsa/ml_dsa_encoders.c
39c6f4c50a388eb16197539132a97cc15b0b74b93ecfc2263a36a0423c2e15b0 crypto/ml_dsa/ml_dsa_hash.h
@@ -320,7 +320,7 @@ e8100495a62f53f95e38a7c4748ce47973a2a70b799468de1d5a26ca8639f5bb crypto/propert
2577c6f712200633fd27236928d4e857248ff9ace2c8858e9295185e0b07571c crypto/property/property_parse.c
fce93d3e7da046501120573317248945945845a7aca1344e36a386d44504f441 crypto/property/property_query.c
5b35510efa119157e9e217996870778d1ab5f69612cc1bcc8a6df372a625e875 crypto/property/property_string.c
-f319002443b029e36c4962d0d283a613787460d293447330fc69363b5df64245 crypto/provider_core.c
+fd5665960fbc4c5e54a7768669bbe97755dfaae1ddce9a2ec7c7b7bebe905258 crypto/provider_core.c
2142e38017cb142e0901eeb38dc12bc435ca367fdba05a613e8506076133a6f2 crypto/provider_local.h
5ba2e1c74ddcd0453d02e32612299d1eef18eff8493a7606c15d0dc3738ad1d9 crypto/provider_predefined.c
87ad98160d380c4e1e8729a922d889e7fa4976ed2990d306cb2239bc4ed8479b crypto/rand/rand_lib.c
@@ -456,7 +456,7 @@ e92402ab6c4f2700b9db83759bc2f78b6f64bd246148990c15aef44cfebfa50b include/crypto
c88b1ecda000ed04f1384fe9656d9daf6ce0ad6f6bdaeaff5975318e66f5eaed include/crypto/ec.h
1358210d72d55cf7f5a10049e8c2cb704a3a4825f51067ca1b67ef1173492270 include/crypto/ec_params.h.in
8eef8896afdccc8c90c548e0d11b290c004df3231a1777e8205b88c04645c4b5 include/crypto/ecx.h
-356c020bb43ef9cc74196ba5202b6ba27a556c5c1634d813934acab81776c874 include/crypto/evp.h
+d23492e809bc66320c8da731b57aadcde9a15181fd93c3287040ffc98faea1f1 include/crypto/evp.h
fc22d8a6d80875c8c45c51a449069b936eadb9621aa9c0bcc8c5d493eed1e52c include/crypto/lhash.h
ab213f48a42742b4c206e90c3b25a73a9de2911b8f5e0b0a3b1ef2429abebd61 include/crypto/md32_common.inc
47a92e596adaf252ed86d3c363e1b7d1893445aaef302eb50cf18473c3c08541 include/crypto/ml_dsa.h
@@ -501,7 +501,7 @@ ee75ecd35b3ae90c51ace957ab7ce06de3c7d5064b97a878241ff65cc943a6db include/intern
5b108c19f064ec47fffe1b3fe310d4693b6db3920b8cc2e5dc05595751ab0f3b include/internal/provider.h
0a16bdf16ba4e75f70535ffbd3e27acd9df32b2c9ef30af901e5a112b9e8649f include/internal/rcu.h
a95f2eb512e23f9628dec78ac17d4e6ef67714fc6206bbf1b12243b6e13bc565 include/internal/refcount.h
-f77c0844cc44bd92965647cd8cb6addb210f0300a8d1090da8c26e4382e87c2c include/internal/safe_math.h
+8bfd201befb0cbde41853dfdb49888710922bc3d7820a471fbedf9db9c43b7ef include/internal/safe_math.h
17f6585bc81ad324d00aaacd558e0176dbe22cc7cbdb353c8c9072fa40000a58 include/internal/sha3.h
8e672cc0620606b044f63b8446125f5233d64e3eea59df54c1fcca6bc90ba537 include/internal/sizes.h
6b1d59c45ed2bd1b049796e67c4d08309fa25914741bf7ac72e3e41447e27916 include/internal/skey.h
@@ -651,7 +651,7 @@ a50e306a0fad6a20f464c107291376e63cbf4652ebb3e1ea356d8ff1d57f329e providers/impl
548fc02c2fd384047950a692e008cb28e4b3bcc49e5e3fae0aa7b6ecf2474266 providers/implementations/ciphers/cipher_aes_hw_rv64i.c
ede48034be45a6c0a0ee66a37bc42c07945146c437897e6e90043d10c6db42d1 providers/implementations/ciphers/cipher_aes_hw_s390x.c
c58f79911106ec449818578d5bee79718ca7eef2e8ead1f3b4e07d8aad3d54ba providers/implementations/ciphers/cipher_aes_hw_t4.c
-dd5134041a455f56987146900b7cd376642022e64166a4ad7d4f1a9440073c09 providers/implementations/ciphers/cipher_aes_ocb.c
+210d5dfb02aee7f085cc59351684d093b9d622ea136cb5c9e831e79312cad5a2 providers/implementations/ciphers/cipher_aes_ocb.c
cc1aab4ef55dd459d3240ddde6c9a7023301f9da61a76938e8b3eec3cb0caf5e providers/implementations/ciphers/cipher_aes_ocb.h
b9cb159602c57cf06a8eeecb9f301aa3673dac0a9154dcc60dc24e8e4bd55df8 providers/implementations/ciphers/cipher_aes_ocb_hw.c
fb6a566d1d1ec28bb3449dc60b86084f94b3a4ab8bbe834f78d608a4bc3f0cee providers/implementations/ciphers/cipher_aes_wrp.c
@@ -667,13 +667,13 @@ bc3ec200e5f13b36e5d682c589ce171b6d6e1da3a76f0ceedb916ed28eca0ec4 providers/impl
cca34f1c7baf3a98964f7ce19a59e06d1eaf2ada121a0d4a438f4078a072b325 providers/implementations/ciphers/cipher_tdes_hw.c
5fa2f02b8de00a9c8b34e71e619062bfce0413c9cb3e3e3107ced4fca265009f providers/implementations/ciphers/ciphercommon.c
2afe5bdf23e7facf956f8a1591c10ad06088fe82b3af846ef3132c7e17bdaf82 providers/implementations/ciphers/ciphercommon_block.c
-bb7632f5e32c5993eda21ae3ba87fca538e9a99022404473c4890cafea48c5be providers/implementations/ciphers/ciphercommon_ccm.c
+a9725d75c51e1e1675d668cb022a117aa419bd1e666226d472300c4b6dc2979b providers/implementations/ciphers/ciphercommon_ccm.c
6632a555d5bcd5af67d0355ce46c2906bb3a0dcdf1651595b29189c40a5ca675 providers/implementations/ciphers/ciphercommon_ccm_hw.c
-c9bf23a8d0827462e142ace9c967180fe3b7ceb43a34b1d028e98904af8ae64b providers/implementations/ciphers/ciphercommon_gcm.c
+9e7c57f15ba875456a256c2c3f914cd1dac5aec7325475bf84b17737400cbdab providers/implementations/ciphers/ciphercommon_gcm.c
bb67eaa7a98494ca938726f9218213870fc97dd87b56bda950626cc794baf20b providers/implementations/ciphers/ciphercommon_gcm_hw.c
8bf2b4bef8167740ae3fffc9f0cf73327a1b4ee361e63da22c257cca0e1e2971 providers/implementations/ciphers/ciphercommon_hw.c
6292f6f2fb30a0c93e000d5a30d8703e25764ef0b38d38f1172d59c08bbcb97d providers/implementations/ciphers/ciphercommon_local.h
-a639cb1b3285e41fa4372bda7b74c66a358a0b7a038cfc9a9c171e5f15beb932 providers/implementations/digests/cshake_prov.c
+c1d9c4acc4c48ea2af6864198cbcdfae398f23aad87ac9ecfb2eb5f13dae4dca providers/implementations/digests/cshake_prov.c
b680a2e4bc430b681bb5a6857c173cd5214c11f046bfa747286cd4f08eb5f707 providers/implementations/digests/digestcommon.c
5ef05ffce97dcd1d29a5647f4c8edcd5375da138a1352fd67746d4f074f6d7aa providers/implementations/digests/ml_dsa_mu_prov.c
794505a44c44f8d835d8e5232691ccc809ab1eb03ebcd62a2432b6c75ab0c1af providers/implementations/digests/sha2_prov.c
@@ -696,7 +696,7 @@ fff5e4e34ffac0520ee8b351ef8445f2040d3b1d7d467d93eddcc8f015756937 providers/impl
88cb1046cda544e67db055a4c7e57b075a94950130ac0463d11dcfd7e4ce8107 providers/implementations/include/prov/ml_dsa.h
20e07d060977d08ffc9d568633e702d5c8537b366ae87ec83822faea20043a3f providers/implementations/include/prov/ml_kem.h
8b678d26c077e9135171aa27a8038041f320aa17a3441240865c54859c864ebb providers/implementations/include/prov/mlx_kem.h
-42c3dfee2b33f4216afd165df9ce28d38ba0c84cbfc090e238f03cc22d62299b providers/implementations/include/prov/names.h
+22214ceca4ff325127e70e5df2bdedaab486e168ddddd247e9755ecba3c773e3 providers/implementations/include/prov/names.h
462dbc1209f0281c1c4301e19fbb0b180d951584010da1430d9cd043cc5778b3 providers/implementations/include/prov/seeding.h
a8ce7c57945c6209da1be94dcb35b5067a088139e0918ae0723bcc17df3792bc providers/implementations/include/prov/skeymgmt_lcl.h
ab4c9694d2d918304991ca85772e6ac65cdc33e44ae6de3efbdc45bd49d9f706 providers/implementations/kdfs/hkdf.c
@@ -704,19 +704,19 @@ e8b4e8ebd10872ee42beeeffff7458b1d2991833edbc763e2275ce4060867b0c providers/impl
821d4b8166f151c95ab9eb27f7fd661b26ac08dc7b77deccd593dcc59206de91 providers/implementations/kdfs/ikev2kdf.c
84a83391cd7215a0d3d822f59cd08a465f82467b0e7ab4c369a266a248a99e27 providers/implementations/kdfs/kbkdf.c
ac8b12984dd6712d5edf372575e381fc98c05d56ab03047434d0366ac698c954 providers/implementations/kdfs/pbkdf2.c
-7d9923c486d6751c3065c6748ea5d186fa2302f802818306cdee9ffdc3ac9d2f providers/implementations/kdfs/snmpkdf.c
+815d4f97f8e5d621e325a1584f659f5318b3958a6a50161598c84c4b91a12444 providers/implementations/kdfs/snmpkdf.c
ad7977d3357e95cb7d25dc8646ff0e9f16a24c7d2e5924750fc69035fbb5b089 providers/implementations/kdfs/srtpkdf.c
-4f70b937d163759b713335a194ca44ca084ce2e58c8a6d15c27e5f1bc61b17c3 providers/implementations/kdfs/sshkdf.c
+bfac9e4e4d62851eb460acb9ab76092c581f2336ee8a243338d1d37f8dd2bab3 providers/implementations/kdfs/sshkdf.c
ecac95b5cfe9864793c0d9339acbdd2f0c07938a3e3ab7a007fcf5120f57ff83 providers/implementations/kdfs/sskdf.c
85d950d15affed86179aaae679c13cef87c35261922227bf6599b53703f54a1e providers/implementations/kdfs/tls1_prf.c
7cf4c1f999a5046ffa1bc7ed2b7e9e575970a71159adb5c4cd21998bebaabe4a providers/implementations/kdfs/x942kdf.c
-2d5e050823bbcb669eacdd7d0a9330808a35c237c8c722cb6676431fd60c05e5 providers/implementations/kem/ml_kem_kem.c
+10efc466720bc9cdb2e0f77446f1107ef01bd71efca8d31512ae214765690d9d providers/implementations/kem/ml_kem_kem.c
38866b46c0c513b919764da57c507ca646e80cc9bb261ce53d47fac6a550447b providers/implementations/kem/mlx_kem.c
-45fbb2d6229202ac99ccbd23e4cd1a424080c5ece1332a787c9ddc0f6441c6cb providers/implementations/kem/rsa_kem.c
+d626c61e80f09e10f9149ef6b43eb072c3274ae9bca7d29541864e40e9b58d2e providers/implementations/kem/rsa_kem.c
842044fa8a651a56cc82336590b030bec59d25b868c841855bfa38b8e863c579 providers/implementations/keymgmt/dh_kmgmt.c
d34296ae8595aa1ed90b5652ab7e8fb7e2c5131f5dac7b69eeed7f0fdc2cb6ad providers/implementations/keymgmt/dsa_kmgmt.c
-eb2d1166a10fa324cd5bded35a739729cd0e693253d927df6737a252ce426e67 providers/implementations/keymgmt/ec_kmgmt.c
-4bdffb8f27db1c2c7727301590a7cb0f8d4c04d979f77921f34754346e837d0e providers/implementations/keymgmt/ecx_kmgmt.c
+47873a18a982fe7712f2d3ed6c04f05bab4f6122ee9742429a869859294ecf9a providers/implementations/keymgmt/ec_kmgmt.c
+7c14202cd6a1307a00148c779f00e883861bb0e75817acf57ee487c9d2972dd2 providers/implementations/keymgmt/ecx_kmgmt.c
dc53ca39327f8ebf9f065afe57ccf74df497056dada597f6929f8bc265e7b732 providers/implementations/keymgmt/kdf_legacy_kmgmt.c
a1afb4d73a07dfa617ae4dc4a0d361ba19403bd5e8f89c9a2c6ccbb93b8ae5f2 providers/implementations/keymgmt/mac_legacy_kmgmt.c
536e25f9b9a7db69957823dd5aa6630865bc963d9cf0e13b7010aae74ea2009d providers/implementations/keymgmt/ml_dsa_kmgmt.c
@@ -732,7 +732,7 @@ ce7866f670bb5b80b8fec42c79ed439e3f1f7edbab561f9a10042ccdbec2e855 providers/impl
7a4ddd75c4df60342154a1e08da480e4bde0c3607d2ae825f43e1ddd71f4d819 providers/implementations/rands/drbg_ctr.c
a65fb53d9b840f0e1c67fe64de2268e20b51f87c4e5fd2f4f057e9f549c8644e providers/implementations/rands/drbg_hash.c
232ca3e184258eef7cd83611975f0c77fff557dd7dd7c3b6147266efd2d103a0 providers/implementations/rands/drbg_hmac.c
-7715f89d9f03a1088e7fc65da1c32417e2f9455c031802a79639fdabf270db5a providers/implementations/rands/fips_crng_test.c
+3fd3039e7d966bb3beb0cb65ac858c08930b9d46dcfdd8de38f511bd4eda717d providers/implementations/rands/fips_crng_test.c
e5e41c1246cd779057adb86f7bc06cd74b606f02127dcc55afc020789825fcd3 providers/implementations/rands/test_rng.c
1c589393350cb573929f0604fba9f3abfb78ea3a77f892b8b497874be22b41a3 providers/implementations/signature/dsa_sig.c
0f69c91461cd360ac45e81b50c02a47d51d12fe0e314f00e35e4082622f46edd providers/implementations/signature/ecdsa_sig.c
@@ -745,4 +745,4 @@ e8f09acc2ee2e11059ee6702402eb7acdf68cc60caa2e48134ba5f9b12e7c50a providers/impl
3d39d2293b9642c722e65e46c1689c42a30b981730c1e6c317ffcf197b9b1ac7 providers/implementations/skeymgmt/generic.c
aa5a7a9e521c3281fdd55cc6a5deb5721c8d067ac1433979c6f2748871ca8d2f ssl/record/methods/ssl3_cbc.c
04f33a330e073222366d31b3498c775ec77bf491e9d27aa7ed65c8ab5f615897 ssl/record/methods/tls_pad.c
-6a064336295b488084050dbb511bf0127b0d91bac54d9132f2162a58b923f095 util/mkerr.pl
+53b6749b97435c7b1fd74b691bde4a2fb8a6b5de385702f94d7b162677eb5a0b util/mkerr.pl
diff --git a/deps/openssl/openssl/providers/fips.checksum b/deps/openssl/openssl/providers/fips.checksum
index ae128f4ea50..ed0d82fb9fa 100644
--- a/deps/openssl/openssl/providers/fips.checksum
+++ b/deps/openssl/openssl/providers/fips.checksum
@@ -1 +1 @@
-fc55c7cc2820af63932b7936ffdbea3fb50e72a1b574e0e591d8f95a277d89e9 providers/fips-sources.checksums
+7c311a35f51af35d806b44b7c16e893c7cb2c975f306c58509585f8ec5ef9807 providers/fips-sources.checksums
diff --git a/deps/openssl/openssl/providers/implementations/ciphers/build.info b/deps/openssl/openssl/providers/implementations/ciphers/build.info
index d3acd423e94..b5cb6d9945a 100644
--- a/deps/openssl/openssl/providers/implementations/ciphers/build.info
+++ b/deps/openssl/openssl/providers/implementations/ciphers/build.info
@@ -127,7 +127,7 @@ SOURCE[$AES_GOAL]=\
cipher_aes_cbc_hmac_sha256_etm_hw.c \
cipher_aes_cbc_hmac_sha512_etm_hw.c \
cipher_cts.c
-DEFINE[$AES_GOAL]=$AESXTSDEF
+DEFINE[$AES_GOAL]=$AESXTSDEF $GHASHDEF
# Extra code to satisfy the FIPS and non-FIPS separation.
# When the AES-xxx-XTS moves to legacy, cipher_aes_xts_fips.c can be removed.
diff --git a/deps/openssl/openssl/providers/implementations/ciphers/cipher_aes_gcm_siv.c b/deps/openssl/openssl/providers/implementations/ciphers/cipher_aes_gcm_siv.c
index ea343eb810c..70b56cf4350 100644
--- a/deps/openssl/openssl/providers/implementations/ciphers/cipher_aes_gcm_siv.c
+++ b/deps/openssl/openssl/providers/implementations/ciphers/cipher_aes_gcm_siv.c
@@ -100,6 +100,16 @@ static int ossl_aes_gcm_siv_init(void *vctx, const unsigned char *key, size_t ke
ctx->enc = enc;
+ /*
+ * Clear AAD when starting a new message or restarting after payload
+ * processing. Preserve pending AAD during parameter adjustments.
+ */
+ if (key != NULL || iv != NULL || ctx->used_enc || ctx->used_dec) {
+ OPENSSL_clear_free(ctx->aad, ctx->aad_len);
+ ctx->aad = NULL;
+ ctx->aad_len = 0;
+ }
+
if (key != NULL) {
if (keylen != ctx->key_len) {
ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_KEY_LENGTH);
@@ -257,6 +267,20 @@ static int ossl_aes_gcm_siv_set_ctx_params(void *vctx, const OSSL_PARAM params[]
return 0;
}
}
+
+ if (p.ivlen != NULL) {
+ size_t iv_len;
+
+ if (!OSSL_PARAM_get_size_t(p.ivlen, &iv_len)) {
+ ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_GET_PARAMETER);
+ return 0;
+ }
+ /* The nonce length can not be modified */
+ if (iv_len != sizeof(ctx->nonce)) {
+ ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_IV_LENGTH);
+ return 0;
+ }
+ }
return 1;
}
diff --git a/deps/openssl/openssl/providers/implementations/ciphers/cipher_aes_gcm_siv.inc.in b/deps/openssl/openssl/providers/implementations/ciphers/cipher_aes_gcm_siv.inc.in
index 891d3b976d0..a48d977b9c1 100644
--- a/deps/openssl/openssl/providers/implementations/ciphers/cipher_aes_gcm_siv.inc.in
+++ b/deps/openssl/openssl/providers/implementations/ciphers/cipher_aes_gcm_siv.inc.in
@@ -1,5 +1,5 @@
/*
- * Copyright 2025 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2025-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the \"License\"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -21,4 +21,5 @@ use OpenSSL::paramnames qw(produce_param_decoder);
(['OSSL_CIPHER_PARAM_KEYLEN', 'keylen', 'size_t'],
['OSSL_CIPHER_PARAM_SPEED', 'speed', 'uint'],
['OSSL_CIPHER_PARAM_AEAD_TAG', 'tag', 'octet_string'],
+ ['OSSL_CIPHER_PARAM_AEAD_IVLEN', 'ivlen', 'size_t'],
)); -}
diff --git a/deps/openssl/openssl/providers/implementations/ciphers/cipher_aes_gcm_siv_hw.c b/deps/openssl/openssl/providers/implementations/ciphers/cipher_aes_gcm_siv_hw.c
index d387973894d..d38c508bb94 100644
--- a/deps/openssl/openssl/providers/implementations/ciphers/cipher_aes_gcm_siv_hw.c
+++ b/deps/openssl/openssl/providers/implementations/ciphers/cipher_aes_gcm_siv_hw.c
@@ -115,13 +115,8 @@ static int aes_gcm_siv_aad(PROV_AES_GCM_SIV_CTX *ctx,
uint8_t *ptr;
uint64_t len64;
- /* length of 0 resets the AAD */
- if (len == 0) {
- OPENSSL_free(ctx->aad);
- ctx->aad = NULL;
- ctx->aad_len = 0;
+ if (len == 0)
return 1;
- }
to_alloc = UP16(ctx->aad_len + len);
/* need to check the size of the AAD per RFC8452 */
len64 = to_alloc;
diff --git a/deps/openssl/openssl/providers/implementations/ciphers/cipher_aes_ocb.c b/deps/openssl/openssl/providers/implementations/ciphers/cipher_aes_ocb.c
index 433e0265980..30d2a396bc7 100644
--- a/deps/openssl/openssl/providers/implementations/ciphers/cipher_aes_ocb.c
+++ b/deps/openssl/openssl/providers/implementations/ciphers/cipher_aes_ocb.c
@@ -512,6 +512,10 @@ static int aes_ocb_cipher(void *vctx, unsigned char *out, size_t *outl,
if (in == NULL)
return aes_ocb_block_final(vctx, out, outl, outsize);
+ /* A NULL output passes AAD, as with Update */
+ if (out == NULL)
+ return aes_ocb_block_update(vctx, out, outl, outsize, in, inl);
+
if (outsize < inl) {
ERR_raise(ERR_LIB_PROV, PROV_R_OUTPUT_BUFFER_TOO_SMALL);
return 0;
diff --git a/deps/openssl/openssl/providers/implementations/ciphers/cipher_aes_siv_hw.c b/deps/openssl/openssl/providers/implementations/ciphers/cipher_aes_siv_hw.c
index a1db52ade62..6f967c41715 100644
--- a/deps/openssl/openssl/providers/implementations/ciphers/cipher_aes_siv_hw.c
+++ b/deps/openssl/openssl/providers/implementations/ciphers/cipher_aes_siv_hw.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2019-2025 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2019-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -13,6 +13,7 @@
*/
#include "internal/deprecated.h"
+#include <openssl/proverr.h>
#include "cipher_aes_siv.h"
static void aes_siv_cleanup(void *vctx);
@@ -114,9 +115,13 @@ static int aes_siv_cipher(void *vctx, unsigned char *out,
if (in == NULL)
return ossl_siv128_finish(sctx) == 0;
- /* Deal with associated data */
- if (out == NULL)
- return (ossl_siv128_aad(sctx, in, len) == 1);
+ if (out == NULL) {
+ if (sctx->final_ret == 0) {
+ ERR_raise(ERR_LIB_PROV, PROV_R_UPDATE_CALL_OUT_OF_ORDER);
+ return 0;
+ }
+ return ossl_siv128_aad(sctx, in, len) == 1;
+ }
if (ctx->enc)
return ossl_siv128_encrypt(sctx, in, out, len) > 0;
diff --git a/deps/openssl/openssl/providers/implementations/ciphers/ciphercommon_ccm.c b/deps/openssl/openssl/providers/implementations/ciphers/ciphercommon_ccm.c
index 70e16aee0a8..083a66ec931 100644
--- a/deps/openssl/openssl/providers/implementations/ciphers/ciphercommon_ccm.c
+++ b/deps/openssl/openssl/providers/implementations/ciphers/ciphercommon_ccm.c
@@ -174,7 +174,7 @@ int ossl_ccm_get_ctx_params(void *vctx, OSSL_PARAM params[])
ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_IV_LENGTH);
return 0;
}
- if (!OSSL_PARAM_set_octet_string_or_ptr(p.iv, ctx->iv, p.iv->data_size)) {
+ if (!OSSL_PARAM_set_octet_string_or_ptr(p.iv, ctx->iv, ccm_get_ivlen(ctx))) {
ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_SET_PARAMETER);
return 0;
}
@@ -185,7 +185,7 @@ int ossl_ccm_get_ctx_params(void *vctx, OSSL_PARAM params[])
ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_IV_LENGTH);
return 0;
}
- if (!OSSL_PARAM_set_octet_string_or_ptr(p.updiv, ctx->iv, p.updiv->data_size)) {
+ if (!OSSL_PARAM_set_octet_string_or_ptr(p.updiv, ctx->iv, ccm_get_ivlen(ctx))) {
ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_SET_PARAMETER);
return 0;
}
diff --git a/deps/openssl/openssl/providers/implementations/ciphers/ciphercommon_gcm.c b/deps/openssl/openssl/providers/implementations/ciphers/ciphercommon_gcm.c
index a0068066d45..ac05c2502ea 100644
--- a/deps/openssl/openssl/providers/implementations/ciphers/ciphercommon_gcm.c
+++ b/deps/openssl/openssl/providers/implementations/ciphers/ciphercommon_gcm.c
@@ -146,6 +146,9 @@ static int setivinv(PROV_GCM_CTX *ctx, unsigned char *in, size_t inl)
|| ctx->enc)
return 0;
+ if (inl == 0 || inl > ctx->ivlen)
+ return 0;
+
memcpy(ctx->iv + ctx->ivlen - inl, in, inl);
if (!ctx->hw->setiv(ctx, ctx->iv, ctx->ivlen))
return 0;
diff --git a/deps/openssl/openssl/providers/implementations/digests/cshake_prov.c b/deps/openssl/openssl/providers/implementations/digests/cshake_prov.c
index 7dd9c589406..7f4bf076ff9 100644
--- a/deps/openssl/openssl/providers/implementations/digests/cshake_prov.c
+++ b/deps/openssl/openssl/providers/implementations/digests/cshake_prov.c
@@ -151,7 +151,7 @@ static int cshake_set_encode_string(const char *in,
*/
if (inlen == 0)
return 1;
- if (inlen >= CSHAKE_MAX_STRING)
+ if (inlen > CSHAKE_MAX_STRING)
return 0;
return ossl_sp800_185_encode_string(out, outmax, outlen,
(const unsigned char *)in, inlen);
@@ -270,8 +270,10 @@ static int cshake_init(void *vctx, const OSSL_PARAM params[])
return 0;
ctx->inited = 0;
ctx->xoflen = (ctx->bitlen == 128) ? 32 : 64; /* Set default values here */
- cshake_set_func_encode_string(NULL, &ctx->func, &ctx->funclen);
- cshake_set_encode_string(NULL, ctx->custom, sizeof(ctx->custom), &ctx->customlen);
+ if (!cshake_set_func_encode_string(NULL, &ctx->func, &ctx->funclen)
+ || !cshake_set_encode_string(NULL, ctx->custom, sizeof(ctx->custom),
+ &ctx->customlen))
+ return 0;
return cshake_set_ctx_params(vctx, params);
}
diff --git a/deps/openssl/openssl/providers/implementations/encode_decode/encode_key2any.c b/deps/openssl/openssl/providers/implementations/encode_decode/encode_key2any.c
index 1d12bf1e9e7..dbadcad0554 100644
--- a/deps/openssl/openssl/providers/implementations/encode_decode/encode_key2any.c
+++ b/deps/openssl/openssl/providers/implementations/encode_decode/encode_key2any.c
@@ -96,7 +96,7 @@ static PKCS8_PRIV_KEY_INFO *key_to_p8info(const void *key, int key_nid,
{
/* der, derlen store the key DER output and its length */
unsigned char *der = NULL;
- int derlen;
+ int derlen = 0;
/* The final PKCS#8 info */
PKCS8_PRIV_KEY_INFO *p8info = NULL;
@@ -104,6 +104,8 @@ static PKCS8_PRIV_KEY_INFO *key_to_p8info(const void *key, int key_nid,
|| (derlen = k2d(key, &der, (void *)ctx)) <= 0
|| !PKCS8_pkey_set0(p8info, OBJ_nid2obj(key_nid), 0,
params_type, params, der, derlen)) {
+ if (der != NULL && derlen > 0)
+ OPENSSL_cleanse(der, derlen);
ERR_raise(ERR_LIB_PROV, ERR_R_ASN1_LIB);
PKCS8_PRIV_KEY_INFO_free(p8info);
OPENSSL_free(der);
diff --git a/deps/openssl/openssl/providers/implementations/include/prov/names.h b/deps/openssl/openssl/providers/implementations/include/prov/names.h
index 09146dd01ed..cf5bef8c077 100644
--- a/deps/openssl/openssl/providers/implementations/include/prov/names.h
+++ b/deps/openssl/openssl/providers/implementations/include/prov/names.h
@@ -183,7 +183,8 @@
#define PROV_NAMES_CAST5_OFB "CAST5-OFB"
#define PROV_NAMES_CAST5_CFB "CAST5-CFB"
#define PROV_NAMES_BF_ECB "BF-ECB"
-#define PROV_NAMES_BF_CBC "BF-CBC:BF:BLOWFISH:1.3.6.1.4.1.3029.1.2"
+/* keep the old incorrect blowfish OID as an alias for compatibility */
+#define PROV_NAMES_BF_CBC "BF-CBC:BF:BLOWFISH:1.3.6.1.4.1.3029.1.1.2:1.3.6.1.4.1.3029.1.2"
#define PROV_NAMES_BF_OFB "BF-OFB"
#define PROV_NAMES_BF_CFB "BF-CFB"
#define PROV_NAMES_IDEA_ECB "IDEA-ECB"
diff --git a/deps/openssl/openssl/providers/implementations/kdfs/argon2.c b/deps/openssl/openssl/providers/implementations/kdfs/argon2.c
index b988aa212f9..7f681d777d8 100644
--- a/deps/openssl/openssl/providers/implementations/kdfs/argon2.c
+++ b/deps/openssl/openssl/providers/implementations/kdfs/argon2.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2022-2025 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2022-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -574,11 +574,12 @@ static int fill_mem_blocks_mt(KDF_ARGON2 *ctx)
for (l = 0; l < ctx->lanes; ++l) {
ARGON2_POS p;
if (l >= ctx->threads) {
- if (ossl_crypto_thread_join(t[l - ctx->threads], NULL) == 0)
+ void *thr = t[l - ctx->threads];
+ if (ossl_crypto_thread_join(thr, NULL) == 0)
goto fail;
- if (ossl_crypto_thread_clean(t[l - ctx->threads]) == 0)
+ t[l - ctx->threads] = NULL;
+ if (ossl_crypto_thread_clean(thr) == 0)
goto fail;
- t[l] = NULL;
}
p.pass = r;
@@ -591,22 +592,16 @@ static int fill_mem_blocks_mt(KDF_ARGON2 *ctx)
t[l] = ossl_crypto_thread_start(ctx->libctx, &fill_segment_thr,
(void *)&t_data[l]);
if (t[l] == NULL) {
- for (ll = 0; ll < l; ++ll) {
- if (ossl_crypto_thread_join(t[ll], NULL) == 0)
- goto fail;
- if (ossl_crypto_thread_clean(t[ll]) == 0)
- goto fail;
- t[ll] = NULL;
- }
goto fail;
}
}
for (l = ctx->lanes - ctx->threads; l < ctx->lanes; ++l) {
- if (ossl_crypto_thread_join(t[l], NULL) == 0)
- goto fail;
- if (ossl_crypto_thread_clean(t[l]) == 0)
+ void *thr = t[l];
+ if (ossl_crypto_thread_join(thr, NULL) == 0)
goto fail;
t[l] = NULL;
+ if (ossl_crypto_thread_clean(thr) == 0)
+ goto fail;
}
}
}
@@ -617,10 +612,18 @@ static int fill_mem_blocks_mt(KDF_ARGON2 *ctx)
return 1;
fail:
- if (t_data != NULL)
- OPENSSL_free(t_data);
- if (t != NULL)
- OPENSSL_free(t);
+ if (t != NULL) {
+ for (ll = 0; ll < ctx->lanes; ++ll) {
+ if (t[ll] == NULL)
+ continue;
+ if (ossl_crypto_thread_join(t[ll], NULL) != 0)
+ (void)ossl_crypto_thread_clean(t[ll]);
+ t[ll] = NULL;
+ }
+ }
+
+ OPENSSL_free(t_data);
+ OPENSSL_free(t);
return 0;
}
@@ -1110,8 +1113,15 @@ static int kdf_argon2_derive(void *vctx, unsigned char *out, size_t outlen,
if (initialize(ctx) != 1)
return 0;
- if (fill_memory_blocks(ctx) != 1)
+ if (fill_memory_blocks(ctx) != 1) {
+ if (ctx->type != ARGON2_D)
+ OPENSSL_secure_clear_free(ctx->memory,
+ ctx->memory_blocks * sizeof(BLOCK));
+ else
+ OPENSSL_clear_free(ctx->memory,
+ ctx->memory_blocks * sizeof(BLOCK));
return 0;
+ }
finalize(ctx, out);
diff --git a/deps/openssl/openssl/providers/implementations/kdfs/pbkdf1.c b/deps/openssl/openssl/providers/implementations/kdfs/pbkdf1.c
index 3eefbc8215d..9201d6eda23 100644
--- a/deps/openssl/openssl/providers/implementations/kdfs/pbkdf1.c
+++ b/deps/openssl/openssl/providers/implementations/kdfs/pbkdf1.c
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2025 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1999-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -307,7 +307,7 @@ static void *kdf_pbkdf1_derive_skey(void *vctx, const char *key_type ossl_unused
return NULL;
if (kdf_pbkdf1_derive(vctx, key, keylen, params) == 0) {
- OPENSSL_free(key);
+ OPENSSL_clear_free(key, keylen);
return NULL;
}
@@ -315,7 +315,7 @@ static void *kdf_pbkdf1_derive_skey(void *vctx, const char *key_type ossl_unused
(void *)key, keylen);
ret = import(provctx, OSSL_SKEYMGMT_SELECT_SECRET_KEY, import_params);
- OPENSSL_free(key);
+ OPENSSL_clear_free(key, keylen);
return ret;
}
diff --git a/deps/openssl/openssl/providers/implementations/kdfs/snmpkdf.c b/deps/openssl/openssl/providers/implementations/kdfs/snmpkdf.c
index e857abc1e8e..7fc2d9fa5a9 100644
--- a/deps/openssl/openssl/providers/implementations/kdfs/snmpkdf.c
+++ b/deps/openssl/openssl/providers/implementations/kdfs/snmpkdf.c
@@ -163,6 +163,13 @@ static int kdf_snmpkdf_set_ctx_params(void *vctx, const OSSL_PARAM params[])
if (ctx == NULL || !snmp_set_ctx_params_decoder(params, &p))
return 0;
+ if (p.pw != NULL
+ && (p.pw->data_size < KDF_SNMP_MIN_PASSWORD_LEN
+ || p.pw->data_size > KDF_SNMP_PASSWORD_HASH_AMOUNT)) {
+ ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_INPUT_LENGTH);
+ return 0;
+ }
+
libctx = PROV_LIBCTX_OF(ctx->provctx);
if (p.digest != NULL) {
if (!ossl_prov_digest_load(&ctx->digest, p.digest, p.propq, libctx))
@@ -181,8 +188,6 @@ static int kdf_snmpkdf_set_ctx_params(void *vctx, const OSSL_PARAM params[])
if (p.pw != NULL) {
if (!snmpkdf_set_membuf(&ctx->password, &ctx->password_len, p.pw))
return 0;
- if ((ctx->password_len > KDF_SNMP_PASSWORD_HASH_AMOUNT) || (ctx->password_len < KDF_SNMP_MIN_PASSWORD_LEN))
- return 0;
}
if (p.eid != NULL && !snmpkdf_set_membuf(&ctx->eid, &ctx->eid_len, p.eid))
@@ -305,8 +310,12 @@ static int SNMPKDF(const EVP_MD *evp_md,
}
value = EVP_MD_get_size(evp_md);
- if (value <= 0 || (size_t)value > keylen)
+ if (value <= 0)
+ goto err;
+ if ((size_t)value != keylen) {
+ ERR_raise(ERR_LIB_PROV, PROV_R_WRONG_OUTPUT_BUFFER_SIZE);
goto err;
+ }
mdsize = (size_t)value;
if (!EVP_DigestInit_ex(md, evp_md, NULL))
diff --git a/deps/openssl/openssl/providers/implementations/kdfs/sshkdf.c b/deps/openssl/openssl/providers/implementations/kdfs/sshkdf.c
index ee2f75a7c2a..bbc7bfbd040 100644
--- a/deps/openssl/openssl/providers/implementations/kdfs/sshkdf.c
+++ b/deps/openssl/openssl/providers/implementations/kdfs/sshkdf.c
@@ -195,6 +195,11 @@ static int kdf_sshkdf_derive(void *vctx, unsigned char *key, size_t keylen,
ERR_raise(ERR_LIB_PROV, PROV_R_MISSING_MESSAGE_DIGEST);
return 0;
}
+ /* each round concats a digest, so we need positive len */
+ if (EVP_MD_get_size(md) <= 0) {
+ ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_DIGEST_SIZE);
+ return 0;
+ }
if (ctx->key == NULL) {
ERR_raise(ERR_LIB_PROV, PROV_R_MISSING_KEY);
return 0;
diff --git a/deps/openssl/openssl/providers/implementations/kem/ml_kem_kem.c b/deps/openssl/openssl/providers/implementations/kem/ml_kem_kem.c
index 2d38e8c805d..e6e4bcd672c 100644
--- a/deps/openssl/openssl/providers/implementations/kem/ml_kem_kem.c
+++ b/deps/openssl/openssl/providers/implementations/kem/ml_kem_kem.c
@@ -49,7 +49,7 @@ static void *ml_kem_newctx(void *provctx)
{
PROV_ML_KEM_CTX *ctx;
- if ((ctx = OPENSSL_malloc(sizeof(*ctx))) == NULL)
+ if (!ossl_prov_is_running())
return NULL;
#ifdef FIPS_MODULE
@@ -58,11 +58,7 @@ static void *ml_kem_newctx(void *provctx)
return NULL;
#endif
- ctx->key = NULL;
- ctx->entropy = NULL;
- ctx->op = 0;
- ctx->test_entropy_used = 0;
- return ctx;
+ return OPENSSL_zalloc(sizeof(*ctx));
}
static void ml_kem_freectx(void *vctx)
diff --git a/deps/openssl/openssl/providers/implementations/kem/rsa_kem.c b/deps/openssl/openssl/providers/implementations/kem/rsa_kem.c
index 675409ba33d..2764e3268f1 100644
--- a/deps/openssl/openssl/providers/implementations/kem/rsa_kem.c
+++ b/deps/openssl/openssl/providers/implementations/kem/rsa_kem.c
@@ -318,6 +318,15 @@ static int rsasve_generate(PROV_RSA_CTX *prsactx,
return 0;
}
+ /*
+ * Likewise, if secretlen is specified it must report the length of the
+ * secret buffer, which receives nlen bytes
+ */
+ if (secretlen != NULL && *secretlen < nlen) {
+ ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_OUTPUT_LENGTH);
+ return 0;
+ }
+
/*
* Step (2): Generate a random byte string z of nlen bytes where
* 1 < z < n - 1
diff --git a/deps/openssl/openssl/providers/implementations/keymgmt/ec_kmgmt.c b/deps/openssl/openssl/providers/implementations/keymgmt/ec_kmgmt.c
index 391cc6b3c6e..905fc21d61b 100644
--- a/deps/openssl/openssl/providers/implementations/keymgmt/ec_kmgmt.c
+++ b/deps/openssl/openssl/providers/implementations/keymgmt/ec_kmgmt.c
@@ -1418,6 +1418,7 @@ static void ec_gen_cleanup(void *genctx)
OPENSSL_free(gctx->encoding);
OPENSSL_free(gctx->seed);
OPENSSL_free(gctx->gen);
+ OPENSSL_free(gctx->group_check);
OPENSSL_free(gctx);
}
diff --git a/deps/openssl/openssl/providers/implementations/keymgmt/ecx_kmgmt.c b/deps/openssl/openssl/providers/implementations/keymgmt/ecx_kmgmt.c
index a12b02e41a1..eb075ef568e 100644
--- a/deps/openssl/openssl/providers/implementations/keymgmt/ecx_kmgmt.c
+++ b/deps/openssl/openssl/providers/implementations/keymgmt/ecx_kmgmt.c
@@ -449,7 +449,7 @@ static int ecx_set_params(void *key, const OSSL_PARAM params[])
|| !OSSL_PARAM_get_octet_string(p.pub, &buf, sizeof(ecxkey->pubkey),
NULL))
return 0;
- OPENSSL_clear_free(ecxkey->privkey, ecxkey->keylen);
+ OPENSSL_secure_clear_free(ecxkey->privkey, ecxkey->keylen);
ecxkey->privkey = NULL;
ecxkey->haspubkey = 1;
}
diff --git a/deps/openssl/openssl/providers/implementations/rands/drbg.c b/deps/openssl/openssl/providers/implementations/rands/drbg.c
index 000b4a2f699..1e2f583e682 100644
--- a/deps/openssl/openssl/providers/implementations/rands/drbg.c
+++ b/deps/openssl/openssl/providers/implementations/rands/drbg.c
@@ -406,7 +406,7 @@ int ossl_prov_drbg_instantiate(PROV_DRBG *drbg, unsigned int strength,
/*
* NIST SP800-90Ar1 section 9.1 says you can combine getting
* the entropy and nonce in 1 call by increasing the entropy
- * with 50% and increasing the minimum length to accommodate
+ * by 50% and increasing the minimum length to accommodate
* the length of the nonce. We do this in case a nonce is
* required and there is no parental nonce capability.
*/
diff --git a/deps/openssl/openssl/providers/implementations/rands/fips_crng_test.c b/deps/openssl/openssl/providers/implementations/rands/fips_crng_test.c
index 4b45d0828f1..8515f94be1b 100644
--- a/deps/openssl/openssl/providers/implementations/rands/fips_crng_test.c
+++ b/deps/openssl/openssl/providers/implementations/rands/fips_crng_test.c
@@ -113,11 +113,11 @@ static int RCT_test(CRNG_TEST *crngt, uint8_t next)
*
* C = 1 + \left\lceil\frac{ -log_2 \alpha}H\right\rceil
*
- * where alpha = 2^-20 and H is the expected entropy per sample.
+ * where alpha = 2^-40 and H is the expected entropy per sample.
*/
static const unsigned int rct_c[9] = {
- 41, /* H = 0.5 */
- 21, 11, 8, 6, 5, 5, 4, 4 /* H = 1, ..., 8 */
+ 81, /* H = 0.5 */
+ 41, 21, 15, 11, 9, 8, 7, 6 /* H = 1, ..., 8 */
};
if (ossl_likely(crngt->rct.b != 0)
@@ -142,12 +142,12 @@ static int APT_test(CRNG_TEST *crngt, uint8_t next)
/*
* Critical values for this test are drawn from a binomial
* distribution with n = 512, p = 2^-H at a critical threshold of
- * 2^-20. H being the expected entropy per sample. Refer SP 800-90B
- * section 4.4.2, table 2.
+ * 2^-40. H being the expected entropy per sample. Refer SP 800-90B
+ * section 4.4.2, footnote 10.
*/
static const unsigned int apt_c[9] = {
- 410, /* H = 0.5 */
- 311, 177, 103, 62, 39, 25, 18, 13 /* H = 1, ..., 8 */
+ 432, /* H = 0.5 */
+ 336, 201, 123, 78, 51, 35, 26, 19 /* H = 1, ..., 8 */
};
if (ossl_likely(crngt->apt.b != 0)) {
@@ -300,6 +300,12 @@ static size_t crng_test_get_seed(void *vcrngt, unsigned char **pout,
size_t n;
size_t r = 0;
+ /*
+ * Seed material that fails the health tests goes straight back to its
+ * source. Do not leave |*pout| pointing at it: a DRBG whose reseed
+ * fails releases whatever |*pout| holds, which would free it again.
+ */
+
/* Without a parent, we rely on the up calls */
if (crngt->parent == NULL
|| crngt->parent_get_seed == NULL) {
@@ -307,8 +313,11 @@ static size_t crng_test_get_seed(void *vcrngt, unsigned char **pout,
min_len, max_len);
if (n == 0)
return 0;
- r = crng_test(crngt, *pout, n);
- return r > 0 ? n : 0;
+ if (crng_test(crngt, *pout, n) > 0)
+ return n;
+ ossl_prov_cleanup_entropy(crngt->provctx, *pout, n);
+ *pout = NULL;
+ return 0;
}
/* Grab seed from our parent */
@@ -318,10 +327,13 @@ static size_t crng_test_get_seed(void *vcrngt, unsigned char **pout,
n = crngt->parent_get_seed(crngt->parent, pout, entropy,
min_len, max_len, prediction_resistance,
adin, adin_len);
- if (n > 0 && crng_test(crngt, *pout, n) > 0)
+ if (n > 0 && crng_test(crngt, *pout, n) > 0) {
r = n;
- else if (crngt->parent_clear_seed != NULL)
- crngt->parent_clear_seed(crngt->parent, *pout, n);
+ } else {
+ if (n > 0 && crngt->parent_clear_seed != NULL)
+ crngt->parent_clear_seed(crngt->parent, *pout, n);
+ *pout = NULL;
+ }
unlock_parent(crngt);
return r;
}
diff --git a/deps/openssl/openssl/providers/implementations/signature/build.info b/deps/openssl/openssl/providers/implementations/signature/build.info
index 579045f2c58..9c1df17d7dd 100644
--- a/deps/openssl/openssl/providers/implementations/signature/build.info
+++ b/deps/openssl/openssl/providers/implementations/signature/build.info
@@ -46,5 +46,5 @@ IF[{- !$disabled{'ml-dsa'} -}]
ENDIF
IF[{- !$disabled{'slh-dsa'} -}]
- SOURCE[$DSA_GOAL]=slh_dsa_sig.c
+ SOURCE[$SLH_DSA_GOAL]=slh_dsa_sig.c
ENDIF
diff --git a/deps/openssl/openssl/ssl/bio_ssl.c b/deps/openssl/openssl/ssl/bio_ssl.c
index ebd9c58365a..ce58bce7781 100644
--- a/deps/openssl/openssl/ssl/bio_ssl.c
+++ b/deps/openssl/openssl/ssl/bio_ssl.c
@@ -89,6 +89,7 @@ static int ssl_free(BIO *a)
BIO_set_init(a, 0);
}
OPENSSL_free(bs);
+ BIO_set_data(a, NULL);
return 1;
}
diff --git a/deps/openssl/openssl/ssl/d1_lib.c b/deps/openssl/openssl/ssl/d1_lib.c
index d670f85679b..04877181fad 100644
--- a/deps/openssl/openssl/ssl/d1_lib.c
+++ b/deps/openssl/openssl/ssl/d1_lib.c
@@ -137,8 +137,8 @@ void dtls1_clear_received_buffer(SSL_CONNECTION *s)
/*
* Called once the DTLS 1.3 hellos are done. Our handshake read keys are only
* installed when the peer's first epoch 2 record arrives (dtls1_read_bytes()),
- * so until then nothing but a plaintext alert may be read. Anything already
- * reassembled or buffered arrived unprotected, so discard it.
+ * so until then only plaintext alerts and ACKs may be read. Handshake messages
+ * already reassembled or buffered arrived unprotected, so discard them.
*/
void dtls13_hellos_done(SSL_CONNECTION *s)
{
@@ -199,15 +199,49 @@ void dtls1_acknowledge_sent_buffer(SSL_CONNECTION *s, uint64_t before_epoch)
}
}
+/*
+ * Returns true if some other entry in queue1 or queue2 still holds wrl.
+ * Multiple dtls_sent_msg entries can share the identical
+ * saved_retransmit_state.wrl: every message written at a given epoch captures
+ * the same write record layer, and more than one can still be queued
+ * by the time dtls1_clear_sent_buffer() removes any one of them. wrl must
+ * not be freed while another queued entry is still going to use it for a
+ * retransmit.
+ */
+static int dtls1_wrl_has_other_owner(const OSSL_RECORD_LAYER *wrl,
+ pqueue *queue1, pqueue *queue2)
+{
+ piterator iter;
+ pitem *item;
+
+ iter = pqueue_iterator(queue1);
+ while ((item = pqueue_next(&iter)) != NULL) {
+ dtls_sent_msg *msg = (dtls_sent_msg *)item->data;
+
+ if (msg->saved_retransmit_state.wrl == wrl)
+ return 1;
+ }
+
+ iter = pqueue_iterator(queue2);
+ while ((item = pqueue_next(&iter)) != NULL) {
+ dtls_sent_msg *msg = (dtls_sent_msg *)item->data;
+
+ if (msg->saved_retransmit_state.wrl == wrl)
+ return 1;
+ }
+
+ return 0;
+}
+
void dtls1_clear_sent_buffer(SSL_CONNECTION *s, int keep_unacked_msgs)
{
pitem *item = NULL;
- pqueue *remaining_sent_messages = pqueue_new();
+ pqueue remaining_sent_messages_buf = { NULL, 0 };
+ pqueue *remaining_sent_messages = &remaining_sent_messages_buf;
pqueue *sent_messages = &s->d1->sent_messages;
while ((item = pqueue_pop(sent_messages)) != NULL) {
dtls_sent_msg *sent_msg = (dtls_sent_msg *)item->data;
- unsigned char msg_type = sent_msg->msg_info.msg_type;
unsigned char record_type = sent_msg->msg_info.record_type;
if (SSL_CONNECTION_IS_DTLS13(s)
@@ -217,16 +251,24 @@ void dtls1_clear_sent_buffer(SSL_CONNECTION *s, int keep_unacked_msgs)
continue;
}
- if (((!SSL_CONNECTION_IS_DTLS13(s) && record_type == SSL3_RT_CHANGE_CIPHER_SPEC)
- || (SSL_CONNECTION_IS_DTLS13(s)
- && (msg_type == SSL3_MT_FINISHED
- || msg_type == SSL3_MT_SERVER_HELLO
- || msg_type == SSL3_MT_KEY_UPDATE)))
+ /*
+ * Free the captured write layer once this is its last reference,
+ * regardless of this message's own type: any queued message can
+ * end up the final owner of a retired layer, not just the ones
+ * that originally triggered the epoch change.
+ */
+ if ((SSL_CONNECTION_IS_DTLS13(s)
+ || record_type == SSL3_RT_CHANGE_CIPHER_SPEC
+ || record_type == SSL3_RT_HANDSHAKE)
&& sent_msg->saved_retransmit_state.wrlmethod != NULL
- && s->rlayer.wrl != sent_msg->saved_retransmit_state.wrl) {
+ && s->rlayer.wrl != sent_msg->saved_retransmit_state.wrl
+ && !dtls1_wrl_has_other_owner(sent_msg->saved_retransmit_state.wrl,
+ sent_messages, remaining_sent_messages)) {
/*
- * If we're freeing the CCS then we're done with the old wrl and it
- * can bee freed
+ * This message was the last one sent with its write record layer
+ * before the keys changed, and the record layer was kept only so
+ * that the message could be retransmitted. Now that the message
+ * is being dropped, the record layer can be freed too.
*/
sent_msg->saved_retransmit_state.wrlmethod->free(sent_msg->saved_retransmit_state.wrl);
}
@@ -238,8 +280,52 @@ void dtls1_clear_sent_buffer(SSL_CONNECTION *s, int keep_unacked_msgs)
if (SSL_CONNECTION_IS_DTLS13(s))
while ((item = pqueue_pop(remaining_sent_messages)) != NULL)
pqueue_insert(&s->d1->sent_messages, item);
+}
- pqueue_free(remaining_sent_messages);
+/*
+ * Retire every queued CertificateRequest regardless of acknowledgment
+ * status, and report whether any was found. Finding none is not an error:
+ * rfc9147 section 7.1 lets the client ACK a CertificateRequest explicitly
+ * if it cannot produce its response right away, in which case ACK
+ * processing already removed it before Finished arrived. Either way, the
+ * client's Finished completes it implicitly (rfc9147 5.8.1: receiving the
+ * next flight, not just an ACK, ends WAITING), so it must not still be
+ * queued by the time Finished is processed. Entries of any other type are
+ * left untouched.
+ */
+static int dtls1_retire_sent_certificate_request_messages(SSL_CONNECTION *s)
+{
+ pitem *item = NULL;
+ pqueue remaining_sent_messages_buf = { NULL, 0 };
+ pqueue *remaining_sent_messages = &remaining_sent_messages_buf;
+ pqueue *sent_messages = &s->d1->sent_messages;
+ int retired = 0;
+
+ while ((item = pqueue_pop(sent_messages)) != NULL) {
+ dtls_sent_msg *sent_msg = (dtls_sent_msg *)item->data;
+
+ if (sent_msg->msg_info.msg_type != SSL3_MT_CERTIFICATE_REQUEST) {
+ pqueue_insert(remaining_sent_messages, item);
+ continue;
+ }
+
+ /* Same ownership rule as dtls1_clear_sent_buffer(): free the
+ * captured write layer only once this is its last reference. */
+ if (sent_msg->saved_retransmit_state.wrlmethod != NULL
+ && s->rlayer.wrl != sent_msg->saved_retransmit_state.wrl
+ && !dtls1_wrl_has_other_owner(sent_msg->saved_retransmit_state.wrl,
+ sent_messages, remaining_sent_messages))
+ sent_msg->saved_retransmit_state.wrlmethod->free(sent_msg->saved_retransmit_state.wrl);
+
+ dtls1_sent_msg_free(sent_msg);
+ pitem_free(item);
+ retired = 1;
+ }
+
+ while ((item = pqueue_pop(remaining_sent_messages)) != NULL)
+ pqueue_insert(sent_messages, item);
+
+ return retired;
}
/*
@@ -265,6 +351,24 @@ void dtls1_clear_current_wrl_from_sent_buffer(SSL_CONNECTION *s)
}
}
+/*
+ * Returns 1 if a message in the sent_messages queue was sent with the current
+ * write record layer, which then has to be kept for retransmissions.
+ */
+int dtls1_sent_buffer_uses_current_wrl(SSL_CONNECTION *s)
+{
+ pitem *item;
+ piterator iter = pqueue_iterator(&s->d1->sent_messages);
+
+ while ((item = pqueue_next(&iter)) != NULL) {
+ dtls_sent_msg *sent_msg = (dtls_sent_msg *)item->data;
+
+ if (sent_msg->saved_retransmit_state.wrl == s->rlayer.wrl)
+ return 1;
+ }
+ return 0;
+}
+
int dtls_any_sent_messages_are_missing_acknowledge(SSL_CONNECTION *s)
{
pitem *item;
@@ -280,6 +384,22 @@ int dtls_any_sent_messages_are_missing_acknowledge(SSL_CONNECTION *s)
return 0;
}
+int dtls_has_unacked_key_update(SSL_CONNECTION *s)
+{
+ pitem *item;
+ piterator iter = pqueue_iterator(&s->d1->sent_messages);
+
+ while ((item = pqueue_next(&iter)) != NULL) {
+ dtls_sent_msg *msg = (dtls_sent_msg *)item->data;
+
+ if (msg->msg_info.msg_type == SSL3_MT_KEY_UPDATE
+ && !ossl_list_record_number_is_empty(&msg->rec_nums))
+ return 1;
+ }
+
+ return 0;
+}
+
void dtls1_free(SSL *ssl)
{
SSL_CONNECTION *s;
@@ -554,6 +674,69 @@ void dtls1_stop_timer(SSL_CONNECTION *s)
dtls1_clear_sent_buffer(s, 0);
}
+/*
+ * Retire the timer and retransmit buffer now that a flight has finished
+ * reading. Post-handshake message categories acknowledge nothing of each
+ * other (rfc9147 5.8.4), so an unrelated message must not discard our own
+ * still-unacknowledged flight. A post-handshake-auth CertificateRequest is
+ * retired here explicitly, since it completes via the next flight rather
+ * than an ACK (rfc9147 5.8.1); that check is scoped to SSL_PHA_REQUESTED so
+ * it can't also fire for the CertificateRequest an ordinary mTLS initial
+ * handshake sends, which has no such special case and still falls through
+ * to the unconditional clear below.
+ *
+ * Whether a CertificateRequest was actually found there is not itself a
+ * precondition for preserving anything else that is still outstanding:
+ * rfc9147 section 7.1 lets the client ACK the CertificateRequest explicitly
+ * if it cannot produce its response right away, in which case ACK
+ * processing already removed it before Finished arrived. Either way, by
+ * the time Finished is processed it must not still be queued, so retiring
+ * it here is idempotent -- the decision to preserve or discard everything
+ * else is made separately, from whether anything else remains unacked.
+ *
+ * This can also be what finally unblocks a deferred write-key install, with
+ * no ACK record involved at all. dtls1_check_deferred_write_key() normally
+ * runs from dtls_process_ack() as ACK records arrive, but a
+ * CertificateRequest retired above -- or anything else cleared below -- can
+ * be the last thing our own KeyUpdate was waiting on. If so, nothing else
+ * is ever going to call it, so it has to be checked here instead, at every
+ * point this function can return, using the state left by whatever
+ * clearing just happened.
+ *
+ * Returns 0 only on a fatal error installing the deferred write key
+ * (SSLfatal() already called, via dtls1_check_deferred_write_key()); 1
+ * otherwise. The caller must check this and stop driving the connection
+ * forward rather than treat reaching the end of this function as success --
+ * SSLfatal() only records the failure in s->statem.state, it has no other
+ * way to halt execution on its own.
+ */
+int dtls1_stop_timer_for_read_flight(SSL_CONNECTION *s)
+{
+ if (SSL_CONNECTION_IS_DTLS13(s)
+ && s->statem.hand_state == TLS_ST_SR_FINISHED
+ && s->post_handshake_auth == SSL_PHA_REQUESTED) {
+ dtls1_retire_sent_certificate_request_messages(s);
+ if (dtls_any_sent_messages_are_missing_acknowledge(s)) {
+ dtls1_clear_sent_buffer(s, 1);
+ return dtls1_check_deferred_write_key(s);
+ }
+ }
+
+ if (SSL_CONNECTION_IS_DTLS13(s)
+ && (s->statem.hand_state == TLS_ST_SR_KEY_UPDATE
+ || s->statem.hand_state == TLS_ST_CR_KEY_UPDATE
+ || s->statem.hand_state == TLS_ST_CR_SESSION_TICKET
+ || (s->statem.hand_state == TLS_ST_CR_CERT_REQ
+ && s->post_handshake_auth == SSL_PHA_REQUESTED))
+ && dtls_any_sent_messages_are_missing_acknowledge(s)) {
+ dtls1_clear_sent_buffer(s, 1);
+ return dtls1_check_deferred_write_key(s);
+ }
+
+ dtls1_stop_timer(s);
+ return dtls1_check_deferred_write_key(s);
+}
+
int dtls1_check_timeout_num(SSL_CONNECTION *s)
{
size_t mtu;
@@ -2686,8 +2869,10 @@ void ossl_dtls_listener_set0_net_rbio(SSL *s, BIO *bio)
DTLS_LISTENER *dl;
BIO *old_rbio;
- if (!IS_DTLS_LISTENER(s))
+ if (!IS_DTLS_LISTENER(s)) {
+ BIO_free_all(bio);
return;
+ }
dl = (DTLS_LISTENER *)s;
@@ -2713,12 +2898,6 @@ void ossl_dtls_listener_set0_net_rbio(SSL *s, BIO *bio)
old_rbio = dl->net_rbio;
- /* No change - nothing to do */
- if (old_rbio == bio) {
- ossl_crypto_mutex_unlock(dl->mutex);
- return;
- }
-
dl->net_rbio = bio;
ossl_crypto_mutex_unlock(dl->mutex);
@@ -2763,8 +2942,10 @@ void ossl_dtls_listener_set0_net_wbio(SSL *s, BIO *bio)
DTLS_LISTENER *dl;
BIO *old_wbio;
- if (!IS_DTLS_LISTENER(s))
+ if (!IS_DTLS_LISTENER(s)) {
+ BIO_free_all(bio);
return;
+ }
dl = (DTLS_LISTENER *)s;
@@ -2776,6 +2957,7 @@ void ossl_dtls_listener_set0_net_wbio(SSL *s, BIO *bio)
/* No change - nothing to do */
if (old_wbio == bio) {
+ BIO_free_all(bio);
return;
}
diff --git a/deps/openssl/openssl/ssl/d1_msg.c b/deps/openssl/openssl/ssl/d1_msg.c
index 5d49e3cd1b9..fc9c08ad550 100644
--- a/deps/openssl/openssl/ssl/d1_msg.c
+++ b/deps/openssl/openssl/ssl/d1_msg.c
@@ -28,6 +28,21 @@ int dtls1_write_app_data_bytes(SSL *s, uint8_t type, const void *buf_,
if (SSL_in_init(s) && !ossl_statem_get_in_handshake(sc)) {
i = sc->handshake_func(s);
+
+ /*
+ * DTLS 1.3: finishing a pending ACK ends a call at TLS_ST_OK, so the
+ * KeyUpdate or ticket still owed is only built by the next call. A
+ * call can also finish with something new owed, such as a response to
+ * a KeyUpdate that arrived while it waited for an ACK. Keep calling
+ * until nothing is owed, before any application data is sent. A call
+ * that needs I/O or fails ends the loop.
+ */
+ while (i > 0 && SSL_CONNECTION_IS_DTLS13(sc)
+ && (sc->key_update != SSL_KEY_UPDATE_NONE
+ || sc->ext.extra_tickets_expected > 0)) {
+ ossl_statem_set_in_init(sc, 1);
+ i = sc->handshake_func(s);
+ }
if (i < 0)
return i;
if (i == 0) {
diff --git a/deps/openssl/openssl/ssl/pqueue.c b/deps/openssl/openssl/ssl/pqueue.c
index e413d8c5aee..301accfece8 100644
--- a/deps/openssl/openssl/ssl/pqueue.c
+++ b/deps/openssl/openssl/ssl/pqueue.c
@@ -64,6 +64,8 @@ pitem *pqueue_insert(pqueue *pq, pitem *item)
if (pq->items == NULL) {
item->next = NULL;
pq->items = item;
+ pq->count++;
+
return item;
}
@@ -80,6 +82,7 @@ pitem *pqueue_insert(pqueue *pq, pitem *item)
pq->items = item;
else
curr->next = item;
+ pq->count++;
return item;
}
@@ -90,6 +93,7 @@ pitem *pqueue_insert(pqueue *pq, pitem *item)
item->next = NULL;
curr->next = item;
+ pq->count++;
return item;
}
@@ -103,8 +107,10 @@ pitem *pqueue_pop(pqueue *pq)
{
pitem *item = pq->items;
- if (pq->items != NULL)
+ if (pq->items != NULL) {
pq->items = pq->items->next;
+ pq->count--;
+ }
return item;
}
@@ -164,12 +170,5 @@ pitem *pqueue_next(piterator *item)
size_t pqueue_size(pqueue *pq)
{
- pitem *item = pq->items;
- size_t count = 0;
-
- while (item != NULL) {
- count++;
- item = item->next;
- }
- return count;
+ return pq->count;
}
diff --git a/deps/openssl/openssl/ssl/quic/quic_ackm.c b/deps/openssl/openssl/ssl/quic/quic_ackm.c
index 5da8af882ad..2ba67343199 100644
--- a/deps/openssl/openssl/ssl/quic/quic_ackm.c
+++ b/deps/openssl/openssl/ssl/quic/quic_ackm.c
@@ -980,6 +980,13 @@ static void ackm_on_pkts_lost(OSSL_ACKM *ackm, int pkt_space,
loss_info.tx_size = p->num_bytes;
ackm->cc_method->on_data_lost(ackm->cc_data, &loss_info);
+ } else {
+ /*
+ * The packet is no longer in flight all the same, so the CC
+ * must stop counting it.
+ */
+ ackm->cc_method->on_data_invalidated(ackm->cc_data,
+ p->num_bytes);
}
}
diff --git a/deps/openssl/openssl/ssl/quic/quic_channel.c b/deps/openssl/openssl/ssl/quic/quic_channel.c
index dc62238211d..926645e3e01 100644
--- a/deps/openssl/openssl/ssl/quic/quic_channel.c
+++ b/deps/openssl/openssl/ssl/quic/quic_channel.c
@@ -46,8 +46,7 @@ static OSSL_TIME ch_determine_next_tick_deadline(QUIC_CHANNEL *ch);
static int ch_retry(QUIC_CHANNEL *ch,
const unsigned char *retry_token,
size_t retry_token_len,
- const QUIC_CONN_ID *retry_scid,
- int drop_later_pn);
+ const QUIC_CONN_ID *retry_scid);
static int ch_restart(QUIC_CHANNEL *ch);
static void ch_cleanup(QUIC_CHANNEL *ch);
@@ -75,8 +74,7 @@ static void rxku_detected(QUIC_PN pn, void *arg);
static int ch_retry(QUIC_CHANNEL *ch,
const unsigned char *retry_token,
size_t retry_token_len,
- const QUIC_CONN_ID *retry_scid,
- int drop_later_pn);
+ const QUIC_CONN_ID *retry_scid);
static void ch_update_idle(QUIC_CHANNEL *ch);
static int ch_discard_el(QUIC_CHANNEL *ch,
uint32_t enc_level);
@@ -2498,6 +2496,9 @@ static void ch_rx_handle_packet(QUIC_CHANNEL *ch, int channel_only)
if (ch->qrx_pkt->hdr->version != 0)
return;
+ if (!ossl_quic_conn_id_eq(&ch->qrx_pkt->hdr->src_conn_id, &ch->init_dcid))
+ return;
+
/*
* RFC 9000 s. 6.2: If a client receives a version negotiation
* packet, we need to do the following:
@@ -2629,7 +2630,7 @@ static void ch_rx_handle_packet(QUIC_CHANNEL *ch, int channel_only)
if (!ch_retry(ch, ch->qrx_pkt->hdr->data,
ch->qrx_pkt->hdr->len - QUIC_RETRY_INTEGRITY_TAG_LEN,
- &ch->qrx_pkt->hdr->src_conn_id, old_have_processed_any_pkt))
+ &ch->qrx_pkt->hdr->src_conn_id))
ossl_quic_channel_raise_protocol_error(ch, OSSL_QUIC_ERR_INTERNAL_ERROR,
0, "handling retry packet");
break;
@@ -2997,9 +2998,29 @@ void ossl_quic_channel_local_close(QUIC_CHANNEL *ch, uint64_t app_error_code,
ch_start_terminating(ch, &tcause, 0);
}
+/*
+ * Force the ACKM to consider every Initial packet still in flight as lost, so
+ * that the CRYPTO data they carried is sent again. None may be in flight, e.g.
+ * when a Version Negotiation packet has just had us mark them all and a Retry
+ * follows before we send again; their data is then already queued.
+ *
+ * Returns 1 on success, 0 on failure.
+ */
+static int ch_mark_initial_pkts_pseudo_lost(QUIC_CHANNEL *ch)
+{
+ OSSL_ACKM *ackm = ch->ackm;
+ QUIC_PN pn;
+
+ while (ossl_ackm_get_largest_unacked(ackm, QUIC_PN_SPACE_INITIAL, &pn))
+ if (!ossl_ackm_mark_packet_pseudo_lost(ackm, QUIC_PN_SPACE_INITIAL, pn))
+ return 0;
+
+ return 1;
+}
+
/**
* ch_restart - Restarts the QUIC channel by simulating loss of the initial
- * packet. This forces the packet to be regenerated with the updated protocol
+ * packets. This forces them to be regenerated with the updated protocol
* version number.
*
* @ch: Pointer to the QUIC_CHANNEL structure.
@@ -3009,22 +3030,19 @@ void ossl_quic_channel_local_close(QUIC_CHANNEL *ch, uint64_t app_error_code,
static int ch_restart(QUIC_CHANNEL *ch)
{
/*
- * Just pretend we lost our initial packet, so it gets
+ * Just pretend we lost our initial packets, so they get
* regenerated, with our updated protocol version number
*/
- return ossl_ackm_mark_packet_pseudo_lost(ch->ackm, QUIC_PN_SPACE_INITIAL,
- /* PN= */ 0);
+ return ch_mark_initial_pkts_pseudo_lost(ch);
}
/* Called when a server asks us to do a retry. */
static int ch_retry(QUIC_CHANNEL *ch,
const unsigned char *retry_token,
size_t retry_token_len,
- const QUIC_CONN_ID *retry_scid,
- int drop_later_pn)
+ const QUIC_CONN_ID *retry_scid)
{
void *buf;
- QUIC_PN pn = 0;
/*
* RFC 9000 s. 17.2.5.1: "A client MUST discard a Retry packet that contains
@@ -3061,24 +3079,16 @@ static int ch_retry(QUIC_CHANNEL *ch,
ch->doing_retry = 1;
/*
- * If a retry isn't our first response, we need to drop packet number
- * one instead (i.e. the case where we did version negotiation first
- */
- if (drop_later_pn == 1)
- pn = 1;
-
- /*
- * We need to stimulate the Initial EL to generate the first CRYPTO frame
+ * We need to stimulate the Initial EL to generate the CRYPTO frames
* again. We can do this most cleanly by simply forcing the ACKM to consider
- * the first Initial packet as lost, which it effectively was as the server
- * hasn't processed it. This also maintains the desired behaviour with e.g.
- * PNs not resetting and so on.
+ * every Initial packet we have sent as lost, which they effectively were as
+ * the server hasn't processed them (RFC 9002 s. 6.3). This also maintains
+ * the desired behaviour with e.g. PNs not resetting and so on.
*
- * The PN we used initially is always zero, because QUIC does not allow
- * repeated retries.
+ * The ClientHello may span more than one Initial packet, so all of them
+ * must be marked, not only the first.
*/
- if (!ossl_ackm_mark_packet_pseudo_lost(ch->ackm, QUIC_PN_SPACE_INITIAL,
- pn))
+ if (!ch_mark_initial_pkts_pseudo_lost(ch))
return 0;
/*
@@ -3457,6 +3467,13 @@ void ossl_quic_channel_on_new_conn_id(QUIC_CHANNEL *ch,
return;
}
+ /*
+ * do nothing if dealing with older NEW_CONN_ID frame or retransmission.
+ */
+ if (new_remote_seq_num == ch->cur_remote_seq_num)
+ return;
+ ch->on_new_conn_id_handled++;
+
if (new_remote_seq_num > ch->cur_remote_seq_num) {
/* Add new stateless reset token */
if (!ossl_quic_srtm_add(ch->srtm, ch, new_remote_seq_num,
@@ -4410,3 +4427,13 @@ uint64_t ossl_quic_channel_get_path_response_count(const QUIC_CHANNEL *ch)
{
return ch->path_response_tx;
}
+
+uint64_t ossl_quic_channel_get_on_new_conn_id_handled(const QUIC_CHANNEL *ch)
+{
+ return ch->on_new_conn_id_handled;
+}
+
+const QUIC_CONN_ID *ossl_quic_channel_get_init_dcid(const QUIC_CHANNEL *ch)
+{
+ return &ch->init_dcid;
+}
diff --git a/deps/openssl/openssl/ssl/quic/quic_channel_local.h b/deps/openssl/openssl/ssl/quic/quic_channel_local.h
index 2d55f95f2c1..487159caf87 100644
--- a/deps/openssl/openssl/ssl/quic/quic_channel_local.h
+++ b/deps/openssl/openssl/ssl/quic/quic_channel_local.h
@@ -540,6 +540,7 @@ struct quic_channel_st {
unsigned int path_challenge_rx;
/* number of path response frames sent */
unsigned int path_response_tx;
+ uint64_t on_new_conn_id_handled;
};
#endif
diff --git a/deps/openssl/openssl/ssl/quic/quic_impl.c b/deps/openssl/openssl/ssl/quic/quic_impl.c
index a858a8c04a5..29c656265cf 100644
--- a/deps/openssl/openssl/ssl/quic/quic_impl.c
+++ b/deps/openssl/openssl/ssl/quic/quic_impl.c
@@ -783,6 +783,16 @@ void ossl_quic_free(SSL *s)
return;
}
+ /*
+ * A pending connection whose channel has been detached is being discarded
+ * by the port. It has no shared resources to clean up, and the port lock
+ * may already be held by the caller.
+ */
+ if (!ctx.is_stream && ctx.qc->pending && ctx.qc->ch == NULL) {
+ qc_cleanup(ctx.qc, /*have_lock=*/0);
+ return;
+ }
+
qctx_lock(&ctx);
if (ctx.is_stream) {
@@ -1203,11 +1213,17 @@ void ossl_quic_conn_set0_net_rbio(SSL *s, BIO *net_rbio)
QCTX ctx;
if (!expect_quic_csl(s, &ctx))
- return;
+ goto free;
- /* Returns 0 if no change. */
+ /* Returns 0 if no change or on failure. */
if (!quic_set0_net_rbio(ctx.obj, net_rbio))
- return;
+ goto free;
+
+ net_rbio = NULL;
+
+free:
+ /* we are supposed to consume net_rbio */
+ BIO_free_all(net_rbio);
}
void ossl_quic_conn_set0_net_wbio(SSL *s, BIO *net_wbio)
@@ -1215,11 +1231,17 @@ void ossl_quic_conn_set0_net_wbio(SSL *s, BIO *net_wbio)
QCTX ctx;
if (!expect_quic_csl(s, &ctx))
- return;
+ goto free;
- /* Returns 0 if no change. */
+ /* Returns 0 if no change or on failure. */
if (!quic_set0_net_wbio(ctx.obj, net_wbio))
- return;
+ goto free;
+
+ net_wbio = NULL;
+
+free:
+ /* we are supposed to consume net_wbio */
+ BIO_free_all(net_wbio);
}
BIO *ossl_quic_conn_get_net_rbio(const SSL *s)
@@ -4618,13 +4640,16 @@ int ossl_quic_get_conn_close_info(SSL *ssl,
{
QCTX ctx;
const QUIC_TERMINATE_CAUSE *tc;
+ int ret = 0;
if (!expect_quic_conn_only(ssl, &ctx))
return -1;
+ qctx_lock(&ctx);
+
tc = ossl_quic_channel_get_terminate_cause(ctx.qc->ch);
if (tc == NULL)
- return 0;
+ goto out;
info->error_code = tc->error_code;
info->frame_type = tc->frame_type;
@@ -4635,7 +4660,11 @@ int ossl_quic_get_conn_close_info(SSL *ssl,
info->flags |= SSL_CONN_CLOSE_FLAG_LOCAL;
if (!tc->app)
info->flags |= SSL_CONN_CLOSE_FLAG_TRANSPORT;
- return 1;
+ ret = 1;
+
+out:
+ qctx_unlock(&ctx);
+ return ret;
}
/*
diff --git a/deps/openssl/openssl/ssl/quic/quic_rstream.c b/deps/openssl/openssl/ssl/quic/quic_rstream.c
index 2606f983b1b..6ca260bac3b 100644
--- a/deps/openssl/openssl/ssl/quic/quic_rstream.c
+++ b/deps/openssl/openssl/ssl/quic/quic_rstream.c
@@ -134,6 +134,9 @@ int ossl_quic_rstream_read(QUIC_RSTREAM *qrs, unsigned char *buf, size_t size,
{
OSSL_TIME rtt = get_rtt(qrs);
+ if (qrs->fs.range_locked)
+ return 0;
+
if (!read_internal(qrs, buf, size, readbytes, fin, 1))
return 0;
@@ -173,6 +176,9 @@ int ossl_quic_rstream_get_record(QUIC_RSTREAM *qrs,
size_t rec_len_;
int ok;
+ if (qrs->fs.range_locked)
+ return 0;
+
ok = ossl_sframe_set_peek(&qrs->fs, &iterator, &qrs->head_range, &record_,
fin);
if (ok == 0) {
@@ -192,6 +198,8 @@ int ossl_quic_rstream_get_record(QUIC_RSTREAM *qrs,
}
rec_len_ = (size_t)(qrs->head_range.end - qrs->head_range.start);
+ if (!ossl_sframe_set_lock_range(&qrs->fs, &qrs->head_range))
+ return 0;
*rec_len = rec_len_;
*record = record_;
@@ -210,6 +218,10 @@ int ossl_quic_rstream_release_record(QUIC_RSTREAM *qrs, size_t read_len)
offset = qrs->head_range.start + read_len;
}
+ if (!qrs->fs.range_locked)
+ return 0;
+
+ ossl_sframe_set_unlock_range(&qrs->fs);
if (!ossl_sframe_set_move_offset(&qrs->fs, offset))
return 0;
diff --git a/deps/openssl/openssl/ssl/quic/quic_stream_map.c b/deps/openssl/openssl/ssl/quic/quic_stream_map.c
index 2d58d08a807..e7bd75af7ee 100644
--- a/deps/openssl/openssl/ssl/quic/quic_stream_map.c
+++ b/deps/openssl/openssl/ssl/quic/quic_stream_map.c
@@ -297,9 +297,30 @@ static ossl_unused int qsm_send_part_permits_gc(const QUIC_STREAM *qs)
}
}
+static int qsm_recv_part_is_terminal(const QUIC_STREAM *qs)
+{
+ switch (qs->recv_state) {
+ case QUIC_RSTREAM_STATE_DATA_RECVD:
+ case QUIC_RSTREAM_STATE_DATA_READ:
+ case QUIC_RSTREAM_STATE_RESET_RECVD:
+ case QUIC_RSTREAM_STATE_RESET_READ:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
static int qsm_ready_for_gc(QUIC_STREAM_MAP *qsm, QUIC_STREAM *qs)
{
- int recv_stream_fully_drained = 0; /* TODO(QUIC FUTURE): Optimisation */
+ /*
+ * Once the receive part has reached a terminal state (all data received
+ * or the peer reset the stream) there is nothing more the peer can send
+ * which we need to track, so we do not need to wait for STOP_SENDING to
+ * be acknowledged. Note that STOP_SENDING may never be sent at all in
+ * this case (e.g. if the peer's RESET_STREAM arrives first), so waiting
+ * for it would leak the stream for the lifetime of the connection.
+ */
+ int recv_stream_fully_drained = qsm_recv_part_is_terminal(qs);
/*
* If sstream has no FIN, we auto-reset it at marked-for-deletion time, so
diff --git a/deps/openssl/openssl/ssl/quic/quic_strm_reas.c b/deps/openssl/openssl/ssl/quic/quic_strm_reas.c
index 8c404df231c..a9a59784911 100644
--- a/deps/openssl/openssl/ssl/quic/quic_strm_reas.c
+++ b/deps/openssl/openssl/ssl/quic/quic_strm_reas.c
@@ -62,6 +62,7 @@ struct stream_chunk_t {
struct quic_rstream_qparm_st {
size_t rsqp_pkt_overhead_treshold;
size_t rsqp_pkt_overhead_sz;
+ size_t rsqp_range_limit;
QUIC_CHANNEL *rsqp_ch;
};
@@ -224,6 +225,19 @@ static int keep_schunk_data_on_packet(SFRAME_SET *fs, OSSL_QRX_PKT *pkt,
return 1;
}
+static int is_range_limit_exceeded(SFRAME_SET *fs)
+{
+ if (fs->stream_ranges >= fs->rsqp->rsqp_range_limit) {
+ ossl_quic_channel_raise_protocol_error(fs->rsqp->rsqp_ch,
+ OSSL_QUIC_ERR_FLOW_CONTROL_ERROR,
+ OSSL_QUIC_FRAME_TYPE_STREAM,
+ "too many gaps in stream data");
+ return 1;
+ }
+
+ return 0;
+}
+
static struct stream_chunk_t *new_schunk(SFRAME_SET *fs, OSSL_QRX_PKT *pkt,
UINT_RANGE *r, const unsigned char *data)
{
@@ -937,6 +951,27 @@ int ossl_sframe_set_insert(SFRAME_SET *fs, UINT_RANGE *r, OSSL_QRX_PKT *pkt,
r->start = fs->offset;
}
+ if (fs->range_locked
+ && r->start < fs->locked_range.end
+ && r->end > fs->locked_range.start) {
+ uint64_t overlap_end;
+ size_t overlap_len;
+
+ /* The checked-out range is the first readable chunk. */
+ assert(fs->locked_range.start == fs->offset);
+ assert(r->start >= fs->locked_range.start);
+
+ overlap_end = r->end < fs->locked_range.end
+ ? r->end
+ : fs->locked_range.end;
+ overlap_len = UINT64_TO_SIZE_T(overlap_end - r->start);
+
+ if (fs->cleanse)
+ OPENSSL_cleanse(deconst(data), overlap_len);
+ data += overlap_len;
+ r->start = overlap_end;
+ }
+
key_sr.sr_range = *r;
/*
@@ -949,6 +984,9 @@ int ossl_sframe_set_insert(SFRAME_SET *fs, UINT_RANGE *r, OSSL_QRX_PKT *pkt,
assert(r->start < r->end);
if ((sr = find_range(fs, &key_sr)) == NULL) {
+ if (is_range_limit_exceeded(fs))
+ return 0;
+
sc = new_schunk(fs, pkt, r, data);
if (sc == NULL)
goto err;
@@ -1225,6 +1263,24 @@ int ossl_sframe_set_peek(SFRAME_SET *fs, void **iterator,
return (range->start == range->end) ? 0 : 1;
}
+int ossl_sframe_set_lock_range(SFRAME_SET *fs, const UINT_RANGE *range)
+{
+ if (fs->range_locked
+ || range->start != fs->offset
+ || range->start >= range->end)
+ return 0;
+
+ fs->locked_range = *range;
+ fs->range_locked = 1;
+ return 1;
+}
+
+void ossl_sframe_set_unlock_range(SFRAME_SET *fs)
+{
+ assert(fs->range_locked);
+ fs->range_locked = 0;
+}
+
void ossl_sframe_set_destroy_ranges(SFRAME_SET *fs)
{
struct stream_range_t *sr, *save_sr;
@@ -1250,6 +1306,9 @@ int ossl_sframe_set_move_offset(SFRAME_SET *fs, uint64_t new_offset)
if (new_offset == fs->offset)
return 1;
+ if (fs->range_locked)
+ return 0;
+
/*
* Offset can move forward within the continuous head range only.
* It can not move backward, into a gap or past the head range end.
@@ -1328,6 +1387,7 @@ QUIC_RSTREAM_QPARM *ossl_quic_rstream_qparm_new(QUIC_CHANNEL *ch)
rsqp->rsqp_pkt_overhead_treshold = PKT_BUFFER_OVERHEAD_TRESHOLD;
rsqp->rsqp_pkt_overhead_sz = 0;
rsqp->rsqp_ch = ch;
+ rsqp->rsqp_range_limit = QUIC_SFRAME_SET_MAX_RANGES;
}
return rsqp;
diff --git a/deps/openssl/openssl/ssl/quic/quic_txp.c b/deps/openssl/openssl/ssl/quic/quic_txp.c
index 9058c92a4fe..ebba1cf0703 100644
--- a/deps/openssl/openssl/ssl/quic/quic_txp.c
+++ b/deps/openssl/openssl/ssl/quic/quic_txp.c
@@ -478,6 +478,9 @@ void ossl_quic_tx_packetiser_set_validated(OSSL_QUIC_TX_PACKETISER *txp)
* `SIZE_MAX - 1`. If the current unvalidated credit is already `SIZE_MAX`,
* the function does nothing.
*
+ * Credit and consumption are both measured in UDP payload bytes (RFC 9000
+ * s. 8.1), so callers credit whole received datagrams.
+ *
* @param txp A pointer to the OSSL_QUIC_TX_PACKETISER structure to update.
* @param credit The amount of credit to add, multiplied by 3.
*/
@@ -520,19 +523,19 @@ void ossl_quic_tx_packetiser_consume_unvalidated_credit(OSSL_QUIC_TX_PACKETISER
* Checks if the QUIC TX packetiser has sufficient unvalidated credit.
*
* This function determines whether the unvalidated credit of the specified
- * QUIC TX packetiser exceeds the required credit value (`req_credit`).
- * If the unvalidated credit is greater than `req_credit`, the function
+ * QUIC TX packetiser is at least the required credit value (`req_credit`).
+ * If the unvalidated credit is at least `req_credit`, the function
* returns 1 (true); otherwise, it returns 0 (false).
*
* @param txp A pointer to the OSSL_QUIC_TX_PACKETISER structure to check.
* @param req_credit The required credit value to compare against.
*
- * @return 1 if the unvalidated credit exceeds `req_credit`, 0 otherwise.
+ * @return 1 if the unvalidated credit is at least `req_credit`, 0 otherwise.
*/
int ossl_quic_tx_packetiser_check_unvalidated_credit(OSSL_QUIC_TX_PACKETISER *txp,
size_t req_credit)
{
- return (txp->unvalidated_credit > req_credit);
+ return (txp->unvalidated_credit >= req_credit);
}
OSSL_QUIC_TX_PACKETISER *ossl_quic_tx_packetiser_new(const OSSL_QUIC_TX_PACKETISER_ARGS *args)
@@ -1002,12 +1005,21 @@ int ossl_quic_tx_packetiser_generate(OSSL_QUIC_TX_PACKETISER *txp,
/* Nothing was generated for this EL, so skip. */
continue;
+ /*
+ * The RFC 9000 s. 8.1 limit applies to bytes sent on the wire, so the
+ * packet overhead (header, PN, AEAD tag) is charged along with the
+ * payload. Without a padding pass pkt_overhead is still the
+ * pre-generation estimate, which can only overstate the charge.
+ */
if (!ossl_quic_tx_packetiser_check_unvalidated_credit(txp,
- pkt[enc_level].h.bytes_appended)) {
+ pkt[enc_level].h.bytes_appended
+ + pkt[enc_level].geom.pkt_overhead)) {
res = TXP_ERR_SPACE;
goto out;
}
- ossl_quic_tx_packetiser_consume_unvalidated_credit(txp, pkt[enc_level].h.bytes_appended);
+ ossl_quic_tx_packetiser_consume_unvalidated_credit(txp,
+ pkt[enc_level].h.bytes_appended
+ + pkt[enc_level].geom.pkt_overhead);
rc = txp_pkt_commit(txp, &pkt[enc_level], archetype,
&txpim_pkt_reffed);
diff --git a/deps/openssl/openssl/ssl/record/build.info b/deps/openssl/openssl/ssl/record/build.info
index 9703d169d6f..d44c8420e9d 100644
--- a/deps/openssl/openssl/ssl/record/build.info
+++ b/deps/openssl/openssl/ssl/record/build.info
@@ -1,6 +1,6 @@
SUBDIRS=methods
-#Needed for the multiblock code in rec_layer_s3.c
+#Needed for the multiblock code in tls_multib.c
IF[{- !$disabled{asm} -}]
$AESDEF_x86=AES_ASM
$AESDEF_x86_64=AES_ASM
diff --git a/deps/openssl/openssl/ssl/record/methods/dtls_meth.c b/deps/openssl/openssl/ssl/record/methods/dtls_meth.c
index 1000cc465f7..f99baca0ced 100644
--- a/deps/openssl/openssl/ssl/record/methods/dtls_meth.c
+++ b/deps/openssl/openssl/ssl/record/methods/dtls_meth.c
@@ -467,17 +467,19 @@ int dtls_prev_epoch_allows_type(const OSSL_RECORD_LAYER *crypto_rl, int type)
}
/*
- * In DTLS 1.3 only the hellos are sent unprotected. Once they are done the
- * read layer still stays in epoch 0 until the peer's first epoch 2 record
- * turns up. libssl marks that point by allowing plaintext alerts, and from
- * then on an alert is the only thing that may still arrive unprotected.
+ * In DTLS 1.3 only the hello handshake messages are sent unprotected. Once
+ * they are done, the read layer stays in epoch 0 until the peer's first
+ * epoch 2 record arrives. libssl marks this phase by allowing plaintext
+ * alerts. Only alerts and ACKs may arrive unprotected in this phase;
+ * dtls_process_ack() checks the epoch authority of each ACK entry.
*/
static int dtls13_plaintext_allows_type(const OSSL_RECORD_LAYER *rl, int type)
{
return rl->version != DTLS1_3_VERSION
|| rl->epoch != 0
|| !rl->allow_plain_alerts
- || type == SSL3_RT_ALERT;
+ || type == SSL3_RT_ALERT
+ || (type == SSL3_RT_ACK && rl->role == OSSL_RECORD_ROLE_SERVER);
}
/*-
diff --git a/deps/openssl/openssl/ssl/record/rec_layer_d1.c b/deps/openssl/openssl/ssl/record/rec_layer_d1.c
index c99269c702e..18fa2222e5b 100644
--- a/deps/openssl/openssl/ssl/record/rec_layer_d1.c
+++ b/deps/openssl/openssl/ssl/record/rec_layer_d1.c
@@ -106,7 +106,14 @@ static int dtls_buffer_record(SSL_CONNECTION *s, TLS_RECORD *rec)
return -1;
rdata = OPENSSL_malloc(sizeof(*rdata));
- item = pitem_new_u64(rec->seq_num, rdata);
+ /*
+ * DTLS 1.3 sequence numbers restart in every epoch, so records of
+ * different epochs can share one. Key on the epoch as well: the 48-bit
+ * sequence number leaves the top 16 bits for the low bits of the epoch.
+ */
+ item = pitem_new_u64(((rec->epoch & 0xFFFF) << 48)
+ | (rec->seq_num & 0xFFFFFFFFFFFFULL),
+ rdata);
if (rdata == NULL || item == NULL) {
OPENSSL_free(rdata);
pitem_free(item);
@@ -400,6 +407,50 @@ start:
return -1;
if (is_dtls13 && current_state == TLS_ST_OK && SSL_in_init(s)) {
+ if (!ossl_statem_get_in_handshake(sc)) {
+ /*
+ * Post-handshake work is still owed (e.g. a reciprocal
+ * KeyUpdate) and nothing is driving the state machine. Run it
+ * now, as the top of this function does, so the message is
+ * sent and its retransmit timer armed. Otherwise nothing
+ * would be in flight and no event would ever end the wait for
+ * the buffered data. It is released by dtls_unbuffer_record()
+ * once the exchange completes.
+ */
+ i = sc->handshake_func(s);
+ /* SSLfatal() already called if appropriate */
+ if (i < 0)
+ return i;
+ if (i == 0)
+ return -1;
+ goto start;
+ }
+
+ /*
+ * The record was buffered, not dropped or failed: it will be
+ * delivered once the in-progress post-handshake exchange (e.g.
+ * a reciprocal KeyUpdate) completes. Without this, rwstate is
+ * left at whatever start: last set it to (SSL_NOTHING, since
+ * this returns instead of looping back there), and
+ * SSL_get_error() reports SSL_ERROR_SYSCALL on an empty error
+ * queue instead of the ordinary retry condition this actually
+ * is.
+ *
+ * A connection accepted by a DTLS listener has no read BIO of
+ * its own -- it receives through the listener's shared demux
+ * queue instead (see dtls_listener_create_conn_ssl()) -- so
+ * SSL_get_rbio() returns NULL here and these BIO flag updates
+ * must be skipped. SSL_get_error() already reports
+ * SSL_ERROR_WANT_READ for SSL_READING on such a connection
+ * without needing a BIO at all.
+ */
+ BIO *rbio = SSL_get_rbio(s);
+
+ sc->rwstate = SSL_READING;
+ if (rbio != NULL) {
+ BIO_clear_retry_flags(rbio);
+ BIO_set_retry_read(rbio);
+ }
return -1;
}
goto start;
@@ -801,10 +852,20 @@ start:
return -1;
} else if (sc->version == DTLS1_3_VERSION) {
/*
- * Let's let DTLS ACK and retransmits fix this problem.
+ * Only buffer data authenticated under application traffic keys
+ * (epoch 3 onwards), including delayed data interleaved with a
+ * post-handshake authentication response. Plaintext, early data,
+ * and handshake-epoch data must not be buffered here for delivery
+ * as ordinary application data.
*/
- ssl_release_record(sc, rr, 0);
- return -1;
+ if (rr->epoch >= 3 && dtls_buffer_record(sc, rr) < 0) {
+ /* SSLfatal() already called */
+ return -1;
+ }
+ if (!ssl_release_record(sc, rr, 0))
+ return -1;
+ /* Continue to the next record or obtain a genuine read retry. */
+ goto start;
} else {
SSLfatal(sc, SSL_AD_UNEXPECTED_MESSAGE, SSL_R_UNEXPECTED_RECORD);
return -1;
diff --git a/deps/openssl/openssl/ssl/record/rec_layer_s3.c b/deps/openssl/openssl/ssl/record/rec_layer_s3.c
index ef7b469b658..80a5dc03953 100644
--- a/deps/openssl/openssl/ssl/record/rec_layer_s3.c
+++ b/deps/openssl/openssl/ssl/record/rec_layer_s3.c
@@ -73,6 +73,17 @@ int RECORD_LAYER_reset(RECORD_LAYER *rl)
{
int ret;
+ /*
+ * Buffered DTLS messages belong to the handshake being abandoned, and
+ * may reference the write record layer that is about to be freed, such
+ * as a ClientHello when SSL_set_connect_state() is called while waiting
+ * for the server's response. Drop them first, and cancel the
+ * retransmission timer along with them so that the application is not
+ * told to keep servicing a timer that has nothing left to retransmit.
+ */
+ if (rl->s->d1 != NULL)
+ dtls1_stop_timer(rl->s);
+
ret = RECORD_LAYER_clear(rl);
/* We try and reset both record layers even if one fails */
@@ -1580,10 +1591,12 @@ int ssl_set_new_record_layer(SSL_CONNECTION *s, int version,
/*
* Free the old record layer if we have one except in the case of DTLS when
- * writing and there are still buffered sent messages in our queue. In that
- * case the record layer is still referenced by those buffered messages for
- * potential retransmit. Only when those buffered messages get freed do we
- * free the record layer object (see dtls1_hm_fragment_free)
+ * writing and buffered sent messages in our queue were sent with it. In
+ * that case the record layer is still referenced by those buffered
+ * messages for potential retransmit. Only when those buffered messages get
+ * freed do we free the record layer object (see dtls1_clear_sent_buffer).
+ * A record layer that no buffered message was sent with, such as the one
+ * for DTLS 1.3 early data, is freed straight away.
*
* For a DTLS 1.3 read layer, hand the old one to the new one for
* retention instead of freeing it: a retransmission of the message that
@@ -1601,7 +1614,7 @@ int ssl_set_new_record_layer(SSL_CONNECTION *s, int version,
}
} else if (!SSL_CONNECTION_IS_DTLS(s)
|| direction == OSSL_RECORD_DIRECTION_READ
- || pqueue_peek(&s->d1->sent_messages) == NULL) {
+ || !dtls1_sent_buffer_uses_current_wrl(s)) {
if (*thismethod != NULL && !(*thismethod)->free(*thisrl)) {
SSLfatal(s, SSL_AD_INTERNAL_ERROR, ERR_R_INTERNAL_ERROR);
return 0;
diff --git a/deps/openssl/openssl/ssl/ssl_lib.c b/deps/openssl/openssl/ssl/ssl_lib.c
index d7510c73f29..0c7d307ea81 100644
--- a/deps/openssl/openssl/ssl/ssl_lib.c
+++ b/deps/openssl/openssl/ssl/ssl_lib.c
@@ -2186,6 +2186,15 @@ int SSL_copy_session_id(SSL *t, const SSL *f)
if (tsc == NULL || fsc == NULL)
return 0;
+ /*
+ * |t| keeps its own SSL_CTX, whose provider sigalgs index the CERT's
+ * pkeys, so it cannot share a CERT sized for a different set of them.
+ */
+ if (tsc->ssl_pkey_num != fsc->cert->ssl_pkey_num) {
+ ERR_raise(ERR_LIB_SSL, ERR_R_PASSED_INVALID_ARGUMENT);
+ return 0;
+ }
+
/* Do we need to do SSL locking? */
if (!SSL_set_session(t, SSL_get_session(f))) {
return 0;
@@ -3105,6 +3114,22 @@ int SSL_shutdown(SSL *s)
return -1;
}
+ /*
+ * An unsent reciprocal KeyUpdate does not prevent an orderly close.
+ * Cancel it only at a completed post-handshake boundary, with no write-key
+ * installation pending. A KeyUpdate already in flight must retain its
+ * state until the exchange completes.
+ */
+ if (SSL_CONNECTION_IS_DTLS13(sc)
+ && !SSL_IS_FIRST_HANDSHAKE(sc)
+ && sc->statem.state == MSG_FLOW_FINISHED
+ && sc->statem.hand_state == TLS_ST_OK
+ && sc->key_update == SSL_KEY_UPDATE_NOT_REQUESTED
+ && !sc->d1->key_update_write_pending) {
+ sc->key_update = SSL_KEY_UPDATE_NONE;
+ ossl_statem_set_in_init(sc, 0);
+ }
+
if (!SSL_in_init(s)) {
if ((sc->mode & SSL_MODE_ASYNC) && ASYNC_get_current_job() == NULL) {
struct ssl_async_args args;
@@ -3161,6 +3186,19 @@ int SSL_key_update(SSL *s, int updatetype)
return 0;
}
+ /*
+ * RFC 9147 section 5.8.4: implementations MUST NOT send a KeyUpdate if
+ * an earlier one has not yet been acknowledged. key_update_write_pending
+ * covers this and more: it also catches an earlier KeyUpdate that is
+ * acknowledged but whose write-key install is still withheld behind an
+ * earlier, unrelated message -- SSL_is_init_finished() above does not
+ * guarantee that has completed.
+ */
+ if (SSL_CONNECTION_IS_DTLS13(sc) && sc->d1->key_update_write_pending) {
+ ERR_raise(ERR_LIB_SSL, SSL_R_REQUEST_PENDING);
+ return 0;
+ }
+
ossl_statem_set_in_init(sc, 1);
sc->key_update = updatetype;
return 1;
@@ -3256,6 +3294,15 @@ int SSL_new_session_ticket(SSL *s)
|| SSL_IS_FIRST_HANDSHAKE(sc) || !sc->server
|| !SSL_CONNECTION_IS_VERSION13(sc))
return 0;
+
+ /*
+ * Our own KeyUpdate's new keys must not be used for anything else
+ * until its write-key install completes (RFC 9147 section 8) -- even
+ * though it may already be acknowledged, with nothing left for
+ * SSL_is_init_finished() to object to.
+ */
+ if (SSL_CONNECTION_IS_DTLS13(sc) && sc->d1->key_update_write_pending)
+ return 0;
sc->ext.extra_tickets_expected++;
if (!RECORD_LAYER_write_pending(&sc->rlayer) && !SSL_in_init(s))
ossl_statem_set_in_init(sc, 1);
@@ -7827,6 +7874,17 @@ int SSL_verify_client_post_handshake(SSL *ssl)
return 0;
}
+ /*
+ * Our own KeyUpdate's new keys must not be used for anything else
+ * until its write-key install completes (RFC 9147 section 8) -- even
+ * though it may already be acknowledged, with nothing left for
+ * SSL_is_init_finished() to object to.
+ */
+ if (SSL_CONNECTION_IS_DTLS13(sc) && sc->d1->key_update_write_pending) {
+ ERR_raise(ERR_LIB_SSL, SSL_R_REQUEST_PENDING);
+ return 0;
+ }
+
switch (sc->post_handshake_auth) {
case SSL_PHA_NONE:
ERR_raise(ERR_LIB_SSL, SSL_R_EXTENSION_NOT_RECEIVED);
diff --git a/deps/openssl/openssl/ssl/ssl_local.h b/deps/openssl/openssl/ssl/ssl_local.h
index aecae880c33..37fbf8711a7 100644
--- a/deps/openssl/openssl/ssl/ssl_local.h
+++ b/deps/openssl/openssl/ssl/ssl_local.h
@@ -2125,7 +2125,7 @@ typedef struct pitem_st pitem;
struct pqueue_st {
pitem *items;
- int count;
+ size_t count;
};
struct pitem_st {
@@ -2207,6 +2207,43 @@ typedef struct dtls_sent_msg_st {
int dtls_any_sent_messages_are_missing_acknowledge(SSL_CONNECTION *s);
+/**
+ * @brief Test whether our own KeyUpdate is still awaiting acknowledgement.
+ *
+ * @param s the DTLS connection
+ * @returns 1 if a KeyUpdate in the sent message queue still has unacknowledged
+ * record numbers, 0 otherwise.
+ */
+int dtls_has_unacked_key_update(SSL_CONNECTION *s);
+
+/**
+ * @brief Install a deferred KeyUpdate write key once it is safe to do so.
+ *
+ * If our KeyUpdate is waiting to install its new write keys, check whether
+ * it and every message sent before it is now acknowledged (RFC 9147 erratum
+ * 8047), and install the key if so. Called when an ACK is processed, and when
+ * a flight is retired implicitly with no ACK record involved.
+ *
+ * @param s the DTLS connection
+ * @returns 0 only on a fatal error installing the key, in which case
+ * SSLfatal() has already been called; 1 otherwise, including when
+ * there was nothing to do.
+ */
+int dtls1_check_deferred_write_key(SSL_CONNECTION *s);
+
+/**
+ * @brief Test whether the next expected handshake message is already buffered.
+ *
+ * Reports a fully received message waiting in the reassembly buffer for the
+ * next expected sequence number, independently of any new record arriving, so
+ * that callers keep reading instead of going idle.
+ *
+ * @param s the DTLS connection
+ * @returns 1 if the next expected message is complete and buffered, 0
+ * otherwise.
+ */
+int dtls1_has_buffered_ready_message(SSL_CONNECTION *s);
+
static ossl_inline int dtls_msg_needs_ack(int sentbyserver, unsigned char msgtype)
{
switch (msgtype) {
@@ -2265,6 +2302,28 @@ typedef struct dtls1_state_st {
unsigned int retransmitting;
unsigned int has_change_cipher_spec;
+ /*
+ * Set when our own KeyUpdate has been sent but not yet acknowledged.
+ * The new write keys are not installed until the ACK arrives
+ * per RFC 9147 section 8: the restriction is on using the new
+ * epoch's keys, not on sending altogether, so we keep using the current
+ * keys in the meantime.
+ */
+ unsigned int key_update_write_pending;
+ /*
+ * Set true once our own pending KeyUpdate has been fully acknowledged.
+ * Tracked separately from its sent_messages entry because that entry
+ * can be freed as soon as it's acknowledged, even while
+ * key_update_write_pending is still waiting on an earlier message -- so
+ * the entry may already be gone by the time we need to know this.
+ */
+ unsigned int key_update_acked;
+ /*
+ * The handshake message sequence number of our own pending KeyUpdate,
+ * captured when it was sent. Lets us tell which other queued messages
+ * precede it, without needing its own entry to still be in the queue.
+ */
+ unsigned short key_update_msg_seq;
#ifndef OPENSSL_NO_SCTP
int shutdown_received;
#endif
@@ -3117,8 +3176,24 @@ __owur int dtls1_check_timeout_num(SSL_CONNECTION *s);
__owur int dtls1_handle_timeout(SSL_CONNECTION *s);
void dtls1_start_timer(SSL_CONNECTION *s);
void dtls1_stop_timer(SSL_CONNECTION *s);
+
+/**
+ * @brief Stop the retransmit timer on reading the peer's flight, keeping any
+ * of our own messages that are still unacknowledged.
+ *
+ * Unlike dtls1_stop_timer(), a DTLS 1.3 connection which still has other
+ * unacknowledged messages outstanding keeps them, retiring only what the
+ * peer's flight implicitly acknowledges (RFC 9147 section 7.2). A deferred
+ * KeyUpdate write key is installed if this unblocks it.
+ *
+ * @param s the DTLS connection
+ * @returns 0 only on a fatal error installing a deferred write key, in which
+ * case SSLfatal() has already been called; 1 otherwise.
+ */
+int dtls1_stop_timer_for_read_flight(SSL_CONNECTION *s);
__owur int dtls1_is_timer_expired(SSL_CONNECTION *s);
void dtls1_clear_current_wrl_from_sent_buffer(SSL_CONNECTION *s);
+int dtls1_sent_buffer_uses_current_wrl(SSL_CONNECTION *s);
__owur int dtls_raw_hello_verify_request(WPACKET *pkt, unsigned char *cookie,
size_t cookie_len);
__owur size_t dtls1_min_mtu(SSL_CONNECTION *s);
diff --git a/deps/openssl/openssl/ssl/ssl_sess.c b/deps/openssl/openssl/ssl/ssl_sess.c
index 7a74b5bbefd..2e2639aebb4 100644
--- a/deps/openssl/openssl/ssl/ssl_sess.c
+++ b/deps/openssl/openssl/ssl/ssl_sess.c
@@ -330,7 +330,9 @@ static int def_generate_session_id(SSL *ssl, unsigned char *id,
{
unsigned int retry = 0;
do {
- if (RAND_bytes_ex(ssl->ctx->libctx, id, *id_len, 0) <= 0)
+ if (RAND_bytes_ex(SSL_CONNECTION_GET_CTX(SSL_CONNECTION_FROM_SSL(ssl))->libctx,
+ id, *id_len, 0)
+ <= 0)
return 0;
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
if (retry > 0) {
@@ -356,7 +358,7 @@ int ssl_generate_session_id(SSL_CONNECTION *s, SSL_SESSION *ss)
{
unsigned int tmp;
GEN_SESSION_CB cb = def_generate_session_id;
- SSL *ssl = SSL_CONNECTION_GET_SSL(s);
+ SSL *ssl = SSL_CONNECTION_GET_USER_SSL(s);
switch (s->version) {
case TLS1_VERSION:
@@ -395,7 +397,7 @@ int ssl_generate_session_id(SSL_CONNECTION *s, SSL_SESSION *ss)
}
/* Choose which callback will set the session ID */
- if (!CRYPTO_THREAD_read_lock(SSL_CONNECTION_GET_SSL(s)->lock)) {
+ if (!CRYPTO_THREAD_read_lock(ssl->lock)) {
SSLfatal(s, SSL_AD_INTERNAL_ERROR, ERR_R_INTERNAL_ERROR);
return 0;
}
diff --git a/deps/openssl/openssl/ssl/statem/extensions.c b/deps/openssl/openssl/ssl/statem/extensions.c
index 126c68d2041..aa5dcffc327 100644
--- a/deps/openssl/openssl/ssl/statem/extensions.c
+++ b/deps/openssl/openssl/ssl/statem/extensions.c
@@ -1187,7 +1187,14 @@ int tls_construct_extensions(SSL_CONNECTION *s, WPACKET *pkt,
/* Add custom extensions first */
#ifndef OPENSSL_NO_ECH
- if ((context & SSL_EXT_CLIENT_HELLO) != 0 && s->ext.ech.attempted == 0)
+ /*
+ * With ECH, the outer ClientHello reuses the custom extensions added
+ * to the inner one, so only reset their flags for the inner. That has
+ * to happen for every inner, as after a HelloRetryRequest the flags
+ * would still be set from the first ClientHello.
+ */
+ if ((context & SSL_EXT_CLIENT_HELLO) != 0
+ && (s->ext.ech.attempted == 0 || s->ext.ech.ch_depth == 1))
/* On the server side with initialise during ClientHello parsing */
custom_ext_init(&s->cert->custext);
#else
diff --git a/deps/openssl/openssl/ssl/statem/extensions_clnt.c b/deps/openssl/openssl/ssl/statem/extensions_clnt.c
index a1c7d7709bc..83e26d90fff 100644
--- a/deps/openssl/openssl/ssl/statem/extensions_clnt.c
+++ b/deps/openssl/openssl/ssl/statem/extensions_clnt.c
@@ -1387,7 +1387,7 @@ EXT_RETURN tls_construct_ctos_psk(SSL_CONNECTION *s, WPACKET *pkt,
{
#if !(defined(OPENSSL_NO_TLS1_3) && defined(OPENSSL_NO_DTLS1_3))
uint32_t agems = 0;
- size_t binderoffset, msglen;
+ size_t binderoffset, msglen, resbinder_end_offset = 0, pskbinder_end_offset = 0;
int reshashsize = 0, pskhashsize = 0;
unsigned char *resbinder = NULL, *pskbinder = NULL, *msgstart = NULL;
const EVP_MD *handmd = NULL, *mdres = NULL, *mdpsk = NULL;
@@ -1595,9 +1595,11 @@ dopsksess:
|| !WPACKET_get_total_written(pkt, &binderoffset)
|| !WPACKET_start_sub_packet_u16(pkt)
|| (dores
- && !WPACKET_sub_allocate_bytes_u8(pkt, reshashsize, &resbinder))
+ && (!WPACKET_sub_allocate_bytes_u8(pkt, reshashsize, NULL)
+ || !WPACKET_get_total_written(pkt, &resbinder_end_offset)))
|| (s->psksession != NULL
- && !WPACKET_sub_allocate_bytes_u8(pkt, pskhashsize, &pskbinder))
+ && (!WPACKET_sub_allocate_bytes_u8(pkt, pskhashsize, NULL)
+ || !WPACKET_get_total_written(pkt, &pskbinder_end_offset)))
|| !WPACKET_close(pkt)
|| !WPACKET_close(pkt)
|| !WPACKET_get_total_written(pkt, &msglen)
@@ -1611,6 +1613,11 @@ dopsksess:
}
msgstart = WPACKET_get_curr(pkt) - msglen;
+ /* Allocating either binder may relocate the packet's backing buffer. */
+ if (dores)
+ resbinder = msgstart + resbinder_end_offset - reshashsize;
+ if (s->psksession != NULL)
+ pskbinder = msgstart + pskbinder_end_offset - pskhashsize;
if (dores && tls_psk_do_binder(s, mdres, msgstart, binderoffset, NULL, resbinder, s->session, 1, 0) != 1) {
/* SSLfatal() already called */
@@ -1996,6 +2003,8 @@ int tls_parse_stoc_alpn(SSL_CONNECTION *s, PACKET *pkt, unsigned int context,
size_t len;
PACKET confpkt, protpkt;
int valid = 0;
+ size_t eff_alpn_len = 0;
+ unsigned char *eff_alpn = NULL;
/* We must have requested it. */
if (!s->s3.alpn_sent) {
@@ -2015,8 +2024,21 @@ int tls_parse_stoc_alpn(SSL_CONNECTION *s, PACKET *pkt, unsigned int context,
return 0;
}
+ eff_alpn = s->ext.alpn;
+ eff_alpn_len = s->ext.alpn_len;
+#ifndef OPENSSL_NO_ECH
+ /*
+ * If we tried ECH and it failed, then we need to compare vs. the
+ * outer alpn, if one was set.
+ */
+ if (s->ext.ech.es != NULL && s->ext.ech.success == 0
+ && s->ext.ech.alpn_outer != NULL) {
+ eff_alpn = s->ext.ech.alpn_outer;
+ eff_alpn_len = s->ext.ech.alpn_outer_len;
+ }
+#endif
/* It must be a protocol that we sent */
- if (!PACKET_buf_init(&confpkt, s->ext.alpn, s->ext.alpn_len)) {
+ if (!PACKET_buf_init(&confpkt, eff_alpn, eff_alpn_len)) {
SSLfatal(s, SSL_AD_INTERNAL_ERROR, ERR_R_INTERNAL_ERROR);
return 0;
}
diff --git a/deps/openssl/openssl/ssl/statem/extensions_srvr.c b/deps/openssl/openssl/ssl/statem/extensions_srvr.c
index 8b0ed79ad27..512f677f79c 100644
--- a/deps/openssl/openssl/ssl/statem/extensions_srvr.c
+++ b/deps/openssl/openssl/ssl/statem/extensions_srvr.c
@@ -813,6 +813,7 @@ int tls_parse_ctos_key_share(SSL_CONNECTION *s, PACKET *pkt,
const size_t *srvrtuples;
uint16_t *first_group_in_tuple;
size_t clnt_num_groups, srvr_num_groups, srvr_num_tuples;
+ size_t srvr_groups_remaining;
PACKET *encoded_pubkey_arr = NULL;
uint16_t *keyshares_arr = NULL;
size_t keyshares_cnt = 0;
@@ -899,10 +900,23 @@ int tls_parse_ctos_key_share(SSL_CONNECTION *s, PACKET *pkt,
* Remark: Selection priority different for client- or server-preference
*/
first_group_in_tuple = (uint16_t *)srvrgroups;
+ srvr_groups_remaining = srvr_num_groups;
for (current_tuple = 0; current_tuple < srvr_num_tuples; current_tuple++) {
size_t number_of_groups_in_tuple = srvrtuples[current_tuple];
int prio_group_idx = 0, candidate_group_idx = 0;
+ /*
+ * The tuple sizes must partition srvrgroups exactly. A tuple larger
+ * than the groups still left means the group and tuple lists have
+ * come from different sources, which is an internal error: stop here
+ * rather than reading past the end of srvrgroups.
+ */
+ if (number_of_groups_in_tuple > srvr_groups_remaining) {
+ SSLfatal(s, SSL_AD_INTERNAL_ERROR, ERR_R_INTERNAL_ERROR);
+ goto err;
+ }
+ srvr_groups_remaining -= number_of_groups_in_tuple;
+
/* Server or client preference ? */
if (s->options & SSL_OP_SERVER_PREFERENCE) {
/* Server preference */
@@ -1108,12 +1122,10 @@ int tls_parse_ctos_cookie(SSL_CONNECTION *s, PACKET *pkt, unsigned int context,
SSLfatal(s, SSL_AD_DECODE_ERROR, SSL_R_LENGTH_MISMATCH);
return 0;
}
- if (group_id != s->s3.group_id
- || s->s3.tmp.new_cipher
- != ssl_get_cipher_by_char(s, ciphdata, 0)) {
+ if (s->s3.tmp.new_cipher != ssl_get_cipher_by_char(s, ciphdata, 0)) {
/*
- * We chose a different cipher or group id this time around to what is
- * in the cookie. Something must have changed.
+ * We chose a different cipher this time around to what is in the
+ * cookie. Something must have changed.
*/
SSLfatal(s, SSL_AD_ILLEGAL_PARAMETER, SSL_R_BAD_CIPHER);
return 0;
@@ -1202,7 +1214,7 @@ int tls_parse_ctos_cookie(SSL_CONNECTION *s, PACKET *pkt, unsigned int context,
if (key_share) {
if (!WPACKET_put_bytes_u16(&hrrpkt, TLSEXT_TYPE_key_share)
|| !WPACKET_start_sub_packet_u16(&hrrpkt)
- || !WPACKET_put_bytes_u16(&hrrpkt, s->s3.group_id)
+ || !WPACKET_put_bytes_u16(&hrrpkt, group_id)
|| !WPACKET_close(&hrrpkt)) {
WPACKET_cleanup(&hrrpkt);
SSLfatal(s, SSL_AD_INTERNAL_ERROR, ERR_R_INTERNAL_ERROR);
@@ -1232,6 +1244,9 @@ int tls_parse_ctos_cookie(SSL_CONNECTION *s, PACKET *pkt, unsigned int context,
/* Act as if this ClientHello came after a HelloRetryRequest */
s->hello_retry_request = SSL_HRR_PENDING;
+ /* The key_share parsing then checks the client sent the group we asked for */
+ if (key_share)
+ s->s3.group_id = group_id;
s->ext.cookieok = 1;
#endif
diff --git a/deps/openssl/openssl/ssl/statem/statem.c b/deps/openssl/openssl/ssl/statem/statem.c
index abea35ae802..7cfc18008a6 100644
--- a/deps/openssl/openssl/ssl/statem/statem.c
+++ b/deps/openssl/openssl/ssl/statem/statem.c
@@ -135,6 +135,7 @@ void ossl_statem_clear(SSL_CONNECTION *s)
ossl_statem_set_in_init(s, 1);
s->statem.no_cert_verify = 0;
s->statem.ack_for_retransmit = 0;
+ s->statem.deferred_key_update_state = TLS_ST_BEFORE;
}
/*
@@ -735,8 +736,10 @@ static SUB_STATE_RETURN read_state_machine(SSL_CONNECTION *s)
return SUB_STATE_ERROR;
case MSG_PROCESS_FINISHED_READING:
- if (SSL_CONNECTION_IS_DTLS(s)) {
- dtls1_stop_timer(s);
+ if (SSL_CONNECTION_IS_DTLS(s)
+ && !dtls1_stop_timer_for_read_flight(s)) {
+ check_fatal(s);
+ return SUB_STATE_ERROR;
}
return SUB_STATE_FINISHED;
@@ -768,8 +771,10 @@ static SUB_STATE_RETURN read_state_machine(SSL_CONNECTION *s)
case WORK_FINISHED_SWAP:
case WORK_FINISHED_STOP:
- if (SSL_CONNECTION_IS_DTLS(s)) {
- dtls1_stop_timer(s);
+ if (SSL_CONNECTION_IS_DTLS(s)
+ && !dtls1_stop_timer_for_read_flight(s)) {
+ check_fatal(s);
+ return SUB_STATE_ERROR;
}
return SUB_STATE_FINISHED;
}
diff --git a/deps/openssl/openssl/ssl/statem/statem_clnt.c b/deps/openssl/openssl/ssl/statem/statem_clnt.c
index a9480f701ba..967dacdfd4d 100644
--- a/deps/openssl/openssl/ssl/statem/statem_clnt.c
+++ b/deps/openssl/openssl/ssl/statem/statem_clnt.c
@@ -431,6 +431,23 @@ static WRITE_TRAN ossl_statem_client13_write_transition(SSL_CONNECTION *s)
return WRITE_TRAN_CONTINUE;
}
+ /*
+ * Resume a write we held back because our own KeyUpdate's write-key
+ * install was still pending (see the TLS_ST_CR_CERT_REQ case below).
+ * Once that completes, fall through into the switch below as if we
+ * were still at the deferred read state, so it can now proceed to
+ * construct that response. Unlike the server's equivalent resume
+ * check, this one only ever resumes into TLS_ST_CR_CERT_REQ, which
+ * re-validates key_update_write_pending itself before sending
+ * anything -- so either check would behave the same here, but this
+ * one matches what it's actually resuming.
+ */
+ if (st->deferred_key_update_state != TLS_ST_BEFORE
+ && !s->d1->key_update_write_pending) {
+ st->hand_state = st->deferred_key_update_state;
+ st->deferred_key_update_state = TLS_ST_BEFORE;
+ }
+
/*
* Note: There are no cases for TLS_ST_BEFORE because we haven't negotiated
* TLSv1.3 yet at that point. They are handled by
@@ -444,6 +461,22 @@ static WRITE_TRAN ossl_statem_client13_write_transition(SSL_CONNECTION *s)
case TLS_ST_CR_CERT_REQ:
if (s->post_handshake_auth == SSL_PHA_REQUESTED) {
+ if (SSL_CONNECTION_IS_DTLS13(s) && s->d1->key_update_write_pending) {
+ /*
+ * RFC 9147 section 8: our own KeyUpdate's new keys must not
+ * be used for anything else until it is acknowledged. Hold
+ * this response back rather than send it now. Checking
+ * key_update_write_pending rather than
+ * dtls_has_unacked_key_update() matters here: the KeyUpdate
+ * can already be acknowledged while its write-key install is
+ * still withheld behind an earlier, unrelated message, and
+ * sending genuinely new content in that window would still
+ * use the old keys.
+ */
+ st->deferred_key_update_state = st->hand_state;
+ st->hand_state = TLS_ST_CW_KEY_UPDATE;
+ return WRITE_TRAN_FINISHED;
+ }
if (do_compressed_cert(s))
st->hand_state = TLS_ST_CW_COMP_CERT;
else
@@ -520,6 +553,18 @@ static WRITE_TRAN ossl_statem_client13_write_transition(SSL_CONNECTION *s)
case TLS_ST_CR_KEY_UPDATE:
case TLS_ST_CR_SESSION_TICKET:
if (SSL_CONNECTION_IS_DTLS13(s)) {
+ /*
+ * RFC 9147 section 8's restriction is on using the new
+ * epoch's keys, not on sending at all. Our own KeyUpdate's
+ * write keys are not installed until its ACK arrives, so
+ * this ACK -- for a received KeyUpdate or NewSessionTicket
+ * alike -- can safely go out under our current, still-valid
+ * keys even while our own KeyUpdate is outstanding. Unlike
+ * the TLS_ST_CR_CERT_REQ case above, this is only ever an
+ * ACK, never new post-handshake content, so it never needs
+ * to share deferred_key_update_state with a genuinely held
+ * back authentication response.
+ */
st->hand_state = TLS_ST_CW_ACK;
return WRITE_TRAN_CONTINUE;
}
@@ -548,6 +593,16 @@ static WRITE_TRAN ossl_statem_client13_write_transition(SSL_CONNECTION *s)
st->ack_for_retransmit = 0;
return WRITE_TRAN_FINISHED;
}
+ if (SSL_CONNECTION_IS_DTLS13(s) && s->d1->key_update_write_pending) {
+ /*
+ * This ACK was for something unrelated to our own KeyUpdate
+ * (see TLS_ST_CR_KEY_UPDATE above), whose write-key install is
+ * still withheld behind an earlier, unrelated message. Go back
+ * to waiting rather than reporting the connection idle.
+ */
+ st->hand_state = TLS_ST_CW_KEY_UPDATE;
+ return WRITE_TRAN_FINISHED;
+ }
st->hand_state = TLS_ST_OK;
return WRITE_TRAN_CONTINUE;
@@ -844,6 +899,31 @@ WORK_STATE ossl_statem_client_pre_work(SSL_CONNECTION *s, WORK_STATE wst)
return tls_finish_handshake(s, wst, 0, 1);
case TLS_ST_OK:
+ /*
+ * A message that arrived out of order may already be sitting fully
+ * received in the reassembly buffer, waiting on something earlier
+ * that we just finished processing in this same call. Loop back
+ * into reading instead of going idle, rather than stranding it
+ * until some unrelated new record happens to arrive later.
+ */
+ if (SSL_CONNECTION_IS_DTLS13(s) && dtls1_has_buffered_ready_message(s)) {
+ /*
+ * This skips tls_finish_handshake() below, so its
+ * post_handshake_auth reset must happen here instead.
+ * Calling the full function isn't an option: its
+ * initial-handshake cleanup clears the reassembly buffer,
+ * which would discard the very message we're trying to keep.
+ *
+ * Without this, a second CertificateRequest already sitting in
+ * that buffer gets rejected as unexpected --
+ * ossl_statem_client_read_transition() only accepts one while
+ * post_handshake_auth is SSL_PHA_EXT_SENT, and it would still
+ * be SSL_PHA_REQUESTED from the exchange that just finished.
+ */
+ if (s->post_handshake_auth == SSL_PHA_REQUESTED)
+ s->post_handshake_auth = SSL_PHA_EXT_SENT;
+ return WORK_FINISHED_SWAP;
+ }
/* Calls SSLfatal() as required */
return tls_finish_handshake(s, wst, 1, 1);
}
@@ -991,7 +1071,17 @@ WORK_STATE ossl_statem_client_post_work(SSL_CONNECTION *s, WORK_STATE wst)
case TLS_ST_CW_KEY_UPDATE:
if (statem_flush(s) != 1)
return WORK_MORE_A;
- if (!tls13_update_key(s, 1)) {
+ if (SSL_CONNECTION_IS_DTLS13(s)) {
+ /*
+ * RFC 9147 section 8: don't switch to the new write keys
+ * until this KeyUpdate has been acknowledged; keep using
+ * the current, still-valid keys until then. Installed from
+ * dtls_process_ack() once the ACK arrives.
+ */
+ s->d1->key_update_write_pending = 1;
+ s->d1->key_update_acked = 0;
+ s->d1->key_update_msg_seq = s->d1->w_msg.msg_seq;
+ } else if (!tls13_update_key(s, 1)) {
/* SSLfatal() already called */
return WORK_ERROR;
}
@@ -1951,6 +2041,14 @@ MSG_PROCESS_RETURN tls_process_server_hello(SSL_CONNECTION *s, PACKET *pkt)
&& s->ext.ech.done != 1 && s->ext.ech.ch_depth == 0
&& s->ext.ech.grease == OSSL_ECH_NOT_GREASE
&& s->ext.ech.attempted_type == TLSEXT_TYPE_ech) {
+ /*
+ * At the ServerHello after a HRR, success still says whether that
+ * HRR accepted ECH. If it didn't, we already fell back to the
+ * public_name when processing the HRR.
+ */
+ int after_hrr = !hrr && s->hello_retry_request != SSL_HRR_NONE;
+ int hrr_accepted = after_hrr && s->ext.ech.success == 1;
+
if (!set_client_ciphersuite(s, cipherchars)) {
/* SSLfatal() already called */
goto err;
@@ -1993,6 +2091,14 @@ MSG_PROCESS_RETURN tls_process_server_hello(SSL_CONNECTION *s, PACKET *pkt)
OSSL_TRACE_END(TLS);
s->ext.ech.success = 1;
}
+ if (after_hrr && s->ext.ech.success != hrr_accepted) {
+ /*
+ * the HRR and SH.random ECH acceptance signals disagree,
+ * so that's an illegal protocol error
+ */
+ SSLfatal(s, SSL_AD_ILLEGAL_PARAMETER, SSL_R_ECH_REQUIRED);
+ goto err;
+ }
if (!hrr && s->ext.ech.success == 1) {
if (ossl_ech_swaperoo(s) != 1
|| ossl_ech_intbuf_fetch(s, &abuf, &alen) != 1
@@ -2007,16 +2113,7 @@ MSG_PROCESS_RETURN tls_process_server_hello(SSL_CONNECTION *s, PACKET *pkt)
* the outer CH, so we better set the hostname for the
* connection accordingly.
*/
- } else if (!hrr && s->ext.ech.success == 0
- && s->ext.ech.hrrsignal_p != NULL) {
- /*
- * we previously saw a good HRR ECH acceptance but now
- * the SH.random ECH acceptance signal is bad so that's an
- * illegal protocol error
- */
- SSLfatal(s, SSL_AD_ILLEGAL_PARAMETER, SSL_R_ECH_REQUIRED);
- goto err;
- } else {
+ } else if (!after_hrr) {
OSSL_TRACE1(TLS, "ECH falling back to public_name: %s\n",
s->ext.ech.outer_hostname != NULL ? s->ext.ech.outer_hostname : "NONE");
s->ext.ech.former_inner = s->ext.hostname;
@@ -3131,8 +3228,11 @@ MSG_PROCESS_RETURN tls_process_certificate_request(SSL_CONNECTION *s,
/*
* We already sent close_notify. This can only happen in TLSv1.3
* post-handshake messages. We can't reasonably respond to this, so
- * we just ignore it
+ * we just ignore it. The read transition already moved us to
+ * SSL_PHA_REQUESTED; undo that so that the write transition does
+ * not go on to send a Certificate.
*/
+ s->post_handshake_auth = SSL_PHA_EXT_SENT;
return MSG_PROCESS_FINISHED_READING;
}
@@ -4524,7 +4624,7 @@ CON_FUNC_RETURN tls_construct_client_compressed_certificate(SSL_CONNECTION *sc,
if (SSL_IS_FIRST_HANDSHAKE(sc)
&& !SSL_IS_QUIC_HANDSHAKE(sc)
&& (sc->early_data_state != SSL_EARLY_DATA_NONE
- || (sc->options & SSL_OP_ENABLE_MIDDLEBOX_COMPAT) != 0)
+ || SSL_CONNECTION_MIDDLEBOX_IS_ENABLED(sc))
&& (!ssl->method->ssl3_enc->change_cipher_state(sc,
SSL3_CC_HANDSHAKE | SSL3_CHANGE_CIPHER_CLIENT_WRITE | SSL3_CC_COMP_CERT))) {
/*
diff --git a/deps/openssl/openssl/ssl/statem/statem_dtls.c b/deps/openssl/openssl/ssl/statem/statem_dtls.c
index a3023b6704f..89119ad5939 100644
--- a/deps/openssl/openssl/ssl/statem/statem_dtls.c
+++ b/deps/openssl/openssl/ssl/statem/statem_dtls.c
@@ -206,6 +206,19 @@ static int dtls1_write_hm_header(unsigned char *msgheaderstart,
return 1;
}
+/*
+ * Take back the room dtls1_do_write() made for a fragment's header, if any, so
+ * that the message is described again as it was when the fragment was started.
+ * Used whenever the fragment is not accepted, so that the next call makes the
+ * room once rather than adding to it.
+ */
+static void dtls1_undo_fragment_header_room(SSL_CONNECTION *s, size_t *room)
+{
+ s->init_off += *room;
+ s->init_num -= *room;
+ *room = 0;
+}
+
/*
* send s->init_buf in records of type 'type' (SSL3_RT_HANDSHAKE,
* SSL3_RT_CHANGE_CIPHER_SPEC or SSL3_RT_ACK)
@@ -231,6 +244,8 @@ int dtls1_do_write(SSL_CONNECTION *s, uint8_t recordtype)
SSL *ssl = SSL_CONNECTION_GET_SSL(s);
SSL *ussl = SSL_CONNECTION_GET_USER_SSL(s);
uint8_t saved_payload[DTLS1_HM_HEADER_LENGTH];
+ /* Room made in front of the current fragment for its header, if any */
+ size_t header_room = 0;
/* msg_len, msg_seq, msg_type are only used for recordtype == SSL3_RT_HANDSHAKE */
const size_t msg_len = s->d1->w_msg.msg_body_len;
const unsigned short msg_seq = s->d1->w_msg.msg_seq;
@@ -281,6 +296,7 @@ int dtls1_do_write(SSL_CONNECTION *s, uint8_t recordtype)
*/
s->init_off -= DTLS1_HM_HEADER_LENGTH;
s->init_num += DTLS1_HM_HEADER_LENGTH;
+ header_room = DTLS1_HM_HEADER_LENGTH;
}
used_len = BIO_wpending(s->wbio) + overhead;
@@ -296,13 +312,14 @@ int dtls1_do_write(SSL_CONNECTION *s, uint8_t recordtype)
ret = BIO_flush(s->wbio);
if (ret <= 0) {
s->rwstate = SSL_WRITING;
- return ret;
+ goto err;
}
if (s->d1->mtu >= overhead + min_len) {
curr_mtu = s->d1->mtu - overhead;
} else {
/* Shouldn't happen */
- return -1;
+ ret = -1;
+ goto err;
}
}
@@ -348,12 +365,14 @@ int dtls1_do_write(SSL_CONNECTION *s, uint8_t recordtype)
if (len < DTLS1_HM_HEADER_LENGTH
|| !dtls1_write_hm_header(msgstart, msg_type, msg_len,
- msg_seq, fragoff, fraglen))
+ msg_seq, fragoff, fraglen)) {
/*
* len is so small that we really can't do anything sensible
* so fail
*/
- return -1;
+ ret = -1;
+ goto err;
+ }
/*
* Recorded so do_dtls1_write() (rec_layer_d1.c) can tag this
@@ -376,21 +395,33 @@ int dtls1_do_write(SSL_CONNECTION *s, uint8_t recordtype)
* retransmit anything. continue as if everything is fine and
* wait for an alert to handle the retransmit
*/
+ ret = -1;
if (retry && BIO_ctrl(SSL_get_wbio(ssl), BIO_CTRL_DGRAM_MTU_EXCEEDED, 0, NULL) > 0
- && !(SSL_get_options(ssl) & SSL_OP_NO_QUERY_MTU)
- && dtls1_query_mtu(s))
- /* Have one more go */
+ && !(SSL_get_options(ssl) & SSL_OP_NO_QUERY_MTU)) {
+ if (!dtls1_query_mtu(s))
+ goto err;
+ /*
+ * Have one more go. The fragment was not written, so take back
+ * the room for its header. Going round again makes it once more.
+ */
+ dtls1_undo_fragment_header_room(s, &header_room);
retry = 0;
- else
- return -1;
+ } else {
+ goto err;
+ }
} else {
/*
* bad if this assert fails, only part of the handshake message
* got sent. but why would this happen?
*/
- if (!ossl_assert(len == written))
- return -1;
+ if (!ossl_assert(len == written)) {
+ ret = -1;
+ goto err;
+ }
+
+ /* The fragment, header included, has been accepted */
+ header_room = 0;
/*
* We should not exceed the MTU size. If compression is in use
@@ -465,6 +496,11 @@ int dtls1_do_write(SSL_CONNECTION *s, uint8_t recordtype)
}
}
return 0;
+
+err:
+ /* The fragment was not written, so don't leave the room for its header made */
+ dtls1_undo_fragment_header_room(s, &header_room);
+ return ret;
}
int dtls_get_message(SSL_CONNECTION *s, int *mt)
@@ -498,8 +534,11 @@ again:
return 1;
/* reconstruct message header */
- dtls1_write_hm_header(rec_data, s->s3.tmp.message_type, s->s3.tmp.message_size,
- s->d1->r_msg_seq, 0, s->s3.tmp.message_size);
+ if (!dtls1_write_hm_header(rec_data, s->s3.tmp.message_type, s->s3.tmp.message_size,
+ s->d1->r_msg_seq, 0, s->s3.tmp.message_size)) {
+ SSLfatal(s, SSL_AD_INTERNAL_ERROR, ERR_R_INTERNAL_ERROR);
+ return 0;
+ }
s->d1->r_msg_seq = 0;
@@ -757,6 +796,30 @@ static int dtls1_retrieve_buffered_fragment(SSL_CONNECTION *s, size_t *len)
}
}
+/*
+ * Whether a fully-received message is already sitting in the reassembly
+ * buffer for the next sequence number we expect, independently of any new
+ * record having just arrived on the wire. dtls1_retrieve_buffered_fragment()
+ * checks this unconditionally on every entry into the read state machine,
+ * but that entry only ever happens as a side effect of a *new*
+ * SSL3_RT_HANDSHAKE/SSL3_RT_ACK record arriving (see dtls1_read_bytes()'s
+ * trampoline) or of a message we just processed ourselves bringing us back
+ * here. Callers use this to decide whether to keep looping instead of
+ * going idle, so a message that arrived out of order and was buffered
+ * ahead of something still missing is not left stranded once that
+ * something finally arrives and is processed in the same call.
+ */
+int dtls1_has_buffered_ready_message(SSL_CONNECTION *s)
+{
+ pitem *item = pqueue_find_u64(&s->d1->rcvd_messages, s->d1->handshake_read_seq);
+ hm_fragment *frag;
+
+ if (item == NULL)
+ return 0;
+ frag = (hm_fragment *)item->data;
+ return frag->reassembly == NULL;
+}
+
static int dtls1_reassemble_fragment(SSL_CONNECTION *s,
const struct hm_header_st *msg_hdr)
{
@@ -873,6 +936,19 @@ int dtls_record_from_retained_epoch(SSL_CONNECTION *s)
&& s->s3.tmp.record_epoch != dtls1_get_epoch(s, SSL3_CC_READ);
}
+/*
+ * Server read states where an ACK must not finish the client's flight.
+ * The certificate states are also used during post-handshake authentication.
+ * Callers admitting ACKs must exclude a pending HelloRetryRequest.
+ */
+int dtls13_server_waiting_for_client_flight(OSSL_HANDSHAKE_STATE state)
+{
+ return state == TLS_ST_EARLY_DATA
+ || state == TLS_ST_SR_CERT
+ || state == TLS_ST_SR_COMP_CERT
+ || state == TLS_ST_SR_CERT_VRFY;
+}
+
int dtls1_process_out_of_seq_message(SSL_CONNECTION *s,
const struct hm_header_st *msg_hdr)
{
@@ -1376,6 +1452,65 @@ CON_FUNC_RETURN dtls_construct_ack(SSL_CONNECTION *s, WPACKET *pkt)
return CON_FUNC_SUCCESS;
}
+/*
+ * If our own KeyUpdate is still awaiting installation of its new write
+ * keys, check whether it -- and everything sent before it -- is now
+ * acknowledged, and install the deferred write key if so. A peer can ACK a
+ * buffered message before it has actually processed the messages that
+ * precede it (rfc9147 section 7), so an ACK of the KeyUpdate itself does
+ * not establish that the peer has processed everything sent before it and
+ * installed the corresponding read keys. Erratum 8047 therefore requires
+ * waiting for every preceding message to be acknowledged too, not just the
+ * KeyUpdate -- a message sent *after* the KeyUpdate (e.g. a ticket) is
+ * unaffected and may remain outstanding.
+ *
+ * This deliberately does not search sent_messages for the KeyUpdate's own
+ * entry: key_update_acked, latched by dtls_process_ack() the instant
+ * coverage of that message completes, already captures whether it is
+ * acknowledged, and key_update_msg_seq -- the handshake message sequence
+ * number captured when it was sent -- identifies which other queued
+ * entries precede it, without depending on its own entry still being in
+ * the queue to do so. That matters because this is called from more than
+ * one place: not just from dtls_process_ack() when an ACK record arrives,
+ * but also from dtls1_stop_timer_for_read_flight(), since a preceding
+ * CertificateRequest can instead be retired implicitly (rfc9147 7.2) by
+ * the next flight, with no ACK record of its own ever involved.
+ *
+ * Returns 0 only on a fatal error installing the key (SSLfatal() already
+ * called); 1 otherwise, including when there was nothing to do.
+ */
+int dtls1_check_deferred_write_key(SSL_CONNECTION *s)
+{
+ pitem *item;
+ piterator iter;
+ int preceding_unacked = 0;
+
+ if (!s->d1->key_update_write_pending || !s->d1->key_update_acked)
+ return 1;
+
+ iter = pqueue_iterator(&s->d1->sent_messages);
+ while ((item = pqueue_next(&iter)) != NULL) {
+ dtls_sent_msg *msg = (dtls_sent_msg *)item->data;
+
+ if (msg->msg_info.msg_seq < s->d1->key_update_msg_seq
+ && !ossl_list_record_number_is_empty(&msg->rec_nums)) {
+ preceding_unacked = 1;
+ break;
+ }
+ }
+
+ if (!preceding_unacked) {
+ s->d1->key_update_write_pending = 0;
+ s->d1->key_update_acked = 0;
+ if (!tls13_update_key(s, 1)) {
+ /* SSLfatal() already called */
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
MSG_PROCESS_RETURN dtls_process_ack(SSL_CONNECTION *s, PACKET *pkt)
{
PACKET record_numbers;
@@ -1406,6 +1541,16 @@ MSG_PROCESS_RETURN dtls_process_ack(SSL_CONNECTION *s, PACKET *pkt)
return MSG_PROCESS_ERROR;
}
+ /*
+ * RFC 9147 section 7: during the initial handshake, an ACK must be
+ * carried in an epoch at least as high as the record it acknowledges.
+ * Ignore unauthorized entries before changing retransmission state.
+ * After the handshake, sending and receiving epochs can differ.
+ */
+ if (SSL_IS_FIRST_HANDSHAKE(s)
+ && epoch > s->s3.tmp.record_epoch)
+ continue;
+
/*
* Epoch 2 is the fixed handshake epoch and is never used again once
* epoch 3 (the first application epoch) is installed. An ACK that
@@ -1471,16 +1616,51 @@ MSG_PROCESS_RETURN dtls_process_ack(SSL_CONNECTION *s, PACKET *pkt)
RSMBLY_BITMASK_IS_COMPLETE(msg->covered,
(long)msg->msg_info.msg_body_len, is_complete);
- if (is_complete)
+ if (is_complete) {
ossl_list_record_number_elem_free(&msg->rec_nums);
+ /*
+ * Latch this immediately, rather than re-discovering it
+ * later by searching sent_messages for the entry: once
+ * fully acknowledged, this entry is eligible to be freed
+ * by dtls1_clear_sent_buffer() at any later, unrelated
+ * point (e.g. when the peer's own KeyUpdate is
+ * processed), so its continued presence in the queue
+ * cannot be relied on below.
+ */
+ if (msg->msg_info.msg_type == SSL3_MT_KEY_UPDATE)
+ s->d1->key_update_acked = 1;
+ }
}
}
}
+ if (!dtls1_check_deferred_write_key(s))
+ return MSG_PROCESS_ERROR;
+
/* Keep the retransmit timer running until the whole flight is ACKed. */
if (dtls_any_sent_messages_are_missing_acknowledge(s))
return MSG_PROCESS_CONTINUE_READING;
+ /*
+ * This ACK interrupted a server still reading the client's flight.
+ * A complete ACK of our flight does not replace the remaining client
+ * messages. It may arrive before Certificate or be reordered after
+ * Certificate or CertificateVerify. Finishing the read sub-state-machine
+ * here would let write_transition() move to TLS_ST_OK and skip them.
+ */
+ if (s->server
+ && dtls13_server_waiting_for_client_flight(s->statem.pre_ack_hand_state)) {
+ /*
+ * We already know above that nothing is left needing
+ * retransmission, so this only resets timeout state and clears the
+ * (already-empty) sent buffer -- it leaves the read state alone, so
+ * the client's flight, including Finished, is still processed on
+ * return.
+ */
+ dtls1_stop_timer(s);
+ return MSG_PROCESS_CONTINUE_READING;
+ }
+
return MSG_PROCESS_FINISHED_READING;
}
@@ -1695,6 +1875,24 @@ int dtls1_retransmit_message(SSL_CONNECTION *s, dtls_sent_msg *sent_msg)
ret = dtls1_do_write(s, sent_msg->msg_info.record_type);
+ /*
+ * If the message was retransmitted through a write record layer that is
+ * no longer the current one, the retransmission used up record sequence
+ * numbers that the current layer does not know about. This only matters
+ * for a ClientHello: it is retransmitted through the epoch 0 layer after
+ * the client has switched to the early data layer, and a ClientHello sent
+ * after a HelloRetryRequest must not reuse any of those sequence numbers.
+ * Keep the saved epoch 0 sequence number up to date for that case.
+ */
+ if (s->rlayer.wrl != saved_state.wrl) {
+ uint64_t epoch, seq;
+
+ if (s->rlayer.wrlmethod->get_epoch(s->rlayer.wrl, &epoch) == 1
+ && epoch == 0
+ && s->rlayer.wrlmethod->get_sequence(s->rlayer.wrl, &seq) == 1)
+ s->rlayer.wlayer_epoch_zero_sequence = seq;
+ }
+
/* restore current state */
s->rlayer.wrlmethod = saved_state.wrlmethod;
s->rlayer.wrl = saved_state.wrl;
diff --git a/deps/openssl/openssl/ssl/statem/statem_lib.c b/deps/openssl/openssl/ssl/statem/statem_lib.c
index 55ce0a48251..e951dc7901a 100644
--- a/deps/openssl/openssl/ssl/statem/statem_lib.c
+++ b/deps/openssl/openssl/ssl/statem/statem_lib.c
@@ -728,9 +728,18 @@ MSG_PROCESS_RETURN tls_process_key_update(SSL_CONNECTION *s, PACKET *pkt)
* If we get a request for us to update our sending keys too then, we need
* to additionally send a KeyUpdate message. However that message should
* not also request an update (otherwise we get into an infinite loop).
+ * For DTLS1.3 specifically, this doesn't go through the public
+ * SSL_key_update() API, so it has to set in_init itself: without it,
+ * nothing tells a later SSL_write()/SSL_do_handshake() call to
+ * re-enter the state machine and notice key_update is no longer
+ * SSL_KEY_UPDATE_NONE, and the scheduled KeyUpdate would never
+ * actually get sent.
*/
- if (updatetype == SSL_KEY_UPDATE_REQUESTED)
+ if (updatetype == SSL_KEY_UPDATE_REQUESTED) {
s->key_update = SSL_KEY_UPDATE_NOT_REQUESTED;
+ if (SSL_CONNECTION_IS_DTLS13(s))
+ ossl_statem_set_in_init(s, 1);
+ }
if (!tls13_update_key(s, 0)) {
/* SSLfatal() already called */
@@ -1532,8 +1541,17 @@ WORK_STATE tls_finish_handshake(SSL_CONNECTION *s, ossl_unused WORK_STATE wst,
else if (sctx->info_callback != NULL)
cb = sctx->info_callback;
- /* The callback may expect us to not be in init at handshake done */
- ossl_statem_set_in_init(s, 0);
+ /*
+ * The callback may expect us to not be in init at handshake done --
+ * but not for DTLS1.3 if a KeyUpdate is still scheduled and hasn't
+ * been constructed yet (e.g. a reciprocal one scheduled by
+ * tls_process_key_update() while processing the very message whose
+ * completion brought us here): clearing in_init here would mean
+ * nothing ever tells a later SSL_write()/SSL_do_handshake() call to
+ * re-enter the state machine and actually send it.
+ */
+ if (!SSL_CONNECTION_IS_DTLS13(s) || s->key_update == SSL_KEY_UPDATE_NONE)
+ ossl_statem_set_in_init(s, 0);
if (cb != NULL) {
if (cleanuphand
diff --git a/deps/openssl/openssl/ssl/statem/statem_local.h b/deps/openssl/openssl/ssl/statem/statem_local.h
index 744518d89f9..0394dfd679b 100644
--- a/deps/openssl/openssl/ssl/statem/statem_local.h
+++ b/deps/openssl/openssl/ssl/statem/statem_local.h
@@ -129,6 +129,7 @@ __owur int tls_get_message_body(SSL_CONNECTION *s, size_t *len);
__owur int dtls_get_message(SSL_CONNECTION *s, int *mt);
__owur int dtls_get_message_body(SSL_CONNECTION *s, size_t *len);
int dtls_record_from_retained_epoch(SSL_CONNECTION *s);
+int dtls13_server_waiting_for_client_flight(OSSL_HANDSHAKE_STATE state);
int dtls1_process_out_of_seq_message(SSL_CONNECTION *s,
const struct hm_header_st *msg_hdr);
__owur int tls_common_finish_mac(SSL_CONNECTION *s);
diff --git a/deps/openssl/openssl/ssl/statem/statem_srvr.c b/deps/openssl/openssl/ssl/statem/statem_srvr.c
index 2dd48dfa353..30187169c57 100644
--- a/deps/openssl/openssl/ssl/statem/statem_srvr.c
+++ b/deps/openssl/openssl/ssl/statem/statem_srvr.c
@@ -81,6 +81,19 @@ static int ossl_statem_server13_read_transition(SSL_CONNECTION *s, int mt)
return 1;
}
+ /*
+ * An ACK may arrive before or between messages of the client's flight.
+ * Preserve the interrupted read state so CertificateVerify and Finished
+ * are still required, even if the ACK covers our entire flight.
+ */
+ if (SSL_CONNECTION_IS_DTLS13(s) && mt == DTLS13_MT_ACK
+ && s->hello_retry_request != SSL_HRR_PENDING
+ && dtls13_server_waiting_for_client_flight(st->hand_state)) {
+ st->pre_ack_hand_state = st->hand_state;
+ st->hand_state = TLS_ST_SR_ACK;
+ return 1;
+ }
+
/*
* Note: There is no case for TLS_ST_BEFORE because at that stage we have
* not negotiated TLSv1.3 yet, so that case is handled by
@@ -140,6 +153,19 @@ static int ossl_statem_server13_read_transition(SSL_CONNECTION *s, int mt)
case TLS_ST_SR_COMP_CERT:
case TLS_ST_SR_CERT:
+ /*
+ * DTLS 1.3 only. A PHA response being read here can straddle our
+ * own still-unacknowledged KeyUpdate: datagram reordering can
+ * deliver that KeyUpdate's ACK in between the client's Certificate
+ * and its Finished. Accept it and resume this same read afterward,
+ * restored by the TLS_ST_SR_ACK handling at the top of this
+ * function.
+ */
+ if (mt == DTLS13_MT_ACK) {
+ st->pre_ack_hand_state = st->hand_state;
+ st->hand_state = TLS_ST_SR_ACK;
+ return 1;
+ }
if (st->no_cert_verify || !received_client_cert(s)) {
if (mt == SSL3_MT_FINISHED) {
st->hand_state = TLS_ST_SR_FINISHED;
@@ -154,6 +180,19 @@ static int ossl_statem_server13_read_transition(SSL_CONNECTION *s, int mt)
break;
case TLS_ST_SR_CERT_VRFY:
+ /*
+ * DTLS 1.3 only. A PHA response being read here can straddle our
+ * own still-unacknowledged KeyUpdate: datagram reordering can
+ * deliver that KeyUpdate's ACK in between the client's
+ * CertificateVerify and its Finished. Accept it and resume this
+ * same read afterward, restored by the TLS_ST_SR_ACK handling at
+ * the top of this function.
+ */
+ if (mt == DTLS13_MT_ACK) {
+ st->pre_ack_hand_state = st->hand_state;
+ st->hand_state = TLS_ST_SR_ACK;
+ return 1;
+ }
if (mt == SSL3_MT_FINISHED) {
st->hand_state = TLS_ST_SR_FINISHED;
return 1;
@@ -167,6 +206,32 @@ static int ossl_statem_server13_read_transition(SSL_CONNECTION *s, int mt)
st->hand_state = TLS_ST_SR_ACK;
return 1;
}
+ /*
+ * DTLS 1.3 only. Our own KeyUpdate being outstanding does not stop
+ * the peer from independently sending a KeyUpdate of its own, or
+ * answering a CertificateRequest we already sent: these are
+ * separate reliability state machines (rfc9147 5.8.4) and must be
+ * accepted the same as if we were at TLS_ST_OK.
+ */
+ if (SSL_CONNECTION_IS_DTLS13(s) && st->hand_state == TLS_ST_SW_KEY_UPDATE) {
+ if (s->post_handshake_auth == SSL_PHA_REQUESTED) {
+ if (mt == SSL3_MT_CERTIFICATE) {
+ st->hand_state = TLS_ST_SR_CERT;
+ return 1;
+ }
+#ifndef OPENSSL_NO_COMP_ALG
+ if (mt == SSL3_MT_COMPRESSED_CERTIFICATE
+ && s->ext.compress_certificate_sent) {
+ st->hand_state = TLS_ST_SR_COMP_CERT;
+ return 1;
+ }
+#endif
+ }
+ if (mt == SSL3_MT_KEY_UPDATE) {
+ st->hand_state = TLS_ST_SR_KEY_UPDATE;
+ return 1;
+ }
+ }
break;
case TLS_ST_OK:
@@ -620,6 +685,39 @@ static WRITE_TRAN ossl_statem_server13_write_transition(SSL_CONNECTION *s)
return WRITE_TRAN_CONTINUE;
}
+ /*
+ * Resume a write we held back waiting on our own KeyUpdate.
+ * deferred_key_update_state holds the real continuation (e.g.
+ * TLS_ST_SW_SESSION_TICKET or TLS_ST_OK), not TLS_ST_SW_ACK itself, and
+ * is copied into deferred_ack_state only here, right before the
+ * TLS_ST_SW_ACK case below consumes it -- deferred_ack_state is also
+ * used by the ack_for_retransmit handling above, which can fire any
+ * number of times while this wait is still in progress, so the
+ * continuation is kept in the field that handling never touches until
+ * the moment it's actually needed.
+ *
+ * What it waits on before resuming depends on which continuation that
+ * is, matching whichever of the two TLS_ST_SR_FINISHED branches below
+ * deferred it: a parked TLS_ST_SW_SESSION_TICKET continuation needs the
+ * real write-key install to have completed (key_update_write_pending),
+ * since issuing that ticket bypasses the public SSL_new_session_ticket()
+ * API's own guard; a parked plain TLS_ST_OK continuation only needs our
+ * KeyUpdate's own ACK (dtls_has_unacked_key_update()), since going idle
+ * sends nothing by itself and every public entry point that could
+ * schedule something new from idle already refuses to while
+ * key_update_write_pending is set -- waiting for the full install there
+ * too would just delay ordinary application data for no reason.
+ */
+ if (st->deferred_key_update_state != TLS_ST_BEFORE
+ && (st->deferred_key_update_state == TLS_ST_SW_SESSION_TICKET
+ ? !s->d1->key_update_write_pending
+ : !dtls_has_unacked_key_update(s))) {
+ st->deferred_ack_state = st->deferred_key_update_state;
+ st->deferred_key_update_state = TLS_ST_BEFORE;
+ st->hand_state = TLS_ST_SW_ACK;
+ return WRITE_TRAN_CONTINUE;
+ }
+
/*
* No case for TLS_ST_BEFORE, because at that stage we have not negotiated
* TLSv1.3 yet, so that is handled by ossl_statem_server_write_transition()
@@ -634,6 +732,15 @@ static WRITE_TRAN ossl_statem_server13_write_transition(SSL_CONNECTION *s)
case TLS_ST_OK:
if (s->key_update != SSL_KEY_UPDATE_NONE) {
st->hand_state = TLS_ST_SW_KEY_UPDATE;
+ /*
+ * A reply owed to the peer's KeyUpdate is built here without
+ * going through a public API, so nothing else has checked that
+ * our own KeyUpdate's write-key install is still pending.
+ * Building another KeyUpdate now would reset that install. Wait
+ * in TLS_ST_SW_KEY_UPDATE, which resumes here once it completes.
+ */
+ if (SSL_CONNECTION_IS_DTLS13(s) && s->d1->key_update_write_pending)
+ return WRITE_TRAN_FINISHED;
return WRITE_TRAN_CONTINUE;
}
if (s->post_handshake_auth == SSL_PHA_REQUEST_PENDING) {
@@ -724,6 +831,29 @@ static WRITE_TRAN ossl_statem_server13_write_transition(SSL_CONNECTION *s)
*/
if (SSL_CONNECTION_IS_DTLS13(s)) {
st->deferred_ack_state = TLS_ST_OK;
+ if (dtls_has_unacked_key_update(s)) {
+ /*
+ * Going idle sends nothing by itself, and
+ * SSL_new_session_ticket(), SSL_verify_client_post_handshake(),
+ * and SSL_key_update() each already refuse to schedule
+ * anything new while key_update_write_pending is set
+ * (test_dtls13_pha_completion_eviction_blocks_new_actions()).
+ * So this only needs our own KeyUpdate's ACK, not the
+ * full write-key install -- key_update_write_pending can
+ * stay set well after that ACK, behind some unrelated
+ * predecessor, and would otherwise delay ordinary
+ * application data for no reason.
+ * Hold this ACK back rather than send it now. The
+ * continuation (TLS_ST_OK) is saved in
+ * deferred_key_update_state, not this TLS_ST_SR_FINISHED
+ * state: re-entering TLS_ST_SR_FINISHED on resume would
+ * rerun this whole case against post_handshake_auth/
+ * ticket_expected state that may have since changed.
+ */
+ st->deferred_key_update_state = TLS_ST_OK;
+ st->hand_state = TLS_ST_SW_KEY_UPDATE;
+ return WRITE_TRAN_FINISHED;
+ }
st->hand_state = TLS_ST_SW_ACK;
} else {
st->hand_state = TLS_ST_OK;
@@ -772,6 +902,43 @@ static WRITE_TRAN ossl_statem_server13_write_transition(SSL_CONNECTION *s)
if (SSL_CONNECTION_IS_DTLS13(s)) {
st->deferred_ack_state = next_state;
+ /*
+ * next_state can be TLS_ST_SW_SESSION_TICKET or, if a ticket
+ * was expected but then suppressed above, plain TLS_ST_OK --
+ * and only the former actually needs to wait for our own
+ * KeyUpdate's write-key install. The automatic ticket reissue
+ * built here bypasses the public SSL_new_session_ticket() API
+ * guard entirely, so key_update_write_pending has to be
+ * enforced on this path directly: RFC 9147 section 8's new
+ * keys must not be used for anything else until the install
+ * completes, and key_update_write_pending -- not
+ * dtls_has_unacked_key_update() -- is what tracks that, since
+ * an earlier unrelated message (e.g. a prior ticket) can hold
+ * the install back even after the KeyUpdate itself is
+ * acknowledged. When next_state is plain TLS_ST_OK instead,
+ * this falls back to the same dtls_has_unacked_key_update()
+ * check as the no-ticket-expected branch above, for the same
+ * reason: going idle alone sends nothing, and every public API
+ * entry point that could schedule something new from idle
+ * already refuses to while key_update_write_pending is set.
+ */
+ if (next_state == TLS_ST_SW_SESSION_TICKET
+ ? s->d1->key_update_write_pending != 0
+ : dtls_has_unacked_key_update(s)) {
+ /*
+ * Hold this ACK back rather than send it now. The real
+ * continuation (next_state) is saved in
+ * deferred_key_update_state, not this TLS_ST_SR_FINISHED
+ * state: re-entering TLS_ST_SR_FINISHED on resume would
+ * rerun this whole case, and post_handshake_auth has by
+ * then moved past SSL_PHA_REQUESTED, so the
+ * ticket-suppressing branch above would compute the wrong
+ * continuation.
+ */
+ st->deferred_key_update_state = next_state;
+ st->hand_state = TLS_ST_SW_KEY_UPDATE;
+ return WRITE_TRAN_FINISHED;
+ }
st->hand_state = TLS_ST_SW_ACK;
} else {
st->hand_state = next_state;
@@ -780,17 +947,44 @@ static WRITE_TRAN ossl_statem_server13_write_transition(SSL_CONNECTION *s)
case TLS_ST_SR_KEY_UPDATE:
if (SSL_CONNECTION_IS_DTLS13(s)) {
- st->deferred_ack_state = TLS_ST_OK;
+ /*
+ * RFC 9147 section 8's restriction is on using the new
+ * epoch's keys, not on sending at all. Our own KeyUpdate's
+ * write keys are not installed until its ACK arrives (see
+ * dtls_process_ack()), so this ACK can safely go out under
+ * our current, still-valid keys even while our own
+ * KeyUpdate is outstanding. If its write-key install hasn't
+ * completed yet, go back to waiting rather than reporting
+ * the connection idle: key_update_write_pending, not
+ * dtls_has_unacked_key_update(), is what tracks that -- the
+ * KeyUpdate can already be acknowledged while its install is
+ * still withheld behind an earlier, unrelated message, and
+ * reporting idle in that window would admit new
+ * post-handshake content under the old keys.
+ */
+ st->deferred_ack_state = s->d1->key_update_write_pending
+ ? TLS_ST_SW_KEY_UPDATE
+ : TLS_ST_OK;
st->hand_state = TLS_ST_SW_ACK;
return WRITE_TRAN_CONTINUE;
}
/* Fall through */
case TLS_ST_SW_KEY_UPDATE:
- if (SSL_CONNECTION_IS_DTLS13(s))
+ /*
+ * Parked here waiting for our own KeyUpdate's write-key install,
+ * which can complete as a side effect of acknowledging some
+ * entirely unrelated message (e.g. a retransmitted ticket) --
+ * nothing re-enters this function for that on its own, so this
+ * case has to notice it the next time it's reached instead of
+ * assuming key_update_write_pending is still set just because
+ * hand_state hasn't moved. Otherwise anything scheduled behind
+ * it (TLS_ST_OK's own key_update check below) would stay stuck
+ * here indefinitely once the install genuinely finishes.
+ */
+ if (SSL_CONNECTION_IS_DTLS13(s) && s->d1->key_update_write_pending)
/* We wait for ACK */
return WRITE_TRAN_FINISHED;
- else
- st->hand_state = TLS_ST_OK;
+ st->hand_state = TLS_ST_OK;
return WRITE_TRAN_CONTINUE;
case TLS_ST_SW_SESSION_TICKET:
@@ -820,6 +1014,15 @@ static WRITE_TRAN ossl_statem_server13_write_transition(SSL_CONNECTION *s)
st->ack_for_retransmit = 0;
return WRITE_TRAN_FINISHED;
}
+ if (st->hand_state == TLS_ST_SW_KEY_UPDATE) {
+ /*
+ * We are only here to resume waiting for our own KeyUpdate's
+ * ACK (see the TLS_ST_SR_KEY_UPDATE and TLS_ST_SR_FINISHED
+ * cases above) -- it was already sent, so this must not
+ * trigger constructing another one.
+ */
+ return WRITE_TRAN_FINISHED;
+ }
return WRITE_TRAN_CONTINUE;
}
@@ -1111,6 +1314,15 @@ WORK_STATE ossl_statem_server_pre_work(SSL_CONNECTION *s, WORK_STATE wst)
/* Fall through */
case TLS_ST_OK:
+ /*
+ * A message that arrived out of order may already be sitting fully
+ * received in the reassembly buffer, waiting on something earlier
+ * that we just finished processing in this same call. Loop back
+ * into reading instead of going idle, rather than stranding it
+ * until some unrelated new record happens to arrive later.
+ */
+ if (SSL_CONNECTION_IS_DTLS13(s) && dtls1_has_buffered_ready_message(s))
+ return WORK_FINISHED_SWAP;
/* Calls SSLfatal() as required */
return tls_finish_handshake(s, wst, 1, 1);
}
@@ -1333,7 +1545,17 @@ WORK_STATE ossl_statem_server_post_work(SSL_CONNECTION *s, WORK_STATE wst)
case TLS_ST_SW_KEY_UPDATE:
if (statem_flush(s) != 1)
return WORK_MORE_A;
- if (!tls13_update_key(s, 1)) {
+ if (SSL_CONNECTION_IS_DTLS13(s)) {
+ /*
+ * RFC 9147 section 8: don't switch to the new write keys
+ * until this KeyUpdate has been acknowledged; keep using
+ * the current, still-valid keys until then. Installed from
+ * dtls_process_ack() once the ACK arrives.
+ */
+ s->d1->key_update_write_pending = 1;
+ s->d1->key_update_acked = 0;
+ s->d1->key_update_msg_seq = s->d1->w_msg.msg_seq;
+ } else if (!tls13_update_key(s, 1)) {
/* SSLfatal() already called */
return WORK_ERROR;
}
@@ -1819,8 +2041,13 @@ MSG_PROCESS_RETURN tls_process_client_hello(SSL_CONNECTION *s, PACKET *pkt)
* so we need to tee that up. The result of that calculation will be put in
* the ServerHello.random (or ECH extension if HRR) to signal to the client
* that ECH "worked."
+ * ECH is TLSv1.3 only, so none of this applies to a renegotiation, which
+ * we might yet refuse below. We don't support ECH with DTLS, and
+ * ossl_ech_get_ch_offsets() would misparse a DTLS ClientHello, as it
+ * doesn't know about the cookie.
*/
- if (s->server && PACKET_remaining(pkt) != 0) {
+ if (s->server && !SSL_CONNECTION_IS_DTLS(s) && SSL_IS_FIRST_HANDSHAKE(s)
+ && PACKET_remaining(pkt) != 0) {
int rv = 0, innerflag = OSSL_ECH_UNKNOWN_CH_TYPE;
size_t startofsessid = 0, startofexts = 0, echoffset = 0;
size_t outersnioffset = 0; /* offset to SNI in outer */
@@ -1829,6 +2056,15 @@ MSG_PROCESS_RETURN tls_process_client_hello(SSL_CONNECTION *s, PACKET *pkt)
/* reset needed in case of HRR */
s->ext.ech.ch_offsets_done = 0;
+ /*
+ * Only a ClientHello answering our HRR continues the inner transcript,
+ * any other starts it afresh.
+ */
+ if (s->hello_retry_request != SSL_HRR_PENDING) {
+ OPENSSL_free(s->ext.ech.transbuf);
+ s->ext.ech.transbuf = NULL;
+ s->ext.ech.transbuf_len = 0;
+ }
rv = ossl_ech_get_ch_offsets(s, pkt, &startofsessid, &startofexts,
&echoffset, &echtype, &innerflag,
&outersnioffset);
@@ -1844,6 +2080,7 @@ MSG_PROCESS_RETURN tls_process_client_hello(SSL_CONNECTION *s, PACKET *pkt)
s->ext.ech.backend = 1;
s->ext.ech.attempted_type = TLSEXT_TYPE_ech;
OPENSSL_free(s->ext.ech.innerch);
+ s->ext.ech.innerch = NULL;
s->ext.ech.innerch_len = PACKET_remaining(pkt);
if (PACKET_peek_bytes(pkt, &pbuf, s->ext.ech.innerch_len) != 1) {
SSLfatal(s, SSL_AD_INTERNAL_ERROR, ERR_R_INTERNAL_ERROR);
@@ -2102,6 +2339,38 @@ static int tls_early_post_process_client_hello(SSL_CONNECTION *s)
}
}
+ /*
+ * The callback may have switched to an SSL_CTX with a different set of
+ * custom extensions, possibly in an earlier call that returned
+ * SSL_CLIENT_HELLO_RETRY. The collected extensions are indexed by the
+ * custom extensions in use when they were collected, so collect them
+ * again unless neither set has any.
+ */
+ if (clienthello->pre_proc_exts_len != TLSEXT_IDX_num_builtins
+ || s->cert->custext.meths_count != 0) {
+ PACKET extensions = clienthello->extensions;
+ void (*debug_cb)(SSL *, int, int, const unsigned char *, int, void *)
+ = s->ext.debug_cb;
+ int ret;
+
+ OPENSSL_free(clienthello->pre_proc_exts);
+ clienthello->pre_proc_exts = NULL;
+ clienthello->pre_proc_exts_len = 0;
+ /*
+ * The first collection has already initialised the built-in
+ * extensions and passed the extensions to the debug callback.
+ */
+ s->ext.debug_cb = NULL;
+ ret = tls_collect_extensions(s, &extensions, SSL_EXT_CLIENT_HELLO,
+ &clienthello->pre_proc_exts,
+ &clienthello->pre_proc_exts_len, 0);
+ s->ext.debug_cb = debug_cb;
+ if (!ret) {
+ /* SSLfatal already been called */
+ goto err;
+ }
+ }
+
/* Set up the client_random */
memcpy(s->s3.client_random, clienthello->random, SSL3_RANDOM_SIZE);
@@ -2225,6 +2494,22 @@ static int tls_early_post_process_client_hello(SSL_CONNECTION *s)
goto err;
}
+ if (SSL_CONNECTION_IS_VERSION13(s)) {
+ memcpy(s->tmp_session_id, s->clienthello->session_id,
+ s->clienthello->session_id_len);
+ s->tmp_session_id_len = s->clienthello->session_id_len;
+
+ /*
+ * A stateless server reconstructs the transcript from the cookie,
+ * which must happen before the PSK binder is verified.
+ */
+ if (!tls_parse_extension(s, TLSEXT_IDX_cookie, SSL_EXT_CLIENT_HELLO,
+ clienthello->pre_proc_exts, NULL, 0)) {
+ /* SSLfatal() already called */
+ goto err;
+ }
+ }
+
/*
* We don't allow resumption in a backwards compatible ClientHello.
* In TLS1.1+, session_id MUST be empty.
@@ -2263,12 +2548,6 @@ static int tls_early_post_process_client_hello(SSL_CONNECTION *s)
}
}
- if (SSL_CONNECTION_IS_VERSION13(s)) {
- memcpy(s->tmp_session_id, s->clienthello->session_id,
- s->clienthello->session_id_len);
- s->tmp_session_id_len = s->clienthello->session_id_len;
- }
-
/*
* If it is a hit, check that the cipher is in the list. In TLSv1.3 we check
* ciphersuite compatibility with the session as part of resumption.
diff --git a/deps/openssl/openssl/ssl/t1_lib.c b/deps/openssl/openssl/ssl/t1_lib.c
index e9575fdfe60..64a095c686a 100644
--- a/deps/openssl/openssl/ssl/t1_lib.c
+++ b/deps/openssl/openssl/ssl/t1_lib.c
@@ -219,6 +219,14 @@ static const uint16_t suiteb_curves[] = {
OSSL_TLS_GROUP_ID_secp384r1,
};
+/*
+ * Group tuples matching the Suite B group lists returned by
+ * tls1_get_supported_groups(): a single tuple holding both P-256 and P-384,
+ * or a single tuple holding just one of them.
+ */
+static const size_t suiteb_tuples_both[] = { OSSL_NELEM(suiteb_curves) };
+static const size_t suiteb_tuples_one[] = { 1 };
+
/* Group list string of the built-in pseudo group DEFAULT_SUITE_B */
#define SUITE_B_GROUP_NAME "DEFAULT_SUITE_B"
#define SUITE_B_GROUP_LIST "?secp256r1:?secp384r1",
@@ -862,11 +870,32 @@ void tls1_get_requested_keyshare_groups(SSL_CONNECTION *s, const uint16_t **pgro
}
}
+/*
+ * Set *ptuples to the list of group tuple sizes and *ptupleslen to the number
+ * of tuples. The tuples returned here always partition exactly the group list
+ * returned by tls1_get_supported_groups().
+ */
void tls1_get_group_tuples(SSL_CONNECTION *s, const size_t **ptuples,
size_t *ptupleslen)
{
SSL_CTX *sctx = SSL_CONNECTION_GET_CTX(s);
+ if (tls1_suiteb(s)) {
+ const uint16_t *groups;
+ size_t groupslen;
+
+ /*
+ * In Suite B mode the fixed group list forms a single tuple. Derive
+ * its size from the list tls1_get_supported_groups() actually returns
+ * rather than repeating the Suite B profile selection here.
+ */
+ tls1_get_supported_groups(s, &groups, &groupslen);
+ *ptuples = groupslen == OSSL_NELEM(suiteb_curves) ? suiteb_tuples_both
+ : suiteb_tuples_one;
+ *ptupleslen = 1;
+ return;
+ }
+
if (s->ext.supportedgroups == NULL) {
*ptuples = sctx->ext.tuples;
*ptupleslen = sctx->ext.tuples_len;
@@ -987,6 +1016,8 @@ int tls1_get0_implemented_groups(int min_proto_version, int max_proto_version,
if (grps->maxtls > 0 && min_proto_version > 0
&& grps->maxtls < min_proto_version)
continue;
+ if (grps->mintls < 0 || grps->maxtls < 0)
+ continue;
if ((gix = OPENSSL_malloc(sizeof(*gix))) == NULL)
goto end;
@@ -3998,9 +4029,7 @@ int tls1_set_sigalgs_list(SSL_CTX *ctx, CERT *c, const char *str, int client)
{
sig_cb_st sig;
sig.sigalgcnt = 0;
-
- if (ctx != NULL)
- sig.ctx = ctx;
+ sig.ctx = ctx;
if (!CONF_parse_list(str, ':', 1, sig_cb, &sig))
return 0;
if (sig.sigalgcnt == 0) {
diff --git a/deps/openssl/openssl/ssl/tls13_enc.c b/deps/openssl/openssl/ssl/tls13_enc.c
index 4624e9ca052..870645929fe 100644
--- a/deps/openssl/openssl/ssl/tls13_enc.c
+++ b/deps/openssl/openssl/ssl/tls13_enc.c
@@ -867,7 +867,14 @@ int tls13_change_cipher_state(SSL_CONNECTION *s, int which)
if (direction == OSSL_RECORD_DIRECTION_READ)
dtls1_clear_received_buffer(s);
- dtls1_clear_sent_buffer(s, 1);
+ /*
+ * The client's early data belongs to the same flight as its
+ * ClientHello, which has not been answered yet. Keep it buffered so
+ * that it can still be retransmitted.
+ */
+ if (!(direction == OSSL_RECORD_DIRECTION_WRITE
+ && (which & SSL3_CC_EARLY) != 0))
+ dtls1_clear_sent_buffer(s, 1);
}
if (!ssl_set_new_record_layer(s, s->version, direction, level, secret,
diff --git a/deps/openssl/openssl/util/missingcrypto.txt b/deps/openssl/openssl/util/missingcrypto.txt
index 7a489a1b6a6..ca63e2e6ffa 100644
--- a/deps/openssl/openssl/util/missingcrypto.txt
+++ b/deps/openssl/openssl/util/missingcrypto.txt
@@ -82,11 +82,7 @@ ASN1_SCTX_set_app_data(3)
ASN1_SEQUENCE_ANY_it(3)
ASN1_SEQUENCE_it(3)
ASN1_SET_ANY_it(3)
-ASN1_STRING_clear_free(3)
-ASN1_STRING_copy(3)
ASN1_STRING_get_default_mask(3)
-ASN1_STRING_length_set(3)
-ASN1_STRING_set0(3)
ASN1_STRING_set_by_NID(3)
ASN1_STRING_set_default_mask(3)
ASN1_STRING_set_default_mask_asc(3)
diff --git a/deps/openssl/openssl/util/mkerr.pl b/deps/openssl/openssl/util/mkerr.pl
index 16555d4a604..8cf2c34e978 100755
--- a/deps/openssl/openssl/util/mkerr.pl
+++ b/deps/openssl/openssl/util/mkerr.pl
@@ -196,7 +196,7 @@ close IN;
if ( ! $statefile ) {
$statefile = $config;
- $statefile =~ s/.ec/.txt/;
+ $statefile =~ s/\.ec$/.txt/;
}
# Unless a rewrite or a report was explicitly requested, skip the run
diff --git a/deps/openssl/openssl/util/mkpod2html.pl b/deps/openssl/openssl/util/mkpod2html.pl
index d23ee4b2eaa..1e887ddcd1f 100755
--- a/deps/openssl/openssl/util/mkpod2html.pl
+++ b/deps/openssl/openssl/util/mkpod2html.pl
@@ -12,6 +12,7 @@ use warnings;
use lib ".";
use Getopt::Std;
use File::Basename;
+use File::Path qw(mkpath);
use Pod::Html;
use File::Spec::Functions qw(:DEFAULT rel2abs);
@@ -24,12 +25,14 @@ use File::Spec::Functions qw(:DEFAULT rel2abs);
# Options.
our ($opt_i); # -i INFILE, one page; without it, pods are read from @ARGV
+ # and the -f file
our ($opt_o); # -o OUTFILE with -i, otherwise the directory to write into
our ($opt_t); # -t TITLE, only with -i
our ($opt_r); # -r PODROOT
our ($opt_j); # -j JOBS, only without -i
+our ($opt_f); # -f FILE, a file naming more pods, one per line, only without -i
-getopts('i:o:t:r:j:');
+getopts('i:o:t:r:j:f:');
die "-o flag missing" unless $opt_o;
die "-r flag missing" unless $opt_r;
@@ -71,6 +74,7 @@ sub format_page
$out = rel2abs($out) or die "Can't convert to real path: $!";
unlink $out;
+ mkpath(dirname($out));
pod2html "--infile=$pod",
"--outfile=$out",
@@ -119,8 +123,19 @@ sub page_of
return ("$opt_o/man$section/$name.html", $name);
}
+# The pods come from the command line and from the file given with -f,
+# which is how the whole set is named without the shell expanding every
+# path onto one command line.
my @pods = @ARGV;
+if (defined $opt_f) {
+ open my $fh, '<', $opt_f
+ or die "Can't read $opt_f, $!\n";
+ chomp(my @listed = <$fh>);
+ close $fh;
+ push @pods, grep { $_ ne '' } @listed;
+}
+
exit 0 unless @pods;
# Only ask how many processors there are when the answer can matter; the
diff --git a/deps/openssl/openssl/util/mkpod2man.pl b/deps/openssl/openssl/util/mkpod2man.pl
index 778dc2b0918..2d366949cca 100644
--- a/deps/openssl/openssl/util/mkpod2man.pl
+++ b/deps/openssl/openssl/util/mkpod2man.pl
@@ -11,6 +11,7 @@ use warnings;
use Getopt::Std;
use File::Basename;
+use File::Path qw(mkpath);
use Pod::Man;
# Format man pages without loading Pod::Man once per page. pod2man is a
@@ -29,8 +30,9 @@ our ($opt_m); # -m MANSUFFIX, appended to the section inside the page
our ($opt_d); # -d DATE
our ($opt_r); # -r RELEASE
our ($opt_j); # -j JOBS
+our ($opt_f); # -f FILE, a file naming the pods, one per line
-getopts('o:m:d:r:j:');
+getopts('o:m:d:r:j:f:');
die "-o flag missing" unless defined $opt_o;
$opt_m = '' unless defined $opt_m;
$opt_d = '' unless defined $opt_d;
@@ -76,6 +78,7 @@ sub format_page
return if -e $out && -M $out < -M $pod;
unlink $out;
+ mkpath(dirname($out));
Pod::Man->new(name => uc $name,
section => "$section$opt_m",
@@ -88,8 +91,20 @@ sub format_page
or die "Can't set the mode of $out, $!\n";
}
+# The pods come from the command line, which is how the per-page rules
+# name their one pod, and from the file given with -f, which is how the
+# whole manual is named without the shell expanding every path onto one
+# command line.
my @pods = @ARGV;
+if (defined $opt_f) {
+ open my $fh, '<', $opt_f
+ or die "Can't read $opt_f, $!\n";
+ chomp(my @listed = <$fh>);
+ close $fh;
+ push @pods, grep { $_ ne '' } @listed;
+}
+
exit 0 unless @pods;
# Only ask how many processors there are when the answer can matter;
diff --git a/deps/openssl/openssl/util/perl/OpenSSL/Config/Query.pm b/deps/openssl/openssl/util/perl/OpenSSL/Config/Query.pm
index 22d6a459bdd..4db4e504848 100644
--- a/deps/openssl/openssl/util/perl/OpenSSL/Config/Query.pm
+++ b/deps/openssl/openssl/util/perl/OpenSSL/Config/Query.pm
@@ -1,4 +1,4 @@
-# Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.
+# Copyright 2021-2026 The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the Apache License 2.0 (the "License"). You may not use
# this file except in compliance with the License. You can obtain a copy
@@ -150,6 +150,37 @@ sub get_config {
return { map { $_ => $self->{config}->{$_} } @_ };
}
+=item B<get_manpods>
+
+=item B<get_htmlpods>
+
+The returned result is an array reference holding the pod every manual page,
+or every HTML page, is made from, section by section. Each page's pod is the
+first element of its generator.
+
+=cut
+
+sub get_manpods {
+ my $self = shift;
+
+ return $self->_get_doc_pods('mandocs');
+}
+
+sub get_htmlpods {
+ my $self = shift;
+
+ return $self->_get_doc_pods('htmldocs');
+}
+
+sub _get_doc_pods {
+ my $self = shift;
+ my $kind = shift; # 'mandocs' or 'htmldocs'
+
+ return [ map { $self->{info}->{generate}->{$_}->[0] }
+ map { @{$self->{info}->{$kind}->{$_} // []} }
+ qw(man1 man3 man5 man7) ];
+}
+
########
#
# Helper functions
diff --git a/deps/openssl/openssl/util/perl/OpenSSL/Test/Utils.pm b/deps/openssl/openssl/util/perl/OpenSSL/Test/Utils.pm
index 1764dc7923f..7e8673cf659 100644
--- a/deps/openssl/openssl/util/perl/OpenSSL/Test/Utils.pm
+++ b/deps/openssl/openssl/util/perl/OpenSSL/Test/Utils.pm
@@ -1,4 +1,4 @@
-# Copyright 2016-2025 The OpenSSL Project Authors. All Rights Reserved.
+# Copyright 2016-2026 The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the Apache License 2.0 (the "License"). You may not use
# this file except in compliance with the License. You can obtain a copy
@@ -14,8 +14,8 @@ use Exporter;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
$VERSION = "0.1";
@ISA = qw(Exporter);
-@EXPORT = qw(alldisabled anydisabled disabled config available_protocols
- have_IPv4 have_IPv6);
+@EXPORT = qw(alldisabled anydisabled disabled config target
+ available_protocols have_IPv4 have_IPv6);
=head1 NAME
@@ -67,6 +67,10 @@ disabled.
Returns an item from the %config hash in \$TOP/configdata.pm.
+=item B<target STRING>
+
+Returns an item from the %target hash in \$TOP/configdata.pm.
+
=item B<have_IPv4>
=item B<have_IPv6>
@@ -166,6 +170,11 @@ sub config {
return $config{$_[0]};
}
+sub target {
+ load_configdata() unless $configdata_loaded;
+ return $target{$_[0]};
+}
+
# IPv4 / IPv6 checker
my $have_IPv4 = -1;
my $have_IPv6 = -1;
diff --git a/deps/openssl/openssl/util/wrap.pl.in b/deps/openssl/openssl/util/wrap.pl.in
index c26500ee8bb..685bbd5573b 100644
--- a/deps/openssl/openssl/util/wrap.pl.in
+++ b/deps/openssl/openssl/util/wrap.pl.in
@@ -118,6 +118,11 @@ if ($^O eq 'VMS') {
@cmd = ( @ARGV );
}
+# A program path coming from foreign tooling (such as cmake) may carry
+# forward slashes, which CreateProcess chokes on for executables on Windows.
+# Normalize to native separators.
+$cmd[0] =~ s|/|\\|g if $^O eq 'MSWin32';
+
# exec() keeps this script's pid, which matters to callers that signal the
# command they started: a test recipe using open3() is handed this pid, not
# the command's, so with a subprocess the signal never reaches the command.