]> git.ipfire.org Git - thirdparty/openssl.git/log
thirdparty/openssl.git
10 days agoFix length of digestinfo_sm3_der
xiaoloudongfeng [Tue, 2 Sep 2025 03:25:19 +0000 (11:25 +0800)] 
Fix length of digestinfo_sm3_der

This fixes the RSA-SM3 signatures to conform to the standard.

CLA: trivial

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

(cherry picked from commit de0944c9b3a77b6f3c7ed07a90f7d463301851a8)

10 days agoFix doublefree after failure in ossl_siv128_init()
Tomas Mraz [Tue, 23 Sep 2025 15:00:00 +0000 (17:00 +0200)] 
Fix doublefree after failure in ossl_siv128_init()

The issue was reported by Ronald Crane from Zippenhop LLC.

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

(cherry picked from commit 3185e2762402dffba569d9a7377d51d5bb0e4382)

11 days agoPrint PowerPC CPUINFO
Bernd Edlinger [Sat, 13 Sep 2025 10:45:00 +0000 (12:45 +0200)] 
Print PowerPC CPUINFO

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

(cherry picked from commit 03a9584499589f14363de758fdfb887cbef84790)

11 days agoCorrect the documentation for OPENSSL_sk_find
Bob Beck [Tue, 16 Sep 2025 21:30:31 +0000 (15:30 -0600)] 
Correct the documentation for OPENSSL_sk_find

Since April of 2023 with commit eb0935f, these functions have not
sorted the stack if it was not sorted. The documentation was noti
changed at the time to reflect this changed behaviour.

This corrects the documentation to reflect the current behaviour
of these functions

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/28578)

(cherry picked from commit 07e70f951e7c4618b4a275d60f7410f77999f92a)

11 days agoClose small race condition on error raising in QUIC
Neil Horman [Tue, 23 Sep 2025 09:40:06 +0000 (05:40 -0400)] 
Close small race condition on error raising in QUIC

Github issue #28501 reported an odd condition in which a double free was
occuring when a given thread was popping entries of its error stack.

It was hypothesized that, because a few places in the quic stack save
error state to a shared structure (ch->err_state, port->error_state,
qtls->error_state), that multiple threads may attempt to mutate the
shared structure during error save/restore in parallel.

Investigation showed that all paths which led to such mutations were
done under lock, so that shouldn't occur.

Except for one case, which this PR addresses.

In ossl_quic_conn_stream_conclude, we unlock our protecting mutex, prior
to calling QUIC_RAISE_NON_NORMAL_ERROR.  If that function is called with
an reason code of SHUTDOWN, it attempts to restore the channel error
state.  Given that the lock was released first, this creates a small
race condition in which two threads may manipulate the shared error
state in the channel struct in parallel.

According to the reporter, applying this patch prevents the reported
error from occuring again.

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

(cherry picked from commit 1e70e8080a5b8766cb5f8b81127f90db9081e856)

12 days agoDo not use RW mutexes on RISC-V arch
Bernd Edlinger [Fri, 19 Sep 2025 06:52:24 +0000 (08:52 +0200)] 
Do not use RW mutexes on RISC-V arch

For unknown reasons using RW mutexes on RISC-V arch
seems to be broken, at least with glibc.

Fixes #28550

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/28634)

(cherry picked from commit bea53924ce729353df41129c58bd3349df7d7a82)

12 days agox509: fix mem leak on error path
Nikola Pajkovsky [Mon, 22 Sep 2025 10:17:16 +0000 (12:17 +0200)] 
x509: fix mem leak on error path

The x509_store_add() creates X509_OBJECT wrapping either X509 or
X509_CRL. However, if you set the type to X509_LU_NONE before
X509_OBJECT_free then it skips the free on the wrapped type and just
calls OPENSSL_free on the object itself. Hence, leaking wrapped
object.

Signed-off-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28631)

(cherry picked from commit 8a4ef31f3ab9c8e512d29600ccc833cf03533b9e)

12 days agoRe-enable the ssl_trace_test()
Tomas Mraz [Sat, 20 Sep 2025 14:53:46 +0000 (16:53 +0200)] 
Re-enable the ssl_trace_test()

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

(cherry picked from commit 0a6b53ac87b54de2f467165c3d25e1af6400280a)

12 days agosslapitest.c: Skip test_ssl_trace() with FIPS providers older than 3.5
Tomas Mraz [Sat, 20 Sep 2025 14:52:07 +0000 (16:52 +0200)] 
sslapitest.c: Skip test_ssl_trace() with FIPS providers older than 3.5

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

(cherry picked from commit bb8bbdcfaa89741321a00dc9a97e9d513eb037ff)

12 days agotls_common.c: Handle inner content type properly on Big Endian
Tomas Mraz [Sat, 20 Sep 2025 14:45:50 +0000 (16:45 +0200)] 
tls_common.c: Handle inner content type properly on Big Endian

When passing the inner content type to msg_callback,
the lowest byte of rec->type needs to be passed instead
of directly passing the rec->type otherwise the value is
incorrect on Big Endian platforms.

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

(cherry picked from commit 2edf021463518d9af905b1b03f952ea643b3fb9b)

12 days agoFix the abnormal branch memory leak in ssl_set_cert_and_key function
lan1120 [Fri, 19 Sep 2025 10:45:30 +0000 (18:45 +0800)] 
Fix the abnormal branch memory leak in ssl_set_cert_and_key function

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

(cherry picked from commit e7f88391867dd71dc0ef37646f497411bea5350c)

12 days agobio_ok.c: Integer Overflow in BIO_f_reliable record parser leads to Out-of-Bounds...
Luigino Camastra [Wed, 10 Sep 2025 10:13:11 +0000 (12:13 +0200)] 
bio_ok.c: Integer Overflow in BIO_f_reliable record parser leads to Out-of-Bounds Read

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

(cherry picked from commit 312904b216f917646ad1909ce8bca8bf8a52e5d7)

12 days agoAdded test suggested by Shane Lontis
Viktor Dukhovni [Mon, 22 Sep 2025 05:02:28 +0000 (15:02 +1000)] 
Added test suggested by Shane Lontis

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/28624)

(cherry picked from commit 38e8981004308ed6d7cdbd3178c826989a30e31a)

12 days agoHarden property put_str() helper corner case
Viktor Dukhovni [Sat, 20 Sep 2025 04:02:52 +0000 (14:02 +1000)] 
Harden property put_str() helper corner case

The put_str() helper of the internal ossl_property_list_to_string()
function failed to correctly check the remaining buffer length in a
corner case in which a property name or string value needs quoting,
and exactly one byte of unused space remained in the output buffer.

The only potentially affected calling code is conditionally compiled
(disabled by default) provider "QUERY" tracing that is executed only
when also requested at runtime.  An initial fragment of the property
list encoding would need to use up exactly 511 bytes, leaving just 1
byte for the next string which requires quoting.  Bug reported by

    Aniruddhan Murali (@ashamedbit)
    Noble Saji Mathews (@NobleMathews)

both from the University of Waterloo.

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/28624)

(cherry picked from commit c6e44fa347aabfc279ec2e50a02fd764c2e8e241)

2 weeks agoFix OPENSSL_VERSION_NUMBER to always have zero status bits
Richard Levitte [Thu, 18 Sep 2025 05:14:13 +0000 (07:14 +0200)] 
Fix OPENSSL_VERSION_NUMBER to always have zero status bits

The documentation suggested that they were always zero, while the
implementation in <openssl/opensslv.h> suggested that it could be
0xf in OpenSSL releases...  which (almost) never happened because
of a bug in said implementation.

Therefore, we solidify that the status bits are indeed always zero,
at least in all OpenSSL 3 versions.

Resolves: https://github.com/openssl/project/issues/1621

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

(cherry picked from commit 60c4feacce6faf0e98167dc2ab2a1c2e85882049)

2 weeks agoFix CI Pipeline by Disabling SSL_TRACE_TEST
Ryan Hooper [Fri, 19 Sep 2025 15:33:09 +0000 (11:33 -0400)] 
Fix CI Pipeline by Disabling SSL_TRACE_TEST

Disabling the SSL_TRACE_TEST since it caused an issue on
some cross compiles. A follow-on commit will change
the test.

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

(cherry picked from commit bd362f346cb1e763c060eab959ffc49fe6ccc611)

2 weeks agoFix another memory order issue
Bernd Edlinger [Mon, 15 Sep 2025 19:12:37 +0000 (21:12 +0200)] 
Fix another memory order issue

this adds another release/acquire link between update_qp and
get_hold_current_qp via the reader_idx because the current
one which is based on the qp users count is only preventing
a race condition, but does not help when the reader acquires
the next qp.

Fixes #27267

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

(cherry picked from commit d296f9653345d79ee316c053f63a489f001565a5)

2 weeks agoFix ML-KEM key equality check when either unset
Viktor Dukhovni [Tue, 16 Sep 2025 12:40:32 +0000 (22:40 +1000)] 
Fix ML-KEM key equality check when either unset

Fixes #28563

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

(cherry picked from commit d20cbc90e48cdd2a56444fc5d6f244d36362cb49)

2 weeks agoRevert "rsa: expose pairwise consistency test API"
Eugene Syromiatnikov [Mon, 15 Sep 2025 20:55:59 +0000 (22:55 +0200)] 
Revert "rsa: expose pairwise consistency test API"

This reverts commit dc5cd6f70a0e "rsa: expose pairwise consistency test API",
that has introduced ossl_rsa_key_pairwise_test() function, as the only user
has been removed in 7f7f75816f26 "import pct: remove import PCTs for most
algorithms".

Complements: 7f7f75816f26 "import pct: remove import PCTs for most algorithms"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28557)

(cherry picked from commit 5a299cb0d4c4fa0d7ac25855ceba288278efda7f)

2 weeks agoFix cipher protocol ID type in docs
Grzesiek11 [Thu, 11 Sep 2025 15:13:48 +0000 (17:13 +0200)] 
Fix cipher protocol ID type in docs

The cipher protocol ID, the return type of SSL_CIPHER_get_protocol_id,
is uint16_t and correctly described in docs to be 2 bytes, however the
function signature on the same page incorrectly pointed to it being
uint32_t, which is 4 bytes.

CLA: trivial

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

(cherry picked from commit 9bdf93776d741726895e6a42ffebd63366296e94)

2 weeks agoUpdated SSL Trace to display the name for all MLKEM-based groups
Ryan Hooper [Tue, 9 Sep 2025 14:43:51 +0000 (10:43 -0400)] 
Updated SSL Trace to display the name for all MLKEM-based groups

Make SSL Trace to display the name of the MLKEM512, MLKEM768,
MLKEM1024 and SecP384r1MLKEM1024 groups.

Fixes #28476

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

(cherry picked from commit f2a41c74aeed0f0c1cfb04f4f07bd476c39f39c1)

2 weeks agodoc: clarify SSL_SESSION_get0_hostname() DESCRIPTION
Ritesh Kudkelwar [Thu, 11 Sep 2025 04:38:34 +0000 (10:08 +0530)] 
doc: clarify SSL_SESSION_get0_hostname() DESCRIPTION

Also refine RETURN VALUES.

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

(cherry picked from commit 32ec97521397597764f72d4e7c279c4e815352ee)

2 weeks agoproviders/implementations/keymgmt/ecx_kmgmt.c.in: remove PCT on ECX import
Eugene Syromiatnikov [Tue, 16 Sep 2025 14:25:33 +0000 (16:25 +0200)] 
providers/implementations/keymgmt/ecx_kmgmt.c.in: remove PCT on ECX import

While PCT on import has been removed for DH, EC, RSA, and SLH-DSA,
ECX seems to be overlooked.  Correct that omission.

Complements: 7f7f75816f26 "import pct: remove import PCTs for most algorithms"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28573)

(cherry picked from commit 05d12fdd955d4cb3efc769becc3d5ceb9a322fdc)

2 weeks agotest/recipes/25-test_verify.t: correct the number of skipped tests on Win/VMS
Eugene Syromiatnikov [Thu, 18 Sep 2025 00:29:10 +0000 (02:29 +0200)] 
test/recipes/25-test_verify.t: correct the number of skipped tests on Win/VMS

On 3.5, there is one test fewer to be skipped due to absence of support
of colon in filenames after the commit b3e7dad7ac08 "Fix
test/recipes/25-test_verify.t [3.5]", provide the correct number
in the skip call.

Fixes: b3e7dad7ac08 "Fix test/recipes/25-test_verify.t [3.5]"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28591)

2 weeks agocrypto/ml_dsa: fix public_from_private() error path to return failure
rodeka [Tue, 16 Sep 2025 17:38:17 +0000 (20:38 +0300)] 
crypto/ml_dsa: fix public_from_private() error path to return failure

The error label returned success (1) even on failure. Make it return failure (0) instead.
Fixes #28562

CLA: trivial

Reviewed-by: Todd Short <todd.short@me.com>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/28576)

(cherry picked from commit 925e4fba1098036e8f8d22652cff6f64c5c7d571)

2 weeks agoFix logic errors in torture_rw_high/low test
Bernd Edlinger [Tue, 16 Sep 2025 15:18:33 +0000 (17:18 +0200)] 
Fix logic errors in torture_rw_high/low test

"old" was never assigned anything and the first
assignment to "*iterations" in the loop was superfluous.

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

(cherry picked from commit a1f6bbf6b0eb5bd15569b225bb0bd443fa879c9c)

2 weeks ago25-test_verify.t: fix partly case-sensitive matching for Windows OS: s/MsWin32/MSWin32/
Dr. David von Oheimb [Sat, 26 Jul 2025 08:46:21 +0000 (10:46 +0200)] 
25-test_verify.t: fix partly case-sensitive matching for Windows OS: s/MsWin32/MSWin32/

Fixes #27984

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28098)

(cherry picked from commit ee16664f6a1887048638e3d645fac38fb9c7f0d2)

2 weeks agoPrepare for 3.5.4 28564/head
openssl-machine [Tue, 16 Sep 2025 12:05:43 +0000 (12:05 +0000)] 
Prepare for 3.5.4

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

2 weeks agoPrepare for release of 3.5.3 openssl-3.5.3
openssl-machine [Tue, 16 Sep 2025 12:05:33 +0000 (12:05 +0000)] 
Prepare for release of 3.5.3

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

2 weeks agomake update
openssl-machine [Tue, 16 Sep 2025 12:05:32 +0000 (12:05 +0000)] 
make update

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

2 weeks agoCopyright year updates
openssl-machine [Tue, 16 Sep 2025 12:03:50 +0000 (12:03 +0000)] 
Copyright year updates

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

2 weeks agoCHANGES.md, NEWS.md: update for 3.5.3
Eugene Syromiatnikov [Mon, 15 Sep 2025 23:40:35 +0000 (01:40 +0200)] 
CHANGES.md, NEWS.md: update for 3.5.3

CHANGES.md:
 * https://github.com/openssl/openssl/pull/28198
 * https://github.com/openssl/openssl/pull/28398
 * https://github.com/openssl/openssl/pull/28411
 * https://github.com/openssl/openssl/pull/28447
 * https://github.com/openssl/openssl/pull/28449

NEWS.md:
 * https://github.com/openssl/openssl/pull/28447

Release: Yes
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/28558)

3 weeks agoTest failure of rsa_encrypt when buffer too short
Viktor Dukhovni [Sat, 13 Sep 2025 02:52:42 +0000 (12:52 +1000)] 
Test failure of rsa_encrypt when buffer too short

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28517)

(cherry picked from commit d498f56d0ab4a7a56746961848e07f561df5fdaf)

3 weeks agoHarden RSA public encrypt
Viktor Dukhovni [Thu, 11 Sep 2025 08:50:44 +0000 (18:50 +1000)] 
Harden RSA public encrypt

Check the that the indicated output buffer length is large enough.

Fix EVP_SealInit() to initialise the output buffer length to the RSA
modulus length, not the input KEK length.

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28517)

(cherry picked from commit f34b1ad17ba37a76a96e53be3813d88bf2b329f2)

3 weeks agoOSSL_CALLBACK.pod: add missing info on required return values of callback functions
Dr. David von Oheimb [Mon, 14 Apr 2025 19:09:16 +0000 (21:09 +0200)] 
OSSL_CALLBACK.pod: add missing info on required return values of callback functions

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28474)

(cherry picked from commit 1875bb0fecf6584cfe62dc5c454648e50a9ad281)

3 weeks agodoc: Add missing commas
Jakub Jelen [Tue, 9 Sep 2025 16:10:30 +0000 (18:10 +0200)] 
doc: Add missing commas

CLA: trivial
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/28493)

(cherry picked from commit 1199882de69bf41225002603a8c3634c401ff99a)

3 weeks agoAdd one more trace message to the torture_rcu_high test
Bernd Edlinger [Mon, 8 Sep 2025 21:00:55 +0000 (23:00 +0200)] 
Add one more trace message to the torture_rcu_high test

It is interesting that in the very rare cases, where this
test failure has been observed so far, the rcu torture value
went always backwards to 0.  This could be either due to
ossl_rcu_deref(&writer_ptr) returning NULL, or the initial
value of "new = CRYPTO_zalloc(sizeof(uint64_t), NULL, 0)"
still visible despite ossl_rcu_assign_ptr(&writer_ptr, &new)
immediatley after the "*new = global_ctr++" statement.
Add one additional trace message to find out what exactly
happens here, when it happens again.
Additionally, we do no longer initialize the new value to
zero but something else, so it can also be detected.

Related to #27267

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

(cherry picked from commit 17d5c9297ef6f6a4d72788082d6772deb7a18f24)

3 weeks agodoc/man3/RAND_load_file.pod: RAND_load_file on non-regular files with bytes=-1
Eugene Syromiatnikov [Fri, 29 Aug 2025 08:29:26 +0000 (10:29 +0200)] 
doc/man3/RAND_load_file.pod: RAND_load_file on non-regular files with bytes=-1

Mention that RAND_load_file attempts to read only RAND_DRBG_STRENGTH
bytes on non-regular files if the number of bytes to be read
is not specified explicitly.

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: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28379)

(cherry picked from commit 0daaf33275196dd5af9535d69b0d521b9e4d03de)

3 weeks agocrypto/rand/randfile.c: avoid signed integer overflow in RAND_load_file
Eugene Syromiatnikov [Fri, 29 Aug 2025 08:02:39 +0000 (10:02 +0200)] 
crypto/rand/randfile.c: avoid signed integer overflow in RAND_load_file

If a file supplied to RAND_load_file is too big (more than INT_MAX bytes),
it is possible to trigger a signer integer overflow during ret calculation.
Avoid it by returning early when we are about to hit it on the next
iteration.

Reported-by: Liu-Ermeng <liuermeng2@huawei.com>
Resolves: https://github.com/openssl/openssl/issues/28375
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: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28379)

(cherry picked from commit 35db6a15d436aa4d981ebcd581eded55fc8c8fb6)

3 weeks agoMake the Unix build process more repeatable
Enji Cooper [Fri, 5 Sep 2025 03:22:00 +0000 (20:22 -0700)] 
Make the Unix build process more repeatable

Before this change all manpages would contain the date when pod2man was
run. This resulted in outputs that differed between builds--or
potentially across a single build if the host clock "ticked" to the next
day when the build was being run.

This commit modifies the manpage generation process as follows:
- The date all manpages were generated will be normalized to a single
  date.
- The release date specified in `VERSION.dat` is used instead of the
  date/time when `pod2man` was executed OR--in the event a date isn't
  specified in `VERSION.dat`--the time when the Makefiles were last
  regenerated.

Embedding a consistent date into the generated manpages helps ensure that
the build process as a whole is more repeatable and helps ensure that
release versions of OpenSSL create artifacts consistent with the date
that the official release was cut.

Co-authored-by: Richard Levitte <levitte@openssl.org>
Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28449)

(cherry picked from commit 2c0c9c83b292fdba001d968a8219db4083294003)

3 weeks agoopenssl-enc.pod.in: We actually use PKCS#7 padding
Sergey G. Brester [Wed, 27 Aug 2025 22:26:11 +0000 (00:26 +0200)] 
openssl-enc.pod.in: We actually use PKCS#7 padding

PKCS#5 padding is a subset for 8-bytes block ciphers only.

CLA: trivial

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

(cherry picked from commit 4e0c2d02a9a415823babf74106985352e7bbcdae)

3 weeks agoRISC-V: Use address for vlenb CSR
Hongren Zheng [Tue, 2 Sep 2025 14:00:10 +0000 (22:00 +0800)] 
RISC-V: Use address for vlenb CSR

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

(cherry picked from commit 1a278e765a5167368268cd3034649c2c5d504c11)

3 weeks agoAdd a helper function to delete the extension list
David Benjamin [Sun, 31 Aug 2025 22:09:52 +0000 (18:09 -0400)] 
Add a helper function to delete the extension list

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

(cherry picked from commit 9e8898b6b6032a69f1002ab823a1cc0bba109b50)

3 weeks agoClear the extension list when removing the last extension
David Benjamin [Sun, 31 Aug 2025 21:25:40 +0000 (17:25 -0400)] 
Clear the extension list when removing the last extension

The extensions list in a certificate, CRL, and CRL entry is defined as:

    ... extensions      [3]  EXPLICIT Extensions OPTIONAL ...
    ... crlEntryExtensions      Extensions OPTIONAL ...
    ... crlExtensions           [0]  EXPLICIT Extensions OPTIONAL ...

    Extensions  ::=  SEQUENCE SIZE (1..MAX) OF Extension

This means that a present but empty extensions list is actually invalid.
Rather, if you have no extensions to encode, you are meant to omit the
list altogether. Fix the delete_ext functions to handle this correctly.

This would mostly be moot, as an application adding extensions only to
delete them all would be unusual. However, #13658 implemented a slightly
roundabout design where, to omit SKID/AKID, the library first puts them
in and then the command-line tool detects some placeholder values and
deletes the extension again.

Fixes #28397

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

(cherry picked from commit 9a8d7dc14201aeeed1e77d54208e4af96916fc4f)

3 weeks agoFix typo in BN_generate_prime docs
Viperinius [Sun, 31 Aug 2025 16:09:11 +0000 (16:09 +0000)] 
Fix typo in BN_generate_prime docs

CLA: trivial

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28395)

(cherry picked from commit b64ac3cb8330d417a7fa859fe74e0bd41805a6db)

3 weeks agodoc: Update documentation of SSL_CTX_set_dh_auto()
Ryan Hooper [Thu, 28 Aug 2025 13:12:39 +0000 (09:12 -0400)] 
doc: Update documentation of SSL_CTX_set_dh_auto()

Update the documentation of the dh_tmp_auto argument in
regards to its behavior when the argument value is 2.

Fixes #27606

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

(cherry picked from commit 7600608eab0cd0a633e4d989d634590831b48a5d)

3 weeks agodocs: Be case specific with links to man headers
Norbert Pocs [Wed, 27 Aug 2025 13:45:45 +0000 (15:45 +0200)] 
docs: Be case specific with links to man headers

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

(cherry picked from commit 56ce30abb7bdf88a020557e70e0489eff541d097)

3 weeks agoapps: remove chopup_args()
Eugene Syromiatnikov [Thu, 4 Sep 2025 14:37:02 +0000 (16:37 +0200)] 
apps: remove chopup_args()

The last (and only?) user has been removed in commit eca471391378 "APPS:
Drop interactive mode in the 'openssl' program".

Complements: eca471391378 "APPS: Drop interactive mode in the 'openssl' program"
Signed-off-by: Eugene Syromiatnikov <esyr@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/28441)

(cherry picked from commit 3f77491cb336df843984139fbb6fb16f47daf876)

4 weeks agohmac: stop using secure memory for the HMAC key
Pauli [Mon, 1 Sep 2025 22:48:06 +0000 (08:48 +1000)] 
hmac: stop using secure memory for the HMAC key

Secure memory is design for long term storage of private material.
HMAC keys are not this.

Secure memory use was introduced in July 2020 by commit
3fddbb264e87a8cef2903cbd7b02b8e1a39a2a99.

Fixes #28346

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

(cherry picked from commit 362739d771f671b444cb9a12a34accf2dce8220e)

4 weeks agodemos/certs: properly handle "$@"
Eugene Syromiatnikov [Mon, 1 Sep 2025 14:45:25 +0000 (16:45 +0200)] 
demos/certs: properly handle "$@"

There is little reason $@ should be used unquoted;  also, "$@"
should be used instead of $* in order to pass the script arguments
to a function.

Fixes: bcd92754d56a "demos: fix cert scripts"
Fixes: 79b184fb4b65 "Extend certificate creation examples to include CRL generation and sample"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
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/28406)

4 weeks agoapps/ocsp.c: avoid using NULL resp
Eugene Syromiatnikov [Mon, 1 Sep 2025 14:42:15 +0000 (16:42 +0200)] 
apps/ocsp.c: avoid using NULL resp

There are some code paths where resp is used without a previous check
for being non-NULL (specifically, OCSP_response_create() can return
NULL, and do_responder() can return -1, that would also lead to resp
being NULL).  Avoid hitting NULL dereferences by wrapping the code that
uses resp in "if (resp != NULL)".

Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1665155
References: https://github.com/openssl/project/issues/1362
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
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/28406)

4 weeks agocrypto/x509/t_req.c: avoid exts leaking on error paths
Eugene Syromiatnikov [Mon, 1 Sep 2025 14:34:34 +0000 (16:34 +0200)] 
crypto/x509/t_req.c: avoid exts leaking on error paths

If an error occurred and jump to the "err" label is performed after
exts has been allocated, it can leak.  Avoid that by adding
sk_X509_EXTENSION_pop_free() on the error path and setting exts to NULL
after sk_X509_EXTENSION_pop_free() in the normal handling.

Fixes: ae880ae6719e "Fix error handling in X509_REQ_print_ex"
Fixes: 87c49f622e7f "Support for parsing of certificate extensions in PKCS#10 requests: these are"
Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1665161
References: https://github.com/openssl/project/issues/1362
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
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/28406)

4 weeks agotest/radix/quic_bindings.c: move locking after child_script_info assignment
Eugene Syromiatnikov [Mon, 1 Sep 2025 12:38:10 +0000 (14:38 +0200)] 
test/radix/quic_bindings.c: move locking after child_script_info assignment

Coverity complains that some child_script_info field accesses are guarded
by the mutexes, while others are not;  placate it by performing the assignment
before taking the lock.

Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1665151
References: https://github.com/openssl/project/issues/1362
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
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/28406)

4 weeks agodoc/man1/openssl-enc.pod.in: document 'k' handling for -bufsize
Eugene Syromiatnikov [Mon, 1 Sep 2025 12:08:08 +0000 (14:08 +0200)] 
doc/man1/openssl-enc.pod.in: document 'k' handling for -bufsize

Apparently, '-bufsize' option parser can handle the 'k' suffix
(and treat is as the value being provided in the multiples of 1024).
Document that.

Complements: d02b48c63a58 "Import of old SSLeay release: SSLeay 0.8.1b"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
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/28406)

4 weeks agoapps/enc.c: avoid signed integer overflow on bufsize assignment
Eugene Syromiatnikov [Mon, 1 Sep 2025 12:05:33 +0000 (14:05 +0200)] 
apps/enc.c: avoid signed integer overflow on bufsize assignment

The calculated option value, while being long-typed, is not checked
for fitting into int-sized bufsize.  Avoid overflow by throwing error
if it is bigger than INT_MAX and document that behaviour.

Fixes: 7e1b7485706c "Big apps cleanup (option-parsing, etc)"
Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1665149
References: https://github.com/openssl/project/issues/1362
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
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/28406)

4 weeks agoslh-dsa: omit test of import PCT
Pauli [Thu, 4 Sep 2025 21:24:19 +0000 (07:24 +1000)] 
slh-dsa: omit test of import PCT

Reviewed-by: Neil Horman <nhorman@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/28447)

(cherry picked from commit c25db4f867c8adc9d1a3b5336743c428a2bb8ca2)

4 weeks agoimport pct: remove import PCTs for most algorithms
Pauli [Thu, 4 Sep 2025 21:23:28 +0000 (07:23 +1000)] 
import pct: remove import PCTs for most algorithms

This coveres DH, EC, RSA and SLH-DSA.

Reviewed-by: Neil Horman <nhorman@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/28447)

(cherry picked from commit 7f7f75816f2643daa9c1ba986aa17d50ae72dce7)

4 weeks agoAdd missing unlock to ossl_provider_new
two-heart [Thu, 4 Sep 2025 09:18:01 +0000 (11:18 +0200)] 
Add missing unlock to ossl_provider_new

unlock on the early return path

CLA: trivial

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

(cherry picked from commit c89b46826caff4ced320268f284d963ff06dee77)

4 weeks agoUpdate news and changes for the 3.5.3 release
Norbert Pocs [Mon, 1 Sep 2025 16:11:19 +0000 (18:11 +0200)] 
Update news and changes for the 3.5.3 release

Release: yes

Signed-off-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28409)

4 weeks agoX509_VERIFY_PARAM_get0(): add check to defend on out-of-bound table access
Dr. David von Oheimb [Thu, 28 Aug 2025 16:33:06 +0000 (18:33 +0200)] 
X509_VERIFY_PARAM_get0(): add check to defend on out-of-bound table access

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/28370)

(cherry picked from commit ceb45f64bde3d299c7ef529e5cd5372e4a421366)

4 weeks agoFIPS: Don't allow SHA512-224 and SHA512-256 for ECDSA/DSA signatures
slontis [Fri, 29 Aug 2025 04:11:59 +0000 (14:11 +1000)] 
FIPS: Don't allow SHA512-224 and SHA512-256 for ECDSA/DSA signatures

These algorithms do not have OIDS (Note that RSA does have OIDS),
and are not valid values for FIPS.
Note that this was only possible if the "ECDSA" algorithm is fetched.
Note that "ECDSA-SHA512-256" and "ECDSA-SHA512-224" are not currently
fetchable.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/28377)

(cherry picked from commit 5ce54ae14bd1ad1934dfe493fe39d89eb1d5b72d)

4 weeks agoslh-dsa: enter FIPS error state if pairwise test fails
Pauli [Sun, 31 Aug 2025 07:21:42 +0000 (17:21 +1000)] 
slh-dsa: enter FIPS error state if pairwise test fails

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28394)

(cherry picked from commit a7d2754661e85d14d9629fb4db0f8f5fcef28e61)

5 weeks agoDocument the OSSL_SELF_TEST_TYPE_PCT_IMPORT failure state
Pauli [Fri, 29 Aug 2025 02:47:35 +0000 (12:47 +1000)] 
Document the OSSL_SELF_TEST_TYPE_PCT_IMPORT failure 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 dc442241b2b6b14f5a5c578c16c33050ef651b45)

5 weeks agoml-kem: convert to transient error state on import failure in FIPS provider
Pauli [Fri, 29 Aug 2025 02:43:09 +0000 (12:43 +1000)] 
ml-kem: convert to transient error state on import failure in FIPS provider

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 eaba675c4b300e18aa4a200a75ff9566653afda8)

5 weeks agoml-dsa: convert to transient error state on import failure in FIPS provider
Pauli [Fri, 29 Aug 2025 02:43:01 +0000 (12:43 +1000)] 
ml-dsa: convert to transient error state on import failure in FIPS provider

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 56a791209c1e63222b1680151709fabd86948548)

5 weeks agoecx: convert to transient error state on import failure in FIPS provider
Pauli [Fri, 29 Aug 2025 02:42:46 +0000 (12:42 +1000)] 
ecx: convert to transient error state on import failure in FIPS provider

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 811f68ffe2cb97ab997c11b0429236135eb437c0)

5 weeks agoec: convert to transient error state on import failure in FIPS provider
Pauli [Fri, 29 Aug 2025 02:42:35 +0000 (12:42 +1000)] 
ec: convert to transient error state on import failure in FIPS provider

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 d6f398cc957b704d6af43c9c1f55a5f432226fd0)

5 weeks agodh: convert to transient error state on import failure in FIPS provider
Pauli [Fri, 29 Aug 2025 02:42:17 +0000 (12:42 +1000)] 
dh: convert to transient error state on import failure in FIPS provider

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 c2ebeeeff67948cd4f44fc5e4a777cf9ea293f17)

5 weeks agorsa: convert to transient error state on import failure in FIPS provider
Pauli [Fri, 29 Aug 2025 02:42:00 +0000 (12:42 +1000)] 
rsa: convert to transient error state on import failure in FIPS provider

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 864a5f6641cd89bc38b28e821701b21957c96341)

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)