]> git.ipfire.org Git - thirdparty/openssl.git/log
thirdparty/openssl.git
8 weeks agorand: fix memory overrun bug
Pauli [Wed, 4 Jun 2025 23:50:34 +0000 (09:50 +1000)] 
rand: fix memory overrun bug

Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.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/27766)

(cherry picked from commit da585e214cf98468e28f4c12ec96ecc7a6192746)

8 weeks agorand: add unit test exhibiting memory overrun
Pauli [Wed, 4 Jun 2025 23:50:20 +0000 (09:50 +1000)] 
rand: add unit test exhibiting memory overrun

Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.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/27766)

(cherry picked from commit 6d490a92fe49ea6e41cb7874086dbad5462078c6)

8 weeks agoAdd a test to confirm that we can repeatedly create and destroy keys
Neil Horman [Thu, 5 Jun 2025 12:54:56 +0000 (08:54 -0400)] 
Add a test to confirm that we can repeatedly create and destroy keys

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

(cherry picked from commit b994ce4088fb52e769ee5e3e49bdde3030fadaf7)

8 weeks agoAllow for reuse of thread_local keys in threads_none
Neil Horman [Thu, 5 Jun 2025 12:25:52 +0000 (08:25 -0400)] 
Allow for reuse of thread_local keys in threads_none

If openssl is configured with no-threads, the implementation has a hard
limit of 256 LIB_CTX values, as each LIB_CTX allocates a thread local
key, and we never reuse them (like libc does when using
pthread_key_create/destroy.

Improve the situation by allowing for marking freed keys as unsued and
searching for an available key when allocating

Fixes #27757

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

(cherry picked from commit b6d01d1b1fef2e98a956b7ba4e8443cf7d916dcb)

8 weeks agoRemove _strlen31
Neil Horman [Wed, 4 Jun 2025 19:48:45 +0000 (15:48 -0400)] 
Remove _strlen31

This function is old and fairly broken.  Code archeology in our git tree
hasn't revealed why it was creted (though it may have possibly been to
support older win32 systems that couldn't do 64 bit integers properly,
like windows 95/98).

There seems to be no good reason to keep it around, and given that it
has potentially serious side effects, lets just remove it.

Fixes #27761

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Richard Levitte <levitte@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/27763)

(cherry picked from commit b0d363a2cb039eac2908b7cb00b395235373193e)
(cherry picked from commit a4acf026ec92de423829d26f9988ef7f0d886c6f)

8 weeks agoFix use of IO::Socket::IP on windows 2025
Neil Horman [Fri, 6 Jun 2025 00:57:35 +0000 (20:57 -0400)] 
Fix use of IO::Socket::IP on windows 2025

Apparently IO::Socket::IP has several odd behaviors on windows 2025,
notably indicating that AF_INET6 isn't a supported family when it
clearly is.

Follow the pattern in determinig the haveIPV6 variable in Proxy.pm, and
record if we determine IPv6 availablity with the IP class or the INET6
class and use the same method when testing port binding

Fixes project/#1213

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Paul Yang <kaishen.yy@antfin.com>
(Merged from https://github.com/openssl/openssl/pull/27780)

(cherry picked from commit ae404a9b3bd052963b76434bcc97757d1d6d502e)

8 weeks agoTest randomly selected client port for availabilty in sslrecords test
Neil Horman [Tue, 3 Jun 2025 20:02:15 +0000 (16:02 -0400)] 
Test randomly selected client port for availabilty in sslrecords test

Encountered this error in a pr today:
https://github.com/openssl/openssl/actions/runs/15418713146/job/43387767612

===
Proxy started on port [::1]:56662
Engine "ossltest" set.
Using default temp DH parameters
ACCEPT [::1]:59189
Server responds on [::1]:59189
Engine "ossltest" set.
C0774F02907F0000:error:80000062:system library:BIO_bind:Address already in use:crypto/bio/bio_sock2.c:240:calling bind()
C0774F02907F0000:error:10000075:BIO routines:BIO_bind:unable to bind socket:crypto/bio/bio_sock2.c:242:
connect:errno=98
===

Its occuring because we randomly select a port to use for our client
connection in the sslrecords test.  Thats usually fine, but sometimes,
we get unlucky and pick a port thats already in use.  This presents as
random failures in our CI on this test.

So lets try harden ourselves against it.  When creating the client
connection, test the randomly selected port by trying to bind to it via
a call to IO::Socket::IP->new(). If that fails, try a different port
number, until we get one that works.  If it works, use that port in the
assignment for the clients local port value.

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

(cherry picked from commit f78f824c8e4064148af1186490e9b445871765fd)

2 months agoapps/x509.c: re-add ERR queue printing on errors
Dr. David von Oheimb [Sun, 1 Jun 2025 14:35:31 +0000 (16:35 +0200)] 
apps/x509.c: re-add ERR queue printing on errors

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

(cherry picked from commit ac85974bc34dc18830fa9401a7d4756dbd2d9e35)

2 months agoSplit arguments taking quotes into account
Viktor Dukhovni [Sun, 1 Jun 2025 02:47:15 +0000 (12:47 +1000)] 
Split arguments taking quotes into account

CA.pl supports interpolating multiple arguments into the executed
commands.  Previously these were evaluated by a shell, which supported
quoting of values that contain whitespace, backslashes, ...

With a shell no longer used (avoid command injection), backwards
compatibility requires some similar functionality.  The code now handles
double and single-quoted strings (shell-style word splitting), but not
parameter expansion ($foo remains unexpanded) or command substitution
(`cmd` and $(cmd) remain unexpanded).

On Windows system(@LIST) does not correctly preserve argv, do our
own quoting instead and use system(<$quoted_cmd>).

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

(cherry picked from commit 287bbb28b09e930a8691efc92a5087bb951edb6b)

2 months agoAvoid shell commandline processing in CA.pl
Viktor Dukhovni [Fri, 18 Apr 2025 04:18:09 +0000 (14:18 +1000)] 
Avoid shell commandline processing in CA.pl

The CA.pl script used to build single-string string commandlines to pass
to a shell via `system(command_string)`.  That was fragile and not a best
practice.

This PR replaces `system(command_string)` with `system { executable } @argv`,
which avoids the shell whenever possible (at least Unix-like systems and
Windows).  The only question mark is whether some sort of quoting is
needed for VMS to preserve the case of commandline arguments even when
processes are spawned directly, rather than via the shell.

Unfortunately, given the way that some environment variables and
command-line options are used to construct the commands to run,
the result is still brittle.  The CA.pl utility really should
be replaced with something better.

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

(cherry picked from commit 0b1bdef38ef1e3369a7bcde1b9a6eabe44b10e54)

2 months agoAdd a CHANGES.md entry regarding no_renegotiation alert
Matt Caswell [Mon, 2 Jun 2025 14:45:06 +0000 (15:45 +0100)] 
Add a CHANGES.md entry regarding no_renegotiation alert

Highight the bug being fixed for DTLS users

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

(cherry picked from commit df5dff26efb6cdc96ebe50c35af394a1121e77fe)

2 months agoUpdate documentation regarding no_renegotiation handling
Matt Caswell [Mon, 2 Jun 2025 14:39:45 +0000 (15:39 +0100)] 
Update documentation regarding no_renegotiation handling

Clarify what happens in the event that a no_renegotiation alert is
received.

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

(cherry picked from commit 0db6a59ea7931024d673024c2d17ff1ec44a4e69)

2 months agoTest that a no_renegotiation alert is handled correctly
Matt Caswell [Fri, 9 May 2025 09:28:16 +0000 (10:28 +0100)] 
Test that a no_renegotiation alert is handled correctly

If we receive a no_renegotiation alert we should abort the connection. We
add a test for 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/27591)

(cherry picked from commit 7f6e66b048cb50dd5381211ef2006ae5e912a914)

2 months agoFix DTLS handling when receiving a no_renegotiation alert
Matt Caswell [Fri, 9 May 2025 08:58:15 +0000 (09:58 +0100)] 
Fix DTLS handling when receiving a no_renegotiation alert

no_renegotiation is a warning alert sent from the server when it is not
prepared to accept a renegotiation attempt. In TLS we abort the connection
when we receive one of these - which is a reasonable response. However,
in DTLS we incorrectly ignore this and keep trying to renegotiate.

We bring the DTLS handling of a no_renegotiation alert into line with
how TLS handles this. In versions prior to 3.2 handling of a warning
alert in DTLS was mishandled resulting in a failure of the connection,
which ends up being the right thing to do "by accident" in the case of
"no_renegotiation". From 3.2 this mishandling was fixed, but exposed this
latent bug.

Fixes #27419

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

(cherry picked from commit e5feca0659ef6119f6cedfab1b6af034735723ff)

2 months agoci: remove windows-2019 runner images
Dmitry Misharov [Tue, 3 Jun 2025 11:04:57 +0000 (13:04 +0200)] 
ci: remove windows-2019 runner images

According to https://github.com/actions/runner-images/issues/12045
The Windows 2019 Actions runner image will begin deprecation on
2025-06-01 and will be fully unsupported by 2025-06-30. Jobs using
the windows-2019 YAML workflow label should be updated to
windows-2022, windows-2025 or windows-latest.

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

(cherry picked from commit 19dfc4672a3e7d152195c890edfdb9bd81d878a7)
(cherry picked from commit 2762016a2b23510da8c57986ee417edac3467f95)

2 months agoRegression test for incorrect HMAC API usage
Nicky Mouha [Sat, 24 May 2025 16:15:54 +0000 (12:15 -0400)] 
Regression test for incorrect HMAC API usage

Fixes #13210

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

(cherry picked from commit a5d1eadde1d566b528cfe495953300cd9f9fe1e9)

2 months agoHandle 0 return values from DH key computations as errors
Frederik Wedel-Heinen [Tue, 20 May 2025 17:58:11 +0000 (19:58 +0200)] 
Handle 0 return values from DH key computations as errors

Returned 0 from ossl_dh_compute_key(), DH_compute_key_padded() and
DH_compute_key() needs to be treated as an error.

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

(cherry picked from commit 1c1ce2a6eeb18b3102e0618a988b2dfe96b709aa)

2 months agoUse value barrier for constant_time_cond_swap_*
Jai S [Wed, 7 May 2025 18:01:06 +0000 (23:31 +0530)] 
Use value barrier for constant_time_cond_swap_*

Resolves #27497

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

(cherry picked from commit 8a9e0d0f499a288cf3363668870806d5e7be3924)

2 months agoDocument that FIPS provider cannot be used by multiple libcryptos
Tomas Mraz [Tue, 27 May 2025 09:36:31 +0000 (11:36 +0200)] 
Document that FIPS provider cannot be used by multiple libcryptos

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

(cherry picked from commit 08b2042a20e76472416c8c7c48e479d893ba904f)

2 months agotest/evp_test.c: Free fetched_digest on error to avoid memory leak
JiashengJiang [Sat, 17 May 2025 00:20:47 +0000 (20:20 -0400)] 
test/evp_test.c: Free fetched_digest on error to avoid memory leak

Call EVP_MD_free() to release fetched_digest if OPENSSL_zalloc() fails, preventing a memory leak.

Fixes: 2208ba56eb ("evp_test: Add the missing check after calling OPENSSL_malloc")
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/27648)

(cherry picked from commit e8deb32af4874c781838c1596c6355712b5d0ed0)

2 months agocrypto/property/property.c: Free impl->method to avoid memory leak
JiashengJiang [Fri, 16 May 2025 18:21:07 +0000 (14:21 -0400)] 
crypto/property/property.c: Free impl->method to avoid memory leak

After ossl_method_up_ref() succeeds, impl_free() should be called to free impl->method.

Fixes: 860ecfd ("property: check return values from the property locking
calls.")
Signed-off-by: JiashengJiang <jiasheng@purdue.edu>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27564)

(cherry picked from commit 00c531a5e327320f0ec78ce4b153fac65ebca229)

2 months agoapps: lib: Prevent potential NULL dereference in init_client()
AntonMoryakov [Fri, 16 May 2025 14:19:21 +0000 (17:19 +0300)] 
apps: lib: Prevent potential NULL dereference in init_client()

apps: lib: Simplify ba_ret handling in init_client()

Simplify logic around ba_ret assignment:
- Fail early if ba_ret == NULL
- Assign directly otherwise, without checking *ba_ret

This avoids extra nesting and matches OpenSSL's conventions.

CLA: trivial
Signed-off-by: Anton Moryakov <ant.v.moryakov@gmail.com>
Co-authored-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26783)

(cherry picked from commit 3161f460fa7eacc7a93f8edf413c78b4dcf65823)

2 months agoNote finished state in cipher BIO EOF
Viktor Dukhovni [Wed, 21 May 2025 15:33:03 +0000 (01:33 +1000)] 
Note finished state in cipher BIO EOF

When the cipher BIO encounters a non-retriable EOF (or error), mark the
state as "finished", else a subsequent BIO_flush() or attempted read may
attempt to finalise the crypto state again, and fail, leading, for
example, to users seeing erroneous apparent decryption failure.

This is not a new problem, the fix should be backported to all supported
releases.  It was made more apparent by recent changes to the base64
BIO, which returns a non-retriable EOF when padding is seen at the end
of the base64 data, even if the underlying next BIO is "retriable".

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

(cherry picked from commit 005fa3e00e1ccfd83aa99d28e2eff55597dd5fc2)

2 months agoDocument EVP_CIPHER failure for missing provider function
Norbert Pocs [Mon, 26 May 2025 08:08:06 +0000 (10:08 +0200)] 
Document EVP_CIPHER failure for missing provider function

When writing a new CIPHER implementation the OSSL_FUNC_cipher_get_params
must be present, otherwise the fetch fails. This behaviour is seen in
function evp_cipher_cache_constants@crypto/evp/evp_lib.c.

Resolves: #25801

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

(cherry picked from commit 3423c30db3aa044f46e1f0270e2ecd899415bf5f)
(cherry picked from commit 8ff81f95b86bf276868427ff97f592b31b75f02c)

2 months agocrypto/pkcs7/pk7_smime.c: Add BIO_free() to avoid memory leak
JiashengJiang [Thu, 22 May 2025 01:12:18 +0000 (21:12 -0400)] 
crypto/pkcs7/pk7_smime.c: Add BIO_free() to avoid memory leak

Add BIO_free() to free tmpout if OPENSSL_malloc() fails to avoid memory leak.

Fixes: 8e70485 ("RT3955: Reduce some stack usage")
Signed-off-by: JiashengJiang <jiasheng@purdue.edu>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27631)

(cherry picked from commit 9882d389df71ef7163c7769b4431a0dbe713ab65)

2 months agoapps/pkeyutl.c: Add OPENSSL_free() to avoid a memory leak
JiashengJiang [Tue, 22 Apr 2025 13:03:44 +0000 (09:03 -0400)] 
apps/pkeyutl.c: Add OPENSSL_free() to avoid a memory leak

If EVP_PKEY_CTX_ctrl_str() fails, the code jumps to 'end' label without freeing passwd, causing a memory leak.

Fixes: 9d1bf5f7de ("Add option to read pkeyopts interactively")
Signed-off-by: JiashengJiang <jiasheng@purdue.edu>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27470)

(cherry picked from commit 0dc6ea55a13dbe27af234b5328527d0a31ae68eb)

2 months agoFix memory leaks after failure of PKCS7_add_signed_attribute()
widneve [Tue, 20 May 2025 14:23:09 +0000 (16:23 +0200)] 
Fix memory leaks after failure of PKCS7_add_signed_attribute()

If PKCS7_add_signed_attribute fails,
seq never escapes out of the callee and will
therefore result in a memory leak.
This is similar to ed3d277127.

CLA: trivial

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

(cherry picked from commit 6543f34dda8908db56372581eef6eafa0ae4add4)

2 months agoUpdated Windows notes on the use of “no-makedepend” for new builds
klaus triendl [Sat, 12 Apr 2025 08:26:34 +0000 (11:26 +0300)] 
Updated Windows notes on the use of “no-makedepend” for new builds

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

(cherry picked from commit afd32bcb5456a9e33b0f4e07f572263b404d4d4b)

2 months agoDrop "by store"'s by_store_subject_ex()
Richard Levitte [Wed, 30 Apr 2025 12:37:12 +0000 (14:37 +0200)] 
Drop "by store"'s by_store_subject_ex()

It was used to pass libctx and propq, which would override the
corresponding values passed to by_store_ctrl_ex().  This wasn't
really reasonable to do either way, as it could potentially be a
surprise to the user, who can reasonably expect that the URI is
opened with the libctx and propq that was passed with the URI, and
not with those passed later.

(cherry picked from commit af5952d533b772ef8a3d7c666ed918acfc1dd911)

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

2 months agoAdd test_verify tests
Dr. David von Oheimb [Wed, 30 Apr 2025 09:46:03 +0000 (11:46 +0200)] 
Add test_verify tests

Originally from https://github.com/openssl/openssl/pull/27507, with some
changes.

Co-authored-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit 927debaf7b4e83e47d3f016808acab947cc50ea2)

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

2 months agoRework the "by store" X509_LOOKUP method to open the given URI early
Richard Levitte [Wed, 30 Apr 2025 09:38:04 +0000 (11:38 +0200)] 
Rework the "by store" X509_LOOKUP method to open the given URI early

The cached X509_LOOKUP method data is no longer just the URI, but now
includes the OSSL_STORE_CTX pointer, and required parameters to reopen
the URI at any time.  cache_objects() is modified to handle this, and
only (re)open the URI when it wasn't previously opened, or when it was
closed by an earlier call.

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.

This assumes that if the URI could be opened once, it can be opened
again.

Fixes #27461

(cherry picked from commit 0c48ee2bf513cbc2f1de2ff8bc11750e4b593620)

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

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)