]> git.ipfire.org Git - thirdparty/openssl.git/log
thirdparty/openssl.git
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 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)

13 months agoAvoid another copy of key schedule pointer in PROV_GCM_CTX
Tomas Mraz [Fri, 13 Oct 2023 14:22:59 +0000 (16:22 +0200)] 
Avoid another copy of key schedule pointer in PROV_GCM_CTX

This copy would need an update on dupctx but
rather than doing it just remove the copy.

This fixes failures of evp_test on Windows with
new CPUs.

Fixes #24135

(cherry picked from commit 143ca66cf00c88950d689a8aa0c89888052669f4)

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/24565)

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

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

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

(cherry picked from commit 443823b51c3cfa2f4c427bf89c3ec121eaaf96e9)

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

(cherry picked from commit 858dfdfc67ea50fbe9ba38250daf306d5d0370a3)

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.1.7 24559/head
Tomas Mraz [Tue, 4 Jun 2024 14:21:32 +0000 (16:21 +0200)] 
Prepare for 3.1.7

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

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

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

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

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

14 months agoCopyright year updates
Tomas Mraz [Tue, 4 Jun 2024 14:18:59 +0000 (16:18 +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)

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)

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)

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)

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)

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
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 ago90-test_sslapi.t: Fix execution of sslapitest with fips provider
Tomas Mraz [Fri, 10 May 2024 12:50:46 +0000 (14:50 +0200)] 
90-test_sslapi.t: Fix execution of sslapitest with fips provider

Default configuration of the fips provider for tests is pedantic
which means that sslapitest was not fully executed with fips provider.

The ems check must be switched off for full execution.

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

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)

(cherry picked from commit 9e33c9c48f6cde4d607a4205476b2faf442e9cb5)

14 months agodoc: Fix description of EVP_CIPHER_CTX_dup
Daiki Ueno [Mon, 13 May 2024 00:07:57 +0000 (09:07 +0900)] 
doc: Fix description of EVP_CIPHER_CTX_dup

This fixes a couple of copy and paste error from EVP_MD_CTX_dup,
where: EVP_CIPHER_CTX_dup is useful to avoid multiple
EVP_CIPHER_fetch (instead of EVP_MD_fetch) and returns
EVP_CIPHER_CTX (instead of EVP_MD_CTX).

Signed-off-by: Daiki Ueno <dueno@redhat.com>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/24376)

(cherry picked from commit 7860bca22c404cfd763ae2648d708d5cc4df6c2f)

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)

14 months agoAdjust FIPS EC/DSA self test data for different nonce generation
Tomas Mraz [Thu, 25 Apr 2024 18:18:51 +0000 (20:18 +0200)] 
Adjust FIPS EC/DSA self test data for different nonce generation

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

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

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)

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)

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)

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)

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)

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)

(cherry picked from commit c263b1fd692bd610b1a3879a9cdad74f3ffe321d)

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)

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)

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)

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)

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)

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)

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)

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 agoaarch64: fix BTI in bsaes assembly code
Tom Cosgrove [Tue, 26 Mar 2024 13:18:00 +0000 (13:18 +0000)] 
aarch64: fix BTI in bsaes assembly code

Change-Id: I63f0fb2af5eb9cea515dec96485325f8efd50511

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
(Merged from https://github.com/openssl/openssl/pull/23982)

(cherry picked from commit 88c74fe05bb4ea21aaba648a5cabd6665e40e3a5)

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)

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)

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)

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)

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)

16 months agoAdd a test for session cache handling
Matt Caswell [Mon, 4 Mar 2024 13:45:23 +0000 (13:45 +0000)] 
Add a test for session cache handling

Repeatedly create sessions to be added to the cache and ensure we never
exceed the expected size.

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)

16 months agodowngrade upload-artifact action to v3
Dmitry Misharov [Wed, 3 Apr 2024 11:47:39 +0000 (13:47 +0200)] 
downgrade upload-artifact action to v3

GitHub Enterpise Server is not compatible with upload-artifact@v4+.
https://github.com/actions/upload-artifact/tree/v4

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

(cherry picked from commit 089271601a1d085f33ef7b7d8c3b6879045be370)

16 months agoopenssl-crl(1): The -verify option is implied by -CA* options
Tomas Mraz [Tue, 2 Apr 2024 16:47:26 +0000 (18:47 +0200)] 
openssl-crl(1): The -verify option is implied by -CA* options

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Todd Short <todd.short@me.com>
(Merged from https://github.com/openssl/openssl/pull/24024)

(cherry picked from commit a16f2e7651b22ee992bb0c279e25164b519c1e80)

16 months agoDEFINE_STACK_OF.pod: Fix prototypes of sk_TYPE_free/zero()
Tomas Mraz [Tue, 2 Apr 2024 14:43:27 +0000 (16:43 +0200)] 
DEFINE_STACK_OF.pod: Fix prototypes of sk_TYPE_free/zero()

They take non-const STACK_OF(TYPE)* 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/24023)

(cherry picked from commit e898c367312c3ab6eb5eaac9b4be768f0d2e4b0e)

16 months agoBackported .gitignore changes from master
dgbkn [Fri, 15 Mar 2024 04:33:14 +0000 (10:03 +0530)] 
Backported .gitignore changes from master

CLA: trivial

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

(cherry picked from commit c79e37a2cd9b51041265d48409a71e79f2224043)

16 months agoAdd 'documentation policy' link to CONTRIBUTING guide.
slontis [Mon, 18 Mar 2024 00:46:12 +0000 (11:46 +1100)] 
Add 'documentation policy' link to CONTRIBUTING guide.

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

(cherry picked from commit e817766c0f46f371fabe344fba60d13afcfc3da9)

16 months agoAlign 'openssl req' string_mask docs to how the software really works
Job Snijders [Tue, 27 Feb 2024 19:14:32 +0000 (19:14 +0000)] 
Align 'openssl req' string_mask docs to how the software really works

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

(cherry picked from commit 2410cb42e62c3be69dcf1aad1bdf1eb0233b670f)

16 months agoFix handling of NULL sig parameter in ECDSA_sign and similar
Bernd Edlinger [Thu, 8 Feb 2024 21:21:55 +0000 (22:21 +0100)] 
Fix handling of NULL sig parameter in ECDSA_sign and similar

The problem is, that it almost works to pass sig=NULL to the
ECDSA_sign, ECDSA_sign_ex and DSA_sign, to compute the necessary
space for the resulting signature.
But since the ECDSA signature is non-deterministic
(except when ECDSA_sign_setup/ECDSA_sign_ex are used)
the resulting length may be different when the API is called again.
This can easily cause random memory corruption.
Several internal APIs had the same issue, but since they are
never called with sig=NULL, it is better to make them return an
error in that case, instead of making the code more complex.

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

(cherry picked from commit 1fa2bf9b1885d2e87524421fea5041d40149cffa)

16 months agoFix openssl req with -addext subjectAltName=dirName
Bernd Edlinger [Fri, 23 Feb 2024 09:32:14 +0000 (10:32 +0100)] 
Fix openssl req with -addext subjectAltName=dirName

The syntax check of the -addext fails because the
X509V3_CTX is used to lookup the referenced section,
but the wrong configuration file is used, where only
a default section with all passed in -addext lines is available.
Thus it was not possible to use the subjectAltName=dirName:section
as an -addext parameter.  Probably other extensions as well.

This change affects only the syntax check, the real extension
was already created with correct parameters.

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

(cherry picked from commit 387418893e45e588d1cbd4222549b5113437c9ab)

16 months agoBump actions/setup-python from 5.0.0 to 5.1.0
dependabot[bot] [Tue, 26 Mar 2024 17:39:00 +0000 (17:39 +0000)] 
Bump actions/setup-python from 5.0.0 to 5.1.0

Bumps [actions/setup-python](https://github.com/actions/setup-python) from 5.0.0 to 5.1.0.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v5.0.0...v5.1.0)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
CLA: trivial

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23977)

(cherry picked from commit de85587911dcd41dc3546b348acf9c9f15dd7c3d)

16 months agoExplicitly state what -keys does
Simo Sorce [Thu, 21 Mar 2024 14:00:52 +0000 (10:00 -0400)] 
Explicitly state what -keys does

Signed-off-by: Simo Sorce <simo@redhat.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/23919)

(cherry picked from commit 693c479a2ca671e0dfca8d1ad14e789169b982ff)

16 months agoAdd NULL check before accessing PKCS7 encrypted algorithm
Viliam Lejčík [Mon, 19 Feb 2024 20:39:05 +0000 (21:39 +0100)] 
Add NULL check before accessing PKCS7 encrypted algorithm

Printing content of an invalid test certificate causes application crash, because of NULL dereference:

user@user:~/openssl$ openssl pkcs12 -in test/recipes/80-test_pkcs12_data/bad2.p12 -passin pass: -info
MAC: sha256, Iteration 2048
MAC length: 32, salt length: 8
PKCS7 Encrypted data: Segmentation fault (core dumped)

Added test cases for pkcs12 bad certificates

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

(cherry picked from commit a4cbffcd8998180b98bb9f7ce6065ed37d079d8b)

16 months agoReplace size_t with int and add the check for the EVP_MD_get_size()
Jiasheng Jiang [Thu, 21 Mar 2024 20:22:01 +0000 (20:22 +0000)] 
Replace size_t with int and add the check for the EVP_MD_get_size()

Replace the type of "digest_size" with int to avoid implicit conversion when it is assigned by EVP_MD_get_size().
Moreover, add the check for the "digest_size".

Fixes: 29ce1066bc ("Update the demos/README file because it is really old. New demos should provide best practice for API use. Add demonstration for computing a SHA3-512 digest - digest/EVP_MD_demo")
Signed-off-by: Jiasheng Jiang <jiasheng@purdue.edu>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23924)

(cherry picked from commit 87e747000fef07c9ec43877bc5e9f2ca34f76a3b)

16 months agoReplace unsigned with int
Jiasheng Jiang [Thu, 21 Mar 2024 19:55:34 +0000 (19:55 +0000)] 
Replace unsigned with int

Replace the type of "digest_length" with int to avoid implicit conversion when it is assigned by EVP_MD_get_size().
Otherwise, it may pass the following check and cause the integer overflow error when EVP_MD_get_size() returns negative numbers.
Signed-off-by: Jiasheng Jiang <jiasheng@purdue.edu>
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/23922)

(cherry picked from commit f13ddaab69def0b453b75a8f2deb80e1f1634f42)

16 months agofix demos/sslecho/main.c so it builds on OpenBSD too
sashan [Fri, 22 Mar 2024 14:19:53 +0000 (15:19 +0100)] 
fix demos/sslecho/main.c so it builds on OpenBSD too

trying to build `demos/sslecho/main.c` shipped by current openssl
fails with error as follows:
```
cc -I../../include -g -Wall   -c -o main.o main.c
main.c:35:24: error: variable has incomplete type 'struct sockaddr_in'
    struct sockaddr_in addr;
                       ^
main.c:35:12: note: forward declaration of 'struct sockaddr_in'
    struct sockaddr_in addr;
           ^
main.c:46:32: error: use of undeclared identifier 'INADDR_ANY'
        addr.sin_addr.s_addr = INADDR_ANY;
                               ^
main.c:152:24: error: variable has incomplete type 'struct sockaddr_in'
    struct sockaddr_in addr;
                       ^
main.c:152:12: note: forward declaration of 'struct sockaddr_in'
    struct sockaddr_in addr;
           ^
3 errors generated.
gmake: *** [<builtin>: main.o] Error 1
```

including `netinet/in.h` fixes the build

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

(cherry picked from commit 01eaf203856bfbb63051f8ecf56eae2d21132496)

16 months agoFixed a typo and grammar in openssl-ts.pod
olszomal [Thu, 21 Mar 2024 10:10:04 +0000 (11:10 +0100)] 
Fixed a typo and grammar in openssl-ts.pod

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

(cherry picked from commit f1c14f1853d2df94e339208eed1df823c2238389)

16 months agoAdd M1 macOS runner to some workflows
Dmitry Misharov [Fri, 1 Mar 2024 15:59:07 +0000 (16:59 +0100)] 
Add M1 macOS runner to some workflows

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

(cherry picked from commit ada9d8c785cce8e75a88675622dd5ec79e9aa6d7)

16 months agoUpdate FIPS hmac key documentation
Matt Hauck [Fri, 15 Mar 2024 01:25:11 +0000 (18:25 -0700)] 
Update FIPS hmac key documentation

The documentation is slightly incorrect about the FIPS hmac key.

CLA: trivial

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

(cherry picked from commit 53ef123f48d402aff7c27f8ec15191cb1cde4105)

16 months agoFix unbounded memory growth when using no-cached-fetch
Matt Caswell [Wed, 13 Mar 2024 15:19:43 +0000 (15:19 +0000)] 
Fix unbounded memory growth when using no-cached-fetch

When OpenSSL has been compiled with no-cached-fetch we do not cache
algorithms fetched from a provider. When we export an EVP_PKEY to a
provider we cache the details of that export in the operation cache for
that EVP_PKEY. Amoung the details we cache is the EVP_KEYMGMT that we used
for the export. When we come to reuse the key in the same provider that
we have previously exported the key to, we check the operation cache for
the cached key data. However because the EVP_KEYMGMT instance was not
cached then instance will be different every time and we were not
recognising that we had already exported the key to the provider.

This causes us to re-export the key to the same provider everytime the key
is used. Since this consumes memory we end up with unbounded memory growth.

The fix is to be more intelligent about recognising that we have already
exported key data to a given provider even if the EVP_KEYMGMT instance is
different.

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

(cherry picked from commit dc9bc6c8e1bd329ead703417a2235ab3e97557ec)