]> git.ipfire.org Git - thirdparty/openssl.git/log
thirdparty/openssl.git
4 days agots_conf: fix memory leak in TS_CONF_set_policies openssl-3.0 16786/head
DONGGEUN YOO [Mon, 29 Sep 2025 00:45:11 +0000 (00:45 +0000)] 
ts_conf: fix memory leak in TS_CONF_set_policies

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

(cherry picked from commit 1f3a6602a13b382c0f09d6659e0d49ec2e41646d)

4 days agoFix Memory leak in CMS_EncryptedData_set1_key
Ryan Hooper [Thu, 25 Sep 2025 16:42:24 +0000 (12:42 -0400)] 
Fix Memory leak in CMS_EncryptedData_set1_key

When CMS_EncryptedData_set1_key is called repeatedly it will
leak data on the second call. This was because
cms->d.encryptedData was already set and needed to be cleared
before the call to M_ASN1_new_of.

Fixes: #28606
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28668)

(cherry picked from commit 7de825efa26d136c7bb118156190437bdcf130b7)

5 days agoPrepare for 3.0.19
openssl-machine [Tue, 30 Sep 2025 13:12:13 +0000 (13:12 +0000)] 
Prepare for 3.0.19

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Release: yes

5 days agoPrepare for release of 3.0.18 openssl-3.0.18
openssl-machine [Tue, 30 Sep 2025 13:12:07 +0000 (13:12 +0000)] 
Prepare for release of 3.0.18

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Release: yes

5 days agomake update
openssl-machine [Tue, 30 Sep 2025 13:12:06 +0000 (13:12 +0000)] 
make update

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Release: yes

5 days agoCopyright year updates
openssl-machine [Tue, 30 Sep 2025 13:10:30 +0000 (13:10 +0000)] 
Copyright year updates

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Release: yes

5 days agoCHANGES.md: update for 3.0.18
Eugene Syromiatnikov [Tue, 30 Sep 2025 10:03:28 +0000 (12:03 +0200)] 
CHANGES.md: update for 3.0.18

3.0.18 CHANGES.md includes the following:
 * https://github.com/openssl/openssl/pull/28198
 * https://github.com/openssl/openssl/pull/28398
 * https://github.com/openssl/openssl/pull/28411
 * https://github.com/openssl/openssl/pull/28449

Release: Yes
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
5 days agoAdd CHANGES.md and NEWS.md updates
Tomas Mraz [Mon, 29 Sep 2025 12:15:34 +0000 (14:15 +0200)] 
Add CHANGES.md and NEWS.md updates

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
6 days agouse_proxy(): Add missing terminating NUL byte
Tomas Mraz [Thu, 11 Sep 2025 16:43:55 +0000 (18:43 +0200)] 
use_proxy(): Add missing terminating NUL byte

Fixes CVE-2025-9232

There is a missing terminating NUL byte after strncpy() call.
Issue and a proposed fix reported by Stanislav Fort (Aisle Research).

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(cherry picked from commit 6bca15039e99d37ce3a3564eb862a3b1ff40e63d)

6 days agokek_unwrap_key(): Fix incorrect check of unwrapped key size
Viktor Dukhovni [Thu, 11 Sep 2025 16:10:12 +0000 (18:10 +0200)] 
kek_unwrap_key(): Fix incorrect check of unwrapped key size

Fixes CVE-2025-9230

The check is off by 8 bytes so it is possible to overread by
up to 8 bytes and overwrite up to 4 bytes.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(cherry picked from commit 9c462be2cea54ebfc62953224220b56f8ba22a0c)

9 days agokrb5kdf.c.in: Check the key size before applying the key
Tomas Mraz [Thu, 25 Sep 2025 12:19:22 +0000 (14:19 +0200)] 
krb5kdf.c.in: Check the key size before applying the key

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

(cherry picked from commit 3addc8bb3a8e62e701d44ae849437f97940632cd)

9 days agoAdd test for using KRB5KDF with erroneous key size
Tomas Mraz [Thu, 25 Sep 2025 10:21:21 +0000 (12:21 +0200)] 
Add test for using KRB5KDF with erroneous key size

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

(cherry picked from commit c18b6968cc1824bd3280cffa914093bba85dff3f)

10 days agoapps/storeutl.c: avoid signed integer overflow in indent_printf()
Eugene Syromiatnikov [Mon, 15 Sep 2025 03:14:09 +0000 (05:14 +0200)] 
apps/storeutl.c: avoid signed integer overflow in indent_printf()

As two arbitrarily large printf return values can trigger signed integer
overflow, rewrite the return value handling to avoid it.

Fixes: fb43ddceda79 "Add a recursive option to 'openssl storeutl'"
Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1665428
References: https://github.com/openssl/project/issues/1432
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28649)

10 days agocrypto/evp/ctrl_params_translate.c: fix a typo in the error message
Eugene Syromiatnikov [Mon, 15 Sep 2025 03:05:01 +0000 (05:05 +0200)] 
crypto/evp/ctrl_params_translate.c: fix a typo in the error message

The ERR_raise_data() call on failure to find ctx->p2 in str_value_map
erroneously refers to ctx->p1 instead;  fix that but supplying the
correct field and casting it to the supposed const char * type.

Fixes: 9a1c4e41e8d3 "EVP: Implement data-driven translation between known ctrl and OSSL_PARAMs"
Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1665427
References: https://github.com/openssl/project/issues/1432
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28649)

10 days agocrypto/bio/bss_file.c: add missing cast in format arg in ERR_raise_data()
Eugene Syromiatnikov [Mon, 15 Sep 2025 02:44:36 +0000 (04:44 +0200)] 
crypto/bio/bss_file.c: add missing cast in format arg in ERR_raise_data()

"%s" conversion specifier requires a "char *" argument, so ptr needs
to be cast to it there, as Coverity has noted.

Fixes: ff988500c2f39 "Replace FUNCerr with ERR_raise_data"
Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1665423
References: https://github.com/openssl/project/issues/1432
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28649)

10 days agocrypto/x509/t_x509.c: check i2d_X509_NAME() return value in X509_ocspid_print()
Eugene Syromiatnikov [Mon, 15 Sep 2025 01:31:31 +0000 (03:31 +0200)] 
crypto/x509/t_x509.c: check i2d_X509_NAME() return value in X509_ocspid_print()

There is little reason for this call to fail, but there is also little
reason for not to check for it, and, since Coverity noticed
that the check is missing, just add it.

Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1665420
References: https://github.com/openssl/project/issues/1432
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28649)

10 days agoFix EVP_PKEY_can_sign() handling of NULL from query_operation_name()
Daniel Kubec [Fri, 19 Sep 2025 13:48:41 +0000 (15:48 +0200)] 
Fix EVP_PKEY_can_sign() handling of NULL from query_operation_name()

EVP_PKEY_can_sign() assumed query_operation_name(OSSL_OP_SIGNATURE)
always returns a non-NULL string. According to the documentation,
query_operation_name() may return NULL, in which case
EVP_KEYMGMT_get0_name() should be used as a fallback.

Fixes #27790

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

(cherry picked from commit 0c2d67f417a2c2e0a63272e8d7753489b4958c0b)

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

The issue was reported by Ronald Crane from Zippenhop LLC.

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

(cherry picked from commit 3185e2762402dffba569d9a7377d51d5bb0e4382)

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

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

Fixes #28550

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

(cherry picked from commit 728d5cf9e1b1bed196b31e8c71b8e1d2e398d2ff)

11 days agodisable rwlocks on nonstop klt model
Neil Horman [Mon, 29 Jul 2024 19:17:07 +0000 (15:17 -0400)] 
disable rwlocks on nonstop klt model

It appears nonstops new threading model defines some level of rwlock
pthread api, but its not working properly.  Disable rwlocks for
_KLT_MODEL_ for now

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

(cherry picked from commit d8ecbb37dcfcee24c4f6c8e46e1e0caefb940187)

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

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

(cherry picked from commit 03a9584499589f14363de758fdfb887cbef84790)

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

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

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

(cherry picked from commit 8a4ef31f3ab9c8e512d29600ccc833cf03533b9e)

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

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

(cherry picked from commit 312904b216f917646ad1909ce8bca8bf8a52e5d7)

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

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

(cherry picked from commit 38e8981004308ed6d7cdbd3178c826989a30e31a)

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

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

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

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

both from the University of Waterloo.

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

(cherry picked from commit c6e44fa347aabfc279ec2e50a02fd764c2e8e241)

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

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

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

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

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

(cherry picked from commit 60c4feacce6faf0e98167dc2ab2a1c2e85882049)

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

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

CLA: trivial

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

(cherry picked from commit 9bdf93776d741726895e6a42ffebd63366296e94)

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

Also refine RETURN VALUES.

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

(cherry picked from commit 32ec97521397597764f72d4e7c279c4e815352ee)

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

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

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

(cherry picked from commit b18f44902c5c48080a06c63972a13f8cb6d5c5d2)

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

Fixes #27984

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

(cherry picked from commit ee16664f6a1887048638e3d645fac38fb9c7f0d2)

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

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

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

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

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

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

3 weeks agoChange HPE NonStop PUT configuration to explicitly not use secure memory.
Randall S. Becker [Wed, 10 Sep 2025 22:09:52 +0000 (23:09 +0100)] 
Change HPE NonStop PUT configuration to explicitly not use secure memory.

Fixes: #28498
Signed-off-by: Randall S. Becker <randall.becker@nexbridge.ca>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28515)

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

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

(cherry picked from commit 1199882de69bf41225002603a8c3634c401ff99a)

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

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

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28379)

(cherry picked from commit 0daaf33275196dd5af9535d69b0d521b9e4d03de)

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

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

Reported-by: Liu-Ermeng <liuermeng2@huawei.com>
Resolves: https://github.com/openssl/openssl/issues/28375
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28379)

(cherry picked from commit 35db6a15d436aa4d981ebcd581eded55fc8c8fb6)

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

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

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

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

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

(cherry picked from commit 2c0c9c83b292fdba001d968a8219db4083294003)

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

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

CLA: trivial

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

(cherry picked from commit 4e0c2d02a9a415823babf74106985352e7bbcdae)

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

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

(cherry picked from commit 9e8898b6b6032a69f1002ab823a1cc0bba109b50)

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

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

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

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

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

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

Fixes #28397

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

(cherry picked from commit 9a8d7dc14201aeeed1e77d54208e4af96916fc4f)

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

CLA: trivial

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

(cherry picked from commit b64ac3cb8330d417a7fa859fe74e0bd41805a6db)

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

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

Fixes #27606

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

(cherry picked from commit 7600608eab0cd0a633e4d989d634590831b48a5d)

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

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

(cherry picked from commit 56ce30abb7bdf88a020557e70e0489eff541d097)

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

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

Complements: eca471391378 "APPS: Drop interactive mode in the 'openssl' program"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28441)

(cherry picked from commit 3f77491cb336df843984139fbb6fb16f47daf876)

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

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

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

Fixes #28346

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

(cherry picked from commit 8e3c76085fd163e2d0c4d54ac8105407c54daff6)

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

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

Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1665155
References: https://github.com/openssl/project/issues/1362
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28408)

(cherry picked from commit e59fa197bafa0dbbff33ce2dee772539a6e70e9e)

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

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

Fixes: ae880ae6719e "Fix error handling in X509_REQ_print_ex"
Fixes: 87c49f622e7f "Support for parsing of certificate extensions in PKCS#10 requests: these are"
Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1665161
References: https://github.com/openssl/project/issues/1362
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28408)

(cherry picked from commit 3b83a7183c71395cdc70eacddce21f4d2d9d2b88)

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

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

Complements: d02b48c63a58 "Import of old SSLeay release: SSLeay 0.8.1b"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28408)

(cherry picked from commit 05902818236f65de43c48d60353f989530a5e7b9)

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

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

Fixes: 7e1b7485706c "Big apps cleanup (option-parsing, etc)"
Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1665149
References: https://github.com/openssl/project/issues/1362
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28408)

(cherry picked from commit 98cb959999e4db9be524a972dccaf6b0c8167431)

4 weeks agoFix a race in by_store_subject
Matt Caswell [Tue, 19 Aug 2025 12:27:50 +0000 (13:27 +0100)] 
Fix a race in by_store_subject

When looking in the stack of objects in the store we need to ensure we
are holding a read lock for the store.

Issue detected via thread sanitizer after the test from the previous
commit was added.

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

4 weeks agoAdd a test for accessing an X509_STORE from multiple threads
Matt Caswell [Tue, 19 Aug 2025 07:38:07 +0000 (08:38 +0100)] 
Add a test for accessing an X509_STORE from multiple threads

Check we don't have any threading issues when accessing an X509_STORE
simultaneously

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

4 weeks agoDon't keep the store open in by_store_ctrl_ex
Matt Caswell [Thu, 7 Aug 2025 16:50:17 +0000 (17:50 +0100)] 
Don't keep the store open in by_store_ctrl_ex

Previously #27529 made a change to `by_store_ctrl_ex` in order to open
the OSSL_STORE early. The reason given in that PR is:

"This way, we can call OSSL_STORE_open_ex() in by_store_ctrl_ex(), and
get to see possible errors when the URI is loaded"

That PR then kept the store open until cache_objects is called and then
reused it. Unfortunately by the time cache_objects() is called we could be
in a multi-threaded scenario where the X509_STORE is being shared by
multiple threads. We then get a race condition where multiple threads are
all using (and ultimately closing) the same `OSSL_STORE_CTX`.

The purpose of keeping the `OSSL_STORE` object between by_store_ctrl_ex()
and `cache_objects` is presumably an optimisation to avoid having to open
the store twice. But this does not work because of the above issue.

We just take the hit and open it again.

Fixes #28171

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

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

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

(cherry picked from commit 4ed6cfce586f7a78c0e7e3d314c2b785ac16f1a9)

5 weeks agoaes-s390x.pl: Initialize reserved and unused memory
Holger Dengler [Wed, 20 Aug 2025 15:55:43 +0000 (17:55 +0200)] 
aes-s390x.pl: Initialize reserved and unused memory

The reserved bytes in the parameter block (bytes 0-11) for the KMA
instruction should be set to zero to be compatible in case of future
architecture changes.

While at it, also the following unused parts of the parameter block
(bytes 48-63) are also cleared to avoid false positives with various
memory checkers like valgrind.

As it makes - performance wise - no difference to process 12, 48 or 64
bytes with one XC call, but two XC calls are slower than one call, the
first 64 bytes of the parameter block will be cleared with a single XC
call. This will also initialize the counter in the parameter block
(bytes 12-15), although it is not strictly necessary.

Co-developed-by: Juergen Christ <jchrist@linux.ibm.com>
Signed-off-by: Juergen Christ <jchrist@linux.ibm.com>
Signed-off-by: Holger Dengler <dengler@linux.ibm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28315)

(cherry picked from commit 899623b29caa02f25e069acbcef581d19fe0a64e)

5 weeks agoFix: Add free to avoid memory leak.
Nachel72 [Sun, 17 Aug 2025 06:08:38 +0000 (14:08 +0800)] 
Fix: Add free to avoid memory leak.

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28289)

(cherry picked from commit f9afb3a07eb72428b98e3e31384380564a236700)

6 weeks agoFix null pointer check in pkey_dh_derive to ensure both keys are set
ritoban23 [Wed, 13 Aug 2025 20:19:17 +0000 (01:49 +0530)] 
Fix null pointer check in pkey_dh_derive to ensure both keys are set

CLA: trivial

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

(cherry picked from commit fc84d46d7227886152be00618889a521e9132ef3)
(cherry picked from commit 0163c6ad1f7cec08f59e9f736d36073d01ae7ae5)
(cherry picked from commit 257c3dd6cdbe9b1bde353fa45445b1319de6ffc3)
(cherry picked from commit eb1e036728bac6e450b2e42372487cf5e3e7a175)
(cherry picked from commit 1aa1863056c02e4b062010ac2782f8eccc178b23)

6 weeks agoBIO_dgram: Fix BIO_CTRL_DGRAM_QUERY_MTU for IPv4-mapped IPv6 addresses
Nikolas Gauder [Thu, 24 Jul 2025 20:00:49 +0000 (22:00 +0200)] 
BIO_dgram: Fix BIO_CTRL_DGRAM_QUERY_MTU for IPv4-mapped IPv6 addresses

Ensure the correct IP header size is subtracted by reusing
dgram_get_mtu_overhead(), which handles address families properly.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/28088)

(cherry picked from commit a71b4fae432796a49c3b9d32ae29354b23809c1f)

6 weeks agod2i_X509.pod: add missing doc of return value of i2d_ASN1_bio_stream()
Dr. David von Oheimb [Mon, 14 Apr 2025 09:20:18 +0000 (11:20 +0200)] 
d2i_X509.pod: add missing doc of return value of i2d_ASN1_bio_stream()

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

(cherry picked from commit 4376c9571a3e4729743f5806ee453c704355a030)

6 weeks agofix asn1_write_micalg() in asn_mime.c on GostR3411 and SHAKE
Dr. David von Oheimb [Sun, 13 Apr 2025 15:21:27 +0000 (17:21 +0200)] 
fix asn1_write_micalg() in asn_mime.c on GostR3411 and SHAKE

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

(cherry picked from commit e4c515833d51a3473078ce0a5da9e184e11d9660)

6 weeks agoapps/cms.c: add missing error message on error writing CMS output (ret == 6)
Dr. David von Oheimb [Mon, 14 Apr 2025 18:08:54 +0000 (20:08 +0200)] 
apps/cms.c: add missing error message on error writing CMS output (ret == 6)

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

(cherry picked from commit 3c7812decde2368168c6cba557ec8c03f973c892)

7 weeks agoAdd test coverage for PKCS7_TEXT mode
Bernd Edlinger [Sun, 10 Aug 2025 16:50:37 +0000 (18:50 +0200)] 
Add test coverage for PKCS7_TEXT mode

This was inspired by the following commit
9882d389df71 ("crypto/pkcs7/pk7_smime.c: Add BIO_free() to avoid memory leak")
which discovered a bug in PKCS7_verify(..., PKCS7_TEXT).
While there is some test coverage for PKCS_verify by
./test/pkcs7_test.c, there is no test coverage whatsoever
of the PKCS7_TEXT flag for PKCS7_sign, PKCS7_encrypt and
PKCS7_decrypt.
So this adds some test coverage for those functions as well.

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

(cherry picked from commit d582adc672bca4bc71a7766bb692558086efdd69)

7 weeks agoDH private key size was one bit too large
Bernd Edlinger [Sat, 21 Jun 2025 10:53:56 +0000 (12:53 +0200)] 
DH private key size was one bit too large

In the case when no q parameter was given,
the function generate_key in dh_key.c did create
one bit too much, so the priv_key value was exceeding
the DH group size q = (p-1)/2.
When the length is used in this case the limit is also
one bit too high, but for backward compatibility this
limit was left as is, instead we have to silently reduce
the value by one.

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

(cherry picked from commit d6510d99ae4a8a23f54fdfb1473af6a920da8345)

7 weeks agoCorrect the synthetisized OPENSSL_VERSION_NUMBER
Richard Levitte [Mon, 11 Aug 2025 18:57:44 +0000 (20:57 +0200)] 
Correct the synthetisized OPENSSL_VERSION_NUMBER

The last hex digit always became 0x0L, even of OPENSSL_VERSION_PRE_RELEASE
was the empty string.

Resolves: https://github.com/openssl/openssl/issues/28227

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

(cherry picked from commit ba2c314a60d9f42d1d2e63ea0f791cc04e03005b)

7 weeks agoFix memory leak on EVP_CIPHER_param_to_asn1 failure
77tiann [Thu, 31 Jul 2025 00:47:06 +0000 (17:47 -0700)] 
Fix memory leak on EVP_CIPHER_param_to_asn1 failure

When EVP_CIPHER_param_to_asn1() fails, xalg->parameter was not freed,
leading to a memory leak. This patch adds proper cleanup for that case.
CLA: trivial

Signed-off-by: 77tiann <27392025k@gmail.com>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28131)

(cherry picked from commit bda2473a44e4534c3c640ce89a0971874165c6df)

7 weeks agoFix RSA key size validation in EVP_PKEY_RSA_keygen demo
Quin-Darcy [Thu, 31 Jul 2025 14:07:46 +0000 (09:07 -0500)] 
Fix RSA key size validation in EVP_PKEY_RSA_keygen demo

The validation was checking the default 'bits' value (4096) instead of
the parsed 'bits_i' from the command line arguments, allowing invalid
key sizes to bypass the 512-bit minimum.

CLA: trivial

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

(cherry picked from commit c79e1b212a616b8dca194a77e7698b886000fcb0)

2 months agoapps/asn1parse.c: correct help text order for -genstr option
Saurabh Kushwah [Wed, 30 Jul 2025 12:36:57 +0000 (18:06 +0530)] 
apps/asn1parse.c: correct help text order for -genstr option

CLA: trivial

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

(cherry picked from commit eac588ac360ca16e0f9979b6c70708f1e8991b4f)

2 months agotest-ec: Skip SM2 key import test if SM2 is disabled
Tomas Mraz [Mon, 28 Jul 2025 09:13:06 +0000 (11:13 +0200)] 
test-ec: Skip SM2 key import test if SM2 is disabled

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

(cherry picked from commit 981d6776a339bebbb1aa4a38b940dd1526ab3508)

2 months agoAdd a test of 'openssl storeutl' with a BER-encoded PKCS#12 file
Richard Levitte [Wed, 16 Jul 2025 13:08:48 +0000 (15:08 +0200)] 
Add a test of 'openssl storeutl' with a BER-encoded PKCS#12 file

The test file (test-BER.p12) was given to us by David von Oheimb

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

(cherry picked from commit 49f8db53274191987b57d8e5542218690a983e35)

2 months agoFix OSSL_STORE to consider cached info in the EOF check.
Richard Levitte [Thu, 10 Jul 2025 15:55:50 +0000 (17:55 +0200)] 
Fix OSSL_STORE to consider cached info in the EOF check.

OSSL_STORE_load() called OSSL_STORE_eof() before checking if there is
cached OSSL_STORE_INFO to consider.  To fix this issue, the cached info
check is moved to OSSL_STORE_eof(), as that seems to make most common
sense.

This solves an issue with PKCS#12 files, where the cached info was never
considered because the underlying file IO layer signaled that EOF is
reached.

Fixes #28010

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

(cherry picked from commit 1f3af48c312a5f94612e9a822b78a3afdadc27c1)

2 months agosm2: sm2_sign.c: check EC_KEY_get0_private_key() for NULL in sm2_sig_gen()
AntonMoryakov [Mon, 2 Jun 2025 10:14:28 +0000 (13:14 +0300)] 
sm2: sm2_sign.c: check EC_KEY_get0_private_key() for NULL in sm2_sig_gen()

Static analysis revealed that sm2_sig_gen() dereferences the return value
of EC_KEY_get0_private_key() without checking for NULL. This could lead to
a crash if the private key is unset.

This patch adds a NULL check and raises ERR_R_PASSED_NULL_PARAMETER if the
key is missing.

Issue found by static analyzer:
> Return value of EC_KEY_get0_private_key() is dereferenced without checking for NULL (11/12 checked)

CLA: trivial
Signed-off-by: Anton Moryakov <ant.v.moryakov@gmail.com>
Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27741)

(cherry picked from commit c108ead2840a76a59fe02c049d08322a02b24761)

2 months agofix SM2 privatekey decode(PEM format, ECPrivateKey).
Alen Yan [Wed, 9 Jul 2025 01:23:00 +0000 (09:23 +0800)] 
fix SM2 privatekey decode(PEM format, ECPrivateKey).

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

2 months agoSupport decode SM2 parameters
K1 [Mon, 18 Jul 2022 17:18:12 +0000 (01:18 +0800)] 
Support decode SM2 parameters

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

2 months agoAdd CODEOWNERS file
Dmitry Misharov [Fri, 18 Jul 2025 06:12:56 +0000 (08:12 +0200)] 
Add CODEOWNERS file

quarckster is the owner of the /.github/workflows/ directory.

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

(cherry picked from commit b3187ab5a757496e588ea9bdb7fabd12d194e66a)

2 months agopin GitHub Actions revisions from untrusted vendors
Dmitry Misharov [Mon, 31 Mar 2025 15:50:45 +0000 (17:50 +0200)] 
pin GitHub Actions revisions from untrusted vendors

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27215)

2 months agosec_mem: add note about the perf implications
Nikola Pajkovsky [Thu, 10 Jul 2025 07:03:38 +0000 (09:03 +0200)] 
sec_mem: add note about the perf implications

Testing secure storage for ml-kem/dsa [1] shows performace penalty
when secure storage is enabled.

| Threads | baseline usec/handshake | secmem usec/handshake |
|---------+-------------------------+-----------------------|
|       1 |              586.784756 |            588.306131 |
|       2 |              599.537648 |            601.007393 |
|       4 |              610.663361 |            613.600663 |
|       8 |              649.347376 |            869.693358 |
|      16 |             1176.402781 |           2487.335286 |
|      32 |             2345.594618 |           5155.747515 |
|      64 |             4697.556045 |          11170.627031 |

the test shows that sec mem is ok-ish up to the number of available cores,
and when the sec mem lock gets contended, performance goes down rapidly.
Tested on Apple M4 Pro.

[1] https://github.com/openssl/openssl/pull/27625

Signed-off-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28011)

(cherry picked from commit b8cc32766060757254f31139d6c521465d796d0d)

2 months agoAdd note about use of EVP_PKEY in different libctxs
Michael Baentsch [Mon, 30 Jun 2025 07:33:46 +0000 (09:33 +0200)] 
Add note about use of EVP_PKEY in different libctxs

Co-authored-by: Shane Lontis <slontis@oracle.com>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26309)

(cherry picked from commit b2ac43b0d89b5b528941ad9d233b4cb4f99a7cca)

2 months agoPEM_read_CMS.pod: Correct the deprecation notice
Tomas Mraz [Fri, 20 Jun 2025 15:07:19 +0000 (17:07 +0200)] 
PEM_read_CMS.pod: Correct the deprecation notice

Fixes #27863

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

(cherry picked from commit 9a6376dd75961c44232dae42943ceac10795a060)

3 months agodemos/cms/cms_denc.c: Add check for BIO_new_file()
Jiasheng Jiang [Wed, 25 Jun 2025 23:06:59 +0000 (23:06 +0000)] 
demos/cms/cms_denc.c: Add check for BIO_new_file()

Add check for the return value of BIO_new_file().

Fixes: 1728756 ("Detached encrypt/decrypt example, fix decrypt sample.")
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27897)

(cherry picked from commit 881ff0c225356a0f28bd55cea5a4c5204b7b7b8a)

3 months agodemos/cms/cms_ddec.c: Replace "in" with "dcont" to correctly check the success of...
Jiasheng Jiang [Fri, 27 Jun 2025 15:59:13 +0000 (15:59 +0000)] 
demos/cms/cms_ddec.c: Replace "in" with "dcont" to correctly check the success of BIO_new_file()

Replace "in" with "dcont" to properly check the return value of BIO_new_file().

Fixes: 1728756 ("Detached encrypt/decrypt example, fix decrypt sample.")
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27896)

(cherry picked from commit 8a7545607e872ccaff3018e2cd201cce65e615ec)

3 months agoPrepare for 3.0.18 27937/head
openssl-machine [Tue, 1 Jul 2025 12:11:17 +0000 (12:11 +0000)] 
Prepare for 3.0.18

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

3 months agoPrepare for release of 3.0.17 openssl-3.0.17
openssl-machine [Tue, 1 Jul 2025 12:11:11 +0000 (12:11 +0000)] 
Prepare for release of 3.0.17

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

3 months agomake update
openssl-machine [Tue, 1 Jul 2025 12:11:09 +0000 (12:11 +0000)] 
make update

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

3 months agoCopyright year updates
openssl-machine [Tue, 1 Jul 2025 12:09:45 +0000 (12:09 +0000)] 
Copyright year updates

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

3 months ago30-news
Neil Horman [Tue, 1 Jul 2025 11:46:50 +0000 (07:46 -0400)] 
30-news

Reviewed-by: Matt Caswell <matt@openssl.org>
Release: yes
(Merged from https://github.com/openssl/openssl/pull/27932)

3 months agoFix nullpointer dereference in OSSL_PARAM_merge
Christian Vögl [Thu, 26 Jun 2025 16:37:37 +0000 (18:37 +0200)] 
Fix nullpointer dereference in OSSL_PARAM_merge

OSSL_PARAM_merge contained an error, where a nullpointer was
dereferenced when both parameter arrays ended with the same key

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

(cherry picked from commit 63cb8f99a13fdc4c7c3b1e88d66a3ff70b72e642)

3 months agoBetter lookup for openssl executable
Dmitry Belyavskiy [Wed, 25 Jun 2025 15:33:16 +0000 (17:33 +0200)] 
Better lookup for openssl executable

Fixes #27891

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

(cherry picked from commit fa0c67a28a5a7d6ebeae7cb14d036780485e2fcd)

3 months agoFix exit code for s_time when -new command line switch specified
Neil Horman [Thu, 19 Jun 2025 16:38:41 +0000 (12:38 -0400)] 
Fix exit code for s_time when -new command line switch specified

When operating with the -new switch in apps/openssl s_time, we neglect
to set the exit code properly, and so the app exits with a code of 1
rather than 0 as expected

Fixes #27856

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

(cherry picked from commit b6ff5598539bf91608246ed81b4b534cbea6539d)

3 months agoAllow our *_gen_cleanup functions to tolerate a NULL ctx
Matt Caswell [Wed, 11 Jun 2025 08:50:16 +0000 (09:50 +0100)] 
Allow our *_gen_cleanup functions to tolerate a NULL ctx

Our *_gen_cleanup functions are essentially "free" functions. Our
free functions tolerate NULL being passed. We are being inconsistent with
our *_gen_cleanup functions. Some of them tolerate NULL and others do not.

We should consistently tolerate NULL.

See also #27795

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

(cherry picked from commit 743bae4a225b9df1d11446e5f0620270b10c835a)

3 months agofix: Better documentation on DTLS_set_timer_cb()
noctuelles [Tue, 10 Jun 2025 20:37:46 +0000 (22:37 +0200)] 
fix: Better documentation on DTLS_set_timer_cb()

Also more precise description of DTLS timeout mechanism.

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

(cherry picked from commit 49885aebe7cafc5caaa6929d0ed5a946e7f09c45)

3 months agoreturn NULL if gctx allocation fails.
Bartel Artem [Wed, 11 Jun 2025 03:58:31 +0000 (06:58 +0300)] 
return NULL if gctx allocation fails.

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

(cherry picked from commit 443298e0f0e2c8225f8c6d6fdc01c6c4d434028b)

3 months agocheck gctx for NULL before cleanup.
Bartel Artem [Tue, 10 Jun 2025 10:11:41 +0000 (13:11 +0300)] 
check gctx for NULL before cleanup.

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

(cherry picked from commit 02f9c9342d54c99981b0a83088982bf0d1083d7f)

3 months agoossl_assert() is in cryptlib.h
Tomas Mraz [Tue, 10 Jun 2025 18:20:23 +0000 (20:20 +0200)] 
ossl_assert() is in cryptlib.h

In 3.0 the ossl_assert() is in internal/cryptlib.h not internal/common.h

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

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

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

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

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

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

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

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

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

3 months agoSilence -Wstringop-overflow warnings with gcc 14 on s390x
Ingo Franzki [Wed, 28 May 2025 06:55:49 +0000 (08:55 +0200)] 
Silence -Wstringop-overflow warnings with gcc 14 on s390x

Compiling OpenSSL on s390x with gcc 14 (i.e. in Fedora 41) shows several
-Wstringop-overflow warnings in providers/implementations/rands/drbg_ctr.c
and test/params_api_test.c.

Add explicit length checks to let the compiler know that it won't overrun
the buffer. This also silences the warnings.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27710)

(cherry picked from commit 9a788281d91f698d6a229d588b9cb36987549669)

3 months agoAllow keygen after dup of minimal PKEY ctx
Viktor Dukhovni [Tue, 13 May 2025 15:23:25 +0000 (01:23 +1000)] 
Allow keygen after dup of minimal PKEY ctx

It should be possible to repeatedly duplicate a PKEY CTX created via
EVP_PKEY_CTX_new_from_name() that has not yet been assigned an
"operation" (e.g. via EVP_PKEY_CTX_keygen_init()), and then perform
keygen_init() and keygen() on the duplicated copies.

When the operation is not yet set, all that's needed is to not try to
use the key if one isn't set yet.

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

(cherry picked from commit 2c74a8d1ef4e9c4b4468afefedb1f72425772a37)

3 months agoFix SHAKE AlgorithmIdentifier encodings
Daniel Van Geest [Fri, 28 Mar 2025 10:40:32 +0000 (10:40 +0000)] 
Fix SHAKE AlgorithmIdentifier encodings

NIST CSOR specifies that the id-shake128 and id-shake256
algorithm identifiers, like the SHA-3 ones, do not carry
any parameters.

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

(cherry picked from commit bef03c6a24f02df4e670697b16b6d7c8b1b604b4)

3 months agoci: remove windows-2019 runner images
Dmitry Misharov [Wed, 4 Jun 2025 14:50:39 +0000 (16:50 +0200)] 
ci: remove windows-2019 runner images

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

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

3 months agorand: document the EVP_RAND_nonce() return correctly
Pauli [Thu, 5 Jun 2025 02:03:50 +0000 (12:03 +1000)] 
rand: document the EVP_RAND_nonce() return correctly

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

3 months agorand: produce correct return from EVP_RAND_nonce
Pauli [Wed, 4 Jun 2025 23:57:13 +0000 (09:57 +1000)] 
rand: produce correct return from EVP_RAND_nonce

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

3 months agorand: fix memory overrun bug
Pauli [Wed, 4 Jun 2025 23:57:00 +0000 (09:57 +1000)] 
rand: fix memory overrun bug

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