openssl.git
13 months agoQUIC DEMUX: Ensure time field is always initialised
Hugo Landau [Wed, 8 Mar 2023 10:29:44 +0000 (10:29 +0000)]
QUIC DEMUX: Ensure time field is always initialised

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

13 months agoQUIC: Add tests for datagram injection API
Hugo Landau [Tue, 7 Mar 2023 19:07:50 +0000 (19:07 +0000)]
QUIC: Add tests for datagram injection API

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

13 months agoQUIC: Add support for datagram injection
Hugo Landau [Mon, 6 Mar 2023 17:58:32 +0000 (17:58 +0000)]
QUIC: Add support for datagram injection

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

13 months agoAdd simple interoperability test with Cloudflare quiche
Tomas Mraz [Thu, 16 Mar 2023 17:25:37 +0000 (18:25 +0100)]
Add simple interoperability test with Cloudflare quiche

This is an external test which requires recursive checkout
of the cloudflare-quiche submodule.

We simply run a client against the example quiche-server
serving HTTP/0.9 requests.

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

13 months agoAdded `CERTIFICATE_VERIFY_MAX_LENGTH` constant
VeronikaNguyen [Fri, 10 Mar 2023 22:13:46 +0000 (23:13 +0100)]
Added `CERTIFICATE_VERIFY_MAX_LENGTH` constant

- Set `CERTIFICATE_VERIFY_MAX_LENGTH` to 65539
  (2 bytes for the algorithm identifier + 2 bytes of signature length
   + 65535 bytes of signature)
- Changed `SSL3_RT_MAX_PLAIN_LENGTH` to `CERTIFICATE_VERIFY_MAX_LENGTH`
  in `statem_srvr.c` and `statem_clnt.c`

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

13 months agoAdd Argon2 KDF demo.
Milan Broz [Fri, 17 Mar 2023 08:02:21 +0000 (09:02 +0100)]
Add Argon2 KDF demo.

Signed-off-by: Milan Broz <gmazyland@gmail.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/20531)

13 months agocmp: fix --strict-warnings windows builds
FdaSilvaYY [Fri, 10 Mar 2023 14:16:01 +0000 (15:16 +0100)]
cmp: fix --strict-warnings windows builds

remove unneeded const qualifier to keep method declaration
and definition in sync.

Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/20436)

13 months agonit: tidy-up code, and fix a typo.
FdaSilvaYY [Fri, 10 Mar 2023 14:21:05 +0000 (15:21 +0100)]
nit: tidy-up code, and fix a typo.

Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/20436)

13 months agoproviders/implementations/kdfs/argon2.c: Don't use UINT64_C
Richard Levitte [Mon, 20 Mar 2023 07:09:40 +0000 (08:09 +0100)]
providers/implementations/kdfs/argon2.c: Don't use UINT64_C

With less than C99 compilers, this macro isn't guaranteed to exist, and
the value passed to it is 32 bits, so explicitly ending it with 'UL' is
correct in all cases.  We simply leave it to the compiler to extend it
appropriately for uint64_t.

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

13 months agothread: remove remnants of ossl_crypto_mem_barrier
Čestmír Kalina [Fri, 17 Mar 2023 16:32:26 +0000 (17:32 +0100)]
thread: remove remnants of ossl_crypto_mem_barrier

Commit ac21c1780a63a8d9a3a6217eb52fe0d188fa7655 VMS knows POSIX threads too!
removed ossl_crypto_mem_barrier for POSIX systems.

Remove it for Win32 and other architectures as well.

Resolves issue #19506 Unable to build under bcc32c environment (Embarcadero
clang compiler).

Signed-off-by: Čestmír Kalina <ckalina@redhat.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20538)

13 months agoenable hardware acceleration for sm4-ccm
zhangzhilei [Sun, 12 Mar 2023 06:53:01 +0000 (14:53 +0800)]
enable hardware acceleration for sm4-ccm

benchmark data test on KunPeng920

before:
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes  16384 bytes
SM4-CCM          20401.16k    33739.97k    40476.08k    42326.70k    43373.91k    43220.99k

after:
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes  16384 bytes
SM4-CCM           8050.11k    13011.29k    15407.10k    16147.80k    16378.54k    16449.76k

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

13 months agoAvoid freeing context on error
Pauli [Sun, 19 Mar 2023 22:02:34 +0000 (09:02 +1100)]
Avoid freeing context on error

Freeing the allocated KDF context seems wrong when derive errors.

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

13 months agoCoverity 1522032: use after free
Pauli [Fri, 17 Mar 2023 01:11:16 +0000 (12:11 +1100)]
Coverity 1522032: use after free

Fix use after free error.

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

13 months agocmp_msg.c: free memory of certStatus before goto err
JAVAID Mohammad-Habib [Tue, 28 Feb 2023 20:07:59 +0000 (21:07 +0100)]
cmp_msg.c: free memory of certStatus before goto err

CLA: trivial

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

13 months agoUpdate documentation to reflect new Windows on Arm configurations
Everton Constantino [Thu, 16 Mar 2023 13:27:12 +0000 (10:27 -0300)]
Update documentation to reflect new Windows on Arm configurations

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

13 months agoFix some Windows issues in the quic_reactor
Matt Caswell [Thu, 16 Mar 2023 15:42:28 +0000 (15:42 +0000)]
Fix some Windows issues in the quic_reactor

An incorrect macro name was being used for Windows detection which meant
we were going down a codepath not intended for Windows and thus failing.

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

13 months agoAdd a simple QUIC test for blocking mode
Matt Caswell [Mon, 13 Mar 2023 17:36:24 +0000 (17:36 +0000)]
Add a simple QUIC test for blocking mode

We create "real" sockets for blocking mode so that we can block on them.

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

13 months agoMake sure the QRX and QTX are associated with a libctx
Matt Caswell [Mon, 13 Mar 2023 17:58:19 +0000 (17:58 +0000)]
Make sure the QRX and QTX are associated with a libctx

If a libctx has been associated with the channel, it must be passed down
to the QRX and QTX.

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

13 months agoFix seg fault when calling SSL_shutdown() for a QUIC connection
Matt Caswell [Mon, 13 Mar 2023 14:49:24 +0000 (14:49 +0000)]
Fix seg fault when calling SSL_shutdown() for a QUIC connection

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

13 months agoFix SSL_has_pending() for QUIC connections
Matt Caswell [Mon, 13 Mar 2023 14:42:50 +0000 (14:42 +0000)]
Fix SSL_has_pending() for QUIC connections

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

13 months agoProvide better errors for some QUIC failures
Matt Caswell [Fri, 10 Mar 2023 15:02:26 +0000 (15:02 +0000)]
Provide better errors for some QUIC failures

For example if would be helpful if we got more useful information if the
caller forgot to set the peer address.

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

13 months agoDefer unknown QUIC ctrls to the SSL object for TLS
Matt Caswell [Fri, 10 Mar 2023 14:46:52 +0000 (14:46 +0000)]
Defer unknown QUIC ctrls to the SSL object for TLS

If the QUIC oject receives a ctrl it does not recognise, the chances are
it is intended for the underlying SSL object - so we forward unknown ctrls
there.

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

13 months agoFix Configure test for -mips in CFLAGS
Mike Gilbert [Sun, 12 Feb 2023 22:56:58 +0000 (17:56 -0500)]
Fix Configure test for -mips in CFLAGS

We want to add -mips2 or -mips3 only if the user hasn't already
specified a mips version in CFLAGS. The existing test was a
double-negative.

CLA: trivial

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

13 months agodoc: note the default iteration count for PBKDF2 in the enc command
Pauli [Wed, 8 Mar 2023 23:17:53 +0000 (10:17 +1100)]
doc: note the default iteration count for PBKDF2 in the enc command

Fixes #20466

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

13 months agoInclude the default iteration count in the help for the enc command
Pauli [Wed, 8 Mar 2023 23:15:54 +0000 (10:15 +1100)]
Include the default iteration count in the help for the enc command

The only way to discover this otherwise is looking at the code.

Fixes #20466

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

13 months agoAdd sanity test for OSSL_sleep()
Tomas Mraz [Fri, 17 Mar 2023 13:58:14 +0000 (14:58 +0100)]
Add sanity test for OSSL_sleep()

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

13 months agosleep.c: Limit the sleep time instead of sleeping for days or even years
Tomas Mraz [Fri, 17 Mar 2023 11:16:33 +0000 (12:16 +0100)]
sleep.c: Limit the sleep time instead of sleeping for days or even years

As the sleep() call is interruptible, it is not even a good idea to call
it in a loop if the caller uses some ridiculously large value as an
infinity just waiting for an interrupt.

Fixes #20524

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

13 months agoproviders/implementations/kdfs/argon2.c: Include openssl/e_os2.h instead of stdint.h
Richard Levitte [Fri, 17 Mar 2023 15:56:11 +0000 (16:56 +0100)]
providers/implementations/kdfs/argon2.c: Include openssl/e_os2.h instead of stdint.h

<stdint.h> may not exist with pre-C99 compilers.  <openssl/e_os2.h> deals
with that, so include it instead.

Similarly, include "internal/numbers.h" rather than <limits.h>, to deal
with things that may be lacking in the latter.

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

13 months agorsaz-*k-avx512.pl: fix wrong name of avx512 flag variable
Tomas Mraz [Wed, 15 Mar 2023 16:46:29 +0000 (17:46 +0100)]
rsaz-*k-avx512.pl: fix wrong name of avx512 flag variable

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

(cherry picked from commit d4765408c705f704f7cf33bd32bfb713061954a7)

13 months agoaes-gcm-avx512.pl: Fix the clang version detection on Apple Oses
Tomas Mraz [Wed, 15 Mar 2023 15:49:24 +0000 (16:49 +0100)]
aes-gcm-avx512.pl: Fix the clang version detection on Apple Oses

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

(cherry picked from commit 110dac578358014c29b86cf18d9a4bfe5561e3bc)

13 months agoproviders: add Argon2 KDF
Čestmír Kalina [Mon, 27 Sep 2021 20:45:38 +0000 (22:45 +0200)]
providers: add Argon2 KDF

https://datatracker.ietf.org/doc/rfc9106/

Signed-off-by: Čestmír Kalina <ckalina@redhat.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/12256)

13 months agoe_os2: add ossl_static_assert_type_eq
Čestmír Kalina [Fri, 2 Dec 2022 11:44:09 +0000 (06:44 -0500)]
e_os2: add ossl_static_assert_type_eq

Add a gcc-only static assertion that a variable is of a specified type.

Signed-off-by: Čestmír Kalina <ckalina@redhat.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/12256)

13 months agoproverr: add PROV_R_{INVALID_MEMORY_SIZE,INVALID_THREAD_POOL_SIZE}
Čestmír Kalina [Fri, 2 Dec 2022 11:46:15 +0000 (06:46 -0500)]
proverr: add PROV_R_{INVALID_MEMORY_SIZE,INVALID_THREAD_POOL_SIZE}

Signed-off-by: Čestmír Kalina <ckalina@redhat.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/12256)

13 months agoevp_test: add thread support
Čestmír Kalina [Wed, 20 Jul 2022 17:07:46 +0000 (13:07 -0400)]
evp_test: add thread support

Signed-off-by: Čestmír Kalina <ckalina@redhat.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/12256)

13 months agoproviders: add XOF support to blake2b
Čestmír Kalina [Mon, 27 Sep 2021 20:49:48 +0000 (22:49 +0200)]
providers: add XOF support to blake2b

Signed-off-by: Čestmír Kalina <ckalina@redhat.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/12256)

13 months agoevp_test: add digest xoflen support
Čestmír Kalina [Tue, 29 Nov 2022 19:20:09 +0000 (14:20 -0500)]
evp_test: add digest xoflen support

Signed-off-by: Čestmír Kalina <ckalina@redhat.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/12256)

13 months agoFix copyright disclaimer.
Pauli [Wed, 15 Mar 2023 08:19:35 +0000 (19:19 +1100)]
Fix copyright disclaimer.

The mention of the GPL shouldn't have been there.

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

13 months agoriscv: GCM: Implement GHASH()
Christoph Müllner [Wed, 18 Jan 2023 11:11:53 +0000 (12:11 +0100)]
riscv: GCM: Implement GHASH()

RISC-V currently only offers a GMULT() callback for accelerated
processing. Let's implement the missing piece to have GHASH()
available as well. Like GMULT(), we provide a variant for
systems with the Zbkb extension (including brev8).

The integration follows the existing pattern for GMULT()
in RISC-V. We keep the C implementation as we need to decide
if we can call an optimized routine at run-time.
The C implementation is the fall-back in case we don't have
any extensions available that can be used to accelerate
the calculation.

Tested with all combinations of possible extensions
on QEMU (limiting the available instructions accordingly).
No regressions observed.

Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20078)

13 months agoriscv: GCM: Simplify GCM calculation
Christoph Müllner [Wed, 18 Jan 2023 10:57:33 +0000 (11:57 +0100)]
riscv: GCM: Simplify GCM calculation

The existing GCM calculation provides some potential
for further optimizations. Let's use the demo code
from the RISC-V cryptography extension groups
(https://github.com/riscv/riscv-crypto), which represents
the extension architect's intended use of the clmul instruction.

The GCM calculation depends on bit and byte reversal.
Therefore, we use the corresponding instructions to do that
(if available at run-time).

The resulting computation becomes quite compact and passes
all tests.

Note, that a side-effect of this change is a reduced register
usage in .gmult(), which opens the door for an efficient .ghash()
implementation.

Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20078)

13 months agoriscv: GCM: Use riscv.pm
Christoph Müllner [Wed, 1 Feb 2023 00:08:23 +0000 (01:08 +0100)]
riscv: GCM: Use riscv.pm

A recent commit introduced a Perl module for common code.
This patch changes the GCM code to use this module, removes duplicated code,
and moves the instruction encoding functions into the module.

Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20078)

13 months agoriscv.pm: Add improved error messages to read_reg code
Christoph Müllner [Tue, 31 Jan 2023 23:20:43 +0000 (00:20 +0100)]
riscv.pm: Add improved error messages to read_reg code

On systems where Devel::StackTrace is available, we can use this module
to create more usable error messages. Further, don't print error
messages in case of official register aliases, but simply accept them.

Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20078)

13 months agoriscv: aes: Move reusable Perl code into Perl module
Christoph Müllner [Tue, 31 Jan 2023 23:02:33 +0000 (00:02 +0100)]
riscv: aes: Move reusable Perl code into Perl module

Move helper functions and instruction encoding functions
into a riscv.pm Perl module to avoid pointless code duplication.

Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20078)

13 months agoriscv: Clean up extension test macros
Christoph Müllner [Tue, 17 Jan 2023 18:31:58 +0000 (19:31 +0100)]
riscv: Clean up extension test macros

In RISC-V we have multiple extensions, that can be
used to accelerate processing.
The known extensions are defined in riscv_arch.def.
From that file test functions of the following
form are generated: RISCV_HAS_$ext().

In recent commits new ways to define the availability
of these test macros have been defined. E.g.:
  #define RV32I_ZKND_ZKNE_CAPABLE   \
          (RISCV_HAS_ZKND() && RISCV_HAS_ZKNE())
  [...]
  #define RV64I_ZKND_ZKNE_CAPABLE   \
          (RISCV_HAS_ZKND() && RISCV_HAS_ZKNE())

This leaves us with two different APIs to test capabilities.
Further, creating the same macros for RV32 and RV64 results
in duplicated code (see example above).

This inconsistent situation makes it hard to integrate
further code. So let's clean this up with the following steps:
* Replace RV32I_* and RV64I_* macros by RICSV_HAS_* macros
* Move all test macros into riscv_arch.h
* Use "AND" and "OR" to combine tests with more than one extension
* Rename include files for accelerated processing (remove extension
  postfix).

We end up with compile time tests for RV32/RV64 and run-time tests
for available extensions. Adding new routines (e.g. for vector crypto
instructions) should be straightforward.

Testing showed no regressions.

Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20078)

13 months agoFix documented function return types
Andy Bernard [Mon, 13 Mar 2023 15:56:37 +0000 (15:56 +0000)]
Fix documented function return types

The documented return type of the (incorrectly named; see below) OSSL_FUNC_decoder_export_object function signature is wrong; the correct type is int, due to the following line in core_dispatch.h:
OSSL_CORE_MAKE_FUNC(int, decoder_export_object,

Fixes #19543

Per the Github conversation with levitte and t8m for pull request #19964, the following issues are not addressed by this patch:

The macro OSSL_CORE_MAKE_FUNC in core_dispatch.h generates a function, and a corresponding function signature typedef with name ending in "_fn". The typedefed signature is unrelated to the signature of the function.
However, provider-decoder.pod describes typedefed signatures generated by the macro, but uses the names of the functions (lacking "_fn") instead of the typedefed signatures, which is a mismatch.

Also, the documented claim about OSSL_FUNC_decoder_export_object, etc that "None of these are actual functions" is contradicted by the fact that the code actually calls those functions, and calls them specifically by those names. E.g. in decoder_meth.c:
decoder->export_object = OSSL_FUNC_decoder_export_object(fns);

The functions are generated by OSSL_CORE_MAKE_FUNC.

The paragraph "None of these are actual functions"... should be replaced by something more like "These function signatures, generated by the OSSL_CORE_MAKE_FUNC macro, are for functions that are offered via function pointers in OSSL_DISPATCH arrays."

CLA: trivial

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

13 months agoenable VPSM4_EX_CAPABLE for sm4_gcm
zhangzhilei [Sun, 12 Mar 2023 07:11:20 +0000 (15:11 +0800)]
enable VPSM4_EX_CAPABLE for sm4_gcm

type     16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes  16384 bytes
before:
SM4-GCM  71134.38k    81512.39k    83432.11k    83808.60k    85183.15k    86199.57k
after:
SM4-GCM  30656.22k   108801.82k   196005.97k   198715.73k   199349.59k   199387.82k

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

13 months agoCoverity 1521490: resource leak
Pauli [Tue, 14 Mar 2023 01:04:11 +0000 (12:04 +1100)]
Coverity 1521490: resource leak

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

13 months agodemo: Fix makefile target
Pauli [Tue, 14 Mar 2023 00:33:51 +0000 (11:33 +1100)]
demo: Fix makefile target

The makefile target was incorrect and wouldn't build the rsa_encrypt demo.

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

13 months agoAdded a short description of VC-WIN*-HYBRIDCRT to Windows notes
klaus triendl [Thu, 2 Mar 2023 10:51:40 +0000 (11:51 +0100)]
Added a short description of VC-WIN*-HYBRIDCRT to Windows notes

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

13 months agoAdded 'hybrid CRT' targets for the Windows platform
klaus triendl [Thu, 19 Jan 2023 12:14:48 +0000 (14:14 +0200)]
Added 'hybrid CRT' targets for the Windows platform

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

13 months agoFix PKCS12_newpass() to work with PBES2.
slontis [Wed, 25 Jan 2023 01:25:33 +0000 (11:25 +1000)]
Fix PKCS12_newpass() to work with PBES2.

Fixes #19092

The code looks like it was written to work with PBES1.
As it had no tests, this would of then broken when PBES2
was introduced at a later point.

Also added libctx and propq support.

This affects the shroudedkeybag object.

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

13 months agoAdd Tests for RSA signatures using X931 padding.
slontis [Fri, 3 Feb 2023 22:25:03 +0000 (08:25 +1000)]
Add Tests for RSA signatures using X931 padding.

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

13 months agoAvoid erroneous diagnostics in speed measuring
Dmitry Belyavskiy [Thu, 16 Feb 2023 10:23:09 +0000 (11:23 +0100)]
Avoid erroneous diagnostics in speed measuring

Fixes #20291

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

13 months agoAdd a flag so finalised contexts are not reused
Simo Sorce [Thu, 9 Mar 2023 16:45:02 +0000 (11:45 -0500)]
Add a flag so finalised contexts are not reused

The EVP layer should not rely on the underlying low level code to
handle catching incorrect reuse of contexts.
Add a flag to mark a context as finalised as needed and then catch and
immediately error on Update/Final operations if called improperly.

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

13 months agoAdd test for context duplication failure
Simo Sorce [Mon, 6 Mar 2023 23:38:00 +0000 (18:38 -0500)]
Add test for context duplication failure

This checks that the first operation successfully completes even if
context duplication fails. But follwing operations get errors as
if the context was finlised.

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

13 months agoDo not fail if ctx dup does not succeed
Simo Sorce [Fri, 24 Feb 2023 00:51:27 +0000 (19:51 -0500)]
Do not fail if ctx dup does not succeed

If the ctx was *really* needed we'll probably fail later with an error
anyway, so no point in failing immediately.

Document that this behavior is dependent on the provider used to
implement the signature/verification.

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

13 months agoImprove the performance of d2i_AutoPrivateKey and friends
Matt Caswell [Wed, 1 Mar 2023 17:03:48 +0000 (17:03 +0000)]
Improve the performance of d2i_AutoPrivateKey and friends

Probe first to see if we have a PKCS8 file to improve decoder performance.

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

13 months agoDocument remaining obsolete SSL_OP_NETSCAPE_*_BUG
Tobias Nießen [Mon, 6 Mar 2023 22:51:17 +0000 (22:51 +0000)]
Document remaining obsolete SSL_OP_NETSCAPE_*_BUG

SSL_OP_NETSCAPE_CA_DN_BUG became obsolete in 3c33c6f6b1086435 and
support for SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG was removed by
7a4dadc3a6a487db. The definitions are still listed under "OBSOLETE
OPTIONS retained for compatibility" in ssl.h.in, so this commit adds
them to the list of obsolete options in doc/man3.

Refs: https://github.com/nodejs/node/pull/46954

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

13 months agoAdd missing assignment to EVP_get_digestbynid()
ndossche [Tue, 7 Mar 2023 12:27:15 +0000 (13:27 +0100)]
Add missing assignment to EVP_get_digestbynid()

The assignment of the result of EVP_get_digestbynid() did not happen
which made the fallback not actually perform the fallback.

CLA: trivial

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

13 months agodoc/man3/X509_STORE_CTX_get_error.pod: make order consistent, add some missing entries
Dr. David von Oheimb [Mon, 27 Feb 2023 18:22:33 +0000 (19:22 +0100)]
doc/man3/X509_STORE_CTX_get_error.pod: make order consistent, add some missing entries

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

13 months agoSegmentation fault in parent rng cleanup
afshinpir [Wed, 8 Mar 2023 03:42:00 +0000 (16:42 +1300)]
Segmentation fault in parent rng cleanup

CLA: trivial
When `cleanup_entropy()` is called to cleanup parent by calling
provided `OSSL_FUNC_rand_clear_seed_fn` method, incorrect random
context is passed to the method. So accessing that context creates
a segmentation fault. Parent context should be passed rather than
DRBG's own context.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20454)

13 months agoUpdated `rsa_has()` for correct validation
afshinpir [Wed, 8 Mar 2023 07:31:54 +0000 (20:31 +1300)]
Updated `rsa_has()` for correct validation

CLA: trivial
In RSA, `(n,e)` and `(n,d)` identify public key and private key.
Modulus `n` is the common part. So I updated `rsa_has()` to validate
these pairs correctly. `OSSL_KEYMGMT_SELECT_KEYPAIR` is common part
for both public and private key, so I changed it to check `n` of
RSA and for `OSSL_KEYMGMT_SELECT_PUBLIC_KEY`, `e` is checked. Before
this change, if `selection` was `OSSL_KEYMGMT_SELECT_PRIVATE_KEY` and
only `e` and `d` was in the RSA structure, the function returns 1
while it was incorrect.

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

13 months agoFix size_t/int mismatch in cms_ec.c and rsa_sig.c
Tomas Mraz [Wed, 8 Mar 2023 10:17:31 +0000 (11:17 +0100)]
Fix size_t/int mismatch in cms_ec.c and rsa_sig.c

Fixes #20435

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

13 months agoaes/asm/bsaes-armv7.pl: Replace adrl with add
Kornel Dulęba [Wed, 8 Mar 2023 10:28:41 +0000 (11:28 +0100)]
aes/asm/bsaes-armv7.pl: Replace adrl with add

"adrl" is a pseudo-instruction used to calculate an address relative
to PC. It's not recognized by clang resulting in a compilation error.
I've stumbled upon it when trying to integrate the bsaes-armv7 assmebly
logic into FreeBSD kernel, which uses clang as it's default compiler.
Note that this affect the build only if BSAES_ASM_EXTENDED_KEY is
defined, which is not the default option in OpenSSL.

The solution here is to replace it with an add instruction.
This mimics what has already been done in !BSAES_ASM_EXTENDED_KEY logic.
Because of that I've marked this as trivial CLA.

CLA: trivial
Signed-off-by: Kornel Dulęba <mindal@semihalf.com>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20458)

13 months agoRemove duplicate code
zhangzhilei [Sun, 12 Mar 2023 07:39:34 +0000 (15:39 +0800)]
Remove duplicate code

since this code is also under GCM_HW_SET_KEY_CTR_FN macro

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

13 months agoAdd missing copyright header
Pauli [Wed, 8 Mar 2023 22:59:25 +0000 (09:59 +1100)]
Add missing copyright header

This file was only recently introduced and the missing header slipped through
the review process.

Fixes #20461

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

13 months agodoc: document that prediction resistance comes with a hidden cost
Pauli [Tue, 7 Mar 2023 23:09:11 +0000 (10:09 +1100)]
doc: document that prediction resistance comes with a hidden cost

In the default setup, using prediction resistance cascades to a reseeding
of all DRBGs.  The cost for this will be excessive for highly threaded
applications.

Fixes #20414

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/20452)

13 months agoapps/x509 etc.: allow private key input when public key is expected
Dr. David von Oheimb [Fri, 26 Aug 2022 18:40:48 +0000 (20:40 +0200)]
apps/x509 etc.: allow private key input when public key is expected

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

13 months agotest/smime-certs/{mksmime-certs.sh,ca.cnf}: simplify and speed up cert generation
Dr. David von Oheimb [Thu, 25 Aug 2022 16:09:09 +0000 (18:09 +0200)]
test/smime-certs/{mksmime-certs.sh,ca.cnf}: simplify and speed up cert generation

Also remove inconsistent key usages from non-RSA certs.

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

13 months agoapps/{dsa,ec,rsa,pkey}.c: harmonize coding w.r.t. 'pubin' variable
Dr. David von Oheimb [Sat, 24 Sep 2022 11:44:47 +0000 (13:44 +0200)]
apps/{dsa,ec,rsa,pkey}.c: harmonize coding w.r.t. 'pubin' variable

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

13 months agoFix how util/wrap.pl is used in OpenSSL::Util::fixup_cmd()
Richard Levitte [Mon, 6 Mar 2023 07:49:08 +0000 (08:49 +0100)]
Fix how util/wrap.pl is used in OpenSSL::Util::fixup_cmd()

The mechanism was pretty tentative and wasn't well tested for diverse
situations.

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

13 months agoFix util/wrap.pl.in for VMS usage
Richard Levitte [Wed, 1 Mar 2023 15:27:50 +0000 (16:27 +0100)]
Fix util/wrap.pl.in for VMS usage

In the name of consistency, make sure that this same script is used
across more platforms, in this case VMS.  This removes the need for
util/local_shlib.com.in and util/unlocal_shlib.com.in, which were
under-used anyway.

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

13 months agoRun the punycode-test over the fuzz corpora during test.
Kurt Roeckx [Wed, 8 Feb 2023 17:48:30 +0000 (18:48 +0100)]
Run the punycode-test over the fuzz corpora during test.

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

13 months agofips: Use salt >= 16 bytes in PBKDF2 selftest
Clemens Lang [Fri, 3 Mar 2023 11:22:03 +0000 (12:22 +0100)]
fips: Use salt >= 16 bytes in PBKDF2 selftest

NIST SP 800-132 [1] section 5.1 says "[t]he length of the
randomly-generated portion of the salt shall be at least
128 bits", which implies that the salt for PBKDF2 must be at least 16
bytes long (see also Appendix A.2.1).

The FIPS 140-3 IG [2] section 10.3.A requires that "the lengths and the
properties of the Password and Salt parameters, as well as the desired
length of the Master Key used in a CAST shall be among those supported
by the module in the approved mode."

As a consequence, the salt length in the self test must be at least 16
bytes long for FIPS 140-3 compliance. Switch the self test to use the
only test vector from RFC 6070 that uses salt that is long enough to
fulfil this requirement. Since RFC 6070 does not provide expected
results for PBKDF2 with HMAC-SHA256, use the output from [3], which was
generated with python cryptography, which was tested against the RFC
6070 vectors with HMAC-SHA1.

 [1]: https://doi.org/10.6028/NIST.SP.800-132
 [2]: https://csrc.nist.gov/CSRC/media/Projects/cryptographic-module-validation-program/documents/fips%20140-3/FIPS%20140-3%20IG.pdf
 [3]: https://github.com/brycx/Test-Vector-Generation/blob/master/PBKDF2/pbkdf2-hmac-sha2-test-vectors.md

Signed-off-by: Clemens Lang <cllang@redhat.com>
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/20429)

13 months agoAdd option to FIPS module to enforce EMS check during KDF TLS1_PRF.
slontis [Wed, 8 Feb 2023 07:22:43 +0000 (17:22 +1000)]
Add option to FIPS module to enforce EMS check during KDF TLS1_PRF.

Fixes #19989

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

13 months agoS390X: Accelerate keccak XOF
Juergen Christ [Fri, 3 Mar 2023 13:36:08 +0000 (14:36 +0100)]
S390X: Accelerate keccak XOF

The keccak XOF used for KMAC can be simplified by using klmd.  This speeds up
XOF processing in cases where more than one result block is needed.

Signed-off-by: Juergen Christ <jchrist@linux.ibm.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20431)

13 months agotest//bio_dgram_test.c: Skip test when BIO_bind() fails
Richard Levitte [Tue, 7 Mar 2023 14:21:16 +0000 (15:21 +0100)]
test//bio_dgram_test.c: Skip test when BIO_bind() fails

This test isn't supposed to test BIO_bind() itself, so we can be a bit
sloppy and assume that it fails because the attempted binding is not
supported on the platform where this is run.  For example, BIO_bind()
fails when it's given an IPv6 address and the platform where this is
run doesn't support that address family.

In a case like this, it's sensible enough to simply skip the test when
BIO_bind() fails.

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

13 months agobss_dgram.c: Use BIO_ADDR_sockaddr() and BIO_ADDR_sockaddr_size()
Richard Levitte [Tue, 7 Mar 2023 14:18:18 +0000 (15:18 +0100)]
bss_dgram.c: Use BIO_ADDR_sockaddr() and BIO_ADDR_sockaddr_size()

Especially, it's important to use BIO_ADDR_sockaddr_size() instead of
taking sizeof(addr), as BIO_ADDR is a union of several sockaddr variants
with different sizes, and some sendto() implementations are very picky
that the size is correct for the indicated sockaddr family.

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

13 months agoDOCS: provider-keymgmt(7) - params for EVP_PKEY_get_default_digest_{name,nid}()
Richard Levitte [Fri, 3 Mar 2023 13:18:43 +0000 (14:18 +0100)]
DOCS: provider-keymgmt(7) - params for EVP_PKEY_get_default_digest_{name,nid}()

This describes them in detail in provider-keymgmt(7).

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

13 months agostream_frame_new(): Add missing allocation check
Tomas Mraz [Wed, 1 Mar 2023 09:28:58 +0000 (10:28 +0100)]
stream_frame_new(): Add missing allocation check

Reported by Marc Schönefeld.

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

13 months agotest_rstream_random(): Test adding final empty frame
Tomas Mraz [Tue, 28 Feb 2023 19:25:53 +0000 (20:25 +0100)]
test_rstream_random(): Test adding final empty frame

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

13 months agoTest new ossl_quic_rstream API calls
Tomas Mraz [Mon, 5 Dec 2022 19:52:14 +0000 (20:52 +0100)]
Test new ossl_quic_rstream API calls

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

13 months agoImprove the QUIC_RSTREAM implementation
Tomas Mraz [Wed, 30 Nov 2022 18:30:30 +0000 (19:30 +0100)]
Improve the QUIC_RSTREAM implementation

Add API calls to avoid copying data when reading
These are ossl_quic_rstream_get_record() and
ossl_quic_rstream_release_record().

Add side storage for the stream frame data.
When there are too many packets referenced by the
receiving stream the function ossl_quic_rstream_move_to_rbuf()
can be called to move the data to a ring buffer.

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

13 months agoVMS knows POSIX threads too!
Richard Levitte [Mon, 6 Mar 2023 07:55:34 +0000 (08:55 +0100)]
VMS knows POSIX threads too!

include/internal/thread_arch.h didn't indicate this, now it does.

This also removes ossl_crypto_mem_barrier(), because we isn't used
anywhere, and doesn't build with compilers that don't support the GNU
extension __asm__.

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

13 months agoImprove the performance of EVP_PKCS82PKEY_ex
Matt Caswell [Wed, 1 Mar 2023 11:14:25 +0000 (11:14 +0000)]
Improve the performance of EVP_PKCS82PKEY_ex

We can easily find out the keytype which should significantly improve
the performance of this function because we don't have to try every loaded
decoder.

Partial fix for #20399

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

13 months agoTest that there are no errors on the stack for rejected early data
Matt Caswell [Mon, 27 Feb 2023 18:38:03 +0000 (18:38 +0000)]
Test that there are no errors on the stack for rejected early data

If we reject early data then it is normal for decryption operations to
fail. We should ensure there are no spurious errors on the stack in that
case. This adds a test for that scenario.

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

13 months agoRemove spurious error queue entries on early data
Matt Caswell [Mon, 27 Feb 2023 18:43:20 +0000 (18:43 +0000)]
Remove spurious error queue entries on early data

Early data decryption is expected to fail sometimes. If it does we should
not leave spurious error entries on the queue.

Fixes #20377

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

13 months agoFix cast.
Pauli [Thu, 2 Mar 2023 23:14:39 +0000 (10:14 +1100)]
Fix cast.

Fixes #20424

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20425)

13 months agoAdd "make help" option
Todd Short [Tue, 28 Feb 2023 23:42:56 +0000 (18:42 -0500)]
Add "make help" option

Based on kubernetes controller Makefile help.

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

13 months agoFix typo in base provider example code
HansHoogerwerf [Wed, 1 Mar 2023 09:02:37 +0000 (10:02 +0100)]
Fix typo in base provider example code

CLA: trivial

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

13 months agoTidy up aarch64 feature detection code in armcap.c
Tom Cosgrove [Sun, 12 Feb 2023 20:26:23 +0000 (20:26 +0000)]
Tidy up aarch64 feature detection code in armcap.c

Make the SIGILL-based code easier to read, and don't use it on Apple Silicon.

Also fix "error: 'HWCAP(2)_*' macro redefined" warnings on FreeBSD.

Fixes #20188

Change-Id: I5618bbe9444cc40cb5705c6ccbdc331c16bab794

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

13 months agoCoverity 1521557: Error handling issues
Pauli [Wed, 1 Mar 2023 01:22:49 +0000 (12:22 +1100)]
Coverity 1521557: Error handling issues

Check the return from DSA_set0_key and generate an error on failure.
Technically a false positive since the function always returns success.

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

13 months agoInclude supported branches in coveralls
Pauli [Mon, 27 Feb 2023 00:05:48 +0000 (11:05 +1100)]
Include supported branches in coveralls

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

14 months agoBump coverallsapp/github-action from 1.2.3 to 1.2.4
dependabot[bot] [Wed, 1 Mar 2023 18:10:31 +0000 (18:10 +0000)]
Bump coverallsapp/github-action from 1.2.3 to 1.2.4

Bumps [coverallsapp/github-action](https://github.com/coverallsapp/github-action) from 1.2.3 to 1.2.4.
- [Release notes](https://github.com/coverallsapp/github-action/releases)
- [Commits](https://github.com/coverallsapp/github-action/compare/v1.2.3...v1.2.4)

---
updated-dependencies:
- dependency-name: coverallsapp/github-action
  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/20417)

14 months agoBump coverallsapp/github-action from 1.1.3 to 1.2.3
dependabot[bot] [Wed, 1 Mar 2023 09:35:19 +0000 (09:35 +0000)]
Bump coverallsapp/github-action from 1.1.3 to 1.2.3

Bumps [coverallsapp/github-action](https://github.com/coverallsapp/github-action) from 1.1.3 to 1.2.3.
- [Release notes](https://github.com/coverallsapp/github-action/releases)
- [Commits](https://github.com/coverallsapp/github-action/compare/1.1.3...v1.2.3)

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

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

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

14 months agoAdd fuzz test for v3name
Hardik Shah [Mon, 13 Feb 2023 02:49:23 +0000 (08:19 +0530)]
Add fuzz test for v3name

v3name_fuzzer build modifications

create 99-test_fuzz_v3name_fuzzer.t

test corpus for cve-2023-0286

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

14 months agoRemove ossl_rsa_pss_params_30_set_maskgenalg().
slontis [Fri, 17 Feb 2023 03:00:12 +0000 (13:00 +1000)]
Remove ossl_rsa_pss_params_30_set_maskgenalg().

This is an unused internal function. It should be added back
in if there is a need to set this value to something other than
NID_mgf1 (which is not likely).

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

14 months agoUpdate AES documentation excluding AES SIV from the FIPS provider
Pauli [Mon, 27 Feb 2023 08:31:58 +0000 (19:31 +1100)]
Update AES documentation excluding AES SIV from the FIPS provider

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

14 months agoRemove AES SIV ciphers from the FIPS provider
Pauli [Mon, 27 Feb 2023 08:20:53 +0000 (19:20 +1100)]
Remove AES SIV ciphers from the FIPS provider

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

14 months agoDon't do AES SIV tests with the FIPS provider
Pauli [Mon, 27 Feb 2023 08:29:58 +0000 (19:29 +1100)]
Don't do AES SIV tests with the FIPS provider

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

14 months agoEnsure we use a non-zero time for tickets in early data
Matt Caswell [Mon, 27 Feb 2023 11:54:29 +0000 (11:54 +0000)]
Ensure we use a non-zero time for tickets in early data

Our tests run so quickly that the ticket age is virtually zero. This may
not show up problems in the age calculations, so we artificially add some
age to the tickets in some runs.

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