]> git.ipfire.org Git - thirdparty/openssl.git/log
thirdparty/openssl.git
2 years agoPrepare for 3.1.3 21613/head
Matt Caswell [Tue, 1 Aug 2023 13:37:03 +0000 (14:37 +0100)] 
Prepare for 3.1.3

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Release: yes

2 years agoPrepare for release of 3.1.2 openssl-3.1.2
Matt Caswell [Tue, 1 Aug 2023 13:36:55 +0000 (14:36 +0100)] 
Prepare for release of 3.1.2

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Release: yes

2 years agomake update
Matt Caswell [Tue, 1 Aug 2023 13:36:54 +0000 (14:36 +0100)] 
make update

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Release: yes

2 years agoCopyright year updates
Matt Caswell [Tue, 1 Aug 2023 13:35:30 +0000 (14:35 +0100)] 
Copyright year updates

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Release: yes

2 years agoFix a regression in X509_VERIFY_PARAM_add0_policy()
Matt Caswell [Thu, 27 Jul 2023 11:09:47 +0000 (12:09 +0100)] 
Fix a regression in X509_VERIFY_PARAM_add0_policy()

Also fixes a similar regression in X509_VERIFY_PARAM_add0_table().

Commit 38ebfc3 introduced a regression in 3.0.6 that changed the return
value of the two functions above from 1 on success to the number of entries
in the stack. If there are more than one entry then this is a change in
behaviour which should not have been introduced into a stable release.

This reverts the behaviour back to what it was prior to the change. The code
is slightly different to the original code in that we also handle a possible
-1 return value from the stack push function. This should never happen in
reality because we never pass a NULL stack as a parameter - but for the sake
of robustness we handle it anyway.

Note that the changed behaviour exists in all versions of 3.1 (it never had
the original version). But 3.1 should be fully backwards compatible with 3.0
so we should change it there too.

Fixes #21570

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

(cherry picked from commit e3d897d3fa3b48bb835fab0665a435469beea7ae)

2 years agovpaes: LoongArch: Use getauxval(AT_HWCAP) for LSX detection
Xi Ruoyao [Fri, 21 Jul 2023 02:07:04 +0000 (02:07 +0000)] 
vpaes: LoongArch: Use getauxval(AT_HWCAP) for LSX detection

Running LSX instructions requires both the hardware support and the
kernel support.  The `cpucfg` instruction only tests the hardware
support, causing a SIGILL if the hardware supports LSX but the kernel
does not.

Use `getauxval(AT_HWCAP)` as the ["Software Development and Build
Convention for LoongArch Architectures"][1] manual suggests.

The LOONGARCH_HWCAP_LSX and LOONGARCH_HWCAP_LASX bits are copied from
the manual too.  In Glibc 2.38 they'll be provided by <sys/auxv.h> as
well, but they are unavailable in earlier Glibc versions so we cannot
rely on it.

The getauxval syscall and Glibc wrapper are available since day one
(Linux-5.19 and Glibc-2.36) for LoongArch.

Fixes #21508.

[1]:https://github.com/loongson/la-softdev-convention/blob/master/la-softdev-convention.adoc#kernel-constraints

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

(cherry picked from commit c612289b77c37f7295d5af0d0e6b6c04e6ba727c)

2 years agoCorrect spelling of database
Fatih Arslan Tugay [Mon, 24 Jul 2023 12:34:08 +0000 (15:34 +0300)] 
Correct spelling of database

Apply normal sentence case to db update message

CLA: trivial

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Todd Short <todd.short@me.com>
(Merged from https://github.com/openssl/openssl/pull/21535)

(cherry picked from commit ccb2f3080d84a271f17458a60e0d7ccd77929e95)

2 years agoAdd CHANGES.md and NEWS.md entries for CVE-2023-3817
Tomas Mraz [Tue, 25 Jul 2023 13:35:34 +0000 (15:35 +0200)] 
Add CHANGES.md and NEWS.md entries for CVE-2023-3817

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Todd Short <todd.short@me.com>
(Merged from https://github.com/openssl/openssl/pull/21550)

(cherry picked from commit 4b29762802c05fa871f0e1efcf804e86db0ddaa2)

2 years agodhtest.c: Add test of DH_check() with q = p + 1
Tomas Mraz [Tue, 25 Jul 2023 13:23:43 +0000 (15:23 +0200)] 
dhtest.c: Add test of DH_check() with q = p + 1

This must fail with DH_CHECK_INVALID_Q_VALUE and
with DH_CHECK_Q_NOT_PRIME unset.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Todd Short <todd.short@me.com>
(Merged from https://github.com/openssl/openssl/pull/21550)

(cherry picked from commit ad5d35572695d7b5748b2bd4fb1afaa189b29e28)

2 years agoDH_check(): Do not try checking q properties if it is obviously invalid
Tomas Mraz [Tue, 25 Jul 2023 13:22:48 +0000 (15:22 +0200)] 
DH_check(): Do not try checking q properties if it is obviously invalid

If  |q| >= |p| then the q value is obviously wrong as q
is supposed to be a prime divisor of p-1.

We check if p is overly large so this added test implies that
q is not large either when performing subsequent tests using that
q value.

Otherwise if it is too large these additional checks of the q value
such as the primality test can then trigger DoS by doing overly long
computations.

Fixes CVE-2023-3817

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Todd Short <todd.short@me.com>
(Merged from https://github.com/openssl/openssl/pull/21550)

(cherry picked from commit 1c16253f3c3a8d1e25918c3f404aae6a5b0893de)

2 years agoMake DH_check set some error bits in recently added error
Bernd Edlinger [Sun, 23 Jul 2023 12:27:54 +0000 (14:27 +0200)] 
Make DH_check set some error bits in recently added error

The pre-existing error cases where DH_check returned zero
are not related to the dh params in any way, but are only
triggered by out-of-memory errors, therefore having *ret
set to zero feels right, but since the new error case is
triggered by too large p values that is something different.
On the other hand some callers of this function might not
be prepared to handle the return value correctly but only
rely on *ret. Therefore we set some error bits in *ret as
additional safety measure.

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

(cherry picked from commit 81d10e61a4b7d5394d08a718bf7d6bae20e818fc)

2 years agoget_cert_by_subject_ex(): Check result of X509_STORE_lock()
atishkov [Fri, 21 Jul 2023 08:36:37 +0000 (11:36 +0300)] 
get_cert_by_subject_ex(): Check result of X509_STORE_lock()

Reviewed-by: Paul Dale <pauli@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/21515)

(cherry picked from commit bc5d9cc8711e86d5c25b81c58dfae531536e61fc)

2 years agox509: add ASN1_STRING_set() check result
atishkov [Thu, 20 Jul 2023 08:02:38 +0000 (11:02 +0300)] 
x509: add ASN1_STRING_set() check result

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

(cherry picked from commit 46e95903762f0cc478d8a3c252390fa7312bba6e)

2 years agoFix error handling in pipelining test
Bernd Edlinger [Fri, 21 Jul 2023 05:34:39 +0000 (07:34 +0200)] 
Fix error handling in pipelining test

When an early error happens in the test_pipelining
function and idx == 5 the error handling would try
to call OPENSSL_free(msg), but msg is at that time
just a string constant in read-only memory, so a
crash would be the result. Fixed that by using
fragsize as an indication when to free msg.

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

(cherry picked from commit 06a0d40322e96dbba816b35f82226871f635ec5a)

2 years agofix: reject adding a duplicity into STACK_OF(X509_ATTRIBUTE)
Adam Šulc [Thu, 20 Jul 2023 19:30:45 +0000 (21:30 +0200)] 
fix: reject adding a duplicity into STACK_OF(X509_ATTRIBUTE)

Function `X509at_add1_attr()` (crypto/x509/x509_att.c) rejects to add a duplicity into `*x` but it searches in a wrong stack.

Changed to search in `*x`.

CLA: trivial

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21505)

(cherry picked from commit 7551264186f176ca5801aa84d60c7b91d8fba31f)

2 years agospeed: Fix execution of EdDSA measurement
Ingo Franzki [Wed, 19 Jul 2023 13:24:49 +0000 (15:24 +0200)] 
speed: Fix execution of EdDSA measurement

Running 'openssl speed eddsa' fails with

Doing 253 bits sign Ed25519 ops for 10s: EdDSA sign failure
000003FF9306C7D0:error:030000BC:digital envelope routines:EVP_DigestSign:
                           final error:crypto/evp/m_sigver.c:585:
-1 253 bits Ed25519 sign ops in 0.00s
Doing 253 bits verify Ed25519 ops for 10s: EdDSA verify failure
000003FF9306C7D0:error:030000BC:digital envelope routines:EVP_DigestVerify:
                           final error:crypto/evp/m_sigver.c:694:
-1 253 bits Ed25519 verify ops in 0.00s

This is because the EVP_DigestSign/Verify() calls in the EdDSA_sign/verify_loop()
fail because the context has already been finalized by the previous
EVP_DigestSign/Verify call during the EdDSA signature test done by speed_main().

This happens since commit 3fc2b7d6b8f961144905330dfd4689f5bd515199 where the
EVP_DigestSign/Verify() functions have been changed to set a flag that the
context has been finalized.

Fix this by re-initializing the context using EVP_DigestSign/Verify() in the
EdDSA_sign/verify_loop().

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21491)

(cherry picked from commit 0c85bcbaeabe3a695831bec44ab87964725a51a6)

2 years agospeed: Fix memory leak
Ingo Franzki [Wed, 19 Jul 2023 12:59:16 +0000 (14:59 +0200)] 
speed: Fix memory leak

Free the signature stack after iterating over all found signatures.
Free the kem and signature stacks at the end of speed_main() if not
NULL.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21491)

(cherry picked from commit cc7e2b20de02959c328f96e464e5fb8b256a00e0)

2 years agoFix documentation around AAD and return values in EVP_Cipher*
Samuel Lee [Wed, 19 Jul 2023 18:04:12 +0000 (11:04 -0700)] 
Fix documentation around AAD and return values in EVP_Cipher*

Fixes #21485

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

(cherry picked from commit 51a7066e2092b062a502e29166adfcc297803058)

2 years agoapps/cms.c: Fix unreachable code in cms_main()
atishkov [Mon, 17 Jul 2023 10:10:44 +0000 (13:10 +0300)] 
apps/cms.c: Fix unreachable code in cms_main()

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

(cherry picked from commit 8c34367e434c6b9555f21cc4fc77a18d6ef84a85)

2 years agoUpdate CHANGES/NEWS for CVE-2023-3446
Matt Caswell [Thu, 13 Jul 2023 15:14:49 +0000 (16:14 +0100)] 
Update CHANGES/NEWS for CVE-2023-3446

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21451)

(cherry picked from commit 4ec53ad6e1791daafbe26bdbd539f2ba9172959a)

2 years agoAdd a test for CVE-2023-3446
Matt Caswell [Fri, 7 Jul 2023 13:39:48 +0000 (14:39 +0100)] 
Add a test for CVE-2023-3446

Confirm that the only errors DH_check() finds with DH parameters with an
excessively long modulus is that the modulus is too large. We should not
be performing time consuming checks using that modulus.

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21451)

(cherry picked from commit ede782b4c8868d1f09c9cd237f82b6f35b7dba8b)

2 years agoFix DH_check() excessive time with over sized modulus
Matt Caswell [Thu, 6 Jul 2023 15:36:35 +0000 (16:36 +0100)] 
Fix DH_check() excessive time with over sized modulus

The DH_check() function checks numerous aspects of the key or parameters
that have been supplied. Some of those checks use the supplied modulus
value even if it is excessively large.

There is already a maximum DH modulus size (10,000 bits) over which
OpenSSL will not generate or derive keys. DH_check() will however still
perform various tests for validity on such a large modulus. We introduce a
new maximum (32,768) over which DH_check() will just fail.

An application that calls DH_check() and supplies a key or parameters
obtained from an untrusted source could be vulnerable to a Denial of
Service attack.

The function DH_check() is itself called by a number of other OpenSSL
functions. An application calling any of those other functions may
similarly be affected. The other functions affected by this are
DH_check_ex() and EVP_PKEY_param_check().

CVE-2023-3446

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21451)

(cherry picked from commit 9e0094e2aa1b3428a12d5095132f133c078d3c3d)

2 years agoopenssl-kdf.pod.in: add text on 'salt' and 'info' parameters; small further improvements
Dr. David von Oheimb [Sun, 16 Jul 2023 13:06:18 +0000 (15:06 +0200)] 
openssl-kdf.pod.in: add text on 'salt' and 'info' parameters; small further improvements

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

(cherry picked from commit 7b2a3a1e9d5246fb0f2935f152d0daec715f79f9)

2 years agoEVP_KDF.pod: extend text on 'salt' and 'info' parameters
Dr. David von Oheimb [Sun, 16 Jul 2023 12:55:35 +0000 (14:55 +0200)] 
EVP_KDF.pod: extend text on 'salt' and 'info' parameters

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

(cherry picked from commit 61c8146aa36b84afd9d83c87c9a01138979ffd60)

2 years agoFix typos found by codespell
Dimitri Papadopoulos [Sun, 16 Jul 2023 05:56:05 +0000 (07:56 +0200)] 
Fix typos found by codespell

Only modify doc/man* in the openssl-3.1 branch.

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

2 years agoFix int_ctx_new() error when use 1.1.1n sm2 key and ec method engine
lan1120 [Sat, 10 Jun 2023 11:36:17 +0000 (19:36 +0800)] 
Fix int_ctx_new() error when use 1.1.1n sm2 key and ec method engine

Signed-off-by: lan1120 <lanming@huawei.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21170)

(cherry picked from commit 4c4fefa5c78a49b63113aec35a2bc8d6d9432436)

2 years agoRemove duplicated values
ljuzwiuk [Tue, 11 Jul 2023 20:43:32 +0000 (20:43 +0000)] 
Remove duplicated values

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

(cherry picked from commit f1b7243cda208d8bd74f75c95990f8205e977ae4)

2 years agoFix ssl3_do_write() to correctly handle retries
Matt Caswell [Wed, 12 Jul 2023 14:50:25 +0000 (15:50 +0100)] 
Fix ssl3_do_write() to correctly handle retries

A BIO is documented to return -1 on write retry - but sometimes they return
0. ssl3_do_write() was incorrectly handling a 0 response.

Fixes #21422

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21435)

2 years agoAdd a test for a retry during the handshake
Matt Caswell [Wed, 12 Jul 2023 13:54:46 +0000 (14:54 +0100)] 
Add a test for a retry during the handshake

Test various scenarios for a write retry occuring during a handshake.

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21435)

2 years agono-module should not imply disabling DSO loading support
Tomas Mraz [Fri, 14 Jul 2023 08:25:42 +0000 (10:25 +0200)] 
no-module should not imply disabling DSO loading support

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

(cherry picked from commit 3d2f96e2c867fa3e79a453639304b70ba0508076)

2 years agoFix RSA OAEP set/get label for legacy engine
ljuzwiuk [Thu, 13 Jul 2023 09:11:28 +0000 (09:11 +0000)] 
Fix RSA OAEP set/get label for legacy engine

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

(cherry picked from commit 64b1d2fb06c9a5233dcabfe130036ff95c3fdaae)

2 years agoAdd CHANGES.md and NEWS.md entries for CVE-2023-2975
Tomas Mraz [Fri, 7 Jul 2023 07:54:18 +0000 (09:54 +0200)] 
Add CHANGES.md and NEWS.md entries for CVE-2023-2975

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

(cherry picked from commit 1e398bec538978b9957e69bf9e12b3c626290bea)

2 years agoAdd testcases for empty associated data entries with AES-SIV
Tomas Mraz [Tue, 4 Jul 2023 15:50:37 +0000 (17:50 +0200)] 
Add testcases for empty associated data entries with AES-SIV

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

(cherry picked from commit 3993bb0c0c87e3ed0ab4274e4688aa814e164cfc)

2 years agoDo not ignore empty associated data with AES-SIV mode
Tomas Mraz [Tue, 4 Jul 2023 15:30:35 +0000 (17:30 +0200)] 
Do not ignore empty associated data with AES-SIV mode

The AES-SIV mode allows for multiple associated data items
authenticated separately with any of these being 0 length.

The provided implementation ignores such empty associated data
which is incorrect in regards to the RFC 5297 and is also
a security issue because such empty associated data then become
unauthenticated if an application expects to authenticate them.

Fixes CVE-2023-2975

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

(cherry picked from commit c426c281cfc23ab182f7d7d7a35229e7db1494d9)

2 years agoModified OSSL_parse_url to initialize pport_num to 0.
Randall S. Becker [Thu, 1 Jun 2023 19:29:15 +0000 (13:29 -0600)] 
Modified OSSL_parse_url to initialize pport_num to 0.

This change is intended to provide some safety for uninitialized stack failures
that have appeared in 80-test_cmp_http on NonStop x86 when run in a complex
CI/CD Jenkins environment. This change also adds init_pint() to handle the
initialization of a pointer to int value.

Fixes: #21083
Signed-off-by: Randall S. Becker <randall.becker@nexbridge.ca>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21109)

2 years agoBump actions/setup-python from 4.6.1 to 4.7.0
dependabot[bot] [Fri, 14 Jul 2023 08:07:23 +0000 (08:07 +0000)] 
Bump actions/setup-python from 4.6.1 to 4.7.0

Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4.6.1 to 4.7.0.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v4.6.1...v4.7.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: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21455)

(cherry picked from commit dbe36351dc3fcb5bd3582075b40d34e0b103b15c)

2 years agoAdd FIPS build instructions
slontis [Tue, 9 May 2023 03:07:50 +0000 (13:07 +1000)] 
Add FIPS build instructions

If you are building the latest release source code with enable-fips configured
then the FIPS provider you are using is not likely to be FIPS compliant.

This update demonstrates how to build a FIPS provider that is compliant
and use it with the latest source code.

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

(cherry picked from commit 2b42290f08c0a75695021aeb7d5cd16068b3edc3)

2 years agoMove Keccak rhotates tables to rodata
Amir Ayupov [Wed, 12 Jul 2023 22:14:51 +0000 (15:14 -0700)] 
Move Keccak rhotates tables to rodata

rhotates tables are placed to .text section which confuses tools such as BOLT.
Move them to rodata to unbreak and avoid polluting icache/iTLB with data.

CLA: trivial

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Paul Yang <kaishen.yy@antfin.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21440)

(cherry picked from commit 2fd82c228363cfd16c5047a348e7c853defa42eb)

2 years agoAdd a NEWS entry covering the FIPS related changes.
Pauli [Fri, 7 Jul 2023 08:37:08 +0000 (18:37 +1000)] 
Add a NEWS entry covering the FIPS related changes.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Todd Short <todd.short@me.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/21386)

2 years agoEVP_PKEY_{en,de}capsulate.pod: fix glitches and add some detail and hints
Dr. David von Oheimb [Fri, 7 Jul 2023 15:34:05 +0000 (17:34 +0200)] 
EVP_PKEY_{en,de}capsulate.pod: fix glitches and add some detail and hints

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

(cherry picked from commit 5be8233d2be306a2906d3da16e59aa15a4559dd2)

2 years agofips: make installations FIPS compliant by default
Pauli [Wed, 5 Jul 2023 09:02:02 +0000 (19:02 +1000)] 
fips: make installations FIPS compliant by default

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

(cherry picked from commit dc6f3b9b8d6e54ea7d8669a158fd73b451862c7d)

2 years agofips: use correct field names when generating fipsmodule.cnf
Pauli [Fri, 30 Jun 2023 01:03:56 +0000 (11:03 +1000)] 
fips: use correct field names when generating fipsmodule.cnf

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

(cherry picked from commit 89111cbc3238dcdf47e921af38d6b12c4b32d326)

2 years agoconf/conf_sap.c: correct return of ossl_config_int() in UEFI system
Yi Li [Tue, 27 Jun 2023 14:33:24 +0000 (22:33 +0800)] 
conf/conf_sap.c: correct return of ossl_config_int() in UEFI system

FIX: https://github.com/openssl/openssl/issues/21299

ret in ossl_config_int() only used to check return value of
CONF_modules_load_file(), should set it to 1 if in UEFI system.

Signed-off-by: Yi Li <yi1.li@intel.com>
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/21300)

(cherry picked from commit 500e479db1beae5fa5691d40b866329d2fdc62e7)

2 years agoFix OSSL_PROVIDER_try_load() retain_fallbacks doc
Duncan Thomson [Wed, 28 Jun 2023 21:02:26 +0000 (22:02 +0100)] 
Fix OSSL_PROVIDER_try_load() retain_fallbacks doc

CLA: trivial

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

(cherry picked from commit 063cdca61adfd4d418affe850f8bebbf528d05d9)

2 years agoopenssl-rsautl.pod: Add missing comma
Jakub Wilk [Wed, 28 Jun 2023 20:17:00 +0000 (22:17 +0200)] 
openssl-rsautl.pod: Add missing comma

CLA: trivial

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

(cherry picked from commit 83f9d03e7c4913c3eb34edd4a8feb3833650b58f)

2 years agoDo not use stitched AES-GCM implementation on PPC32
Tomas Mraz [Wed, 28 Jun 2023 14:55:57 +0000 (16:55 +0200)] 
Do not use stitched AES-GCM implementation on PPC32

The implementation is not usable there at all.
Fixes #21301

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21312)

2 years agoAdd some test_ssl_new tests for the ffdhe groups
Matt Caswell [Fri, 23 Jun 2023 15:01:41 +0000 (16:01 +0100)] 
Add some test_ssl_new tests for the ffdhe groups

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

2 years agoFix supported_groups handing in TLSv1.2
Matt Caswell [Fri, 23 Jun 2023 14:45:14 +0000 (15:45 +0100)] 
Fix supported_groups handing in TLSv1.2

In TLSv1.2 we should not attempt to use a supported_group value that is
intended for use with TLSv1.3 - even if both the server and the client
support it, e.g. the ffdhe groups are supported by OpenSSL for TLSv1.3 but
not for TLSv1.2.

Fixes #21081

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

2 years agoopenssl speed -multi -evp prints wrong algorithm name
Jörg Sommer [Thu, 15 Jun 2023 16:16:49 +0000 (18:16 +0200)] 
openssl speed -multi -evp prints wrong algorithm name

When running `openssl speed -evp md5` the result shows `md5` as algorithm
name. But when adding the option `-multi 2` it gives `evp` as algorithm
name.

Signed-off-by: Jörg Sommer <joerg@jo-so.de>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21216)

(cherry picked from commit 33c09341bb081682535be0450ff6032df47ea141)

2 years agos390xcap.c: Avoid copying structure on initialization
Tomas Mraz [Mon, 26 Jun 2023 15:13:30 +0000 (17:13 +0200)] 
s390xcap.c: Avoid copying structure on initialization

This is problematic on old compilers. It also avoids duplicating
the read-only data.

Reviewed-by: Todd Short <todd.short@me.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21284)

2 years agoCONF_modules_load_file_ex(): Do not try to load an empty file name
Tomas Mraz [Mon, 26 Jun 2023 09:11:57 +0000 (11:11 +0200)] 
CONF_modules_load_file_ex(): Do not try to load an empty file name

Fixes #21258

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/21282)

(cherry picked from commit 8b7d5ea7dd602eb7c2c4bc5ad45489dc5fc711f6)

2 years agoAdd a test for pkeyutl encrypt/decrypt using SM2
Matt Caswell [Fri, 23 Jun 2023 11:05:07 +0000 (12:05 +0100)] 
Add a test for pkeyutl encrypt/decrypt using SM2

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

(cherry picked from commit 810f7dc1c7cc5441097b398f753e33652848a4cc)

2 years agoDon't truncate the input when decrypting in pkeyutl
Matt Caswell [Fri, 23 Jun 2023 10:50:17 +0000 (11:50 +0100)] 
Don't truncate the input when decrypting in pkeyutl

The pkeyutl app was truncating the input file for decryption leading to
incorrect results. This was probably ok historically when RSA was being
used for decryption which has short maximum sizes. This is not ok with SM2.

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

(cherry picked from commit 849450746f38a5658ef783abb0a8c79ae2861464)

2 years agoCheck for 0 modulus in BN_RECP_CTX_set.
fullwaywang [Wed, 21 Jun 2023 07:00:06 +0000 (15:00 +0800)] 
Check for 0 modulus in BN_RECP_CTX_set.

The function BN_RECP_CTX_set did not check whether arg d is zero,
in which case an early failure should be returned to the invoker.
This is a similar fix to the cognate defect of CVE-2015-1794.

Fixes #21111

CLA: trivial

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

(cherry picked from commit 43596b306b1fe06da3b1a99e07c0cf235898010d)

2 years agoadd note about retrieving error stack
Vladimír Kotal [Fri, 16 Jun 2023 09:22:24 +0000 (11:22 +0200)] 
add note about retrieving error stack

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

(cherry picked from commit a7c54dde5189f11c046f638e5aaf2004aee34202)

2 years agoAdd a test case for the password prompt on garbage PKCS#12 file
Richard Levitte [Fri, 16 Jun 2023 11:56:36 +0000 (13:56 +0200)] 
Add a test case for the password prompt on garbage PKCS#12 file

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

(cherry picked from commit 1a27cc3626bd15f8fd9a26a2dbc59a681d505321)

2 years agoOSSL_STORE and PKCS#12: Check if there is a MAC to verify before prompting
Richard Levitte [Tue, 13 Jun 2023 18:06:04 +0000 (20:06 +0200)] 
OSSL_STORE and PKCS#12: Check if there is a MAC to verify before prompting

When a DER object with unknown contents comes all the way to
ossl_store_handle_load_result(), and it attempts to decode them as different
objects, the PKCS#12 decoding attempt would (almost) always prompt for a
passphrase, even if there isn't a MAC to verify it against in the PKCS#12
object.

This change checks if there is a MAC to verify against before attempting to
prompt for a passphrase, leading to less surprising behavior.

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

(cherry picked from commit 7a520619c997146639f42ce8595162ac34c2ad41)

2 years agoDon't do SIGILL capability detection on Apple Silicon
Tom Cosgrove [Thu, 22 Jun 2023 02:31:47 +0000 (03:31 +0100)] 
Don't do SIGILL capability detection on Apple Silicon

Fixes #20753

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

2 years agoAdd a test for an invalid group in the HRR
Matt Caswell [Fri, 9 Jun 2023 08:33:11 +0000 (09:33 +0100)] 
Add a test for an invalid group in the HRR

Test that if the client sends a key share for a group in the server's
supported_group list but is otherwise invalid, that we don't select it
in the HRR.

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

(cherry picked from commit adf33f9e268b17ec1b4739707abb40b03b21ea6a)

2 years agoDon't ask for an invalid group in an HRR
Matt Caswell [Fri, 9 Jun 2023 08:09:06 +0000 (09:09 +0100)] 
Don't ask for an invalid group in an HRR

If the client sends us a group in a key_share that is in our
supported_groups list but is otherwise not suitable (e.g. not compatible
with TLSv1.3) we reject it. We should not ask for that same group again
in a subsequent HRR.

Fixes #21157

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

(cherry picked from commit 7a949ae5f1799a6629cf6deb44ae0f38455a73dd)

2 years agoreturn immediately if namemap is NULL
Vladimír Kotal [Fri, 16 Jun 2023 14:25:58 +0000 (16:25 +0200)] 
return immediately if namemap is NULL

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

(cherry picked from commit 307cd045dccbd9ea589ff47682e39504d79644d4)

2 years agoFix new typos found by codespell
Dimitri Papadopoulos [Thu, 15 Jun 2023 07:16:22 +0000 (09:16 +0200)] 
Fix new typos found by codespell

Fix only typos in doc/man* for inclusion in 3.* branches.

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

2 years agofips: use tsan counter instead of tsan_add to increment
Pauli [Wed, 14 Jun 2023 06:53:51 +0000 (16:53 +1000)] 
fips: use tsan counter instead of tsan_add to increment

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

(cherry picked from commit ff934cfdc85a7b8ddb4bdebf9ab68d518bf68b7f)

2 years agoapps/ca.c: Handle EVP_PKEY_get_default_digest_name() returning 1 with "UNDEF"
Richard Levitte [Wed, 8 Mar 2023 10:53:34 +0000 (11:53 +0100)] 
apps/ca.c: Handle EVP_PKEY_get_default_digest_name() returning 1 with "UNDEF"

EVP_PKEY_get_default_digest_name() may return 1 with the returned digest
name "UNDEF".  This case hasn't been documented, and the meaning has been
left undefined, until now.

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

(cherry picked from commit af99d55078582fb2ac35787043d56e0c10b1fe97)

2 years agofips: update DSA security check to fix legacy verify strengths
Pauli [Mon, 12 Jun 2023 23:37:57 +0000 (09:37 +1000)] 
fips: update DSA security check to fix legacy verify strengths

Refer SP 800-131Ar2 table 2:
    https://csrc.nist.gov/publications/detail/sp/800-131a/rev-2/final

Fixes #21185

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

(cherry picked from commit 71cf587ea21c1422640847e358019a51806d2811)

2 years agocrypto/params: drop float for UEFI
Yi Li [Tue, 16 May 2023 03:09:47 +0000 (11:09 +0800)] 
crypto/params: drop float for UEFI

Using floating point is not supported in UEFI and can cause build
problems, for example due to SSE being disabled and x64 calling
convention passing floats in SSE registers.

Avoid those problems by not compiling the related code for floating
point numbers.

Signed-off-by: Yi Li <yi1.li@intel.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21189)

2 years agofips: use memory ordering rather than locks
Pauli [Tue, 13 Jun 2023 01:39:23 +0000 (11:39 +1000)] 
fips: use memory ordering rather than locks

The FIPS provider accesses it's current state under lock.
This is overkill, little or no synchronisation is actually required in
practice (because it's essentially a read only setting).  Switch to using
TSAN operations in preference.

Fixes #21179

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

(cherry picked from commit 8e9ca334528e0a923c4deb0af250a60510974be0)

2 years agoAPPS: remove spurious errors when certain config file entries are not provided
Dr. David von Oheimb [Mon, 15 May 2023 17:59:16 +0000 (19:59 +0200)] 
APPS: remove spurious errors when certain config file entries are not provided

This backports the functional essence of #20971.

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Todd Short <todd.short@me.com>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
(Merged from https://github.com/openssl/openssl/pull/21050)

(cherry picked from commit 1737fb8f455963b0956c81504a2bec4304bd902d)

2 years agorand_lib: RAND_poll: Reseed in non-"no-deprecated" builds.
Mike Kasick [Fri, 9 Jun 2023 17:40:16 +0000 (13:40 -0400)] 
rand_lib: RAND_poll: Reseed in non-"no-deprecated" builds.

In a non-"no-deprecated" libcrypto build with a default configuration,
RAND_get_rand_method() == RAND_OpenSSL() and so needs to fall through to
the RAND_seed call (used in "no-deprecated" builds) to perform a reseed.

CLA: trivial

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

(cherry picked from commit cc343d047c147e0a395fb101efbe9dedf458aa17)

2 years agoX509_NAME_cmp fix for empty name
Wim Decroix [Thu, 8 Jun 2023 10:40:36 +0000 (12:40 +0200)] 
X509_NAME_cmp fix for empty name

CLA: trivial

Fixes #21156

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

(cherry picked from commit ec59752835f616860cd9451d6cfcea16bfc3ad05)

2 years agoINSTALL: document shared library pinning for static builds
Matthias St. Pierre [Wed, 17 May 2023 09:54:07 +0000 (11:54 +0200)] 
INSTALL: document shared library pinning for static builds

The libcrypto library uses shared library pinning to prevent its
cleanup handlers from crashing at program termination because of a
premature unloading of the shared library.

However, shared library pinning is enabled also for static builds,
which may lead to surpising behaviour if libcrypto is linked
statically to a shared third-party library, because in this case
the third-party library gets pinned.

This surprising behaviour is caused by the fact that the `no-shared`
configure option does not imply `no-pinshared`. Since this quirk
can't be changed without potentially breaking existing code, we just
document it here and provide a workaround.

Fixes #20977

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

(cherry picked from commit ce451fb86141fedad607bd68840639b06616047e)

2 years agoFix incorrect ERR_raise() calls
Theo Buehler [Sat, 10 Jun 2023 09:01:32 +0000 (11:01 +0200)] 
Fix incorrect ERR_raise() calls

A few ERR_raise() calls in v3_purp.c use the wrong library. For example,
in OpenSSL 3.1.1 we get

00000000:error:0580009E:x509 certificate routines:ossl_x509v3_cache_extensions:reason(158):crypto/x509/v3_purp.c:635:

instead of

00000000:error:1100009E:X509 V3 routines:ossl_x509v3_cache_extensions:invalid certificate:crypto/x509/v3_purp.c:635:

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

(cherry picked from commit 959c150a1dcc4535c2d94ac6f3310566723911f1)

2 years agoSet RC4 defines on libcrypto/liblegacy
Tomas Mraz [Thu, 8 Jun 2023 08:50:52 +0000 (10:50 +0200)] 
Set RC4 defines on libcrypto/liblegacy

Also add missing prototype for rc4_md5_enc.

Fixes #21150

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

(cherry picked from commit 58e8af4cecd23dbea2e6b061ab68190b38d64145)

2 years agoCast the argument to unsigned char when calling isspace()
Michael Baentsch [Thu, 8 Jun 2023 06:05:42 +0000 (08:05 +0200)] 
Cast the argument to unsigned char when calling isspace()

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

(cherry picked from commit 8a2e74d0536c91585fbe789e0ab7b06cab0289c2)

2 years agoCast the argument to unsigned char when calling isdigit()
Michael Baentsch [Mon, 5 Jun 2023 11:09:29 +0000 (13:09 +0200)] 
Cast the argument to unsigned char when calling isdigit()

Fixes #21123

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

(cherry picked from commit 8229874476cc2955e6947cf6d3fee09e13b8c160)

2 years agoMake link to RFC 1578 in CHANGES.md be a proper link
Tomas Mraz [Tue, 6 Jun 2023 09:32:15 +0000 (11:32 +0200)] 
Make link to RFC 1578 in CHANGES.md be a proper link

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

(cherry picked from commit 18f82df5b14b3fba078c6c5f0f4a0bb8eee6c954)

2 years agodoc: note that out ChaCha20 isn't standard compliant.
Pauli [Wed, 31 May 2023 23:51:46 +0000 (09:51 +1000)] 
doc: note that out ChaCha20 isn't standard compliant.

Fixes #21095

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

(cherry picked from commit c69756e7a0133b67df50525e89206c9cc4a7d2b8)

2 years agoDon't take a write lock to retrieve a value from a stack
Matt Caswell [Fri, 12 May 2023 15:15:21 +0000 (16:15 +0100)] 
Don't take a write lock to retrieve a value from a stack

ossl_x509_store_ctx_get_by_subject() was taking a write lock for the
store, but was only (usually) retrieving a value from the stack of
objects. We take a read lock instead.

Partially fixes #20286

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

(cherry picked from commit 80935bf5ad309bf6c03591acf1d48fe1db57b78f)

2 years agoAvoid an unneccessary lock if we didn't add anything to the store
Matt Caswell [Fri, 12 May 2023 14:52:07 +0000 (15:52 +0100)] 
Avoid an unneccessary lock if we didn't add anything to the store

Partially fixes #20286

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

(cherry picked from commit 50001e0e15d4a96213c2eea7c56f80087afa89fd)

2 years agoFix documentation where openssl-genrsa is listed as deprecated since OpenSSL 3.0
Darana [Thu, 25 May 2023 18:58:16 +0000 (23:58 +0500)] 
Fix documentation where openssl-genrsa is listed as deprecated since OpenSSL 3.0

openssl-genrsa is not deprecated however the OpenSSL documentation
states that it is the case from OpenSSL 3.0. This has been fixed in the
documentation, specifically in manpage 1.

Fixes #21055

CLA: trivial

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

(cherry picked from commit 4ad2dd43d0959b850c06c5a681d34aeb78d7c4b9)

2 years agoCMS_ContentInfo_free(): fix mem leak on encrypted content key
Dr. David von Oheimb [Thu, 25 May 2023 15:46:48 +0000 (17:46 +0200)] 
CMS_ContentInfo_free(): fix mem leak on encrypted content key

Fixes #21026

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

(cherry picked from commit 7a1857483938b6b6eec5b8760c68c71a71296cd2)

2 years agoSMIME_crlf_copy(): check for NULL pointer arguments
Dr. David von Oheimb [Thu, 25 May 2023 15:48:04 +0000 (17:48 +0200)] 
SMIME_crlf_copy(): check for NULL pointer arguments

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

(cherry picked from commit 23450cfb9204615e97467e8be6a709141523a59e)

2 years agoIgnore the fetch error when a legacy algorithm is found
Yuri Penkin [Tue, 23 May 2023 20:32:23 +0000 (23:32 +0300)] 
Ignore the fetch error when a legacy algorithm is found

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

(cherry picked from commit cb1f87f59d0b290eca9207ec4ef36d8073e6feec)

2 years agodoc: update FIPS provider version information
Pauli [Thu, 25 May 2023 01:31:36 +0000 (11:31 +1000)] 
doc: update FIPS provider version information

With 3.0.8 validated, we need to note this in the documentation.

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

(cherry picked from commit 73f59aa8ebee4231ef8d4072b474974c571efb96)

2 years agoCompute RSA-PSS algorithm params in libcrypto for legacy
Tomas Mraz [Mon, 22 May 2023 13:08:38 +0000 (15:08 +0200)] 
Compute RSA-PSS algorithm params in libcrypto for legacy

Fixes regression of RSA signatures for legacy keys caused
by quering the provider for the algorithm id with parameters.

Legacy keys do not have a method that would create the
algorithm id. So we revert to what was done in 3.0.7 and
earlier versions for these keys.

Fixes #21008

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21019)

(cherry picked from commit 3410a72dce57651e08d5d2143409cde0205a8f3b)

2 years agoFix arm64 asm code back compatible issue with gcc 4.9.4
Xiaokang Qian [Mon, 15 May 2023 09:14:39 +0000 (09:14 +0000)] 
Fix arm64 asm code back compatible issue with gcc 4.9.4

Fix: #20963

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

(cherry picked from commit 09bd0d05a6ab9eb4965763c100edf9b86ae03d2b)

2 years agoBump actions/setup-python from 4.6.0 to 4.6.1
dependabot[bot] [Thu, 25 May 2023 15:57:31 +0000 (15:57 +0000)] 
Bump actions/setup-python from 4.6.0 to 4.6.1

Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4.6.0 to 4.6.1.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v4.6.0...v4.6.1)

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

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

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

(cherry picked from commit a1c8edcfc907a84d2595bc52ea7a43f4b33c7339)

2 years agoWhen we're just reading EX_CALLBACK data just get a read lock
Matt Caswell [Thu, 11 May 2023 10:25:07 +0000 (11:25 +0100)] 
When we're just reading EX_CALLBACK data just get a read lock

The crypto_ex_data code was always obtaining a write lock in all functions
regardless of whether we were only reading EX_CALLBACK data or actually
changing it. Changes to the EX_CALLBACK data are rare, with many reads so
we should change to a read lock where we can.

We hit this every time we create or free any object that can have ex_data
associated with it (e.g. BIOs, SSL, etc)

Partially fixes #20286

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

(cherry picked from commit 6d15357aeb893c6e8b4c7a8188c18f4db54c0612)

2 years agoPrepare for 3.1.2
Tomas Mraz [Tue, 30 May 2023 12:14:16 +0000 (14:14 +0200)] 
Prepare for 3.1.2

Reviewed-by: Richard Levitte <levitte@openssl.org>
Release: yes

2 years agoPrepare for release of 3.1.1 openssl-3.1.1
Tomas Mraz [Tue, 30 May 2023 12:13:24 +0000 (14:13 +0200)] 
Prepare for release of 3.1.1

Reviewed-by: Richard Levitte <levitte@openssl.org>
Release: yes

2 years agomake update
Tomas Mraz [Tue, 30 May 2023 12:13:12 +0000 (14:13 +0200)] 
make update

Reviewed-by: Richard Levitte <levitte@openssl.org>
Release: yes

2 years agoUpdate copyright year
Tomas Mraz [Tue, 30 May 2023 12:11:01 +0000 (14:11 +0200)] 
Update copyright year

Reviewed-by: Richard Levitte <levitte@openssl.org>
Release: yes

2 years agoRestrict the size of OBJECT IDENTIFIERs that OBJ_obj2txt will translate
Richard Levitte [Fri, 12 May 2023 08:00:13 +0000 (10:00 +0200)] 
Restrict the size of OBJECT IDENTIFIERs that OBJ_obj2txt will translate

OBJ_obj2txt() would translate any size OBJECT IDENTIFIER to canonical
numeric text form.  For gigantic sub-identifiers, this would take a very
long time, the time complexity being O(n^2) where n is the size of that
sub-identifier.

To mitigate this, a restriction on the size that OBJ_obj2txt() will
translate to canonical numeric text form is added, based on RFC 2578
(STD 58), which says this:

> 3.5. OBJECT IDENTIFIER values
>
> An OBJECT IDENTIFIER value is an ordered list of non-negative numbers.
> For the SMIv2, each number in the list is referred to as a sub-identifier,
> there are at most 128 sub-identifiers in a value, and each sub-identifier
> has a maximum value of 2^32-1 (4294967295 decimal).

Fixes otc/security#96
Fixes CVE-2023-2650

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
2 years agox509: Handle ossl_policy_level_add_node errors
Clemens Lang [Wed, 24 May 2023 11:12:54 +0000 (13:12 +0200)] 
x509: Handle ossl_policy_level_add_node errors

The invocation of ossl_policy_level_add_node in tree_calculate_user_set
did not have any error handling. Add it to prevent a memory leak for the
allocated extra policy data.

Also add error handling to sk_X509_POLICY_NODE_push to ensure that if
a new node was allocated, but could not be added to the stack, it is
freed correctly.

Fix error handling if tree->user_policies cannot be allocated by
returning 0, indicating failure, rather than 1.

Signed-off-by: Clemens Lang <cllang@redhat.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21040)

(cherry picked from commit 95a8aa6dc0e283b1560dd3258d2e9115c02659b1)

2 years agox509: Fix possible use-after-free when OOM
Clemens Lang [Wed, 24 May 2023 10:22:25 +0000 (12:22 +0200)] 
x509: Fix possible use-after-free when OOM

ossl_policy_level_add_node() first adds the new node to the level->nodes
stack, and then attempts to add extra data if extra_data is true. If
memory allocation or adding the extra data to tree->extra_data fails,
the allocated node (that has already been added to the level->nodes
stack) is freed using ossl_policy_node_free(), which leads to
a potential use after free.

Additionally, the tree's node count and the parent's child count would
not be updated, despite the new node being added.

Fix this by either performing the function's purpose completely, or not
at all by reverting the changes on error.

Signed-off-by: Clemens Lang <cllang@redhat.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21040)

(cherry picked from commit de53817ec386ea9e943d8f33716945dd9dbe1f31)

2 years agoAdd missing CHANGES.md entries
Tomas Mraz [Thu, 25 May 2023 14:58:04 +0000 (16:58 +0200)] 
Add missing CHANGES.md entries

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

2 years agoReplace __attribute__((malloc)) with __attribute__((__malloc__)) in macros.h
Anis-cpu-13 [Tue, 2 May 2023 12:59:11 +0000 (14:59 +0200)] 
Replace __attribute__((malloc)) with __attribute__((__malloc__)) in macros.h

Fix macro attribute conflict with cmocka
Fixes #20776

CLA: trivial

Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20869)

(cherry picked from commit 0bf7e94c10f1b00510b8a36cdcbedc02a66468be)

2 years agoClarify how to return string data
Watson Ladd [Fri, 19 May 2023 20:55:08 +0000 (13:55 -0700)] 
Clarify how to return string data

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

(cherry picked from commit eab96453bb145cde8e447f420a4ba099a5fa7004)

2 years agoFix a bug where the result of rehash is unstable
minyong.ha [Mon, 22 May 2023 05:44:13 +0000 (14:44 +0900)] 
Fix a bug where the result of rehash is unstable

The root cause is that the file entries targeted for rehash are not actually sorted.
Sort was skipped because the compare function was null.
So a compare function has been implemented to allow file entries to be sorted.

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

(cherry picked from commit 31c94b5e1159b5435b2354e6525355ec33683ecc)

2 years agoFix incorrect parameter verification in EVP_MD_CTX_get_params
lan1120 [Mon, 22 May 2023 12:37:59 +0000 (20:37 +0800)] 
Fix incorrect parameter verification in EVP_MD_CTX_get_params

Signed-off-by: lan1120 <lanming@huawei.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21022)

(cherry picked from commit b501df3cefebcdaaeb7d6480b7a7b82d68927873)