]> git.ipfire.org Git - thirdparty/openssl.git/log
thirdparty/openssl.git
21 months agono-engine: fix signing with legacy app method based keys
Matthias St. Pierre [Thu, 21 Sep 2023 14:43:43 +0000 (16:43 +0200)] 
no-engine: fix signing with legacy app method based keys

Signing with an app method based key (i.e. an `EVP_PKEY` which wraps an
`RSA` key with an application defined `RSA_METHOD`) used to work in 1.1.1.
That feature was broken in commit 60488d2434, but later on fixed by @t8m
in commit b247113c05 (see #14859).

This commit corrects a  minor flaw of the fix, which affects only
`no-engine` builds: the special treatment for foreign keys is guarded
by an `OPENSSL_NO_ENGINE` check.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Todd Short <todd.short@me.com>
(Merged from https://github.com/openssl/openssl/pull/22163)

21 months agoDo not include sparse_array.o in libssl
Huiyue Xu [Thu, 14 Sep 2023 08:21:35 +0000 (16:21 +0800)] 
Do not include sparse_array.o in libssl

sparse_array.o is not needed in libssl at 3.0.x version.

Signed-off-by: Huiyue Xu <xuhuiyue@huawei.com>
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/22111)

(cherry picked from commit a31cd07af1ca34cdbbd2b077a933208d447ed0b2)

21 months agoClarify the terminology in the noisy dgram BIO
Matt Caswell [Thu, 21 Sep 2023 09:25:00 +0000 (10:25 +0100)] 
Clarify the terminology in the noisy dgram BIO

The previous terminology was quite confusing. We try to use drop, duplicate
and delay more consistently and introduce the "reinject" terminology as a
mechanism for implementing duplicates and delays.

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

21 months agoEnsure we free all the BIOs in a chain for QUIC like we do in TLS
Matt Caswell [Wed, 20 Sep 2023 15:25:44 +0000 (16:25 +0100)] 
Ensure we free all the BIOs in a chain for QUIC like we do in TLS

An application may pass in a whole BIO chain via SSL_set_bio(). When we
free the BIO we should be using BIO_free_all() not BIO_free() like we do
with TLS.

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

21 months agoEnsure we up-ref the sbio before passing it to tserver
Matt Caswell [Wed, 20 Sep 2023 15:24:37 +0000 (16:24 +0100)] 
Ensure we up-ref the sbio before passing it to tserver

We are actually passing two references to sbio: one as part of a BIO chain
and one stand alone. Therefore we need two references.

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

21 months agoRemove some redundant code from test helper BIOs
Matt Caswell [Wed, 20 Sep 2023 12:25:42 +0000 (13:25 +0100)] 
Remove some redundant code from test helper BIOs

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

21 months agoEnsure client to server datagrams are noisy too
Matt Caswell [Tue, 19 Sep 2023 15:52:00 +0000 (16:52 +0100)] 
Ensure client to server datagrams are noisy too

So far we've only applied noise to the server to client datagrams. Do the
same thing the other way around.

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

21 months agoAdd the ability to do client side tracing in quictestlib.c
Matt Caswell [Tue, 19 Sep 2023 15:40:25 +0000 (16:40 +0100)] 
Add the ability to do client side tracing in quictestlib.c

We add a new flag QTEST_FLAG_CLIENT_TRACE to get debug tracing output if
required.

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

21 months agoExtend the noisy dgram test so that packets are also affected by noise
Matt Caswell [Tue, 19 Sep 2023 11:21:27 +0000 (12:21 +0100)] 
Extend the noisy dgram test so that packets are also affected by noise

Where multiple packets are in a single datagram we split them so that all
packets can be affected by the noise

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

21 months agoAdd a packet splitting BIO
Matt Caswell [Tue, 19 Sep 2023 10:52:42 +0000 (11:52 +0100)] 
Add a packet splitting BIO

Provide a BIO filter that can split QUIC datagrams containing multiple
packets, such that each packet is in its own datagram.

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

21 months agoUse fake time rather than real time in the noisy dgram test
Matt Caswell [Mon, 18 Sep 2023 16:06:31 +0000 (17:06 +0100)] 
Use fake time rather than real time in the noisy dgram test

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

21 months agoAdd support for timeouts into quictestlib.c
Matt Caswell [Mon, 18 Sep 2023 15:55:52 +0000 (16:55 +0100)] 
Add support for timeouts into quictestlib.c

Now that we have a noisy datagram BIO we cannot rely on datagrams always
reliably being delivered in the test framework. We need to start taking
notice of timeouts and handling them appropriately.

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

21 months agoAdd some optional debug output to the noisy dgram BIO
Matt Caswell [Mon, 18 Sep 2023 10:41:42 +0000 (11:41 +0100)] 
Add some optional debug output to the noisy dgram BIO

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

21 months agoUse test_random() to introduce better noise into the noisy dgram BIO
Matt Caswell [Fri, 15 Sep 2023 14:35:56 +0000 (15:35 +0100)] 
Use test_random() to introduce better noise into the noisy dgram BIO

We drop some datagrams, and we delay some datagrams. We can also duplicate
some datagrams.

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

21 months agoExtend the nosiy datagram test to send more data
Matt Caswell [Thu, 14 Sep 2023 15:34:41 +0000 (16:34 +0100)] 
Extend the nosiy datagram test to send more data

We send several messages between client and server, and server and client,
and also create a new stream.

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

21 months agoAdd the ability to drop datagrams in the noisy dgram BIO
Matt Caswell [Thu, 14 Sep 2023 11:24:12 +0000 (12:24 +0100)] 
Add the ability to drop datagrams in the noisy dgram BIO

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

21 months agoCreate a noisy dgram test
Matt Caswell [Thu, 14 Sep 2023 09:59:47 +0000 (10:59 +0100)] 
Create a noisy dgram test

Create a noisy dgram test that can drop/duplicate/reorder UDP packets and
ensure that the QUIC connection is tolerant of this. At this stage we just
create the outline of the test. Adding in the noise will come in future
commits.

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

21 months agoAdd command line option for setting propquery in evp_test
Veronika Hanulíková [Fri, 8 Sep 2023 09:44:27 +0000 (11:44 +0200)] 
Add command line option for setting propquery in evp_test

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

21 months agoAdd command line option for setting provider in evp_test
Veronika Hanulíková [Tue, 12 Sep 2023 13:24:21 +0000 (15:24 +0200)] 
Add command line option for setting provider in evp_test

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

21 months agoFix test_cms if DSA is not supported
Steffen Klee [Tue, 19 Sep 2023 22:04:18 +0000 (00:04 +0200)] 
Fix test_cms if DSA is not supported

CLA: trivial

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

21 months agoFix error handling in lhash contract
Bernd Edlinger [Wed, 20 Sep 2023 13:45:56 +0000 (15:45 +0200)] 
Fix error handling in lhash contract

When the realloc fails in contract, this not a fatal
error, since the memory is only shrinked. It is also no
option to exit the function at this point, since that
would leave the hash table in an inconsistent state.

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

21 months agoFix error handling in CRYPTO_get_ex_new_index
Bernd Edlinger [Tue, 19 Sep 2023 18:15:18 +0000 (20:15 +0200)] 
Fix error handling in CRYPTO_get_ex_new_index

If an out of memory error happens when the index zero
is reserved in a newly created ip->meth stack object,
that reservation is not done in a second attempt, which makes
various X_set_ex_data overwrite the value of X_set_app_data.

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

21 months agoFix some memory leaks in the openssl app
Bernd Edlinger [Mon, 11 Sep 2023 04:38:31 +0000 (06:38 +0200)] 
Fix some memory leaks in the openssl app

In some error cases the normal cleanup did not
happen, but instead an exit(1) which caused some
memory leaks, as reported in #22049.

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

21 months agocmp_vfy.c: Use verification callback if cert_acceptable() finds expired cert
Dr. David von Oheimb [Thu, 6 May 2021 16:49:54 +0000 (18:49 +0200)] 
cmp_vfy.c: Use verification callback if cert_acceptable() finds expired cert

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

21 months agodoc: change name of OSSL_PROVIDER_load_ex design document
Matthias St. Pierre [Fri, 8 Sep 2023 10:35:57 +0000 (12:35 +0200)] 
doc: change name of OSSL_PROVIDER_load_ex design document

Use dashes instead of underscores, to be more consistent with
existing document names. And speaking of consistency, introduce
a consistent name transformation, which will scale better when
design documents start filling the folder ;-)

    OSSL_PROVIDER_load_ex -> ossl-provider-load-ex.md

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

21 months agodoc: suggestions for OSSL_PROVIDER_load_ex design document
Matthias St. Pierre [Fri, 8 Sep 2023 10:31:09 +0000 (12:31 +0200)] 
doc: suggestions for OSSL_PROVIDER_load_ex design document

Late review comments for pull request #21604, sort of.

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

21 months agoDocument the OPENSSL_TEST_RAND_SEED environment variable
Matt Caswell [Fri, 15 Sep 2023 13:36:05 +0000 (14:36 +0100)] 
Document the OPENSSL_TEST_RAND_SEED environment variable

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

21 months agoEnable the ability to seed the test RNG without randomising test ordering
Matt Caswell [Fri, 15 Sep 2023 13:29:05 +0000 (14:29 +0100)] 
Enable the ability to seed the test RNG without randomising test ordering

Numerous tests use the test_random() function to get a random number. If a
test fails then the seed that was used for the test RNG is displayed.
Setting the seed to the same value in a future run is supposed to cause the
same random numbers to be generated again.

The way to set the RNG seed again is to use the `OPENSSL_TEST_RAND_ORDER`
environment variable. However setting this environment variable *also*
randomises the test ordering as well as seeding the RNG. This in itself
calls test_random() so, in fact, when the test finally runs it gets
different random numbers to when it originally run (defeating the
repeatability objective).

This means that only way repeatability can be obtained is if the test was
originally run with `OPENSSL_TEST_RAND_ORDER` set to 0. If that wasn't done
then the seed printed when the test failed is not useful.

We introduce a new environment variable `OPENSSL_TEST_RAND_SEED` which can
be used to independently seed the test RNG without randomising the test
ordering. This can be used to get repeatability in cases where test ordering
randomisation was not done in the first place.

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

21 months agocoverity: NULL dereference
Pauli [Tue, 19 Sep 2023 01:07:21 +0000 (11:07 +1000)] 
coverity: NULL dereference

Fixes coverity 1544699.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/22138)

21 months agoBIO: Wire poll descriptor functions in BIO_s_sock
Hugo Landau [Thu, 14 Sep 2023 07:40:14 +0000 (08:40 +0100)] 
BIO: Wire poll descriptor functions in BIO_s_sock

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

21 months agoSSL: Test SSL_get_[rw]poll_descriptor, SSL_net_(read|write)_desired
Hugo Landau [Wed, 13 Sep 2023 12:47:13 +0000 (13:47 +0100)] 
SSL: Test SSL_get_[rw]poll_descriptor, SSL_net_(read|write)_desired

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

21 months agoQUIC: Update documentation for SSL_get_[rw]poll_descriptor, SSL_net_(read|write)_desired
Hugo Landau [Wed, 13 Sep 2023 12:46:44 +0000 (13:46 +0100)] 
QUIC: Update documentation for SSL_get_[rw]poll_descriptor, SSL_net_(read|write)_desired

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

21 months agoQUIC APL: Wire SSL_get_[rw]poll_descriptor for TLS/DTLS
Hugo Landau [Wed, 13 Sep 2023 12:46:27 +0000 (13:46 +0100)] 
QUIC APL: Wire SSL_get_[rw]poll_descriptor for TLS/DTLS

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

21 months agoQUIC: Wire SSL_net_(read|write)_desired for TLS/DTLS
Hugo Landau [Wed, 6 Sep 2023 07:04:17 +0000 (08:04 +0100)] 
QUIC: Wire SSL_net_(read|write)_desired for TLS/DTLS

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

21 months agoAdd documentation for the function SSL_CONF_CTX_finish.
Sumitra Sharma [Mon, 18 Sep 2023 11:08:11 +0000 (16:38 +0530)] 
Add documentation for the function SSL_CONF_CTX_finish.

Add documentation for the function SSL_CONF_CTX_finish() in man3.

Fixes #22084

Signed-off-by: Sumitra Sharma <sumitraartsy@gmail.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22128)

21 months agoos zoo ci
Dmitry Misharov [Mon, 18 Sep 2023 08:53:00 +0000 (10:53 +0200)] 
os zoo ci

Use a Github Actions expression to set value for the environment
variable.

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

21 months agoenc: "bad decrypt" only in decryption
Mathieu Tortuyaux [Mon, 18 Sep 2023 14:02:21 +0000 (16:02 +0200)] 
enc: "bad decrypt" only in decryption

CLA: trivial

Signed-off-by: Mathieu Tortuyaux <mathieu.tortuyaux@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22134)

21 months agoAdd provider documentation for the new open_ex
Simo Sorce [Thu, 14 Sep 2023 20:55:32 +0000 (16:55 -0400)] 
Add provider documentation for the new open_ex

Signed-off-by: Simo Sorce <simo@redhat.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20131)

21 months agoAdd Test to verify open_ex password checking works
Simo Sorce [Thu, 14 Sep 2023 13:25:30 +0000 (09:25 -0400)] 
Add Test to verify open_ex password checking works

Signed-off-by: Simo Sorce <simo@redhat.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20131)

21 months agoAllow to pass a passprase callback at store open
Simo Sorce [Mon, 23 Jan 2023 22:28:21 +0000 (17:28 -0500)] 
Allow to pass a passprase callback at store open

Some PKCS11 modules require authentication early on to be able to
preload objects, which we want to do to avoid costly roundtrips when the
HSM is actually reached over a network (Cloud HSM).

Unfortunately at open time we can't interact with the user becaue the
callbacks are only passed at object load time. later on.

This patch corrects this issue by providing a more feature rich open
call for providers.

Signed-off-by: Simo Sorce <simo@redhat.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20131)

21 months agoPostponed further context duplication support for ciphers
Tomas Mraz [Wed, 13 Sep 2023 14:56:58 +0000 (16:56 +0200)] 
Postponed further context duplication support for ciphers

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

21 months agoEnhance code safety and readability in SSL_get_shared_ciphers()
Sumitra Sharma [Tue, 12 Sep 2023 06:30:21 +0000 (12:00 +0530)] 
Enhance code safety and readability in SSL_get_shared_ciphers()

This commit introduces two key improvements:

1. Improve code safety by replacing the conditional statement with
`if (n >= size)` and using OPENSSL_strnlen() instead of strlen().
This change ensures proper buffer size handling and adheres to
secure coding practices.

2. Enhance code readability by substituting `strcpy(p, c->name)` with
`memcpy(p, c->name, n)`. This adjustment prioritizes code clarity and
maintenance, even while mitigating a minimal buffer overflow risk.

These enhancements bolster the code's robustness and comprehensibility,
aligning with secure coding principles and best practices.

Fixes #19837

Signed-off-by: Sumitra Sharma <sumitraartsy@gmail.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21934)

21 months agoUpdate OPENSSL_buf2hexstr() to use DEFAULT_SEPARATOR.
Pan Lanlan [Fri, 8 Sep 2023 16:13:43 +0000 (00:13 +0800)] 
Update OPENSSL_buf2hexstr() to use DEFAULT_SEPARATOR.

CLA: trivial

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

21 months agoAPPS: remove duplicate definition of `trace_data_stack`
Matthias St. Pierre [Fri, 15 Sep 2023 13:32:25 +0000 (15:32 +0200)] 
APPS: remove duplicate definition of `trace_data_stack`

Note: It seems like the C compiler doesn't care about the duplicate.
(The first definition is eight lines above.) The C++ compiler however
didn't like it when I reused the tracing code snippets elsewhere.

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

21 months agoFix new typos found by codespell
Dimitri Papadopoulos [Wed, 13 Sep 2023 18:50:11 +0000 (20:50 +0200)] 
Fix new typos found by codespell

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

21 months agocoveralls.yml: Improve coverage mapping and remove 1.1.1
Tomas Mraz [Thu, 14 Sep 2023 14:59:47 +0000 (16:59 +0200)] 
coveralls.yml: Improve coverage mapping and remove 1.1.1

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

21 months agoFix a key repointing in various ciphers
Neil Horman [Tue, 12 Sep 2023 21:09:06 +0000 (17:09 -0400)] 
Fix a key repointing in various ciphers

In the dupctx fixups I missed a pointer that needed to be repointed to
the surrounding structures AES_KEY structure for the sm4/aes/aria
ccm/gcm variants.  This caused a colliding use of the key and possible
use after free issues.

Fixes #22076

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

21 months agoFix regression in evp_test for provider compat CI
Neil Horman [Tue, 12 Sep 2023 21:07:53 +0000 (17:07 -0400)] 
Fix regression in evp_test for provider compat CI

If we ignore the faliure to copy on an old fips provider, we need to use
ctx_base, rather than ctx

Fixes #22076

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

21 months agoFix PKCS#12 creation error when certificate contains auxiliary data
Olga Batyshkina [Mon, 7 Aug 2023 13:14:53 +0000 (15:14 +0200)] 
Fix PKCS#12 creation error when certificate contains auxiliary data

Prefer friendly name passed by the caller and calculated local
key id to ones found in certificate auxiliary data when creating
PKCS#12.

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

21 months agoStore: API for deletion - documentation
Dmitry Belyavskiy [Thu, 31 Aug 2023 09:33:36 +0000 (11:33 +0200)] 
Store: API for deletion - documentation

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

21 months agoStore: API for deletion - tests
Dmitry Belyavskiy [Mon, 28 Aug 2023 11:38:33 +0000 (13:38 +0200)] 
Store: API for deletion - tests

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

21 months agoStore: API for deletion - make update
Dmitry Belyavskiy [Mon, 28 Aug 2023 11:38:19 +0000 (13:38 +0200)] 
Store: API for deletion - make update

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

21 months agoStore: API for deletion
Dmitry Belyavskiy [Mon, 28 Aug 2023 11:37:33 +0000 (13:37 +0200)] 
Store: API for deletion

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

21 months agoFix engine cleanup error handling
Bernd Edlinger [Tue, 5 Sep 2023 14:59:45 +0000 (16:59 +0200)] 
Fix engine cleanup error handling

Error handling in engine_cleanup_add_first/last was
broken and caused memory leaks.

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

21 months agoRemove use of _Static_assert
Matt Caswell [Wed, 13 Sep 2023 09:31:46 +0000 (10:31 +0100)] 
Remove use of _Static_assert

We had some use of the C11 _Static_assert feature which can cause some
problems on some platforms. Everywhere we were using it, it is not really
required so remove it.

Fixes #22017

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Richard Levitte <levitte@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/22091)

21 months agoFix build of SHA3 on ARM64 with no-asm
Tomas Mraz [Wed, 13 Sep 2023 06:29:17 +0000 (08:29 +0200)] 
Fix build of SHA3 on ARM64 with no-asm

Fixes #22089

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

21 months agoUse correct version of 3.1 build for FIPS provider.
Pauli [Wed, 13 Sep 2023 02:06:20 +0000 (12:06 +1000)] 
Use correct version of 3.1 build for FIPS provider.

We're (currently) intending to validate 3.1.2 against FIPS 140-3.

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

21 months agoHave legacy blake2 EVP structure use base blake2 implementation
Richard Levitte [Tue, 12 Sep 2023 12:58:03 +0000 (14:58 +0200)] 
Have legacy blake2 EVP structure use base blake2 implementation

For some reason, the code here was made to got through the provider
specific init functions.  This is very very dangerous if the provider
specific functions were to change in any way (such as changes to the
implementation context structure).

Instead, use the init functions from the base blake2 implementations
directly.

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

21 months agoQUIC CHANNEL: Add missing duplicate TPARAM handling cases
Hugo Landau [Fri, 8 Sep 2023 11:50:59 +0000 (12:50 +0100)] 
QUIC CHANNEL: Add missing duplicate TPARAM handling cases

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

21 months agoQUIC MULTISTREAM TEST: Correct trivial bug
Hugo Landau [Fri, 8 Sep 2023 12:08:10 +0000 (13:08 +0100)] 
QUIC MULTISTREAM TEST: Correct trivial bug

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

21 months agoFix test/quic_tserver_test.c for slow machines
Richard Levitte [Tue, 12 Sep 2023 13:07:29 +0000 (15:07 +0200)] 
Fix test/quic_tserver_test.c for slow machines

OSSL_sleep(1) isn't enough of a wait for threads to process the next QUIC
tick, so it gets increased to OSSL_sleep(100).  This may be a tad much,
perhaps, but for now, it gives a good margin.

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

21 months agoFix memory leaks in ssl_old_test.c
Bernd Edlinger [Mon, 11 Sep 2023 10:26:46 +0000 (12:26 +0200)] 
Fix memory leaks in ssl_old_test.c

This fixes a few memory leaks reported in #22049.

If SSL_CTX_set0_tmp_dh_pkey rejects the temp dh key
due to security restrictions (even when @SECLEVEL=0 is used!)
then the caller has to delete the PKEY object.
That is different to how the deprecated
SSL_CTX_set_tmp_dh_pkey was designed to work.

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

21 months agod2i_ECPKParameters and i2d_ECPKParameters are not deprecated
Tomas Mraz [Mon, 11 Sep 2023 15:23:46 +0000 (17:23 +0200)] 
d2i_ECPKParameters and i2d_ECPKParameters are not deprecated

So do not document them as such.

Fixes #22068

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

21 months agoFurther fix in bio_dgram_test for BIO_s_dgram_mem()
Matt Caswell [Tue, 12 Sep 2023 09:39:51 +0000 (10:39 +0100)] 
Further fix in bio_dgram_test for BIO_s_dgram_mem()

When setting an explicit buffer size using BIO_s_dgram_mem() make sure we
take into account the size of the header (which may be large on NonStop)

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

21 months agoFix a failure in bio_dgram_test on the NonStop platform
Matt Caswell [Mon, 11 Sep 2023 09:03:22 +0000 (10:03 +0100)] 
Fix a failure in bio_dgram_test on the NonStop platform

The size of the datagram header is significantly larger that we might
expect on NonStop (probably driven by sizeof(BIO_ADDR)). We adjust the
size of the default buffer to take into account the header size and the
mtu.

Fixes #22013

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

21 months agoTest that a client that does not supply ALPN fails as expected
Matt Caswell [Mon, 11 Sep 2023 12:57:35 +0000 (13:57 +0100)] 
Test that a client that does not supply ALPN fails as expected

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

21 months agoEnsure QUIC-TLS errors raised during channel start are available to caller
Matt Caswell [Mon, 11 Sep 2023 12:55:41 +0000 (13:55 +0100)] 
Ensure QUIC-TLS errors raised during channel start are available to caller

TLS misconfiguration errors should be shown to the application to enable
diagnosis of the problem. Otherwise you just get a generical "internal
error" message.

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

21 months agoTest we correctly handle missing ALPN from the server
Matt Caswell [Fri, 8 Sep 2023 16:36:38 +0000 (17:36 +0100)] 
Test we correctly handle missing ALPN from the server

ALPN is a requirement for QUIC so it is an error if the server does not
send it.

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

21 months agoFix typos found by codespell
Dimitri Papadopoulos [Mon, 11 Sep 2023 11:27:05 +0000 (13:27 +0200)] 
Fix typos found by codespell

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

21 months agoFix a memleak in prepare_rsa_params
Bernd Edlinger [Mon, 11 Sep 2023 10:34:02 +0000 (12:34 +0200)] 
Fix a memleak in prepare_rsa_params

This affects only RSA-PSS keys with params using
negative salt legth, or in case of out of memory.
This fixes a memory leak reported in #22049.

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

21 months agoAdd dupctx support to rc4_hmac_md5 algo
Neil Horman [Fri, 1 Sep 2023 17:47:15 +0000 (13:47 -0400)] 
Add dupctx support to rc4_hmac_md5 algo

Pretty straightforward, just clone the requested context, no pointers to
fixup

Fixes #21887

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

21 months agoimplement dupctx for chacha20_poly1305
Neil Horman [Fri, 1 Sep 2023 17:22:03 +0000 (13:22 -0400)] 
implement dupctx for chacha20_poly1305

Same as chacha20 in the last commit, just clone the ctx and its
underlying tlsmac array if its allocated

Fixes #21887

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

21 months agoFix aes_gcm_siv dupctx function
Neil Horman [Fri, 1 Sep 2023 16:13:19 +0000 (12:13 -0400)] 
Fix aes_gcm_siv dupctx function

This cipher family has a dupctx function, but was failing because it was
attempting to memdup a field only if it was null

Fix the conditional check to get it working again

Fixes #21887

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

21 months agoimplement dupctx for aes_WRAP methods
Neil Horman [Fri, 1 Sep 2023 15:28:33 +0000 (11:28 -0400)] 
implement dupctx for aes_WRAP methods

create a dupctx method for aes_WRAP implementations of all sizes

Fixes #21887

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

21 months agoAdd dupctx support to aead ciphers
Neil Horman [Fri, 1 Sep 2023 13:10:35 +0000 (09:10 -0400)] 
Add dupctx support to aead ciphers

Add dupctx method support to to ciphers implemented with IMPLEMENT_aead_cipher
This includes:
aes-<kbits>-gcm
aria-<kbits>-ccm
aria-<kbits>-gcm
sm4-<kibs>-gcm

Fixes #21887

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

21 months agomake inability to dup/clone ciphers an error
Neil Horman [Tue, 29 Aug 2023 19:42:48 +0000 (15:42 -0400)] 
make inability to dup/clone ciphers an error

There should be no reason that a cipher can't be duplicated

Fixes #21887

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

21 months agoAdd a test for SSL_CIPHER_find() when used with a QUIC SSL object
Matt Caswell [Fri, 8 Sep 2023 10:22:36 +0000 (11:22 +0100)] 
Add a test for SSL_CIPHER_find() when used with a QUIC SSL object

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

21 months agoFix the SSL_CIPHER_find() function when used with a QCSO
Matt Caswell [Thu, 7 Sep 2023 16:45:49 +0000 (17:45 +0100)] 
Fix the SSL_CIPHER_find() function when used with a QCSO

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

21 months agoAdd a test for using a PSK with QUIC
Matt Caswell [Thu, 7 Sep 2023 16:36:13 +0000 (17:36 +0100)] 
Add a test for using a PSK with QUIC

Check that we can set and use a PSK when establishing a QUIC connection.

Fixes openssl/project#83

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

21 months agoaugment man pages with information about PKCS12KDF in FIPS mode
Vladimir Kotal [Tue, 5 Sep 2023 09:13:47 +0000 (11:13 +0200)] 
augment man pages with information about PKCS12KDF in FIPS mode

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

21 months agoAdd CVE-2023-4807 fix to CHANGES.md and NEWS.md
Tomas Mraz [Fri, 8 Sep 2023 13:28:45 +0000 (15:28 +0200)] 
Add CVE-2023-4807 fix to CHANGES.md and NEWS.md

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

21 months agoSync changes between 3.2 and 3.1 branches
Tomas Mraz [Fri, 8 Sep 2023 13:21:23 +0000 (15:21 +0200)] 
Sync changes between 3.2 and 3.1 branches

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

21 months agoFix a possible memleak in rsa_pub_encode
Bernd Edlinger [Thu, 7 Sep 2023 17:22:25 +0000 (19:22 +0200)] 
Fix a possible memleak in rsa_pub_encode

That seems to be only an issue for RSA-PSS with parameters.
Spotted by code review, so it looks like there is no test coverage for this.

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

21 months agoremove unused Appveyour config
Dmitry Misharov [Thu, 7 Sep 2023 11:52:46 +0000 (13:52 +0200)] 
remove unused Appveyour config

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

21 months agoBad function definition
Dimitri Papadopoulos [Sun, 6 Aug 2023 17:44:37 +0000 (19:44 +0200)] 
Bad function definition

void f() should probably be void f(void)

Found by running the checkpatch.pl Linux script to enforce coding style.

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

21 months ago"foo * bar" should be "foo *bar"
Dimitri Papadopoulos [Sun, 16 Jul 2023 18:03:40 +0000 (20:03 +0200)] 
"foo * bar" should be "foo *bar"

Found by running the checkpatch.pl Linux script to enforce coding style.

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

21 months agoRemove repeated words
Dimitri Papadopoulos [Sun, 16 Jul 2023 07:09:31 +0000 (09:09 +0200)] 
Remove repeated words

Found by running the checkpatch.pl Linux script to enforce coding style.

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

21 months agoFix test_quic_multistream to allow multiple concurrent tests
Richard Levitte [Fri, 8 Sep 2023 06:20:02 +0000 (08:20 +0200)] 
Fix test_quic_multistream to allow multiple concurrent tests

The server port was hard coded to 8186.  That could make for some
"interesting" effects if two instances of this same test was running
on the same machine.

This change binds the server interface with port 0, and captures the
resulting random port.

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

21 months agoFix a build failure where recvmmsg is available but not sendmmsg
Matt Caswell [Fri, 8 Sep 2023 14:26:40 +0000 (15:26 +0100)] 
Fix a build failure where recvmmsg is available but not sendmmsg

Some old glibc versions have recvmmsg but not sendmmsg. We require both to
use that functionality. Introduce a test to check we have a sufficiently
recent version of glibc.

Fixes #22021

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
(Merged from https://github.com/openssl/openssl/pull/22036)

21 months agoPrevent 80-test_cmp_http from accidentally killing perl in error.
Randall S. Becker [Thu, 7 Sep 2023 19:42:10 +0000 (20:42 +0100)] 
Prevent 80-test_cmp_http from accidentally killing perl in error.

If there is an issue with setting up the test environment in this test,
pid is not set so stop_server kills the perl process. A guard has been
added to prevent this situation.

Fixes: #22014
Signed-off-by: Randall S. Becker <randall.becker@nexbridge.ca>
Reviewed-by: Richard Levitte <levitte@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/22015)

21 months agoLoongArch64 assembly pack: add ChaCha20 modules
Min Zhou [Thu, 7 Sep 2023 03:07:53 +0000 (11:07 +0800)] 
LoongArch64 assembly pack: add ChaCha20 modules

This assembly implementation for ChaCha20 includes three code paths:
scalar path, 128-bit LSX path and 256-bit LASX path. We prefer the
LASX path or LSX path if the hardware and system support these
extensions.

There are 32 vector registers avaialable in the LSX and LASX
extensions. So, we can load the 16 initial states and the 16
intermediate states of ChaCha into the 32 vector registers for
calculating in the implementation. The test results on the 3A5000
and 3A6000 show that this assembly implementation significantly
improves the performance of ChaCha20 on LoongArch based machines.
The detailed test results are as following.

Test with:
$ openssl speed -evp chacha20

3A5000
type               16 bytes     64 bytes    256 bytes    1024 bytes    8192 bytes   16384 bytes
C code           178484.53k   282789.93k   311793.70k    322234.99k    324405.93k    324659.88k
assembly code    223152.28k   407863.65k   989520.55k   2049192.96k   2127248.70k   2131749.55k
                   +25%         +44%         +217%        +536%         +556%         +557%

3A6000
type               16 bytes     64 bytes     256 bytes    1024 bytes    8192 bytes   16384 bytes
C code           214945.33k   310041.75k    340724.22k    349949.27k    352925.01k    353140.74k
assembly code    299151.34k   492766.34k   2070166.02k   4300909.91k   4473978.88k   4499084.63k
                   +39%         +59%         +508%         +1129%        +1168%        +1174%

Signed-off-by: Min Zhou <zhoumin@loongson.cn>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21998)

21 months agoRegexp modifier "r" needs perl 5.14; OpenSSL should build with 5.11, so do not use...
Rainer Jung [Thu, 7 Sep 2023 22:27:07 +0000 (00:27 +0200)] 
Regexp modifier "r" needs perl 5.14; OpenSSL should build with 5.11, so do not use the "r" shortcut.

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

21 months agoFix output corruption in req command
Bernd Edlinger [Fri, 8 Sep 2023 08:33:24 +0000 (10:33 +0200)] 
Fix output corruption in req command

when used in conjunction with -out and -modulus options.

Fixes #21403

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

21 months agoExclude include of poll.h from NonStop builds - not defined on platform.
Randall S. Becker [Thu, 7 Sep 2023 14:15:21 +0000 (15:15 +0100)] 
Exclude include of poll.h from NonStop builds - not defined on platform.

socket.h has been modified so that poll.h is omitted for OPENSSL_SYS_NONSTOP
builds. The platform configuration is derived from UNIX so the include is
only omitted for NonStop but kept in the OPENSSL_SYS_UNIX include block.

Fixes: #22001
Signed-off-by: Randall S. Becker <randall.becker@nexbridge.ca>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22006)

21 months agoModify 50-nonstop.conf to enable c99 extensions for uintptr_t.
Randall S. Becker [Thu, 7 Sep 2023 14:00:19 +0000 (15:00 +0100)] 
Modify 50-nonstop.conf to enable c99 extensions for uintptr_t.

This is done using the define __NSK_OPTIONAL_TYPES__ and is specific to the
NonStop platform builds.

Fixes: #22002
Signed-off-by: Randall S. Becker <randall.becker@nexbridge.ca>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
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/22005)

21 months agoReturn NULL if we fail to create a BIO in the demos/quicserver
Matt Caswell [Wed, 6 Sep 2023 11:36:43 +0000 (12:36 +0100)] 
Return NULL if we fail to create a BIO in the demos/quicserver

Strictly speaking the previous code was still correct since BIO_set_fd
is tolerant of a NULL BIO. But this way is more clear.

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

21 months agoAdd a missing call to BIO_closesocket()
Matt Caswell [Wed, 6 Sep 2023 11:14:33 +0000 (12:14 +0100)] 
Add a missing call to BIO_closesocket()

A couple of the demos missed a call to this function in an error case.

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

21 months agoExpand the explanation of how to go and do useful work in non-blocking
Matt Caswell [Tue, 5 Sep 2023 14:17:29 +0000 (15:17 +0100)] 
Expand the explanation of how to go and do useful work in non-blocking

Add additional commentary to the non-blocking examples explaining where to
add code to go and do other useful work.

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

21 months agoAdd a new guide page on writing a non-blocking QUIC client
Matt Caswell [Fri, 1 Sep 2023 16:41:48 +0000 (17:41 +0100)] 
Add a new guide page on writing a non-blocking QUIC client

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

21 months agoAdd a new guide page on writing a non-blocking TLS client
Matt Caswell [Fri, 25 Aug 2023 17:05:32 +0000 (18:05 +0100)] 
Add a new guide page on writing a non-blocking TLS client

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