]> git.ipfire.org Git - thirdparty/openssl.git/log
thirdparty/openssl.git
2 months agoThe condition that is never checked has been removed.
Dmitriy Denisov [Tue, 13 May 2025 08:56:33 +0000 (11:56 +0300)] 
The condition that is never checked has been removed.

If criterion == OSSL_STORE_SEARCH_BY_KEY_FINGERPRINT, the criterion !=0 condition will be triggered.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27607)

(cherry picked from commit 00480f1def86aab882f2bd4d15d2d03862009718)

2 months agodemos/bio/sconnect.c: Free ssl_bio on error to avoid memory leak
JiashengJiang [Fri, 16 May 2025 13:37:48 +0000 (09:37 -0400)] 
demos/bio/sconnect.c: Free ssl_bio on error to avoid memory leak

Call BIO_free() to release ssl_bio if an error occurs before BIO_push(), preventing a memory leak.

Fixes: 396e720965 ("Fix certificate validation for IPv6 literals in sconnect demo")
Signed-off-by: JiashengJiang <jiasheng@purdue.edu>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27639)

(cherry picked from commit 55d8d859797e8229bc499bbc7c3c76821b654682)

2 months agocrypto/x509/v3_lib.c: Free tmpext if X509V3_EXT_add() fails to avoid memory leak
JiashengJiang [Mon, 5 May 2025 17:46:53 +0000 (13:46 -0400)] 
crypto/x509/v3_lib.c: Free tmpext if X509V3_EXT_add() fails to avoid memory leak

Add OPENSSL_free to free tmpext if X509V3_EXT_add() fails to avoid memory leak.

Fixes: 878dc8dd95 ("Join the x509 and x509v3 directories")
Signed-off-by: JiashengJiang <jiasheng@purdue.edu>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27566)

(cherry picked from commit 5f661e4e96bc3bfa52b4e0735f407cb41f162869)

2 months agoFix build failure on AIX
sashan [Fri, 11 Apr 2025 15:42:31 +0000 (17:42 +0200)] 
Fix build failure on AIX

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

(cherry picked from commit e11fdd8293c5e13e09c817b89b9c3d4c1a46d857)

2 months agodemos/guide/tls-client-block.c Spelling correction
Benson Muite [Tue, 13 May 2025 15:52:22 +0000 (18:52 +0300)] 
demos/guide/tls-client-block.c Spelling correction

Fix spelling error in one word.

CLA: trivial

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
(Merged from https://github.com/openssl/openssl/pull/27611)

(cherry picked from commit 10bd6fa8ca93b4cf53f005f110c827ed923c89a4)

2 months agos3_lib.c: Use illegal_parameter for failing encapsulation in ml_kem
Norbert Pocs [Thu, 15 May 2025 07:53:00 +0000 (09:53 +0200)] 
s3_lib.c: Use illegal_parameter for failing encapsulation in ml_kem

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

(cherry picked from commit e66097fc6687750ac792986a71375b23793766c2)

2 months agos3_lib.c: Handle weak x keys as illegal_parameter alert
Norbert Pocs [Sun, 11 May 2025 15:36:05 +0000 (17:36 +0200)] 
s3_lib.c: Handle weak x keys as illegal_parameter alert

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

(cherry picked from commit 5da4ea10be8cf8ca66dff95c9997966f21c82029)

2 months agotest/testutil/testutil_init.c: Add OPENSSL_free() to avoid memory leak
JiashengJiang [Mon, 12 May 2025 14:02:05 +0000 (10:02 -0400)] 
test/testutil/testutil_init.c: Add OPENSSL_free() to avoid memory leak

Free trace_data if error occurs to avoid memory leak.

Fixes: d73458d17a ("Add tracing capability in test utilities")
Signed-off-by: JiashengJiang <jiasheng@purdue.edu>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27600)

(cherry picked from commit 3818f7779ef4bf4d4ccacd13506ec92885e45553)

2 months agoStop a TLSv1.3 server emitting an unsolicited PSK extension
Matt Caswell [Thu, 8 May 2025 13:54:35 +0000 (14:54 +0100)] 
Stop a TLSv1.3 server emitting an unsolicited PSK extension

If we attempt to accept a connection on an SSL object, and the
application has set an SSL_SESSION on that SSL object then we
can mistakenly believe that we are resuming and
emit an unsolicited PSK extension back to the client.

This can especially happen when using SSL_clear() which leaves
any SSL_SESSION associated with the SSL object.

See
https://github.com/openssl/openssl/discussions/27563#discussioncomment-13049352
and
https://github.com/openssl/openssl/discussions/24567

Reviewed-by: Todd Short <todd.short@me.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27584)

(cherry picked from commit aa8bca2e81030560d690cb68bbcbe8b7d00d1d29)

2 months agoAPPS/cmp.c: fix char encoding of subject, issuer, sender, and recipient DN
Dr. David von Oheimb [Fri, 9 May 2025 09:44:57 +0000 (11:44 +0200)] 
APPS/cmp.c: fix char encoding of subject, issuer, sender, and recipient DN

Fixes #27572

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

(cherry picked from commit 35e431ed6daa894ee5385363cf4cfe4954312e4d)

2 months agochacha_poly: fix settable ctx param list
Pauli [Wed, 30 Apr 2025 22:12:00 +0000 (08:12 +1000)] 
chacha_poly: fix settable ctx param list

The settable list used the generic AEAD cipher list which included
an extra parameter and omitted the IV length one.  The set ctx param call
was custom so the errant list didn't directly impact operation.

The comment about ignoring OSSL_CIPHER_PARAM_AEAD_MAC_KEY is completely bogus.
That parameter isn't accepted either here or by the shared AEAD cipher params.

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

(cherry picked from commit 1c63382294750c9111e23931dcd5637d60d1b6c4)

2 months agoAdd a test for app data received too early
Matt Caswell [Fri, 2 May 2025 15:40:50 +0000 (16:40 +0100)] 
Add a test for app data received too early

Add a test for app data which was received prior to the Finished is read
correctly, and that if we continue to read we get the expected result.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Todd Short <todd.short@me.com>
(Merged from https://github.com/openssl/openssl/pull/27543)

(cherry picked from commit af712a59332ff9052d4618a70dc662cb637556bf)

2 months agoEnsure we properly release DTLS buffered app data records
Matt Caswell [Fri, 2 May 2025 15:37:32 +0000 (16:37 +0100)] 
Ensure we properly release DTLS buffered app data records

If we read an app data record before we have read the Finished we buffer
it. Once we've read it we need to make sure we've properly released it
otherwise we will attempt to read it again (and this time there will be
no data in it).

Fixes #27316

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Todd Short <todd.short@me.com>
(Merged from https://github.com/openssl/openssl/pull/27543)

(cherry picked from commit d459d00f97959d5003b29f32d52a53208507cda1)

2 months agotest/bio_comp_test.c: Initialize pointer to avoid undefined behavior
JiashengJiang [Mon, 5 May 2025 18:23:38 +0000 (14:23 -0400)] 
test/bio_comp_test.c: Initialize pointer to avoid undefined behavior

If the allocation for "original" fails, "result" may be freed without being
properly initialized. Since result could hold a random value due to its
assignment in do_bio_comp_test(), freeing it without initialization is unsafe
and may lead to undefined behavior.

Fixes: 12e96a2360 ("Add brotli compression support (RFC7924)")
Signed-off-by: JiashengJiang <jiasheng@purdue.edu>
Reviewed-by: Paul Dale <ppzgs1@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/27569)

(cherry picked from commit 4dca928a29cbe413f2416ac5e1ba2fe4e073f608)

2 months agoAdd a test for sending an empty app data record in DTLS
Matt Caswell [Wed, 30 Apr 2025 12:09:58 +0000 (13:09 +0100)] 
Add a test for sending an empty app data record in DTLS

DTLS should ignore this

Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27541)

(cherry picked from commit fe01b4d2f62261a6c78d5c2a7608d4ba76c6d6f3)

2 months agoDrop empty app data records in DTLS
Matt Caswell [Tue, 29 Apr 2025 13:21:49 +0000 (14:21 +0100)] 
Drop empty app data records in DTLS

App data records with 0 bytes of payload will confuse callers of SSL_read().
This will cause a successful read and return 0 bytes as read. Unfortunately
a 0 return from SSL_read() is considered a failure response. A subsequent
call to SSL_get_error() will then give the wrong result.

Zero length app data records are actually allowed by the spec, but have
never been handled correctly by OpenSSL. We already disallow creating such
empty app data records. Since the SSL_read() API does not have a good way to
handle this type of read, we simply ignore them.

Partial fix for #27316

Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27541)

(cherry picked from commit a23d5e20f162564d8c13bda50ea358caaa7b047c)

2 months agocrypto/provider_conf.c: Fix possible memory leak
JiashengJiang [Mon, 5 May 2025 01:41:39 +0000 (21:41 -0400)] 
crypto/provider_conf.c: Fix possible memory leak

Assign the return value of ossl_provider_info_add_to_store to added instead of
setting it directly to 1, in order to avoid a memory leak caused by entry not
being freed if ossl_provider_info_add_to_store() fails.

Signed-off-by: JiashengJiang <jiasheng@purdue.edu>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27472)

(cherry picked from commit 9884f1dc11675a5c4613339cfb92903c6ba6103f)

3 months agoFix use after free bugs for public_keys and private_keys in evp_test
Tobias Brick [Thu, 17 Apr 2025 14:50:36 +0000 (14:50 +0000)] 
Fix use after free bugs for public_keys and private_keys in evp_test

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

(cherry picked from commit 81e8b5a5038b4952a22b2dc9fcf9994615ee8dc4)

3 months agoDisable unterminated-string-initialization in strict-warnings
Neil Horman [Thu, 24 Apr 2025 13:26:33 +0000 (09:26 -0400)] 
Disable unterminated-string-initialization in strict-warnings

Recently updated to fedora 42, which includes an updated gcc, which
triggers a new warning:

test/afalgtest.c:44:9: error: initializer-string for array of 'unsigned char' truncates NUL terminator but destination lacks 'nonstring' attribute (18 chars into 17 available) [-Werror=unterminated-string-initialization]
   44 |         "\x53\x69\x6e\x67\x6c\x65\x20\x62\x6c\x6f\x63\x6b\x20\x6d\x73\x67"

The warning occurs because in some locations we create char buffers of
length X, and fill it with X bytes of data, truncating the NULL
terminator.

We could fix it by adding the nonstring attribute, but given that:
1) Adding attributes might impact other platforms that don't understand the
   attribute.

2) We often create char buffers that don't expect a NULL terminator.

3) Converting the unsigned char arrays to uint8_t, or other types that
   could be interpreted as non-strings has no impact, only applying the
   nonstring attribute silences the warning.

It seems more sensible to just disable the warning entirely

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

(cherry picked from commit d08d77789e20e8b47a48f4d0a998ccfcde9d389b)

3 months agosslecho: Rename bool to flag to avoid C23 conflict
Tomas Mraz [Mon, 28 Apr 2025 14:00:32 +0000 (16:00 +0200)] 
sslecho: Rename bool to flag to avoid C23 conflict

Fixes #27516

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/27519)

(cherry picked from commit 81ce3d3ae8f6c4021e0dce86891e869efa1710db)

3 months agoossl_json_f64() seems to be unused, remove it to avoid libm dependency
sashan [Fri, 18 Apr 2025 10:09:52 +0000 (12:09 +0200)] 
ossl_json_f64() seems to be unused, remove it to avoid libm dependency

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

(cherry picked from commit 0e418628998d0337599643c1e4054c60e5f21ec4)

3 months agoClarify how s_client -ign_eof and -quiet impact command processing
Matt Caswell [Fri, 25 Apr 2025 14:21:47 +0000 (15:21 +0100)] 
Clarify how s_client -ign_eof and -quiet impact command processing

If -ign_eof -or -quiet are passed to s_client this implicitly turns off
command processing (i.e. equivalent to -nocommands). This was stated on
the man page in the "CONNECTED COMMANDS" section, but not in the
documentation for "-ign_eof" or "-quiet" directly. We state it here as
well to make it clearer.

Fixes #27443

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

(cherry picked from commit 20fb5dcb1e2b762545aa127058cc11efe09d6700)

3 months agoTest+fix handling "wrong" downgrade signals
Anton Tieleman [Mon, 28 Apr 2025 11:49:25 +0000 (13:49 +0200)] 
Test+fix handling "wrong" downgrade signals

This accounts for cases that can only occur when een non-compliant server sends
the wrong downgrade signal. (TLS1.1 signal when negotiating TLS1.2 or TLS1.2
signal when negotiating TLS1.0/TLS1.1). According to the TLS1.3 RFC these
cases should be rejected:

RFC8446, section 4.1.3: TLS 1.3 clients receiving a ServerHello indicating
TLS 1.2 or below MUST check that the last 8 bytes are not equal to either of
these values. TLS 1.2 clients SHOULD also check that the last 8 bytes are
not equal to the second value if the ServerHello indicates TLS 1.1 or below.

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

(cherry picked from commit 290fd4a0c87b5f777e928a80503ee20ca6e768de)

3 months agoRepair downgrade tests
Anton Tieleman [Mon, 28 Apr 2025 11:30:01 +0000 (13:30 +0200)] 
Repair downgrade tests

A number of these tests were failing for the wrong reasons. The intention is to verify
that the client sends an illegal parameter alert when an unexpected downgrade signal
is received. Instead, a number of tests failed because TLS1.1 was not available. The
tests are adapted to explicitly check for an illegal parameter alert from the client.

Client and server flags are updated to enable TLS1.1 where required and a few tests
requiring TLS1.1 were moved to be disabled when TLS1.1 is not available.

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

(cherry picked from commit 7535f26210afa386fe9021a79dbaea13fbb9e649)

3 months agoBIO_dump_indent_cb(): Check for negative return from BIO_snprintf()
Tomas Mraz [Fri, 25 Apr 2025 08:04:37 +0000 (10:04 +0200)] 
BIO_dump_indent_cb(): Check for negative return from BIO_snprintf()

In practice this cannot happen but Coverity complains.

Fixes Coverity 1646683

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

(cherry picked from commit 56c739816f3dacbb024ceae29c546abe677ee02c)

3 months agoFix also BIO_printf formatting for INF and NAN
Bernd Edlinger [Thu, 24 Apr 2025 19:09:40 +0000 (21:09 +0200)] 
Fix also BIO_printf formatting for INF and NAN

Avoid infinite loooooooops in %e and %g formatting for +/-INF and
make the invalid value at least visible by using '?' as signvalue.

Fixes #26973

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

(cherry picked from commit b56dd5bfec8e790cc2d5b1bdca6ecd350a3b7779)

3 months agoFix P-384 curve on lower-than-P9 PPC64 targets
A. Wilcox [Thu, 17 Apr 2025 13:51:53 +0000 (08:51 -0500)] 
Fix P-384 curve on lower-than-P9 PPC64 targets

The change adding an asm implementation of p384_felem_reduce incorrectly
uses the accelerated version on both targets that support the intrinsics
*and* targets that don't, instead of falling back to the generics on older
targets.  This results in crashes when trying to use P-384 on < Power9.

Signed-off-by: Anna Wilcox <AWilcox@Wilcox-Tech.com>
Closes: #27350
Fixes: 85cabd94 ("Fix Minerva timing side-channel signal for P-384 curve on PPC")
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27429)

(cherry picked from commit 29864f2b0f1046177e8048a5b17440893d3f9425)

3 months agoRevert "Temporarily disable gost-engine tests in ci"
Neil Horman [Thu, 3 Apr 2025 21:52:44 +0000 (17:52 -0400)] 
Revert "Temporarily disable gost-engine tests in ci"

This reverts commit db9771b5a056d939b6112cdc099fbf4f86d184ee.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(cherry picked from commit 172076029c0bbb188e321f5832f6a15971834e90)

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

3 months agoupdate to latest version of gost-engine
Neil Horman [Thu, 3 Apr 2025 21:51:46 +0000 (17:51 -0400)] 
update to latest version of gost-engine

Need to pull in the latest version of its submodule, libprov which has
fixes for cmake 4.0

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(cherry picked from commit ae1396488721750f7482d2ec60950080312e1518)

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

3 months agoFix BIO_printf formatting for negative numbers formatted with %e
Richard Levitte [Wed, 23 Apr 2025 08:26:56 +0000 (10:26 +0200)] 
Fix BIO_printf formatting for negative numbers formatted with %e

Some parts of the formatting code assumed that the input number is
positive.  This is fixed by working on its absolute value.

test/bioprinttest.c is amended to test the output of negative numbers
as well.

Fixes #26973

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

(cherry picked from commit fb555eb7a1d523e9df5584b44d16d0f72417bd19)

3 months agodocs: update OSSL_PARAM_int documentation
Ryan Schanzenbacher [Sat, 8 Mar 2025 04:35:32 +0000 (23:35 -0500)] 
docs: update OSSL_PARAM_int documentation

This change adds an example to allow compilation without warnings using
compiler options like `-Wincompatible-pointer-types-discards-qualifiers`

Code for the example was inspired by libarchive's https://github.com/libarchive/libarchive/pull/1869/commits/9e3a7e4b6c77e8aa19a69430f48917dbc15b319d

Fixes #20956

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

(cherry picked from commit b83b67fe59511de951db1987fb2ab9e028e2da32)

3 months agoFix URL parsing to handle missing ports and ISO 8601 timestamps in paths
olszomal [Fri, 3 Jan 2025 07:42:55 +0000 (08:42 +0100)] 
Fix URL parsing to handle missing ports and ISO 8601 timestamps in paths

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

(cherry picked from commit 56910e7211363de26d3975635f4968c55de08eb6)

3 months agoTypo in TLS introduction
Christian Wansart [Mon, 21 Apr 2025 09:39:23 +0000 (11:39 +0200)] 
Typo in TLS introduction

CLA: trivial

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

(cherry picked from commit 9eb2c13432a703dc07c9ae021949c96517ce5246)

3 months agoReplace ilammy/setup-nasm with nasm install from choco
Dmitry Misharov [Tue, 22 Apr 2025 07:52:14 +0000 (09:52 +0200)] 
Replace ilammy/setup-nasm with nasm install from choco

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

(cherry picked from commit 1ad186986c8c90dfc58666531c0554641e022dbb)

3 months agoDocument SSL_CTX_set_min_proto_version defaults
Norbert Pocs [Wed, 16 Apr 2025 13:44:07 +0000 (15:44 +0200)] 
Document SSL_CTX_set_min_proto_version defaults

If the function is not called the settings default to 0.

Fixes #10584

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

(cherry picked from commit 871182d29dc24bbb51ff7a4d952ff9d9868f14b5)

3 months agoprovider-signature.pod: fix typos (digeset -> digest)
Dr. David von Oheimb [Mon, 14 Apr 2025 08:48:10 +0000 (10:48 +0200)] 
provider-signature.pod: fix typos (digeset -> digest)

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

(cherry picked from commit 7d14d1c46a6144c5f8eafc8d07b750324e1275be)

3 months agoprovider-signature.pod: fix doc of OSSL_SIGNATURE_PARAM_ALGORITHM_ID, describing...
Dr. David von Oheimb [Sun, 13 Apr 2025 19:58:35 +0000 (21:58 +0200)] 
provider-signature.pod: fix doc of OSSL_SIGNATURE_PARAM_ALGORITHM_ID, describing its relevance

This provides a fix for the documentation part of #22932.

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

(cherry picked from commit 23e3b3c0c5d8f29d95f518a1f0e40f3e1c63ead9)

3 months agotest: test for setting hkdf salt to null
Pauli [Wed, 9 Apr 2025 02:42:40 +0000 (12:42 +1000)] 
test: test for setting hkdf salt to null

Fixes #27302

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

(cherry picked from commit 727117960c0a47073290de936fb517db12351174)

3 months agohkdf: allow salt to be set to null
Pauli [Wed, 9 Apr 2025 02:42:10 +0000 (12:42 +1000)] 
hkdf: allow salt to be set to null

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

(cherry picked from commit 12eb6c58ff2a8d857924b3020d30c8d485ace0a7)

3 months agoProperly skip SM2 evp tests
Tobias Brick [Tue, 15 Apr 2025 20:30:39 +0000 (20:30 +0000)] 
Properly skip SM2 evp tests

Taken from commit 2a53830958b1e90231742e1d8ae0523d463560e3
as the patch overall does not apply cleanly to 3.3.

Reviewed-by: Paul Yang <kaishen.yy@antfin.com>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27400)

3 months agoFix OSSL_FUNC_keymgmt_load declaration in man7/provider-keymgmt
Mironenko [Fri, 28 Mar 2025 10:41:26 +0000 (13:41 +0300)] 
Fix OSSL_FUNC_keymgmt_load declaration in man7/provider-keymgmt

OSSL_FUNC_keymgmt_load prototype declared in man7 does not match
the actual OSSL_FUNC_keymgmt_load prototype declared in
include/openssl/core_dispatch.h. This commit fixes the prototype
in man7.

CLA: trivial

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

(cherry picked from commit ada231523f6569c92795e16c9a61b7190f2032b1)

3 months agoFix EVP_PKEY_CTX_dup() so that it copies the keymanager.
slontis [Wed, 9 Apr 2025 00:05:09 +0000 (10:05 +1000)] 
Fix EVP_PKEY_CTX_dup() so that it copies the keymanager.

A call to EVP_PKEY_CTX_new() creates a keymgmt pointer internally,
but EVP_PKEY_CTX_dup() does not copy this field.

Calling EVP_PKEY_derive_set_peer_ex() after EVP_PKEY_CTX_dup() resulted
in a segfault because it tried to access this pointer.

EVP_PKEY_CTX_dup() has been updated to copy the keymanager (and upref it).

Reported by Eamon ODea (Oracle).

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

(cherry picked from commit 3c22da73465f5dd211299e64f0de8786dcaf86c3)

3 months agoFix PKCS7_sign and CMS_sign default hash documentation
David Benjamin [Mon, 7 Apr 2025 20:40:05 +0000 (16:40 -0400)] 
Fix PKCS7_sign and CMS_sign default hash documentation

Fixes #27291. See issue for details.

Reviewed-by: Paul Yang <kaishen.yy@antfin.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/27292)

(cherry picked from commit 4f81470afadea3d1582d1df7f1b2b5e3ece63331)

3 months agoUpdated the change log to include SSLv3 being disabled by default.
emery [Mon, 7 Apr 2025 15:02:00 +0000 (11:02 -0400)] 
Updated the change log to include SSLv3 being disabled by default.

This change was implemented into version 1.1.0 and onward. The last version that had SSLv3 enabled was version 1.0.2h, which is why the addition was made where it is.

CLA: trivial

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

(cherry picked from commit 6509f18c9fdbf76a63e8c6056da989cd047a7fb2)

3 months agoRemove DAYS argument
Malcolm Hogan [Fri, 7 Mar 2025 23:30:43 +0000 (18:30 -0500)] 
Remove DAYS argument

This commit removes DAYS from certificate requests to avoid the warning

'Ignoring -days without -x509; not generating a certificate'

This argument is not needed with the -new argument. Additionally makes sure
$1 is handled when -nodes is not given. Preventing an uninitialized value
error when the DAYS argument is removed.

Fixes #26595

CLA: trivial

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

(cherry picked from commit d890ad2b96efea4f5f4b0db190017ce9a3897df7)

3 months agoFix potential NULL pointer dereference in final_maxfragmentlen()
Andrey Tsygunka [Fri, 4 Apr 2025 11:58:40 +0000 (14:58 +0300)] 
Fix potential NULL pointer dereference in final_maxfragmentlen()

In the final_maxfragmentlen() function, s->session is checked
for NULL after it was dereferenced earlier.
So move this NULL check to the top of the function.

CLA: trivial

Fixes: fa49560451 (Fix handling of max_fragment_length extension for PSK)
Signed-off-by: Andrey Tsygunka <aitsygunka@yandex.ru>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Paul Yang <kaishen.yy@antfin.com>
(Merged from https://github.com/openssl/openssl/pull/27272)

(cherry picked from commit 28de1f5004c1083d358e6934552124a201e0251e)

3 months agoFix test failures on big endian ARMv9 target
Bernd Edlinger [Thu, 3 Apr 2025 12:33:25 +0000 (14:33 +0200)] 
Fix test failures on big endian ARMv9 target

This fixes a couple of big-endian issues in the
assembler code of chacha, SM3 and SM4.

Fixes #27197
Tested-by: @zeldin
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27252)

(cherry picked from commit 1a81d509a001607e40eb49174fa555068bdf7c48)

3 months agossl/ssl_lib.c: Avoid crash when SSL_CONNECTION is NULL
Graham Leggett [Wed, 2 Apr 2025 11:08:11 +0000 (12:08 +0100)] 
ssl/ssl_lib.c: Avoid crash when SSL_CONNECTION is NULL

Detection for sc == NULL is performed after sc is used. Add the
check to the correct place.

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

(cherry picked from commit 7f6cc862c69800a72c49fcfe89e2931ee4ca2e7a)

3 months agocrypto/ui/ui_lib.c: Add OPENSSL_free to avoid memory leaks
JiashengJiang [Tue, 1 Apr 2025 01:22:53 +0000 (21:22 -0400)] 
crypto/ui/ui_lib.c: Add OPENSSL_free to avoid memory leaks

Add OPENSSL_free() if general_allocate_boolean() or general_allocate_string fails to avoid memory leaks.

Fixes: a63d5eaab2 ("Add a general user interface API. This is designed to replace things like des_read_password and friends (backward compatibility functions using this new API are provided). The purpose is to remove prompting functions from the DES code section as well as provide for prompting through dialog boxes in a window system and the like.")
Signed-off-by: JiashengJiang <jiasheng@purdue.edu>
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/27218)

(cherry picked from commit 8f06efe234ca875eb09af7f35f1ad3d62be696aa)

3 months agocmp_client_test.c: relax tight timeout value in test_exec_IR_ses_poll_no_timeout()
Dr. David von Oheimb [Thu, 3 Apr 2025 10:43:20 +0000 (12:43 +0200)] 
cmp_client_test.c: relax tight timeout value in test_exec_IR_ses_poll_no_timeout()

Fixes #27165

Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/27249)

(cherry picked from commit 46e14174da24a5f4fd5c480f1906371e2edd62cb)

4 months agoFix a visual glitch in test_cmp_http.t
Bernd Edlinger [Fri, 21 Mar 2025 19:58:57 +0000 (20:58 +0100)] 
Fix a visual glitch in test_cmp_http.t

Kill the shell process after the Mock server is running,
to prevent the shell from printing an error message when
the Mock server is finally killed.

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

(cherry picked from commit c45f0dd80370f1aa942cf47fc5ea99cb887621e4)

4 months agoTemporarily disable gost-engine tests in ci
Neil Horman [Tue, 1 Apr 2025 17:16:04 +0000 (13:16 -0400)] 
Temporarily disable gost-engine tests in ci

We need to temporarily disable this as we have a build break in CI:
https://github.com/openssl/openssl/actions/runs/14192630435

Its occuring because gost-engine depends on libprov, which requires a
minimum version cmake-3.0.  The update of github runners to cmake-4.0
causes a bail out as cmake 4.0 no longers supports cmake 3.0 syntax.

Libprov is fixed now, but gost-engine needs to update its libprov
submodule, and then we need to update the gost-engine submodule.  Until
thats done (which may take days), we should disable the gost-engine
external tests

Reviewed-by: Paul Yang <kaishen.yy@antfin.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27234)

(cherry picked from commit db9771b5a056d939b6112cdc099fbf4f86d184ee)

4 months agoLink SSL_get_negotiated_group() and SSL_get0_group_name() in the docs
Matt Caswell [Mon, 31 Mar 2025 14:51:14 +0000 (15:51 +0100)] 
Link SSL_get_negotiated_group() and SSL_get0_group_name() in the docs

If you are intereseted in one you might be interested in the other.

Fixes #27137

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

(cherry picked from commit 9eb21877f5704595a89cd550b1a639df86229b09)

4 months agostatem: always save sigalgs during PHA
Benjamin Kaduk [Fri, 14 Jun 2024 21:10:39 +0000 (14:10 -0700)] 
statem: always save sigalgs during PHA

We use the same extension-parsing function on server and client
for convenience, but while the server might worry about tracking
what was previously received and not overwriting it, on the client
receiving a request for post-handshake authentication, we always
want to use the values from the current extension (and should
always have a new session object that we are free to mutate).

It is somewhat unclear whether the server also needs the check
for a resumed connection; it appears to have been added back in
2015 in commit 062178678f5374b09f00d70796f6e692e8775aca as part
of a broad pass to handle extensions on resumption, but without
specific documentation of each extension's handling.

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

(cherry picked from commit ddd99d52d30e2fdae08f9684947cba45ce53898b)

4 months agoFix cpp comment in windows build
slontis [Fri, 28 Mar 2025 08:35:42 +0000 (19:35 +1100)] 
Fix cpp comment in windows build

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

(cherry picked from commit b8860598d2f7eab14fcf63c22579d879615465c8)

4 months agoFix Strict c issue in aes_gcm for armv8
slontis [Sun, 30 Mar 2025 22:42:59 +0000 (09:42 +1100)] 
Fix Strict c issue in aes_gcm for armv8

Reported by David Makepeace

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

(cherry picked from commit 0a78595eac55cc9ec9d2046c704404ec52752b8c)

4 months agoUpdate FIPS-README.md to reflect latest versions
Neil Horman [Thu, 27 Mar 2025 14:34:52 +0000 (10:34 -0400)] 
Update FIPS-README.md to reflect latest versions

With our new FIPS provider certification, lets update the FIPS-README to
reflect our latest release and fips validated versions

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

(cherry picked from commit 50316c18a0468bb0191904d7615955c9b47f061f)

4 months agoapps/lib/apps.c: Add a check for OPENSSL_strdup()
JiashengJiang [Wed, 26 Mar 2025 21:40:16 +0000 (17:40 -0400)] 
apps/lib/apps.c: Add a check for OPENSSL_strdup()

Add a check for the return value of OPENSSL_strdup() to guarantee the success of allocation, similar to the other call sites.

Fixes: c7d5ea2670 ("Prepare to detect index changes in OCSP responder.")
Signed-off-by: JiashengJiang <jiasheng@purdue.edu>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27172)

(cherry picked from commit 930c645e6b74a09398f6345b2d265c38ff035afe)

4 months agoFix quic_multistream_test: correct more frame types
Bernd Edlinger [Tue, 25 Mar 2025 15:57:32 +0000 (16:57 +0100)] 
Fix quic_multistream_test: correct more frame types

There are a few more critical frame injections that
previously created an out-of-diskspace problem
and now only a CI test failure.  The pattern
in the qlog files is always similar to this:

{"frame_type":"stop_sending","stream_id":6,"error_code":1152,"length":4},
{"frame_type":"path_challenge","length":9},...{}

Note: The stream_id 6 is a OSSL_QUIC_FRAME_TYPE_CRYPTO.

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

(cherry picked from commit 8ed3eee3b416d0bff4890bba24af4a7a1839bf78)

4 months agoUse OPENSSL_strdup() for strings freed by OPENSSL_free()
sashan [Wed, 26 Mar 2025 08:37:01 +0000 (09:37 +0100)] 
Use OPENSSL_strdup() for strings freed by OPENSSL_free()

Things can get messy when application decides to use it's own memory
allocation functions using CRYPTO_set_mem_functions(3ossl)

Reviewed-by: Richard Levitte <levitte@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/27163)

(cherry picked from commit 7fa51041e4d68838b2c7ddf4f77d6bba0edf2735)
(cherry picked from commit 49bd72584a6733cd5ce610f4aca1ec92496e1d30)

4 months agoUpdate X509_VERIFY_PARAM_set_flags.pod
Kyle Mullen [Tue, 18 Mar 2025 13:29:25 +0000 (09:29 -0400)] 
Update X509_VERIFY_PARAM_set_flags.pod

Change description of B<X509_V_FLAG_CRL_CHECK_ALL> to reflect its inability
to function without B<X509_V_FLAG_CRL_CHECK> being enabled as well.

Fixes #27056 (https://github.com/openssl/openssl/issues/27056)

CLA: trivial

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

(cherry picked from commit b7d3c729b14ccd9d23437d8ae107020a4332af72)

4 months agobn_mul_words.pod: Fix failures in doc-nits check
qu3ri [Tue, 4 Feb 2025 14:05:02 +0000 (09:05 -0500)] 
bn_mul_words.pod: Fix failures in doc-nits check

Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26597)

(cherry picked from commit 1b61f8e1808d3b3ee2d8f8e42bdc8fcc2b538373)

4 months agoMoved crypto/bn/README.pod to internal manpages
qu3ri [Thu, 30 Jan 2025 19:04:59 +0000 (14:04 -0500)] 
Moved crypto/bn/README.pod to internal manpages

The new place is doc/internal/man3/bn_mul_words.pod.

Also removed outdated information.

Implementing the fix from https://github.com/quictls/quictls/pull/214

Fixes #26399

Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26597)

(cherry picked from commit 78b1fdf4a101ae4909038e90b2c3c961be5a7064)

4 months agoFix return value of the i2d_ASN1_bio_stream() call
Andrey Tsygunka [Thu, 20 Mar 2025 14:45:23 +0000 (17:45 +0300)] 
Fix return value of the i2d_ASN1_bio_stream() call

If the flags argument does not contain the SMIME_STREAM bit,
the i2d_ASN1_bio_stream() function always returns 1,
ignoring the result of the ASN1_item_i2d_bio() call.

Fix the return value to the result of the ASN1_item_i2d_bio()
call for this case.

CLA: trivial

Signed-off-by: Andrey Tsygunka <aitsygunka@yandex.ru>
Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
Reviewed-by: Paul Yang <kaishen.yy@antfin.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27106)

(cherry picked from commit 3edb1f09c62c058edf4039587ef35f6b074e0870)

4 months agoUpdate provider compatibility CI to run on 3.5 branch
Tomas Mraz [Tue, 25 Mar 2025 09:16:30 +0000 (10:16 +0100)] 
Update provider compatibility CI to run on 3.5 branch

Also drop 3.1 development branch as it is out of public support now.

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

(cherry picked from commit 725f55e235057c463feadabbb4d23450126117fd)

4 months agoIn doc/man7/provider-{en,de}coder.pod, clarify where properties are defined
Richard Levitte [Mon, 24 Mar 2025 05:25:01 +0000 (06:25 +0100)] 
In doc/man7/provider-{en,de}coder.pod, clarify where properties are defined

Fixes #27126

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

(cherry picked from commit a006b0a0894b9aa399eee91bd28ca06b281eef7e)

4 months agoChange documentation to point to new wiki location
Jon Ericson [Fri, 14 Mar 2025 16:44:55 +0000 (09:44 -0700)] 
Change documentation to point to new wiki location

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

(cherry picked from commit da8de0e8dd3e09655cd17ef700359c63acdc9cd4)

4 months agoMemory leak fix ktls_meth.c
jay9827342 [Fri, 21 Mar 2025 09:39:49 +0000 (09:39 +0000)] 
Memory leak fix ktls_meth.c

The OSSL_RECORD_LAYER needs to be properly freed when return code isnt success.
Memory leak fix

CLA: trivial

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Yang <kaishen.yy@antfin.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27111)

(cherry picked from commit e5e4cf41c7af9b533265efb05e81ce1c56d58601)

4 months agoFix NULL pointer dereference in `asn1_ex_i2c()`, crypto/asn1/tasn_enc.c
Andrey Tsygunka [Wed, 19 Mar 2025 11:53:02 +0000 (14:53 +0300)] 
Fix NULL pointer dereference in `asn1_ex_i2c()`, crypto/asn1/tasn_enc.c

Adds handling of V_ASN1_UNDEF to avoid NULL dereference
in case ASN1 structure contains an element of type ASN1_TYPE
without initializing its value (i.e. default constructed)

CLA: trivial

Signed-off-by: Andrey Tsygunka <aitsygunka@yandex.ru>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27100)

(cherry picked from commit 8e08f9c5a013d9a9fb9e2db3c90a70eda50f78b5)

4 months agoTry to fix endless loops in quic_multistream_test
Bernd Edlinger [Sun, 23 Mar 2025 14:20:34 +0000 (15:20 +0100)] 
Try to fix endless loops in quic_multistream_test

The problem seem to be caused by syntax errors due to injected
OSSL_QUIC_FRAME_TYPE_PATH_CHALLENGE packets which are too short
by 8 bytes.

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

(cherry picked from commit ad684e1a6a925c7fbadad7d309f0204f49e67105)

4 months agoUpload artifacts despite possible test failures
Bernd Edlinger [Fri, 21 Mar 2025 16:34:24 +0000 (17:34 +0100)] 
Upload artifacts despite possible test failures

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

(cherry picked from commit 289dcbe008018b3cf81053cba2b36825a1f49b74)

4 months agoDo not wrap the python3 in ../../util/wrap.pl
Bernd Edlinger [Thu, 20 Mar 2025 18:45:17 +0000 (19:45 +0100)] 
Do not wrap the python3 in ../../util/wrap.pl

That is bad, because this script does seem to have issues,
because it is itself linked against libcrypto, which causes
crashes in enable-asan builds:

ASan runtime does not come first in initial library list;
you should either link runtime to your application or manually
preload it with LD_PRELOAD.
../../util/wrap.pl python3 ../../test/recipes/70-test_quic_multistream_data/verify-qlog.py => 1
    not ok 1 - running qlog verification script
not ok 2 - check qlog output

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

(cherry picked from commit f346932a15b5ce0cf7e42628e0b02a1871de93e1)

4 months agoTry to fix reported qlog issues
Bernd Edlinger [Thu, 20 Mar 2025 16:14:51 +0000 (17:14 +0100)] 
Try to fix reported qlog issues

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

(cherry picked from commit 9f85a036e331d2837db604fc505062f7790a8b2b)

4 months agoqlog_event_helpers.c: Fix inverted condition
Tomas Mraz [Mon, 24 Mar 2025 09:53:02 +0000 (10:53 +0100)] 
qlog_event_helpers.c: Fix inverted condition

We want to skip up to PACKET_remaining() and not "at least"
PACKET_remaining() bytes.

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

(cherry picked from commit 83b11af01738196b0ebde28a2f91df351c1c72fc)

4 months agoAvoid erroneous legacy code path when provided
Viktor Dukhovni [Mon, 17 Mar 2025 03:08:52 +0000 (14:08 +1100)] 
Avoid erroneous legacy code path when provided

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

(cherry picked from commit 27b88364e41f01cc1be6ff2941dd07919f286c89)

4 months agoapps/cms.c, apps/ocsp.c: Added NULL pointer checks
Ankit Kekre [Thu, 13 Mar 2025 15:59:54 +0000 (21:29 +0530)] 
apps/cms.c, apps/ocsp.c: Added NULL pointer checks

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

(cherry picked from commit 952d9b83b20359e9ed0fff8f18a84add29949f6f)

4 months agoRemove workaround for an old ppc64le compiler bug
Bernd Edlinger [Tue, 11 Mar 2025 17:58:25 +0000 (18:58 +0100)] 
Remove workaround for an old ppc64le compiler bug

Lowering the optimization level is no longer needed,
since the old compiler bug from ubuntu-20.04 has been
fixed meanwhile.

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

(cherry picked from commit c658a60aae5b3ac5a22cc11ad59d687bafcc6fbf)
(cherry picked from commit 9609e2a5f0af1e3151ec4f793ac99580d7b26577)

4 months agoFix gettable_params() for ECX
Martin Oliveira [Wed, 12 Mar 2025 17:09:04 +0000 (11:09 -0600)] 
Fix gettable_params() for ECX

The OSSL_PKEY_PARAM_MANDATORY_DIGEST parameter is only handled by the
ed25519_get_params() and ed448_get_params(). The x25519 and x448
versions of get_params() always ignore that parameter, so it should not
be in the list of gettable params.

Fixes: 1a7328c88256 ("PROV: Ensure that ED25519 & ED448 keys have a mandatory digest")
cla: trivial

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/27043)

(cherry picked from commit 482d3f9338b3d4c7537a1d112dce9c8e370c8d9f)

4 months agoDo some more cleanup in the RCU code
Bernd Edlinger [Sun, 9 Mar 2025 10:20:43 +0000 (11:20 +0100)] 
Do some more cleanup in the RCU code

Only a minimum of 2 qp's are necessary: one for the readers,
and at least one that writers can wait on for retirement.
There is no need for one additional qp that is always unused.
Also only one ACQUIRE barrier is necessary in get_hold_current_qp,
so the ATOMIC_LOAD of the reader_idx can be changed to RELAXED.
And finally clarify some comments.

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

(cherry picked from commit a532f2302d9eac7a2ba52b9929b790c20347c9ba)

4 months agoFix a memory order issue with weakly ordered systems
Bernd Edlinger [Mon, 3 Mar 2025 22:46:12 +0000 (23:46 +0100)] 
Fix a memory order issue with weakly ordered systems

this adds a dummy atomic release operation to update_qp, which
should make sure that the new value of reader_idx is visible in
get_hold_current_qp, directly after incrementing the users count.

Fixes: #26875
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/26964)

(cherry picked from commit 4a1a7fe5ce088964010779e1f5a90560903ecc76)

4 months agoFix Minerva timing side-channel signal for P-384 curve on PPC
Danny Tsen [Tue, 11 Feb 2025 18:48:01 +0000 (13:48 -0500)] 
Fix Minerva timing side-channel signal for P-384 curve on PPC

1. bn_ppc.c: Used bn_mul_mont_int() instead of bn_mul_mont_300_fixed_n6()
   for Montgomery multiplication.
2. ecp_nistp384-ppc64.pl:
   - Re-wrote p384_felem_mul and p384_felem_square for easier maintenance with
     minumum perl wrapper.
   - Implemented p384_felem_reduce, p384_felem_mul_reduce and p384_felem_square_reduce.
   - Implemented p384_felem_diff64, felem_diff_128_64 and felem_diff128 in assembly.
3. ecp_nistp384.c:
   - Added wrapper function for p384_felem_mul_reduce and p384_felem_square_reduce.

Signed-off-by: Danny Tsen <dtsen@us.ibm.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26709)

(cherry picked from commit 85cabd94958303859b1551364a609d4ff40b67a5)

4 months agoKeep the provided peer EVP_PKEY in the EVP_PKEY_CTX too
Tomas Mraz [Tue, 4 Mar 2025 17:43:18 +0000 (18:43 +0100)] 
Keep the provided peer EVP_PKEY in the EVP_PKEY_CTX too

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

(cherry picked from commit 2656922febfc36f6b44cff1c363917685633b4c5)

4 months agoFix RCU TODOs
Andrew Dinh [Tue, 4 Mar 2025 15:32:56 +0000 (22:32 +0700)] 
Fix RCU TODOs

- Update allocate_new_qp_group to take unsigned int
- Move id_ctr in rcu_lock_st for better stack alignment

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26972)

(cherry picked from commit 7097d2e00ea9f0119a5e42f13a51487fb1e67aa3)

5 months agoUpdated SSL_SESSION_get0_hostname() documentation to be consistent with the function
RSA-1977 [Fri, 24 Jan 2025 17:09:56 +0000 (12:09 -0500)] 
Updated SSL_SESSION_get0_hostname() documentation to be consistent with the function

CLA: trivial

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

(cherry picked from commit 8d6fd6142b0b55ce029df6d7b63dda5f7cb8ce54)

5 months agoRCU: Ensure that qp's are actually retired in order
Bernd Edlinger [Mon, 3 Mar 2025 07:22:31 +0000 (08:22 +0100)] 
RCU: Ensure that qp's are actually retired in order

The current retirement code for rcu qp's has a race condition,
which can cause use-after-free errors, but only if more than
3 QPs are allocated, which is not the default configuration.

This fixes an oversight in commit 5949918f9afa ("Rework and
simplify RCU code")

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

(cherry picked from commit 6e7be995fd7fd24d38b95982cf90f801ac045743)

5 months agoMake RCU atomics more inline with 3.4 branch
Bernd Edlinger [Mon, 3 Mar 2025 12:22:08 +0000 (13:22 +0100)] 
Make RCU atomics more inline with 3.4 branch

to avoid the risk of backports not to cherry-pick
or unexpectedly breaking things.

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

5 months agocompiler-zoo.yml: Switch to ubuntu-22.04 where possible
Tomas Mraz [Tue, 4 Mar 2025 15:20:16 +0000 (16:20 +0100)] 
compiler-zoo.yml: Switch to ubuntu-22.04 where possible

And drop the rest.

The ubuntu-20.04 CI runners are discontinued.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26971)

(cherry picked from commit 4e9b542868890428f0294a4ce53fcde68c1fcaf7)

5 months agoFix a compilation failure in AIX
Matt Caswell [Fri, 28 Feb 2025 11:52:08 +0000 (11:52 +0000)] 
Fix a compilation failure in AIX

AIX (at least for 7.1)  defines some macros for "events" and "revents" which
interferes with our own use of these names.

Fixes #24236

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

(cherry picked from commit 5eb55ad8a70ef948432ba17e0985c7b4d3b13c25)

5 months agoUpdate doc README URLs
14MM4CH1N3 [Fri, 14 Feb 2025 17:11:01 +0000 (12:11 -0500)] 
Update doc README URLs

This updates the openssl documentation link to the one currently in use,
and removes the standards.txt section as that URL leads to the normal
documentation page and there is no "standards" page in the openssl
documentation site.

CLA: trivial

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

(cherry picked from commit da44eb2901bd541f86547d814f45ab305b918611)

5 months agoFix hashsum files in release assets
Dmitry Misharov [Wed, 26 Feb 2025 08:13:36 +0000 (09:13 +0100)] 
Fix hashsum files in release assets

We use the coreutils format since 3.4.0.

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

(cherry picked from commit 808a0861716e6dd5e1c9f08cebec93084f028fd8)

5 months agoFix libctx passing for CMS PWRI use
Jakub Zelenka [Fri, 28 Feb 2025 16:04:50 +0000 (17:04 +0100)] 
Fix libctx passing for CMS PWRI use

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

(cherry picked from commit 5045712d3dbe6abdfffcb4f518c67409ec85535e)

5 months agoapps: Escape control characters in DNs by default
Tomas Mraz [Fri, 28 Feb 2025 10:13:27 +0000 (11:13 +0100)] 
apps: Escape control characters in DNs by default

When displaying distinguished names the control characters
are escaped by default.

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

(cherry picked from commit 2411f9b662fa501c9eec257a30a7da0cfc2dc173)

5 months agoEncoder : Fix floating pointer when OSSL_ENCODER_to_data() is called
slontis [Tue, 25 Feb 2025 06:03:38 +0000 (17:03 +1100)] 
Encoder : Fix floating pointer when OSSL_ENCODER_to_data() is called
twice.

Fixes #26862

This only happens when using the FIPS provider, since it needs to export
the key.

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

(cherry picked from commit c2f4d7aae1c7c726eb1f8226d3d454dfd9754758)

5 months agoTolerate 3.5+ FIPS providers in kem_rsa_params test
Viktor Dukhovni [Wed, 26 Feb 2025 09:59:38 +0000 (20:59 +1100)] 
Tolerate 3.5+ FIPS providers in kem_rsa_params test

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

5 months agoAdd record overflow test to tlsfuzzer external tests
Neil Horman [Mon, 24 Feb 2025 13:14:36 +0000 (08:14 -0500)] 
Add record overflow test to tlsfuzzer external tests

Add this to our regression test suite for tlsfuzzer, since it recently
caught an error

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

(cherry picked from commit 83dbfde6aaf7a384cfc7bab6608943a56ac4ebed)

5 months agoChange cipher suite alert for 0 length cipher_suites
Neil Horman [Sun, 16 Feb 2025 13:35:38 +0000 (08:35 -0500)] 
Change cipher suite alert for 0 length cipher_suites

From RFC 8446:

Note: TLS defines two generic alerts (see Section 6) to use upon
   failure to parse a message.  Peers which receive a message which
   cannot be parsed according to the syntax (e.g., have a length
   extending beyond the message boundary or contain an out-of-range
   length) MUST terminate the connection with a "decode_error" alert.
   Peers which receive a message which is syntactically correct but
   semantically invalid (e.g., a DHE share of p - 1, or an invalid enum)
   MUST terminate the connection with an "illegal_parameter" alert.

A zero length cipher suite list I think is considered out of range, and
so we should return "decode_error" rather than "illegal_parameter"

Fixes #25309

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

(cherry picked from commit 2ce46ad8cef8909ae9162a429daf8e3d5fc8cb03)

5 months agoFix read out of buffer bounds when dealing with BIO_ADDR
Alexandr Nedvedicky [Mon, 23 Dec 2024 16:03:32 +0000 (17:03 +0100)] 
Fix read out of buffer bounds when dealing with BIO_ADDR

This issue was discoevered while I was testing SSL_new_from_listener()
using a newly created unit test. It has turned out the QUIC stack
at few places contain pattern as follows:
foo(QUIC_WHATEVER *q, BIO_ADDR *a)
{
   q->a = *a;
}

The problem is that derefencning a that way is risky. If the address `a`
comes from BIO_lookup_ex() it may actually be shorter than sizeof(BIO_ADDR).
Using BIO_ADDR_copy() is the right thing to do here.

Fixes #26241

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

(cherry picked from commit 395a83a617a09c1ae02e8040386f9acb356d13c1)

5 months agoFix potential memory leak in policy_section()
Niels Dossche [Tue, 21 Jan 2025 11:04:44 +0000 (12:04 +0100)] 
Fix potential memory leak in policy_section()

If sk_POLICYQUALINFO_push() fails, qual is not freed.
Fix it by adding POLICYQUALINFO_free() to the error path.

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

(cherry picked from commit ececabd9adb4b4def9c044491f993b94ba0c618f)

5 months agoadd_uris_recursive(): Avoid OSSL_STORE_INFO leak on error
Tomas Mraz [Wed, 22 Jan 2025 08:57:36 +0000 (09:57 +0100)] 
add_uris_recursive(): Avoid OSSL_STORE_INFO leak on error

Fixes #26480

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26511)

(cherry picked from commit be5965acad7a1c45e49411bcf4abad99d106a7c1)

5 months agoFix potential leak in error path in cert_response()
Niels Dossche [Wed, 22 Jan 2025 13:35:25 +0000 (14:35 +0100)] 
Fix potential leak in error path in cert_response()

get1_cert_status() returns an object that must be freed,
but the error path does not do that.
Fix it by adding a call to X509_free() in the error path.

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

(cherry picked from commit 56160f173d055486357b7a315ab4e9579b2538d5)