]> git.ipfire.org Git - thirdparty/openssl.git/log
thirdparty/openssl.git
13 months agoOpenSSL::Test: Avoid running IPv6 related tests if IPv6 was explicitly disabled
Richard Levitte [Thu, 27 Jun 2024 06:30:28 +0000 (08:30 +0200)] 
OpenSSL::Test: Avoid running IPv6 related tests if IPv6 was explicitly disabled

It's possible to disable IPv6  explicitly when configuring OpenSSL.  In that
case, IPv6 related tests should be skipped.

This is solved by having OpenSSL::Test::Utils::have_IPv6() check configuration
first, before trying to determine if the machine supports IPv6.

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

(cherry picked from commit 5a9c90b1e59b2c368876229862fbff29f2bcf006)

13 months agoClarify DRBG seeding.
Pauli [Thu, 27 Jun 2024 00:08:05 +0000 (10:08 +1000)] 
Clarify DRBG seeding.

There is a legacy code path that OpenSSL won't use anymore but applications
could.  Add a comment indicating this to avoid confusion for people not
intimately conversant with the nuances in the RNG code.

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

(cherry picked from commit 1eb122aa0ca152dc564e61674caf3f11acd85b57)

13 months agoAdd aix-clang and aix64-clang configuration
sanumesh [Tue, 11 Jun 2024 14:47:07 +0000 (09:47 -0500)] 
Add aix-clang and aix64-clang configuration

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

(cherry picked from commit 7afa7731e924d5ac10fc992d8cd777f407d33af9)

13 months agoFree appname if it was set after initializing crypto.
sgzmd [Tue, 25 Jun 2024 14:53:32 +0000 (15:53 +0100)] 
Free appname if it was set after initializing crypto.

Fixes #24729

CLA: trivial

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

(cherry picked from commit fbd6609bb21b125c9454d07c484d166a33b4815b)

13 months agodocs: document that *_free(NULL) does nothing
Vita Batrla [Tue, 25 Jun 2024 09:58:49 +0000 (11:58 +0200)] 
docs: document that *_free(NULL) does nothing

Explicitly documents that *_free(NULL) does nothing.
Fixes two cases where that wasn't true.
Fixes #24675.

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Sasa Nedvedicky <sashan@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24735)

(cherry picked from commit 981d129a5609ee2e031367c34c67a9f61a5bfd66)

13 months agoAdd a test for an empty NextProto message
Matt Caswell [Fri, 21 Jun 2024 13:29:26 +0000 (14:29 +0100)] 
Add a test for an empty NextProto message

It is valid according to the spec for a NextProto message to have no
protocols listed in it. The OpenSSL implementation however does not allow
us to create such a message. In order to check that we work as expected
when communicating with a client that does generate such messages we have
to use a TLSProxy test.

Follow on from CVE-2024-5535

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

(cherry picked from commit a201030901de9f9a48b34c38f6922fb0b272f26f)

13 months agoAdd explicit testing of ALN and NPN in sslapitest
Matt Caswell [Fri, 21 Jun 2024 09:09:41 +0000 (10:09 +0100)] 
Add explicit testing of ALN and NPN in sslapitest

We already had some tests elsewhere - but this extends that testing with
additional tests.

Follow on from CVE-2024-5535

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

(cherry picked from commit 0453bf5a7ac60ab01c8bb713d8cc2a94324aa88c)

13 months agoAdd ALPN validation in the client
Matt Caswell [Fri, 21 Jun 2024 10:51:54 +0000 (11:51 +0100)] 
Add ALPN validation in the client

The ALPN protocol selected by the server must be one that we originally
advertised. We should verify that it is.

Follow on from CVE-2024-5535

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

(cherry picked from commit 017e54183b95617825fb9316d618c154a34c634e)

13 months agoCorrect return values for tls_construct_stoc_next_proto_neg
Matt Caswell [Fri, 21 Jun 2024 09:41:55 +0000 (10:41 +0100)] 
Correct return values for tls_construct_stoc_next_proto_neg

Return EXT_RETURN_NOT_SENT in the event that we don't send the extension,
rather than EXT_RETURN_SENT. This actually makes no difference at all to
the current control flow since this return value is ignored in this case
anyway. But lets make it correct anyway.

Follow on from CVE-2024-5535

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

(cherry picked from commit 087501b4f572825e27ca8cc2c5874fcf6fd47cf7)

13 months agoAllow an empty NPN/ALPN protocol list in the tests
Matt Caswell [Tue, 4 Jun 2024 14:47:32 +0000 (15:47 +0100)] 
Allow an empty NPN/ALPN protocol list in the tests

Allow ourselves to configure an empty NPN/ALPN protocol list and test what
happens if we do.

Follow on from CVE-2024-5535

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

(cherry picked from commit c54e56fc8ab19e9d07c284d6c7c6bf293f7520d2)

13 months agoAdd a test for SSL_select_next_proto
Matt Caswell [Fri, 31 May 2024 15:35:16 +0000 (16:35 +0100)] 
Add a test for SSL_select_next_proto

Follow on from CVE-2024-5535

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

(cherry picked from commit ad1318efa2cfdf43ed49d23c4a815f4754604b97)

13 months agoClarify the SSL_select_next_proto() documentation
Matt Caswell [Fri, 31 May 2024 10:46:38 +0000 (11:46 +0100)] 
Clarify the SSL_select_next_proto() documentation

We clarify the input preconditions and the expected behaviour in the event
of no overlap.

Follow on from CVE-2024-5535

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

(cherry picked from commit 889ed19ba25abebd2690997acd6d4791cbe5c493)

13 months agoMore correctly handle a selected_len of 0 when processing NPN
Matt Caswell [Fri, 31 May 2024 10:18:27 +0000 (11:18 +0100)] 
More correctly handle a selected_len of 0 when processing NPN

In the case where the NPN callback returns with SSL_TLEXT_ERR_OK, but
the selected_len is 0 we should fail. Previously this would fail with an
internal_error alert because calling OPENSSL_malloc(selected_len) will
return NULL when selected_len is 0. We make this error detection more
explicit and return a handshake failure alert.

Follow on from CVE-2024-5535

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

(cherry picked from commit 4279c89a726025c758db3dafb263b17e52211304)

13 months agoFix SSL_select_next_proto
Matt Caswell [Fri, 31 May 2024 10:14:33 +0000 (11:14 +0100)] 
Fix SSL_select_next_proto

Ensure that the provided client list is non-NULL and starts with a valid
entry. When called from the ALPN callback the client list should already
have been validated by OpenSSL so this should not cause a problem. When
called from the NPN callback the client list is locally configured and
will not have already been validated. Therefore SSL_select_next_proto
should not assume that it is correctly formatted.

We implement stricter checking of the client protocol list. We also do the
same for the server list while we are about it.

CVE-2024-5535

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

(cherry picked from commit 4ada436a1946cbb24db5ab4ca082b69c1bc10f37)

13 months agoevp_pkey_ctx_setget_params_to_ctrl(): Always properly set ctx.action_type
Tomas Mraz [Mon, 24 Jun 2024 09:25:12 +0000 (11:25 +0200)] 
evp_pkey_ctx_setget_params_to_ctrl(): Always properly set ctx.action_type

Fixes #24698

Some applicable translations are bidirectional so they have
NONE action_type. However we need to set the real action_type
in the ctx.

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

(cherry picked from commit 55c1458303c0fef88e4b2b35a090e9145f3e07eb)

13 months agobio_ssl.c: Do not call SSL_shutdown if not inited
erbsland-dev [Sat, 22 Jun 2024 07:14:25 +0000 (09:14 +0200)] 
bio_ssl.c: Do not call SSL_shutdown if not inited

Fixes #4545

If free is called for an SSL BIO that is in initialization phase,
the `SSL_shutdown` call is omitted.

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

(cherry picked from commit 57b83edc46926662491d63666231ba7ddc954a38)

13 months agoAllow calling OPENSSL_INIT_free() with NULL argument
Tomas Mraz [Wed, 19 Jun 2024 15:40:21 +0000 (17:40 +0200)] 
Allow calling OPENSSL_INIT_free() with NULL argument

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

(cherry picked from commit d38f62ea118170fc40e10f6f95b180cccbaa7581)

13 months agoAdd Provider compatibility on PR CI job
Tomas Mraz [Fri, 31 May 2024 12:59:21 +0000 (14:59 +0200)] 
Add Provider compatibility on PR CI job

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

(cherry picked from commit 94567d6889b8b48ac618cd8a90911e6732d0e4df)

13 months ago[DOCS] Correct history in doc/man3/OSSL_STORE_LOADER.pod
Richard Levitte [Wed, 19 Jun 2024 06:06:45 +0000 (08:06 +0200)] 
[DOCS] Correct history in doc/man3/OSSL_STORE_LOADER.pod

Bulk editing had history wrongly specify current functions as deprecated,
among other small errors.

Fixes #24678

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

(cherry picked from commit b23cd39f0a4e3cfe142694402a5246a498a3574f)

13 months agoFix regression of EVP_PKEY_CTX_add1_hkdf_info() with older providers
Tomas Mraz [Mon, 17 Jun 2024 14:48:26 +0000 (16:48 +0200)] 
Fix regression of EVP_PKEY_CTX_add1_hkdf_info() with older providers

If there is no get_ctx_params() implemented in the key exchange
provider implementation the fallback will not work. Instead
check the gettable_ctx_params() to see if the fallback should be
performed.

Fixes #24611

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

(cherry picked from commit 663dbc9c9c897392a9f9d18aa9a8400ca024dc5d)

13 months agoASN1_item_verify_ctx(): Return -1 on fatal errors
Tomas Mraz [Thu, 6 Jun 2024 13:36:00 +0000 (15:36 +0200)] 
ASN1_item_verify_ctx(): Return -1 on fatal errors

Fixes #24575

Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/24576)

(cherry picked from commit 8d380f85da215012570347f156e642d69909877a)

13 months agoAdd CHANGES.md entry for the EC/DSA nonce generation fixes
Tomas Mraz [Mon, 17 Jun 2024 10:35:39 +0000 (12:35 +0200)] 
Add CHANGES.md entry for the EC/DSA nonce generation fixes

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/24660)

(cherry picked from commit 72bff68f6acc4f420e283bcc77db76eb1917d7bf)

13 months agoFix handling of max_fragment_length extension for PSK
Frederik Wedel-Heinen [Tue, 28 May 2024 11:59:44 +0000 (13:59 +0200)] 
Fix handling of max_fragment_length extension for PSK

A psk session was assumed to be a resumption which failed a check
when parsing the max_fragment_length extension hello from the client.

Relevant code from PR#18130 which was a suggested fix to the issue
was cherry-picked.

Fixes #18121

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

(cherry picked from commit fa495604516a610d988f02298c8d97a6ac4777bb)

13 months agodocs: fix SSL_CTX_set_tlsext_ticket_key_cb typos
Daniel McCarney [Mon, 17 Jun 2024 20:53:50 +0000 (16:53 -0400)] 
docs: fix SSL_CTX_set_tlsext_ticket_key_cb typos

* "shortcuts the TLS" -> "shortcuts the TLS handshake"
* "don't occur" -> "doesn't occur"
* "storing client certificate" -> "storing the client certificate"
* "an all other" -> "and all other"

CLA: trivial

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

(cherry picked from commit e2a4d68a03b8a3576b0fe917a602b3a283d105a5)

13 months agoossl_store.pod: Correct the example of OSSL_STORE API usage
Et7f3 [Sat, 6 Apr 2024 19:09:30 +0000 (21:09 +0200)] 
ossl_store.pod: Correct the example of OSSL_STORE API usage

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

(cherry picked from commit d5412c94a399d3923b2dec2431ead60288d857c8)

13 months agoFix typo in openssl-verification-options documentation.
Jaime Hablutzel [Mon, 17 Jun 2024 16:40:08 +0000 (11:40 -0500)] 
Fix typo in openssl-verification-options documentation.

CLA: trivial

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

(cherry picked from commit f159d861e2761ffc6421b0486fdd482f37215f9f)

13 months agofix potential memory leak in PKCS12_add_key_ex()
sashan [Wed, 22 May 2024 07:16:49 +0000 (09:16 +0200)] 
fix potential memory leak in PKCS12_add_key_ex()

function must make sure memorry allocated for `p8`
gets freed in error path. Issue reported by LuMingYinDetect

Fixes #24453

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

13 months agoOSSL_CMP_{validate_msg,CTX_new}.pod: add warning notes on OSSL_CMP_OPT_PERMIT_TA_IN_E...
Dr. David von Oheimb [Mon, 11 Mar 2024 12:06:13 +0000 (13:06 +0100)] 
OSSL_CMP_{validate_msg,CTX_new}.pod: add warning notes on OSSL_CMP_OPT_PERMIT_TA_IN_EXTRACERTS_FOR_IR

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

(cherry picked from commit 40948c4c74099ae21843d9265dfe65f13cb9e6c5)

13 months agoOSSL_CMP_validate_msg(): fix check such that OSSL_CMP_OPT_PERMIT_TA_IN_EXTRACERTS_FOR...
Dr. David von Oheimb [Mon, 11 Mar 2024 11:48:26 +0000 (12:48 +0100)] 
OSSL_CMP_validate_msg(): fix check such that OSSL_CMP_OPT_PERMIT_TA_IN_EXTRACERTS_FOR_IR becomes usable again

Fixes #23706

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

(cherry picked from commit b893ceef2feb6b64504446f984ee5a57d2b69d1f)

13 months agoConfigure: make absolutedir() use rel2abs() on Windows too
Richard Levitte [Wed, 5 Jun 2024 19:43:01 +0000 (21:43 +0200)] 
Configure: make absolutedir() use rel2abs() on Windows too

perl's realpath() seems to be buggy on Windows, so we turn to rel2abs()
there as well.

Fixes #23593

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

(cherry picked from commit 6e01d3114b77c82cf83a2bfe53f7ba97840fbe36)

14 months ago[Docs] Notes about freeing objects
Ruslan Baratov [Thu, 23 May 2024 14:03:12 +0000 (22:03 +0800)] 
[Docs] Notes about freeing objects

- Free objects returned from PEM read
- Free objects returned from d2i_*

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

(cherry picked from commit d4700c0b237c05315e3bf14fc416abcbdfe51ff2)

14 months agotest/prov_config_test.c: Cleanup and fix potential leaks
Tomas Mraz [Thu, 11 Apr 2024 09:34:57 +0000 (11:34 +0200)] 
test/prov_config_test.c: Cleanup and fix potential leaks

Fixes #24106

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

(cherry picked from commit 140540189c67ba94188165b1144fdfb5b248bc02)

14 months agoenable AES-XTS optimization for AIX in 3.0 branch
sanumesh [Wed, 29 May 2024 16:09:26 +0000 (11:09 -0500)] 
enable AES-XTS optimization for AIX in 3.0 branch

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

14 months agoAdd power optimizations for AES-XTS algorithm
sanumesh [Mon, 20 May 2024 14:35:55 +0000 (09:35 -0500)] 
Add power optimizations for AES-XTS algorithm

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

14 months agoDrop the old PGP key fingerprint
Richard Levitte [Wed, 5 Jun 2024 08:22:22 +0000 (10:22 +0200)] 
Drop the old PGP key fingerprint

All public releases have the information of the new PGP key in
doc/fingerprints.txt, so it is finally time to drop the old.

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

(cherry picked from commit a9fa07f47cea6a43d5ac4a3aa336ab34756c2e9b)

14 months agoPrepare for 3.0.15 24560/head
Tomas Mraz [Tue, 4 Jun 2024 14:27:49 +0000 (16:27 +0200)] 
Prepare for 3.0.15

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

14 months agoPrepare for release of 3.0.14 openssl-3.0.14
Tomas Mraz [Tue, 4 Jun 2024 14:27:20 +0000 (16:27 +0200)] 
Prepare for release of 3.0.14

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

14 months agomake update
Tomas Mraz [Tue, 4 Jun 2024 14:27:18 +0000 (16:27 +0200)] 
make update

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

14 months agoCopyright year updates
Tomas Mraz [Tue, 4 Jun 2024 14:25:21 +0000 (16:25 +0200)] 
Copyright year updates

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

14 months agoUpdate CHANGES.md and NEWS.md for the upcoming release
Tomas Mraz [Mon, 3 Jun 2024 14:52:29 +0000 (16:52 +0200)] 
Update CHANGES.md and NEWS.md for the upcoming release

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

(cherry picked from commit 3fa9df5f1d0f12d1d488aaa0fc46bb533d3870f0)

14 months ago[Docs] SSL_*_use will increment reference counter
Ruslan Baratov [Wed, 29 May 2024 00:36:53 +0000 (08:36 +0800)] 
[Docs] SSL_*_use will increment reference counter

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

(cherry picked from commit 0c73d65eeae9086c37149f4a512946040c8c2af3)

14 months agocmp_hdr_test.c: Fix leaks in error cases
shridhar kalavagunta [Mon, 27 May 2024 23:43:51 +0000 (18:43 -0500)] 
cmp_hdr_test.c: Fix leaks in error cases

Fixes #24475

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

(cherry picked from commit 0986e128ff258d482cab712aa617a533db5588ea)

14 months agoFix potential memory leak in test_bad_dtls
Amir Mohammadi [Wed, 22 May 2024 16:18:51 +0000 (19:48 +0330)] 
Fix potential memory leak in test_bad_dtls

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

(cherry picked from commit abe05fda8bdbfb35de7420cab31d5e459fabc874)

14 months agoVMS: Redefine _XOPEN_SOURCE_EXTENDED with the value 1 in apps/ocsp.c
Richard Levitte [Thu, 23 May 2024 06:04:42 +0000 (08:04 +0200)] 
VMS: Redefine _XOPEN_SOURCE_EXTENDED with the value 1 in apps/ocsp.c

Some versions if the VMS C system header files seem to require this.

Fixes #24466 on release older than 3.3.

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

(cherry picked from commit 54e9e254feefb153b4b94330f9d3f20b6120c106)

14 months agoecstresstest.c: Fix memory leak on error
Nek Saikou [Fri, 24 May 2024 10:45:01 +0000 (17:45 +0700)] 
ecstresstest.c: Fix memory leak on error

Fixes #24476
CLA: trivial

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

(cherry picked from commit 434e7f7cb4259f8c8c1463fd38fe723b3efca887)

14 months agoFurther extend the SSL_free_buffers testing
Matt Caswell [Fri, 26 Apr 2024 12:58:29 +0000 (13:58 +0100)] 
Further extend the SSL_free_buffers testing

We extend the testing to test what happens when pipelining is in use.

Follow on from CVE-2024-4741

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

(cherry picked from commit 6972d5ace1275faf404e7a53e806861962f4121c)

14 months agoMove the ability to load the dasync engine into ssltestlib.c
Matt Caswell [Fri, 26 Apr 2024 10:05:52 +0000 (11:05 +0100)] 
Move the ability to load the dasync engine into ssltestlib.c

The sslapitest has a helper function to load the dasync engine which is
useful for testing pipelining. We would like to have the same facility
from sslbuffertest, so we move the function to the common location
ssltestlib.c

Follow on from CVE-2024-4741

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

(cherry picked from commit 0544c21a22f4d787e6f31d35e8f980402ac90a6d)

14 months agoExtend the SSL_free_buffers testing
Matt Caswell [Thu, 25 Apr 2024 08:34:16 +0000 (09:34 +0100)] 
Extend the SSL_free_buffers testing

Test that attempting to free the buffers at points where they should not
be freed works as expected.

Follow on from CVE-2024-4741

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

(cherry picked from commit 4238abc17d44383592f92d6254d89dac806ee76b)

14 months agoSet rlayer.packet to NULL after we've finished using it
Matt Caswell [Wed, 24 Apr 2024 10:33:41 +0000 (11:33 +0100)] 
Set rlayer.packet to NULL after we've finished using it

In order to ensure we do not have a UAF we reset the rlayer.packet pointer
to NULL after we free it.

CVE-2024-4741

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

(cherry picked from commit d146349171101dec3a876c13eb7a6dea32ba62ba)

14 months agoOnly free the read buffers if we're not using them
Watson Ladd [Wed, 24 Apr 2024 10:26:56 +0000 (11:26 +0100)] 
Only free the read buffers if we're not using them

If we're part way through processing a record, or the application has
not released all the records then we should not free our buffer because
they are still needed.

CVE-2024-4741

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

(cherry picked from commit 704f725b96aa373ee45ecfb23f6abfe8be8d9177)

14 months ago[Docs] Default value for verification flags is 'SSL_VERIFY_NONE'
Ruslan Baratov [Sat, 18 May 2024 15:34:19 +0000 (23:34 +0800)] 
[Docs] Default value for verification flags is 'SSL_VERIFY_NONE'

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

(cherry picked from commit a73e07dbb7df4795c4ec537f19516b541fb8dd3c)

14 months agofips provider: explicitly setup cpuid when initializing
Hongren Zheng [Thu, 16 May 2024 08:41:25 +0000 (16:41 +0800)] 
fips provider: explicitly setup cpuid when initializing

Fixes: #23979
Previously fips module relied on OPENSSL_cpuid_setup
being used as constructor by the linker to correctly
setup the capability vector, either via .section .init
(for x86_64) or via __attribute__((constructor)).

This would make ld.so call OPENSSL_cpuid_setup before
the init function for fips module. However, this early
constructing behavior has several disadvantages:

1. Not all platform/toolchain supports such behavior

2. Initialisation sequence is not well defined, and
some function might not be initialized when cpuid_setup
is called

3. Implicit path is hard to maintain and debug

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

(cherry picked from commit a192b2439c0207ce1b04ba6137329b68f9e23680)

14 months agoFix typo in CONTRIBUTING.md
James Muir [Thu, 16 May 2024 02:07:58 +0000 (22:07 -0400)] 
Fix typo in CONTRIBUTING.md

CLA: trivial

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

(cherry picked from commit 45f5d51b72a262bf85c4461fbded91485ce6b9da)

14 months agoCheck DSA parameters for excessive sizes before validating 24399/head
Tomas Mraz [Wed, 8 May 2024 13:23:45 +0000 (15:23 +0200)] 
Check DSA parameters for excessive sizes before validating

This avoids overly long computation of various validation
checks.

Fixes CVE-2024-4603

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

(cherry picked from commit 85ccbab216da245cf9a6503dd327072f21950d9b)

14 months agoUpdate openssl-smime.pod.in
DominikN [Fri, 5 Apr 2024 21:06:41 +0000 (23:06 +0200)] 
Update openssl-smime.pod.in

Remove duplicate entries for -nocerts and -noattr

CLA:trivial

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

(cherry picked from commit 5a0c92cf093b4f0aa65f4fdbff88d7bdc83491f3)

14 months ago[Docs] 'SSL_CTX_set_cert_store' ownership of 'store'
Ruslan Baratov [Sun, 12 May 2024 08:33:59 +0000 (16:33 +0800)] 
[Docs] 'SSL_CTX_set_cert_store' ownership of 'store'

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

(cherry picked from commit 987baef4fa54d268d7eaa93837a56398409698a1)

14 months agofix sm2 encryption implementation bug.
Liu-Ermeng [Mon, 8 Jan 2024 04:01:29 +0000 (20:01 -0800)] 
fix sm2 encryption implementation bug.

According to the "GB/T 32918.4-2016"
section 6.1 encryption, step A5:
If result of the "KDF" is all zeros, we should go back to
the begin(step A1).

section 7.1 decryption, step B4:
If result of the "KDF" is all zeros, we should raise error and exit.

Signed-off-by: Liu-Ermeng <liuermeng2@huawei.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23210)

(cherry picked from commit 170620675dfd74f34bdcf8aba71dffeb07f3d533)

14 months agosslapitest.c: With fips skip tests depending on X25519 and X448
Tomas Mraz [Thu, 9 May 2024 08:48:56 +0000 (10:48 +0200)] 
sslapitest.c: With fips skip tests depending on X25519 and X448

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

(cherry picked from commit f6e469808501f52c7e8f8679d6c3290cf1c258b3)

14 months agotest/ssl-tests: Avoid depending on X25519 and X448 being fips approved
Tomas Mraz [Wed, 17 Apr 2024 16:05:35 +0000 (18:05 +0200)] 
test/ssl-tests: Avoid depending on X25519 and X448 being fips approved

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

(cherry picked from commit 32ca45d3f905d014c44e1570617d96a7372c324d)

14 months agoRelease pkey_ctx on initialization failure
irosay [Fri, 10 May 2024 16:37:52 +0000 (17:37 +0100)] 
Release pkey_ctx on initialization failure

CLA: trivial

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

(cherry picked from commit 3e9d933882407a0792dc3466ba9a0d53d40677a7)

14 months agoapps/pkcs12: Not writing the private key file until the import password is verified
naaysayer [Sat, 2 Mar 2024 09:35:35 +0000 (13:35 +0400)] 
apps/pkcs12: Not writing the private key file until the import password is verified

Fixes #904

CLA: trivial

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

(cherry picked from commit f5462572a1873482ce38646cbf00dfc483f02068)

14 months agoAdd reason codes with the correct offset for two alerts
Jacob Champion [Mon, 6 May 2024 16:50:11 +0000 (09:50 -0700)] 
Add reason codes with the correct offset for two alerts

Fixes #24300. The current values of SSL_R_NO_APPLICATION_PROTOCOL and
SSL_R_PSK_IDENTITY_NOT_FOUND don't allow for a correct lookup of the
corresponding reason strings.

CLA: trivial

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

14 months agoDependabot update: Bump coverallsapp/github-action
dependabot[bot] [Wed, 8 May 2024 17:11:38 +0000 (17:11 +0000)] 
Dependabot update: Bump coverallsapp/github-action

CLA: trivial

(deps): Bump coverallsapp/github-action

Bumps [coverallsapp/github-action](https://github.com/coverallsapp/github-action) from 2.2.3 to 2.3.0.
- [Release notes](https://github.com/coverallsapp/github-action/releases)
- [Commits](https://github.com/coverallsapp/github-action/compare/v2.2.3...v2.3.0)

---
updated-dependencies:
- dependency-name: coverallsapp/github-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24350)

(cherry picked from commit 13d37d8f7557ee7935032ea832eab3e3c5540158)

14 months agoCorrect top for EC/DSA nonces if BN_DEBUG is on
Tomas Mraz [Tue, 30 Apr 2024 09:46:26 +0000 (11:46 +0200)] 
Correct top for EC/DSA nonces if BN_DEBUG is on

Otherwise following operations would bail out in bn_check_top().

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(cherry picked from commit a380ae85be287045b1eaa64d23942101a426c080)

(Merged from https://github.com/openssl/openssl/pull/24317)

(cherry picked from commit 549208d1f1175aca5cc1ea989c4e9e4a41bc558c)

14 months agoRename BN_generate_dsa_nonce() to ossl_bn_gen_dsa_nonce_fixed_top()
Tomas Mraz [Mon, 29 Apr 2024 15:56:01 +0000 (17:56 +0200)] 
Rename BN_generate_dsa_nonce() to ossl_bn_gen_dsa_nonce_fixed_top()

And create a new BN_generate_dsa_nonce() that corrects the BIGNUM top.
We do this to avoid leaking fixed top numbers via the public API.

Also add a slight optimization in ossl_bn_gen_dsa_nonce_fixed_top()
and make it LE/BE agnostic.

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(cherry picked from commit 9c85f6cd2d6debe5ef6ef475ff4bf17e0985f7a2)

(Merged from https://github.com/openssl/openssl/pull/24317)

(cherry picked from commit fdc3efc371be43d5092bb19823e084f54541cbe3)

14 months agoAdd ossl_bn_priv_rand_range_fixed_top() and use it for EC/DSA
Tomas Mraz [Thu, 25 Apr 2024 17:26:08 +0000 (19:26 +0200)] 
Add ossl_bn_priv_rand_range_fixed_top() and use it for EC/DSA

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(cherry picked from commit 13b3ca5c998e6db4f7251a56c43541cb1a422bd0)

(Merged from https://github.com/openssl/openssl/pull/24317)

(cherry picked from commit a70ca93cdbc0ed36bf783b9eadc4cea35986b139)

14 months agoAdd ossl_bn_is_word_fixed_top()
Tomas Mraz [Thu, 25 Apr 2024 13:35:36 +0000 (15:35 +0200)] 
Add ossl_bn_is_word_fixed_top()

Also correct some BN_FLG_FIXED_TOP flag handling.

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(cherry picked from commit 2d285fa873028f6cff9484a0cdf690fe05d7fb16)

(Merged from https://github.com/openssl/openssl/pull/24317)

(cherry picked from commit 5dbb2a8ca2c1ba42dfb9445b5ea76adccbdb9744)

14 months agoMake BN_generate_dsa_nonce() constant time and non-biased
Tomas Mraz [Thu, 11 Apr 2024 11:10:09 +0000 (13:10 +0200)] 
Make BN_generate_dsa_nonce() constant time and non-biased

Co-authored-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(cherry picked from commit d7d1bdcb6aa3d5000bf7f5ebc5518be5c91fd5a5)

(Merged from https://github.com/openssl/openssl/pull/24317)

(cherry picked from commit 0df711a25da6e99a7ce0dbaf992acb644252385f)

14 months agoAvoid memory leak in x509_test error path
Viktor Dukhovni [Wed, 27 Mar 2024 22:15:29 +0000 (18:15 -0400)] 
Avoid memory leak in x509_test error path

Fixes #23897

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

(cherry picked from commit 7cbca5a6d6e792c75c414e1f3fb22e2afae67988)

15 months agoFix intermittent sslapitest early data related failures
Matt Caswell [Mon, 25 Mar 2024 12:32:17 +0000 (12:32 +0000)] 
Fix intermittent sslapitest early data related failures

Early data is time sensitive. We have an approx 8 second allowance between
writing the early data and reading it. If we exceed that time tests will
fail. This can sometimes (rarely) occur in normal CI operation. We can try
and detect this and just ignore the result of such test failures if the test
has taken too long. We assume anything over 7 seconds is too long.

This is a partial fix for #22605

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

(cherry picked from commit ee2b7d5264d9e5498393744e9355dc8b735ab237)

15 months agoAdd linux-arm64ilp32-clang target
Huiyue Xu [Thu, 9 Nov 2023 02:54:02 +0000 (10:54 +0800)] 
Add linux-arm64ilp32-clang target

While clang 15 config target by '--target', not cannot support
'-mabi=ilp32', so add the linux-arm64ilp32-clang target.

Signed-off-by: Huiyue Xu <xuhuiyue@huawei.com>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22666)

(cherry picked from commit 69bd5e4fff8ac9bf4dc3ed6fd87b5a5858edbb01)

15 months agoCorrect ossl_sleep for threaded model by introducing sleep().
Randall S. Becker [Mon, 25 Mar 2024 19:30:53 +0000 (19:30 +0000)] 
Correct ossl_sleep for threaded model by introducing sleep().

This fix handles situations where ossl_sleep() receives a millis value equal
or greater than 1000, which breaks platforms where this is not legal. The
change also avoids unnecessarily calling sleep(0).

Fixes: #23961
Signed-off-by: Randall S. Becker <randall.becker@nexbridge.ca>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23972)

15 months agoAdd docs noting requirements for SM2 signing
Neil Horman [Tue, 19 Mar 2024 08:52:57 +0000 (04:52 -0400)] 
Add docs noting requirements for SM2 signing

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

(cherry picked from commit 54673b93594a71c9f8052a1df1a7c6bf07c49f4d)

15 months agoAdd check for public key presence on sm2 signing
Neil Horman [Mon, 18 Mar 2024 18:59:32 +0000 (14:59 -0400)] 
Add check for public key presence on sm2 signing

SM2 requires that the public EC_POINT be present in a key when signing.
If its not there we crash on a NULL pointer.  Add a check to ensure that
its present, and raise an error if its not

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

(cherry picked from commit 1316aa05aae57cf47d8c8bfca38aaa042db1518f)

15 months agoess_lib.c: Changed ERR_LIB_CMS to ERR_LIB_ESS
leerubin13 [Sun, 28 Apr 2024 21:50:32 +0000 (17:50 -0400)] 
ess_lib.c: Changed ERR_LIB_CMS to ERR_LIB_ESS

This fixes an incorrect error message.

Fixes #24224
CLA: trivial

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

(cherry picked from commit 2d29a8a7e8ef42050d2b08ca8cec9e4d9f0a0bb7)

15 months agodoc: clarify SSL_CIPHER_description allocation
Daniel McCarney [Thu, 21 Mar 2024 19:41:11 +0000 (15:41 -0400)] 
doc: clarify SSL_CIPHER_description allocation

Previously the documentation for `SSL_CIPHER_description` said:
> If buf is provided, it must be at least 128 bytes, otherwise a buffer
> will be allocated using OPENSSL_malloc().

In reality, `OPENSSL_malloc` is only invoked if the provided `buf`
argument is `NULL`. If the `buf` arg is not `NULL`, but smaller than
128 bytes, the function returns `NULL` without attempting to allocate
a new buffer for the description.

This commit adjusts the documentation to better describe the implemented
behaviour.

CLA: trivial

Reviewed-by: Matt Caswell <matt@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/23921)

(cherry picked from commit 6a4a714045415be6720f4165c4d70a0ff229a26a)

15 months agoFix missing NULL check in prov_config_test
Neil Horman [Fri, 19 Apr 2024 14:17:54 +0000 (10:17 -0400)] 
Fix missing NULL check in prov_config_test

coverity-1596500 caught a missing null check.  We should never hit it as
the test harness always sets the environment variable, but lets add the
check for safety

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

(cherry picked from commit a380ec952f138f644d227637eeba90fd1e17f72f)

15 months agoFix up path generation to use OPENSSL_MODULES
Neil Horman [Fri, 5 Apr 2024 13:06:10 +0000 (09:06 -0400)] 
Fix up path generation to use OPENSSL_MODULES

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(cherry picked from commit 4e3c1e6206251c59855362d6d2edab4621c31dec)

(Merged from https://github.com/openssl/openssl/pull/24198)

(cherry picked from commit 163202f0b95cfc7e666e45cafc55a505f51f6153)

15 months agoUpdate modulepath test for provider config to skip if not present
Neil Horman [Thu, 4 Apr 2024 19:39:17 +0000 (15:39 -0400)] 
Update modulepath test for provider config to skip if not present

If the p_test.so library isn't present, don't run the test

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(cherry picked from commit b80fed3f27ebe156b17246f7c12c5178cbe6834e)

(Merged from https://github.com/openssl/openssl/pull/24198)

(cherry picked from commit 83c649996c18e5185f9439172d5908ad7fef9146)

15 months agoAdd test for OSSL_PROVIDER_load with module path set
Neil Horman [Wed, 3 Apr 2024 19:18:33 +0000 (15:18 -0400)] 
Add test for OSSL_PROVIDER_load with module path set

Ensure that, with the modulepath setting set in a config field, that we
are able to load a provider from the path relative to OPENSSL_MODULES

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(cherry picked from commit 91a77cbf66c575345cf1eab31717e8edafcd1633)

(Merged from https://github.com/openssl/openssl/pull/24198)

(cherry picked from commit db163245097bc813235403c234795721d4e5c4eb)

15 months agoset module path from template
Neil Horman [Tue, 2 Apr 2024 19:02:51 +0000 (15:02 -0400)] 
set module path from template

Modules that aren't activated at conf load time don't seem to set the
module path from the template leading to load failures.  Make sure to
set that

Fixes #24020

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(cherry picked from commit bc9595963a45e28e6a8b2de45a6719c252bd3a3d)

(Merged from https://github.com/openssl/openssl/pull/24198)

(cherry picked from commit 71e5bb982f9c9563567ea8ae9f6e29492e9146ca)

15 months agoAdd an Apple privacy info file for OpenSSL
Takehiko Yokota [Wed, 24 Apr 2024 09:03:59 +0000 (18:03 +0900)] 
Add an Apple privacy info file for OpenSSL

Added PrivacyInfo.xcprivacy to os-dep/Apple/ dir.

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

(cherry picked from commit bde66e828dd2869d02225e4aab01d0983f242ae3)

15 months agoUpdate perl-actions/install-with-cpanm version in CI
Tomas Mraz [Fri, 16 Feb 2024 15:24:49 +0000 (16:24 +0100)] 
Update perl-actions/install-with-cpanm version in CI

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
(Merged from https://github.com/openssl/openssl/pull/23613)

(cherry picked from commit 599bc929baa3c5496342641e028e4c482aed7449)

15 months agoInvoke tear_down when exiting test_encode_tls_sct() prematurely
shridhar kalavagunta [Sun, 21 Apr 2024 23:48:33 +0000 (18:48 -0500)] 
Invoke tear_down when exiting test_encode_tls_sct() prematurely

Fixes #24121

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

(cherry picked from commit 264ff64b9443e60c7c93af0ced2b22fdf622d179)

15 months agoFix migration guide mappings for i2o/o2i_ECPublicKey
slontis [Fri, 5 Apr 2024 04:32:23 +0000 (15:32 +1100)] 
Fix migration guide mappings for i2o/o2i_ECPublicKey

Fixes #23854

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

(cherry picked from commit 6594baf6457c64f6fce3ec60cb2617f75d98d159)

15 months agoHandle empty param in EVP_PKEY_CTX_add1_hkdf_info
trinity-1686a [Mon, 15 Apr 2024 09:13:14 +0000 (11:13 +0200)] 
Handle empty param in EVP_PKEY_CTX_add1_hkdf_info

Fixes #24130
The regression was introduced in PR #23456.

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

(cherry picked from commit 299996fb1fcd76eeadfd547958de2a1b822f37f5)

15 months agodoc/fingerprints.txt: Add the future OpenSSL release key
Richard Levitte [Mon, 8 Apr 2024 13:14:40 +0000 (15:14 +0200)] 
doc/fingerprints.txt: Add the future OpenSSL release key

This will be used for future releases

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

(cherry picked from commit 4ffef97d3755a0425d5d72680daebfa07383b05c)

15 months agolist_provider_info(): Fix leak on error
Tomas Mraz [Thu, 11 Apr 2024 15:49:53 +0000 (17:49 +0200)] 
list_provider_info(): Fix leak on error

Fixes #24110

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

(cherry picked from commit 993c2407d04956ffdf9b32cf0a7e4938ace816dc)

15 months agomake_addressPrefix(): Fix a memory leak in error case
Tomas Mraz [Thu, 11 Apr 2024 07:40:18 +0000 (09:40 +0200)] 
make_addressPrefix(): Fix a memory leak in error case

Fixes #24098

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

(cherry picked from commit 682ed1b86ebe97036ab37897d528343d0e4def69)

15 months agoDocument that private and pairwise checks are not bounded by key size
Tomas Mraz [Fri, 5 Apr 2024 14:31:05 +0000 (16:31 +0200)] 
Document that private and pairwise checks are not bounded by key size

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

(cherry picked from commit 27005cecc75ec7a22a673d57fc35a11dea30ac0a)

15 months agoFix socket descriptor checks on Windows
olszomal [Thu, 4 Apr 2024 09:34:33 +0000 (11:34 +0200)] 
Fix socket descriptor checks on Windows

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

(cherry picked from commit c89baf871030c811ba316ccbdcea26c294f605ae)

15 months agoman EVP_PKEY_CTX_set_params: document params is a list
Hubert Kario [Wed, 27 Mar 2024 16:44:42 +0000 (17:44 +0100)] 
man EVP_PKEY_CTX_set_params: document params is a list

Signed-off-by: Hubert Kario <hkario@redhat.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23986)

(cherry picked from commit 9b87c5a3ffa1ca233be96dd0bce812c04bad53fe)

15 months agoAPPS: Add missing OPENSSL_free() and combine the error handler
Jiasheng Jiang [Sat, 16 Mar 2024 21:27:14 +0000 (21:27 +0000)] 
APPS: Add missing OPENSSL_free() and combine the error handler

Add the OPENSSL_free() in the error handler to release the "*md_value"
allocated by app_malloc(). To make the code clear and avoid possible
future errors, combine the error handler in the "err" tag.
Then, we only need to use "goto err" instead of releasing the memory
separately.

Since the EVP_MD_get_size() may return negative numbers when an error occurs,
create_query() may fail to catch the error since it only considers 0 as an
error code.

Therefore, unifying the error codes of create_digest() from non-positive
numbers to 0 is better, which also benefits future programming.

Fixes: c7235be ("RFC 3161 compliant time stamp request creation, response generation and response verification.")
Signed-off-by: Jiasheng Jiang <jiasheng@purdue.edu>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/23873)

(cherry picked from commit beb82177ddcd4b536544ceec92bb53f4d85d8e91)

15 months agoFix "Error finalizing cipher loop" when running openssl speed -evp -decrypt
Tom Cosgrove [Mon, 26 Feb 2024 17:14:48 +0000 (17:14 +0000)] 
Fix "Error finalizing cipher loop" when running openssl speed -evp -decrypt

When using CCM, openssl speed uses the loop function EVP_Update_loop_ccm() which
sets a (fake) tag when decrypting. When using -aead (which benchmarks a different
sequence than normal, to be comparable to TLS operation), the loop function
EVP_Update_loop_aead() is used, which also sets a tag when decrypting.

However, when using defaults, the loop function EVP_Update_loop() is used, which
does not set a tag on decryption, leading to "Error finalizing cipher loop".

To fix this, set a fake tag value if we're doing decryption on an AEAD cipher in
EVP_Update_loop(). We don't check the return value: this shouldn't really be able
to fail, and if it does, the following EVP_DecryptUpdate() is almost certain to
fail, so that can catch it.

The decryption is certain to fail (well, almost certain, but with a very low
probability of success), but this is no worse than at present. This minimal
change means that future benchmarking data should be comparable to previous
benchmarking data.

(This is benchmarking code: don't write real apps like this!)

Fixes #23657

Change-Id: Id581cf30503c1eb766464e315b1f33914040dcf7

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

(cherry picked from commit b3be6cc89e4dcfafe8f8be97e9519c26af2d19f5)

15 months agoFix EVP_PKEY_CTX_add1_hkdf_info() behavior
Todd Short [Fri, 2 Feb 2024 04:09:38 +0000 (23:09 -0500)] 
Fix EVP_PKEY_CTX_add1_hkdf_info() behavior

Fix #23448

`EVP_PKEY_CTX_add1_hkdf_info()` behaves like a `set1` function.

Fix the setting of the parameter in the params code.
Update the TLS_PRF code to also use the params code.
Add tests.

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

(cherry picked from commit 6b566687b58fde08b28e3331377f050768fad89b)

15 months agoAdd a test for session cache overflow
Matt Caswell [Fri, 15 Jul 2022 12:26:33 +0000 (13:26 +0100)] 
Add a test for session cache overflow

Test sessions behave as we expect even in the case that an overflow
occurs when adding a new session into the session cache.

Related to CVE-2024-2511

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

(cherry picked from commit ddead0935d77ba9b771d632ace61b145d7153f18)

15 months agoHardening around not_resumable sessions
Matt Caswell [Fri, 15 Mar 2024 17:58:42 +0000 (17:58 +0000)] 
Hardening around not_resumable sessions

Make sure we can't inadvertently use a not_resumable session

Related to CVE-2024-2511

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

(cherry picked from commit c342f4b8bd2d0b375b0e22337057c2eab47d9b96)

15 months agoAdd a CHANGES.md/NEWS.md entry for the unbounded memory growth bug
Matt Caswell [Tue, 5 Mar 2024 16:01:20 +0000 (16:01 +0000)] 
Add a CHANGES.md/NEWS.md entry for the unbounded memory growth bug

Related to CVE-2024-2511

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

(cherry picked from commit e32ad41b48c28d82339de064b05d5e269e5aed97)

15 months agoFix unconstrained session cache growth in TLSv1.3
Matt Caswell [Tue, 5 Mar 2024 15:43:53 +0000 (15:43 +0000)] 
Fix unconstrained session cache growth in TLSv1.3

In TLSv1.3 we create a new session object for each ticket that we send.
We do this by duplicating the original session. If SSL_OP_NO_TICKET is in
use then the new session will be added to the session cache. However, if
early data is not in use (and therefore anti-replay protection is being
used), then multiple threads could be resuming from the same session
simultaneously. If this happens and a problem occurs on one of the threads,
then the original session object could be marked as not_resumable. When we
duplicate the session object this not_resumable status gets copied into the
new session object. The new session object is then added to the session
cache even though it is not_resumable.

Subsequently, another bug means that the session_id_length is set to 0 for
sessions that are marked as not_resumable - even though that session is
still in the cache. Once this happens the session can never be removed from
the cache. When that object gets to be the session cache tail object the
cache never shrinks again and grows indefinitely.

CVE-2024-2511

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

(cherry picked from commit 7e4d731b1c07201ad9374c1cd9ac5263bdf35bce)

15 months agoExtend the multi_resume test for simultaneous resumptions
Matt Caswell [Tue, 5 Mar 2024 15:35:51 +0000 (15:35 +0000)] 
Extend the multi_resume test for simultaneous resumptions

Test what happens if the same session gets resumed multiple times at the
same time - and one of them gets marked as not_resumable.

Related to CVE-2024-2511

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

(cherry picked from commit 031b11a4054c972a5e2f07dfa81ce1842453253e)