]> git.ipfire.org Git - thirdparty/openssl.git/log
thirdparty/openssl.git
5 weeks agoAdd OSSL_SELF_TEST_TYPE_PCT_IMPORT transient error state
Pauli [Fri, 29 Aug 2025 02:41:22 +0000 (12:41 +1000)] 
Add OSSL_SELF_TEST_TYPE_PCT_IMPORT transient error state

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28376)

(cherry picked from commit 1dc1de78617a3ef817d845329ad9c7b8c96362a2)

5 weeks agoadd new error
Pauli [Fri, 29 Aug 2025 02:37:45 +0000 (12:37 +1000)] 
add new error

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28376)

(cherry picked from commit 9013cca925836ff092cf31acd6edadbbee0c6858)

5 weeks agoslh-dsa: add a PCT for key import when in FIPS mode
Pauli [Thu, 14 Aug 2025 04:57:19 +0000 (14:57 +1000)] 
slh-dsa: add a PCT for key import when in FIPS mode

Fixes #28182

Co-Authored-By: slontis <shane.lontis@oracle.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28276)

(cherry picked from commit 79037022801d6496bb8e1a8a29c21236084c8588)

5 weeks agoNOTES-WINDOWS.md: correct the Windows context macro name
Eugene Syromiatnikov [Mon, 25 Aug 2025 14:02:37 +0000 (16:02 +0200)] 
NOTES-WINDOWS.md: correct the Windows context macro name

Fix incorrect Windows context macro spelling "OPENSSL_WINCTX"
by replacing it with "OSSL_WINCTX".

Reported-by: https://github.com/sjan1970
Resolves: https://github.com/openssl/openssl/issues/28329
Fixes: 630e3a168446 "Change WININSTALLCONTEXT to OSSL_WINCTX"
Complements: c2ab75e30a21 "doc: fix OSSL_WINCTX spelling windows notes"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28338)

(cherry picked from commit 0b091c88d7d50c542ee393ed31ef5a1b92eea476)

5 weeks agodoc: Fix function name in example code
Jakub Jelen [Mon, 25 Aug 2025 08:04:41 +0000 (10:04 +0200)] 
doc: Fix function name in example code

CLA: trivial
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28334)

(cherry picked from commit 5ea22d199bddc266a3410b4fc297e0f3524b8934)

5 weeks agoaes-s390x.pl: Initialize reserved and unused memory
Holger Dengler [Wed, 20 Aug 2025 15:55:43 +0000 (17:55 +0200)] 
aes-s390x.pl: Initialize reserved and unused memory

The reserved bytes in the parameter block (bytes 0-11) for the KMA
instruction should be set to zero to be compatible in case of future
architecture changes.

While at it, also the following unused parts of the parameter block
(bytes 48-63) are also cleared to avoid false positives with various
memory checkers like valgrind.

As it makes - performance wise - no difference to process 12, 48 or 64
bytes with one XC call, but two XC calls are slower than one call, the
first 64 bytes of the parameter block will be cleared with a single XC
call. This will also initialize the counter in the parameter block
(bytes 12-15), although it is not strictly necessary.

Co-developed-by: Juergen Christ <jchrist@linux.ibm.com>
Signed-off-by: Juergen Christ <jchrist@linux.ibm.com>
Signed-off-by: Holger Dengler <dengler@linux.ibm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28315)

(cherry picked from commit 899623b29caa02f25e069acbcef581d19fe0a64e)

5 weeks agodoc/man3/SSL_poll.pod: mention SSL_POLL_EVENT_{EL,IC} in SYNOPSIS
Eugene Syromiatnikov [Tue, 19 Aug 2025 13:27:39 +0000 (15:27 +0200)] 
doc/man3/SSL_poll.pod: mention SSL_POLL_EVENT_{EL,IC} in SYNOPSIS

While the constants are present since the initial commit 2a5ee0a08d2c "QUIC:
Add polling API", they weren't initially documented in c9b0df2250e2 "QUIC:
Add manpage for SSL_poll" (probably due to absence of the QUIC server
mode support at the time), and mentioned for the first time in b20f55702100
"QUIC: Update SSL_poll documentation", but without the accompanying update
of the SYNOPSIS section.  Rescind the omission by updating it as well.

Complements: b20f55702100 "QUIC: Update SSL_poll documentation"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28303)

(cherry picked from commit b930ea87dfc49195a5572cb2f699545d5777dee0)

5 weeks agoFix: Add free to avoid memory leak.
Nachel72 [Sun, 17 Aug 2025 06:08:38 +0000 (14:08 +0800)] 
Fix: Add free to avoid memory leak.

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28289)

(cherry picked from commit f9afb3a07eb72428b98e3e31384380564a236700)

5 weeks agoCorrect fixed cert validity end date in oqsprovider testing
Michael Baentsch [Wed, 27 Aug 2025 05:43:13 +0000 (07:43 +0200)] 
Correct fixed cert validity end date in oqsprovider testing

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28350)

(cherry picked from commit 045a158e616abfaf949449f8e96fda6742951692)

6 weeks agodh: add FIPS 140-3 PCT on key generation
Nikola Pajkovsky [Fri, 15 Aug 2025 12:02:44 +0000 (14:02 +0200)] 
dh: add FIPS 140-3 PCT on key generation

According to FIPS 140-3 IG 10.3.A Additonal Comment 1, a PCT shall be
performed.

Signed-off-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/28280)

(cherry picked from commit b561837ee9bb9393cd3ada325180130fda2613bc)

6 weeks agoFix null pointer check in pkey_dh_derive to ensure both keys are set
ritoban23 [Wed, 13 Aug 2025 20:19:17 +0000 (01:49 +0530)] 
Fix null pointer check in pkey_dh_derive to ensure both keys are set

CLA: trivial

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Todd Short <todd.short@me.com>
(Merged from https://github.com/openssl/openssl/pull/28259)

(cherry picked from commit fc84d46d7227886152be00618889a521e9132ef3)

6 weeks agoFix: Check for wrong object. The converted sc should be checked instead of the original s
Nachel72 [Wed, 13 Aug 2025 15:15:05 +0000 (23:15 +0800)] 
Fix: Check for wrong object. The converted sc should be checked instead of the original s

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Todd Short <todd.short@me.com>
(Merged from https://github.com/openssl/openssl/pull/28248)

(cherry picked from commit bc28ca499ef37e5ab6e2676727a3db7f02c837ae)

6 weeks agoFix reallocation failure condition in qtx_resize_txe()
Niels Dossche [Thu, 21 Aug 2025 11:24:01 +0000 (13:24 +0200)] 
Fix reallocation failure condition in qtx_resize_txe()

Returning the same pointer does not mean that the reallocation failed,
it would also prevent updating alloc_len down below.
This is similar code and a similar change to 043a41ddee.

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28317)

(cherry picked from commit 220f5be6908631759d56c7a6458be8385d984260)

6 weeks agoMake error checks on RSA_public_decrypt() consistent
Niels Dossche [Tue, 19 Aug 2025 20:56:38 +0000 (22:56 +0200)] 
Make error checks on RSA_public_decrypt() consistent

Some are only checking for a value < 0, some for <= 0, some for == 0, etc.
The documentation tells us that -1 is returned on error, so at least the
== 0 ones are wrong. In general, the return values are checked
inconsistently. This patch makes the return value checks consistent to
the form that seems to occur most.

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28306)

(cherry picked from commit 3e2f54a718f541b02b599bbf5109587189368e4d)

6 weeks agoFix a race in by_store_subject
Matt Caswell [Tue, 19 Aug 2025 12:27:50 +0000 (13:27 +0100)] 
Fix a race in by_store_subject

When looking in the stack of objects in the store we need to ensure we
are holding a read lock for the store.

Issue detected via thread sanitizer after the test from the previous
commit was added.

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28198)

(cherry picked from commit 07f65e16c209e06be9887c2d5f943f528e3f0139)

6 weeks agoAdd a test for accessing an X509_STORE from multiple threads
Matt Caswell [Tue, 19 Aug 2025 07:38:07 +0000 (08:38 +0100)] 
Add a test for accessing an X509_STORE from multiple threads

Check we don't have any threading issues when accessing an X509_STORE
simultaneously

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28198)

(cherry picked from commit 994774b4ca61cf7ecf42750a7d374dd2865f1ce3)

6 weeks agoDon't keep the store open in by_store_ctrl_ex
Matt Caswell [Thu, 7 Aug 2025 16:50:17 +0000 (17:50 +0100)] 
Don't keep the store open in by_store_ctrl_ex

Previously #27529 made a change to `by_store_ctrl_ex` in order to open
the OSSL_STORE early. The reason given in that PR is:

"This way, we can call OSSL_STORE_open_ex() in by_store_ctrl_ex(), and
get to see possible errors when the URI is loaded"

That PR then kept the store open until cache_objects is called and then
reused it. Unfortunately by the time cache_objects() is called we could be
in a multi-threaded scenario where the X509_STORE is being shared by
multiple threads. We then get a race condition where multiple threads are
all using (and ultimately closing) the same `OSSL_STORE_CTX`.

The purpose of keeping the `OSSL_STORE` object between by_store_ctrl_ex()
and `cache_objects` is presumably an optimisation to avoid having to open
the store twice. But this does not work because of the above issue.

We just take the hit and open it again.

Fixes #28171

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28198)

(cherry picked from commit 08951fb27306ad9b4365103b8616b8545658ffcc)

6 weeks agofips: upgrade self-test KATs to reduce SHA-1/SHA-224 usage
Dimitri John Ledkov [Wed, 20 Aug 2025 01:26:09 +0000 (02:26 +0100)] 
fips: upgrade self-test KATs to reduce SHA-1/SHA-224 usage

FIPS 140-3 IG states that SHA-224 needs standalone KAT, if it is
implemented without SHA-256. As OpenSSL implements SHA-256, upgrade
existing higher level KAT from SHA-224 to SHA-256 without adding
SHA-224 digest KAT.

Upgrade KATs that use SHA-1 to SHA-256, and add explicit SHA-1 KAT.

SHA-1 and SHA-224 are promised to be deprecated by 2030, as per draft
[NIST SP 800-131A Rev. 3](https://csrc.nist.gov/pubs/sp/800/131/a/r3/ipd).

With upgrades to these KATs it makes it easier to build a modules with
SHA-1 and SHA-224 marked as unapproved services, or removed
altogether.

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/28307)

(cherry picked from commit 5bb4a4860e25af80b146cbb2ae94b2ab8c8b4008)

6 weeks agoTest setting a client to send a key share not allowed in TLSv1.3
Matt Caswell [Fri, 15 Aug 2025 16:12:11 +0000 (17:12 +0100)] 
Test setting a client to send a key share not allowed in TLSv1.3

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Hugo Landau <hlandau@devever.net>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/28283)

(cherry picked from commit 9226b3e8f4cb4dfb8a43fd2790ef506f75a11e76)

6 weeks agoFail immediately if we have no key shares to send
Matt Caswell [Fri, 15 Aug 2025 15:43:49 +0000 (16:43 +0100)] 
Fail immediately if we have no key shares to send

If we are configured in such a way that we have no valid key shares to
send in the ClientHello we should immediately abort the connection.

Fixes #28281

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Hugo Landau <hlandau@devever.net>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/28283)

(cherry picked from commit 47b0f172aa60a0faa3428cc739e3efd71f756aa7)

6 weeks agoBIO_dgram: Fix BIO_CTRL_DGRAM_QUERY_MTU for IPv4-mapped IPv6 addresses
Nikolas Gauder [Thu, 24 Jul 2025 20:00:49 +0000 (22:00 +0200)] 
BIO_dgram: Fix BIO_CTRL_DGRAM_QUERY_MTU for IPv4-mapped IPv6 addresses

Ensure the correct IP header size is subtracted by reusing
dgram_get_mtu_overhead(), which handles address families properly.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/28088)

(cherry picked from commit a71b4fae432796a49c3b9d32ae29354b23809c1f)

6 weeks agod2i_X509.pod: add missing doc of return value of i2d_ASN1_bio_stream()
Dr. David von Oheimb [Mon, 14 Apr 2025 09:20:18 +0000 (11:20 +0200)] 
d2i_X509.pod: add missing doc of return value of i2d_ASN1_bio_stream()

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27567)

6 weeks agofix asn1_write_micalg() in asn_mime.c on GostR3411 and SHAKE
Dr. David von Oheimb [Sun, 13 Apr 2025 15:21:27 +0000 (17:21 +0200)] 
fix asn1_write_micalg() in asn_mime.c on GostR3411 and SHAKE

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27567)

6 weeks agoapps/cms.c: add missing error message on error writing CMS output (ret == 6)
Dr. David von Oheimb [Mon, 14 Apr 2025 18:08:54 +0000 (20:08 +0200)] 
apps/cms.c: add missing error message on error writing CMS output (ret == 6)

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27567)

7 weeks agotest/ml_kem_internal_test.c: Add EVP_MD_free() in the error path to avoid memory...
Jiasheng Jiang [Mon, 11 Aug 2025 21:52:59 +0000 (21:52 +0000)] 
test/ml_kem_internal_test.c: Add EVP_MD_free() in the error path to avoid memory leak

Add EVP_MD_free() to free sha256 in the error path to avoid memory leak.

Fixes: d2136d9 ("Multi-variant ML-KEM")
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/27946)

(cherry picked from commit d6fcaa5658bca18474a5e55d7c4807efcc242173)

7 weeks agoAdd CRYPTO_FREE_REF to ossl_quic_free_token_store
Neil Horman [Wed, 13 Aug 2025 14:12:38 +0000 (10:12 -0400)] 
Add CRYPTO_FREE_REF to ossl_quic_free_token_store

ossl_quic_free_token_store doesn't call CRYPTO_FREE_REF on the
hdl->reference object, which could lead to memory leaks on platforms
that don't support atomics (where the call to CRYPTO_NEW_REF allocates a
mutex as part of its function.  It wasn't caught before because all the
platforms we do ci on support threads.

Fixes #28241

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28247)

(cherry picked from commit d2a71ed94e82f96a589fbc017d525d415b427337)

7 weeks agoAdd test coverage for PKCS7_TEXT mode
Bernd Edlinger [Sun, 10 Aug 2025 16:50:37 +0000 (18:50 +0200)] 
Add test coverage for PKCS7_TEXT mode

This was inspired by the following commit
9882d389df71 ("crypto/pkcs7/pk7_smime.c: Add BIO_free() to avoid memory leak")
which discovered a bug in PKCS7_verify(..., PKCS7_TEXT).
While there is some test coverage for PKCS_verify by
./test/pkcs7_test.c, there is no test coverage whatsoever
of the PKCS7_TEXT flag for PKCS7_sign, PKCS7_encrypt and
PKCS7_decrypt.
So this adds some test coverage for those functions as well.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28223)

(cherry picked from commit d582adc672bca4bc71a7766bb692558086efdd69)

7 weeks agoDH private key size was one bit too large
Bernd Edlinger [Sat, 21 Jun 2025 10:53:56 +0000 (12:53 +0200)] 
DH private key size was one bit too large

In the case when no q parameter was given,
the function generate_key in dh_key.c did create
one bit too much, so the priv_key value was exceeding
the DH group size q = (p-1)/2.
When the length is used in this case the limit is also
one bit too high, but for backward compatibility this
limit was left as is, instead we have to silently reduce
the value by one.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27870)

(cherry picked from commit d6510d99ae4a8a23f54fdfb1473af6a920da8345)

7 weeks agoCorrect the synthetisized OPENSSL_VERSION_NUMBER
Richard Levitte [Mon, 11 Aug 2025 18:57:44 +0000 (20:57 +0200)] 
Correct the synthetisized OPENSSL_VERSION_NUMBER

The last hex digit always became 0x0L, even of OPENSSL_VERSION_PRE_RELEASE
was the empty string.

Resolves: https://github.com/openssl/openssl/issues/28227

Reviewed-by: Paul Yang <kaishen.yy@antfin.com>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/28230)

(cherry picked from commit ba2c314a60d9f42d1d2e63ea0f791cc04e03005b)

7 weeks agoRemove OSSL_CRYPTO_ALLOC attribute from CRYPTO_*dup routines
Eugene Syromiatnikov [Mon, 11 Aug 2025 08:56:13 +0000 (10:56 +0200)] 
Remove OSSL_CRYPTO_ALLOC attribute from CRYPTO_*dup routines

The __attribute__((malloc)) is for functions that return new memory,
and "the memory [returned by the function] has undefined content", which
is a property that doesn't hold for the *dup functions (the same reason
it doesn't apply to realloc).

Fixes: e1035957eba1 "OSSL_CRYPTO_ALLOC attribute introduction proposal."
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/28220)

(cherry picked from commit 85bba74789f82daca7482a9274c6d02843fb2dbb)

7 weeks agoAdd NULL check
Andrew Dinh [Mon, 11 Aug 2025 10:07:15 +0000 (17:07 +0700)] 
Add NULL check

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28221)

(cherry picked from commit 24f72a5aaab0243c136e1402b54348fda9cdbc36)

7 weeks agoFix SKEYMGMT enumeration, add tests
Dmitry Belyavskiy [Fri, 8 Aug 2025 09:52:11 +0000 (11:52 +0200)] 
Fix SKEYMGMT enumeration, add tests

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28207)

(cherry picked from commit f446bf79515f55f55930c5340eb3eb981327f2ac)

7 weeks agodoc/man3/SSL_CTX_set_domain_flags: fix version in HISTORY section
Nikolas Gauder [Wed, 30 Jul 2025 17:50:50 +0000 (19:50 +0200)] 
doc/man3/SSL_CTX_set_domain_flags: fix version in HISTORY section

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28128)

(cherry picked from commit 2b618a13cf420d2095ef6e238873f754b4fe5f96)

7 weeks agotest/sanitytest.c: fix setitimer usage in timer disarmament
Eugene Syromiatnikov [Sun, 10 Aug 2025 00:00:25 +0000 (02:00 +0200)] 
test/sanitytest.c: fix setitimer usage in timer disarmament

It is incorrect to call setitimer(which, NULL, NULL) to disarm a timer,
Linux just gives a pass on that;  properly provide a zeroed-out
structure instead.

Fixes: 760929f6ba18 "crypto/sleep.c: avoid returning early due to signal"
Reported-by: Neil Horman <nhorman@openssl.org>
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28215)

(cherry picked from commit 1b1a859d3d8aafbdda2977f9955ceee6f32f7ea4)

7 weeks agoFix memory leak on EVP_CIPHER_param_to_asn1 failure
77tiann [Thu, 31 Jul 2025 00:47:06 +0000 (17:47 -0700)] 
Fix memory leak on EVP_CIPHER_param_to_asn1 failure

When EVP_CIPHER_param_to_asn1() fails, xalg->parameter was not freed,
leading to a memory leak. This patch adds proper cleanup for that case.
CLA: trivial

Signed-off-by: 77tiann <27392025k@gmail.com>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28131)

(cherry picked from commit bda2473a44e4534c3c640ce89a0971874165c6df)

7 weeks agoFix RSA key size validation in EVP_PKEY_RSA_keygen demo
Quin-Darcy [Thu, 31 Jul 2025 14:07:46 +0000 (09:07 -0500)] 
Fix RSA key size validation in EVP_PKEY_RSA_keygen demo

The validation was checking the default 'bits' value (4096) instead of
the parsed 'bits_i' from the command line arguments, allowing invalid
key sizes to bypass the 512-bit minimum.

CLA: trivial

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/28139)

(cherry picked from commit c79e1b212a616b8dca194a77e7698b886000fcb0)

8 weeks agocrypto/sleep.c: avoid returning early due to signal
Eugene Syromiatnikov [Thu, 7 Aug 2025 14:01:23 +0000 (16:01 +0200)] 
crypto/sleep.c: avoid returning early due to signal

On POSIX systems, sleep/usleep/nanosleep may return early due to arrival
of a signal, and OSSL_sleep does not report that, so it is assumed that
it cannot return early.  Fix that by introducing a loop that checks
the remaining time and sleep some more if the time has not passed;
that also solves the issue of limited sleeping time on some systems.

Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28196)

8 weeks agoEnsure that the largest_pn values are migrated to our channel qrx
Neil Horman [Mon, 4 Aug 2025 22:29:52 +0000 (18:29 -0400)] 
Ensure that the largest_pn values are migrated to our channel qrx

Recently, our overnight QUIC interop runs began failing in CI when an
openssl server was tested against an ngtcp2 client:
https://github.com/openssl/openssl/actions/runs/16739736813

The underlying cause bears some explination for historical purposes

The problem began happening with a recent update to ngtcp2 in which
ngtcp2 updated its wolfssl tls backend to support ML-KEM, which caused
ngtcp to emit a client hello message that offered several groups
(including X25519MLKEM768) but only provided a keyshare for x25519.
This in turn triggered the openssl server to respond with a hello retry
request (HRR), requesting an ML-KEM keyshare instead, which ngtcp2
obliged. However all subsequent frames from the client were discarded by
the server, due to failing packet body decryption.

The problem was tracked down to a mismatch in the initial vectors used
by the client and server, leading to an AEAD tag mismatch.

Packet protection keys generate their IV's in QUIC by xoring the packet
number of the received frame with the base IV as derived via HKDF in the
tls layer.

The underlying problem was that openssl hit a very odd corner case with
how we compute the packet number of the received frame.  To save space,
QUIC encodes packet numbers using a variable length integer, and only
sends the changed bits in the packet number.  This requires that the
receiver (openssl) store the largest received pn of the connection,
which we nominally do.

However, in default_port_packet_handler (where QUIC frames are processed
prior to having an established channel allocated) we use a temporary qrx
to validate the packet protection of those frames.  This temporary qrx
may be incorporated into the channel in some cases, but is not in the
case of a valid frame that generates an HRR at the TLS layer.  In this
case, the channel allocates its own qrx independently.  When this
occurs, the largest_pn value of the temporary qrx is lost, and
subsequent frames are unable to be received, as the newly allocated qrx
belives that the larges_pn for a given pn_space is 0, rather than the
value received in the initial frame (which was a complete 32 bit value,
rather than just the changed lower 8 bits).  As a result the IV
construction produced the wrong value, and the decrypt failed on those
subsequent frames.

Up to this point, that wasn't even a problem, as most quic
implementations start their packet numbering at 0, so the next packet
could still have its packet number computed properly.  The combination
of ngtcp using large random values for initial packet numbers, along
with the HRR triggering a separate qrx creation on a channel led to the
discovery of this discrepancy.

The fix seems pretty straightforward.  When we detect in
port_default_packet_handler, that we have a separate qrx in the new
channel, we migrate processed packets from the temporary qrx to the
canonical channel qrx.  In addition to doing that, we also need to
migrate the largest_pn array from the temporary qrx to the channel_qrx
so that subsequent frame reception is guaranteed to compute the received
frame packet number properly, and as such, compute the proper IV for
packet protection decryption.

Fixes openssl/project#1296

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28189)

8 weeks agoquic_channel: Handle HRR and the second transport params extension
Norbert Pocs [Mon, 28 Jul 2025 13:45:09 +0000 (15:45 +0200)] 
quic_channel: Handle HRR and the second transport params extension

When HRR happens a second client hello is sent and it consist of a
transport params extension. This must be processed and not cause
failure.

Fixes: https://github.com/openssl/project/issues/1296
Signed-off-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28189)

8 weeks agoquicapitest: Check if we can handle HRR
Norbert Pocs [Mon, 28 Jul 2025 08:32:53 +0000 (10:32 +0200)] 
quicapitest: Check if we can handle HRR

Signed-off-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28189)

8 weeks agossl/quic/quic_channel.c: Fix endianness of supported versions from received version...
Nikolas Gauder [Mon, 4 Aug 2025 21:47:23 +0000 (23:47 +0200)] 
ssl/quic/quic_channel.c: Fix endianness of supported versions from received version negotiation packets

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28169)

(cherry picked from commit 95efe41d2e76501f4900eb6a5dece159fb1312df)

8 weeks agossl/quic/quic_port.c: Fix endianness of supported versions in sent version negotiatio...
Nikolas Gauder [Mon, 4 Aug 2025 19:12:35 +0000 (21:12 +0200)] 
ssl/quic/quic_port.c: Fix endianness of supported versions in sent version negotiation packets

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28169)

(cherry picked from commit 2b24455a9fb253b6d26e81e83d6adc2a615ff4b9)

2 months agoPrepare for 3.5.3 28174/head
openssl-machine [Tue, 5 Aug 2025 12:09:35 +0000 (12:09 +0000)] 
Prepare for 3.5.3

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Release: yes

2 months agoPrepare for release of 3.5.2 openssl-3.5.2
openssl-machine [Tue, 5 Aug 2025 12:09:26 +0000 (12:09 +0000)] 
Prepare for release of 3.5.2

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Release: yes

2 months agomake update
openssl-machine [Tue, 5 Aug 2025 12:09:25 +0000 (12:09 +0000)] 
make update

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Release: yes

2 months agoCopyright year updates
openssl-machine [Tue, 5 Aug 2025 12:07:41 +0000 (12:07 +0000)] 
Copyright year updates

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Release: yes

2 months agoRevert "Pairwise check for DH keys import as part of FIPS"
Nikola Pajkovsky [Wed, 30 Jul 2025 07:21:29 +0000 (09:21 +0200)] 
Revert "Pairwise check for DH keys import as part of FIPS"

Not needed anymore. It's handled in the 'ec (fips): add PCT for key import'

This reverts commit e08b83cbb3b853ae9dc364c32d927405172918ac.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28122)

(cherry picked from commit b20da2328018107414fe896e59e7d4d6c8af8174)

2 months agodh: add extra argument to ossl_dh_check_pairwise
Pauli [Wed, 30 Jul 2025 06:50:03 +0000 (16:50 +1000)] 
dh: add extra argument to ossl_dh_check_pairwise

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28122)

(cherry picked from commit 1afc4e8baa3226ea6edb643180246201968d8958)

2 months agodh: add FIPS 140-3 PCT on key import.
Pauli [Thu, 30 Jan 2025 23:38:28 +0000 (10:38 +1100)] 
dh: add FIPS 140-3 PCT on key import.

This is mandated by FIPS 140-3 IG 10.3.A additional comment 1

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28122)

(cherry picked from commit db969c3ab08240cf9652cb621fbf1936d056464c)

2 months agofips: add DH PCT name
Pauli [Thu, 30 Jan 2025 23:16:17 +0000 (10:16 +1100)] 
fips: add DH PCT name

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28122)

(cherry picked from commit 88a13095667228c2361361c97704ea992d837ade)

2 months agochanges: add note about PCT on key import to the FIPS provider
Pauli [Wed, 29 Jan 2025 01:41:59 +0000 (12:41 +1100)] 
changes: add note about PCT on key import to the FIPS provider

This is mandated by FIPS 140-3 IG 10.3.A additional comment 1.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28122)

(cherry picked from commit 32ff539daf83cccc15a159fe214cac66acc80fec)

2 months agorsa (fips): add PCT for key import
Pauli [Wed, 29 Jan 2025 00:31:33 +0000 (11:31 +1100)] 
rsa (fips): add PCT for key import

FIPS 140-3 IG 10.3.A additional comment 1 mandates a PCT on key import.

Fixes #26572

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28122)

(cherry picked from commit 57230da2bd0be6b219cec2995832034b1e09e0e9)

2 months agoec (fips): add PCT for key import
Pauli [Wed, 29 Jan 2025 00:16:54 +0000 (11:16 +1100)] 
ec (fips): add PCT for key import

FIPS 140-3 IG 10.3.A additional comment 1 mandates a PCT on key import.

Fixes #26572

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28122)

(cherry picked from commit a177798e0b8f3c7ff66b2a609924aafeb66b8b12)

2 months agoecx (fips): add PCT for key import
Pauli [Wed, 29 Jan 2025 00:16:44 +0000 (11:16 +1100)] 
ecx (fips): add PCT for key import

FIPS 140-3 IG 10.3.A additional comment 1 mandates a PCT on key import.

Fixes #26572

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28122)

(cherry picked from commit 58ab3b0ffeea2b4c30f8794d281650ce7bfec6d2)

2 months agorsa: expose pairwise consistency test API
Pauli [Wed, 29 Jan 2025 00:44:02 +0000 (11:44 +1100)] 
rsa: expose pairwise consistency test API

This is only used by the FIPS provider as part of importing keys.  At least
at the moment.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28122)

(cherry picked from commit dc5cd6f70a0eeb30e272fe885a64f3e3d76b5e42)

2 months agoapps/asn1parse.c: correct help text order for -genstr option
Saurabh Kushwah [Wed, 30 Jul 2025 12:36:57 +0000 (18:06 +0530)] 
apps/asn1parse.c: correct help text order for -genstr option

CLA: trivial

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28123)

(cherry picked from commit eac588ac360ca16e0f9979b6c70708f1e8991b4f)

2 months agofuzz/dtlsserver.c: Remove incorrect ifdef guard
Michael Baentsch [Mon, 28 Jul 2025 04:52:49 +0000 (06:52 +0200)] 
fuzz/dtlsserver.c: Remove incorrect ifdef guard

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28102)

(cherry picked from commit fd7fc90346306f49773866eddff90717e22b9181)

2 months agoOnly report generic error if provider did not put an error on the error queue
Ingo Franzki [Tue, 22 Jul 2025 13:09:27 +0000 (15:09 +0200)] 
Only report generic error if provider did not put an error on the error queue

Commit 72351b0d18078170af270418b2d5e9fc579cb1af added code to unconditionally
put a generic error onto the error stack, if key generation, encryption,
decryption, sign, or verify fails to ensure that there is an error entry
on the error queue, even if the provider did not itself put a specific error
onto the queue.

However, this can hide error details if an application just looks at the very
last error entry and checks for specific errors. Now, the generic error is
always the last entry, and the application won't find the expected error
entry, although it would be there as second last entry. This can lead to
different application behavior in error situations than before this change.

To fix this, only add the generic error entry if the provider did not itself
add an error entry onto the queue. That way, there always is an error on the
error queue in case of a failure, but no behavior change in case the provider
emitted the error entry itself.

Closes: https://github.com/openssl/openssl/issues/27992
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28073)

(cherry picked from commit b9ff440dd613e0c65527ef7eaf565f618979ecce)

2 months agoMake ERR_count_to_mark() available to providers via 'in' dispatch array
Ingo Franzki [Tue, 22 Jul 2025 13:01:38 +0000 (15:01 +0200)] 
Make ERR_count_to_mark() available to providers via 'in' dispatch array

Functions like ERR_set_mark(), ERR_clear_last_mark(), and ERR_pop_to_mark()
are already passed to the a provider via the 'in' dispatch array of the
provider initialization function (although the documentation did not
mention them).

Also pass ERR_count_to_mark() to the provider the same way, and update
the documentation to mention all four functions.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28073)

(cherry picked from commit f77fafd16e92699544466556d368ed7722f49dd8)

2 months agoPairwise check for DH keys import as part of FIPS
Nikola Pajkovsky [Thu, 17 Jul 2025 10:45:49 +0000 (12:45 +0200)] 
Pairwise check for DH keys import as part of FIPS

For DH key import, it appears the PCT and assurances are implemented in
the source but are not be performed by default.

Signed-off-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28058)

(cherry picked from commit e08b83cbb3b853ae9dc364c32d927405172918ac)

2 months agoUpdate dh_pub to be pairwise consistent with dh_priv
Nikola Pajkovsky [Wed, 16 Jul 2025 12:37:58 +0000 (14:37 +0200)] 
Update dh_pub to be pairwise consistent with dh_priv

Signed-off-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28058)

(cherry picked from commit 9c09d2076aad3ee853156048de60e3a1d93b424b)

2 months agotest-ec: Skip SM2 key import test if SM2 is disabled
Tomas Mraz [Mon, 28 Jul 2025 09:13:06 +0000 (11:13 +0200)] 
test-ec: Skip SM2 key import test if SM2 is disabled

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28106)

(cherry picked from commit 981d6776a339bebbb1aa4a38b940dd1526ab3508)

2 months agoBackport of the fix #27506 (empty IDP causes error) to the version 3.5.
Igor Ustinov [Wed, 23 Jul 2025 17:48:50 +0000 (20:48 +0300)] 
Backport of the fix #27506 (empty IDP causes error) to the version 3.5.

(cherry picked from commit 6f0de58619a2a96a7ae9d098f572deda99dc73c9)

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/28080)

2 months ago- adding a missing file
Alexandr Nedvedicky [Tue, 22 Jul 2025 21:31:57 +0000 (23:31 +0200)] 
- adding a missing file

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28023)

(cherry picked from commit d777deffbae3dc27f57c3086f385f91a62b1e5bd)

2 months ago- changes suggested by @t8m
Alexandr Nedvedicky [Tue, 22 Jul 2025 20:59:28 +0000 (22:59 +0200)] 
- changes suggested by @t8m

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28023)

(cherry picked from commit 92330c8f80e4dbfc45b7718d9ed526f196daba0a)

2 months ago- fix RFC reference and indentation
sashan [Mon, 21 Jul 2025 06:57:41 +0000 (08:57 +0200)] 
- fix RFC reference and indentation

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28023)

(cherry picked from commit a43b926fd2c73349c9eb6167f08a4d435e6f04a6)

2 months agoUpdate ssl/quic/quic_ackm.c
Sashan [Mon, 21 Jul 2025 06:44:17 +0000 (08:44 +0200)] 
Update ssl/quic/quic_ackm.c

Co-authored-by: Andrew Dinh <andrewd@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28023)

(cherry picked from commit b0836134764817fb8b20ceb432d8dff4fd58c2aa)

2 months agoUpdate ssl/quic/quic_ackm.c
Sashan [Mon, 21 Jul 2025 06:43:49 +0000 (08:43 +0200)] 
Update ssl/quic/quic_ackm.c

Co-authored-by: Andrew Dinh <andrewd@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28023)

(cherry picked from commit 4a3c954a0cdb9fa1f511ce43bb4833303a6067e2)

2 months agoACK manager must avoid infinite probe time when waiting handshake confirmation
sashan [Tue, 15 Jul 2025 13:09:40 +0000 (15:09 +0200)] 
ACK manager must avoid infinite probe time when waiting handshake confirmation

According to RFC 9002, section 6.2.2.1 the client the client must keep PTO (probe
time out) armed if it has not seen HANDSHAKE_DONE quic message from server.
Not following RFC spec here may cause the QUIC session to stale during TLS handshake.

Fixes openssl/project#1266

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28023)

(cherry picked from commit cdbfacead0d07ed47fa1087d633acf6f6399aa2c)

2 months agoAdd a test of 'openssl storeutl' with a BER-encoded PKCS#12 file
Richard Levitte [Wed, 16 Jul 2025 13:08:48 +0000 (15:08 +0200)] 
Add a test of 'openssl storeutl' with a BER-encoded PKCS#12 file

The test file (test-BER.p12) was given to us by David von Oheimb

Co-Authored-By: David von Oheimb <david.von.oheimb@siemens.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
(Merged from https://github.com/openssl/openssl/pull/28016)

(cherry picked from commit 49f8db53274191987b57d8e5542218690a983e35)

2 months agoFix OSSL_STORE to consider cached info in the EOF check.
Richard Levitte [Thu, 10 Jul 2025 15:55:50 +0000 (17:55 +0200)] 
Fix OSSL_STORE to consider cached info in the EOF check.

OSSL_STORE_load() called OSSL_STORE_eof() before checking if there is
cached OSSL_STORE_INFO to consider.  To fix this issue, the cached info
check is moved to OSSL_STORE_eof(), as that seems to make most common
sense.

This solves an issue with PKCS#12 files, where the cached info was never
considered because the underlying file IO layer signaled that EOF is
reached.

Fixes #28010

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
(Merged from https://github.com/openssl/openssl/pull/28016)

(cherry picked from commit 1f3af48c312a5f94612e9a822b78a3afdadc27c1)

2 months agosm2: sm2_sign.c: check EC_KEY_get0_private_key() for NULL in sm2_sig_gen()
AntonMoryakov [Mon, 2 Jun 2025 10:14:28 +0000 (13:14 +0300)] 
sm2: sm2_sign.c: check EC_KEY_get0_private_key() for NULL in sm2_sig_gen()

Static analysis revealed that sm2_sig_gen() dereferences the return value
of EC_KEY_get0_private_key() without checking for NULL. This could lead to
a crash if the private key is unset.

This patch adds a NULL check and raises ERR_R_PASSED_NULL_PARAMETER if the
key is missing.

Issue found by static analyzer:
> Return value of EC_KEY_get0_private_key() is dereferenced without checking for NULL (11/12 checked)

CLA: trivial
Signed-off-by: Anton Moryakov <ant.v.moryakov@gmail.com>
Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27741)

(cherry picked from commit c108ead2840a76a59fe02c049d08322a02b24761)

2 months agofix SM2 privatekey decode(PEM format, ECPrivateKey).
Alen Yan [Wed, 9 Jul 2025 01:23:00 +0000 (09:23 +0800)] 
fix SM2 privatekey decode(PEM format, ECPrivateKey).

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27963)

(cherry picked from commit bd172dd0e1b76116402534aa4bb5c89d039e7762)

2 months agoopenssl rand command should use the loaded library context
Daniel Van Geest [Wed, 23 Jul 2025 08:30:57 +0000 (10:30 +0200)] 
openssl rand command should use the loaded library context

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28075)

(cherry picked from commit e7d5398aa1349cc575a5b80e0d6eb28e61cb4bfa)

2 months agoRaise PROV_R_NULL_OUTPUT_BUFFER if shsec is NULL in ml_kem_encapsulate()
lanming [Thu, 10 Jul 2025 02:20:05 +0000 (10:20 +0800)] 
Raise PROV_R_NULL_OUTPUT_BUFFER if shsec is NULL in ml_kem_encapsulate()

Signed-off-by: lanming <lanming@huawei.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/28009)

(cherry picked from commit 5d0c6c52e722f37f0254f8d5bfaf9b5c6b0df68b)

2 months agoAdd CODEOWNERS file
Dmitry Misharov [Fri, 18 Jul 2025 06:12:56 +0000 (08:12 +0200)] 
Add CODEOWNERS file

quarckster is the owner of the /.github/workflows/ directory.

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/28060)

(cherry picked from commit b3187ab5a757496e588ea9bdb7fabd12d194e66a)

2 months agopin GitHub Actions revisions from untrusted vendors
Dmitry Misharov [Mon, 31 Mar 2025 14:50:36 +0000 (16:50 +0200)] 
pin GitHub Actions revisions from untrusted vendors

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27209)

2 months agoUpdate container images in OS Zoo CI workflow
Dmitry Misharov [Wed, 16 Jul 2025 09:05:27 +0000 (11:05 +0200)] 
Update container images in OS Zoo CI workflow

Replace outdated and unsupported distro versions with up-to-date ones.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28049)

(cherry picked from commit a9a7e017b8cde8ea33918a63eec392b0f98979fe)

2 months agosec_mem: add note about the perf implications
Nikola Pajkovsky [Thu, 10 Jul 2025 07:03:38 +0000 (09:03 +0200)] 
sec_mem: add note about the perf implications

Testing secure storage for ml-kem/dsa [1] shows performace penalty
when secure storage is enabled.

| Threads | baseline usec/handshake | secmem usec/handshake |
|---------+-------------------------+-----------------------|
|       1 |              586.784756 |            588.306131 |
|       2 |              599.537648 |            601.007393 |
|       4 |              610.663361 |            613.600663 |
|       8 |              649.347376 |            869.693358 |
|      16 |             1176.402781 |           2487.335286 |
|      32 |             2345.594618 |           5155.747515 |
|      64 |             4697.556045 |          11170.627031 |

the test shows that sec mem is ok-ish up to the number of available cores,
and when the sec mem lock gets contended, performance goes down rapidly.
Tested on Apple M4 Pro.

[1] https://github.com/openssl/openssl/pull/27625

Signed-off-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28011)

(cherry picked from commit b8cc32766060757254f31139d6c521465d796d0d)

2 months agoci: enable lms only on master
Nikola Pajkovsky [Fri, 11 Jul 2025 07:18:12 +0000 (09:18 +0200)] 
ci: enable lms only on master

a new config option cannot be enabled globally because the option
was not backported to the older versions.

Signed-off-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28019)

(cherry picked from commit 4337989667b003bbf7ddc10984129d3cba298e8b)

2 months agoAdd note about use of EVP_PKEY in different libctxs
Michael Baentsch [Mon, 30 Jun 2025 07:33:46 +0000 (09:33 +0200)] 
Add note about use of EVP_PKEY in different libctxs

Co-authored-by: Shane Lontis <slontis@oracle.com>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26309)

(cherry picked from commit b2ac43b0d89b5b528941ad9d233b4cb4f99a7cca)

2 months agoPEM_read_CMS.pod: Correct the deprecation notice
Tomas Mraz [Fri, 20 Jun 2025 15:07:19 +0000 (17:07 +0200)] 
PEM_read_CMS.pod: Correct the deprecation notice

Fixes #27863

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27865)

(cherry picked from commit 9a6376dd75961c44232dae42943ceac10795a060)

2 months agotest/quic-openssl-docker/hq-interop/quic-hq-interop.c: Move BIO_free() to err label...
Jiasheng Jiang [Tue, 8 Jul 2025 23:18:43 +0000 (23:18 +0000)] 
test/quic-openssl-docker/hq-interop/quic-hq-interop.c: Move BIO_free() to err label to avoid memory leak

Relocate the BIO_free() call to the 'err' label to ensure the memory is properly freed in case of an error.

Fixes: ec6200bf0f ("Move hq-interop code to test/quic-openssl-docker")
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27995)

(cherry picked from commit 13259a758ada910aec10313cd063ce54dacfc4a5)

2 months agoQUIC receiver may accidentally ACK packet it fails to process
Alexandr Nedvedicky [Wed, 9 Jul 2025 09:24:38 +0000 (11:24 +0200)] 
QUIC receiver may accidentally ACK packet it fails to process

we set ok to -1 as we enter ossl_quic_handle_frames().  If we
set ok to 0 here we effectively assume successful processing
of all frames found in packet. We do this just before
we return from function:

```
  1479
  1480     /* Now that special cases are out of the way, parse frames */
  1481     if (!PACKET_buf_init(&pkt, qpacket->hdr->data, qpacket->hdr->len)
  1482         || !depack_process_frames(ch, &pkt, qpacket,
  1483                                   enc_level,
  1484                                   qpacket->time,
  1485                                   &ackm_data))
  1486         goto end;
  1487
  1488     ok = 1;
  1489  end:
  1490     /*
  1491      * ASSUMPTION: If this function is called at all, |qpacket| is
  1492      * a legitimate packet, even if its contents aren't.
  1493      * Therefore, we call ossl_ackm_on_rx_packet() unconditionally, as long as
  1494      * |ackm_data| has at least been initialized.
  1495      */
  1496     if (ok >= 0)
  1497         ossl_ackm_on_rx_packet(ch->ackm, &ackm_data);
  1498
  1499     return ok > 0;
```

if the call to `depack_process_frames()` at line 1492 fails, because
barticualr frame in packet is corrupted/invalid we take a branch
to `end:` goto target. In this case we must avoid the call to
`ossl_ackm_on_rx_packet()`. Packet with malformed/invalid frame
must not be accepted. See RFC 9000 section 13.1:

    Once the packet has been fully processed, a receiver acknowledges
    receipt by sending one or more ACK frames containing the packet
    number of the received packet.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28002)

(cherry picked from commit e6c20588efa755c246f52d56891a889b201a015a)

2 months agoFixup non-optional use of IO::Socket::IP
Neil Horman [Tue, 1 Jul 2025 18:19:17 +0000 (14:19 -0400)] 
Fixup non-optional use of IO::Socket::IP

IO::Socket::IP is an optionally used package in our perl scripts, and a
recent change of mine used it unilaterally, causing breakage on older
perl installations.  Fix it up to use it optionally again, falling back
to IO::Socket::INET when needed.

Fixes #27940

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27941)

(cherry picked from commit b321bf25c88f2e604f3dd387dd14e1e6369895ad)

2 months agocrypto/slh_dsa/slh_hash.c: Add check for EVP_MD_get_size()
Jiasheng Jiang [Thu, 26 Jun 2025 00:58:51 +0000 (00:58 +0000)] 
crypto/slh_dsa/slh_hash.c: Add check for EVP_MD_get_size()

Add the check for the return value of EVP_MD_get_size() to avoid invalid size.

Fixes: 2f9e152d86 ("Add SLH_DSA signature verification.")
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/27900)

(cherry picked from commit 36614faa98c5a947a635d3f44e78c7c36b722534)

3 months agoThe check-ansi job is failing in the openssl-3.5 branch as a result of commit 60775e3...
Daniel Van Geest [Tue, 1 Jul 2025 20:57:57 +0000 (21:57 +0100)] 
The check-ansi job is failing in the openssl-3.5 branch as a result of commit 60775e3. Fix that.

I guess this job doesn't run on PRs in master?

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27944)

3 months agoRemove unused data from self test. 27943/head
slontis [Thu, 26 Jun 2025 03:19:59 +0000 (13:19 +1000)] 
Remove unused data from self test.

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27902)

(cherry picked from commit f2e45b6418fe9b969af1cb16843af8a7b73273c6)

3 months agoUpdate FIPS provider doc to match the current code.
slontis [Thu, 26 Jun 2025 03:18:18 +0000 (13:18 +1000)] 
Update FIPS provider doc to match the current code.

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27902)

(cherry picked from commit b63adfc58acba09f06050553957261aa19b58f0b)

3 months agodemos/cms/cms_denc.c: Add check for BIO_new_file()
Jiasheng Jiang [Wed, 25 Jun 2025 23:06:59 +0000 (23:06 +0000)] 
demos/cms/cms_denc.c: Add check for BIO_new_file()

Add check for the return value of BIO_new_file().

Fixes: 1728756 ("Detached encrypt/decrypt example, fix decrypt sample.")
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27897)

(cherry picked from commit 881ff0c225356a0f28bd55cea5a4c5204b7b7b8a)

3 months agodemos/cms/cms_ddec.c: Replace "in" with "dcont" to correctly check the success of...
Jiasheng Jiang [Fri, 27 Jun 2025 15:59:13 +0000 (15:59 +0000)] 
demos/cms/cms_ddec.c: Replace "in" with "dcont" to correctly check the success of BIO_new_file()

Replace "in" with "dcont" to properly check the return value of BIO_new_file().

Fixes: 1728756 ("Detached encrypt/decrypt example, fix decrypt sample.")
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27896)

(cherry picked from commit 8a7545607e872ccaff3018e2cd201cce65e615ec)

3 months agoFix internal documentation of ossl_namemap_num2name()
Tomas Mraz [Wed, 25 Jun 2025 10:21:53 +0000 (12:21 +0200)] 
Fix internal documentation of ossl_namemap_num2name()

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/27889)

(cherry picked from commit bdb769841a32199cb0d0e6c03b09d4b515b49c70)

3 months agodecoders: Fix prioritization of decoders via property query
Daniel Van Geest [Mon, 23 Jun 2025 11:45:59 +0000 (12:45 +0100)] 
decoders: Fix prioritization of decoders via property query

When a property query string was used, it was not being applied to decoders.
When multiple providers supporting the same algorithm were loaded, it was
undefined which provider would be used when decoding a key, even when a
propquery string was provided.  This fix scores decoder instances based on
property query matching and selects the highest scored decoder instance when
building the decoder chain.

The fake_rsa test provider is updated to support basic encoding and decoding.
A test is added using the fake_rsa provider to ensure that property query
strings are respected when loading decoders.

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27876)

(cherry picked from commit 60775e31123e6ef66a7cf86f199289d6e250dceb)

3 months agoPrepare for 3.5.2 27933/head
openssl-machine [Tue, 1 Jul 2025 11:52:18 +0000 (11:52 +0000)] 
Prepare for 3.5.2

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Release: yes

3 months agoPrepare for release of 3.5.1 openssl-3.5.1
openssl-machine [Tue, 1 Jul 2025 11:52:08 +0000 (11:52 +0000)] 
Prepare for release of 3.5.1

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Release: yes

3 months agomake update
openssl-machine [Tue, 1 Jul 2025 11:52:07 +0000 (11:52 +0000)] 
make update

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Release: yes

3 months agoCopyright year updates
openssl-machine [Tue, 1 Jul 2025 11:50:25 +0000 (11:50 +0000)] 
Copyright year updates

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Release: yes

3 months agoCHANGES.md / NEWS.md fixups ahead of release
Neil Horman [Tue, 1 Jul 2025 11:21:56 +0000 (07:21 -0400)] 
CHANGES.md / NEWS.md fixups ahead of release

Release: yes

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27927)

(cherry picked from commit f6c400f4ccaf6b36f5430aa3f6c94b704e335738)

3 months agoFixes #27831: Decreased NAMEMAP_HT_BUCKETS to 512.
INDIA\kanagavels [Wed, 18 Jun 2025 13:12:54 +0000 (18:42 +0530)] 
Fixes #27831: Decreased NAMEMAP_HT_BUCKETS to 512.

Decreased the NAMEMAP_HT_BUCKETS value to 512, to avoid memory
allocation fail issues.

CLA: Trivial

Signed-off-by: Kanagavel S <kanagavels@ami.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27850)

(cherry picked from commit b3161bd9a9329be3d6bf6b29a06835e2721898bb)

3 months agofix: msg callback in dtls1_do_write that incorrectly shows message (like a certificat...
noctuelles [Thu, 29 May 2025 19:01:21 +0000 (21:01 +0200)] 
fix: msg callback in dtls1_do_write that incorrectly shows message (like a certificate) that spans over multiple fragments.

Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27811)

(cherry picked from commit de5a619aa015e7c8648e415975e5e2b722b2cbf7)