]> git.ipfire.org Git - thirdparty/openssl.git/log
thirdparty/openssl.git
18 months agocrypto/*: Fix various typos, repeated words, align some spelling to LDP.
FdaSilvaYY [Tue, 23 Aug 2022 18:37:03 +0000 (20:37 +0200)] 
crypto/*: Fix various typos, repeated words, align some spelling to LDP.

partially revamped from #16712
- fall thru -> fall through
- time stamp -> timestamp
- host name -> hostname
- ipv6 -> IPv6

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

(cherry picked from commit c7340583097a80a4fe42bacea745b2bbaa6d16db)

18 months agocrypto: Fix various typos, repeated words, align some spelling to LDP.
FdaSilvaYY [Tue, 23 Aug 2022 18:33:58 +0000 (20:33 +0200)] 
crypto: Fix various typos, repeated words, align some spelling to LDP.

partially revamped from #16712
- fall thru -> fall through
- time stamp -> timestamp
- file name -> filename
- host name -> hostname

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

(cherry picked from commit 1567a821a4616f59748fa8982724f88e542867d6)

18 months agoFixed some grammar and spelling
Thiago Suchorski [Thu, 22 Sep 2022 11:27:27 +0000 (08:27 -0300)] 
Fixed some grammar and spelling

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

(cherry picked from commit af33b200da8040c78dbfd8405878190980727171)

18 months agoERR: replace remnant ECerr() and EVPerr() calls in crypto/
Dr. David von Oheimb [Fri, 26 Aug 2022 08:04:01 +0000 (10:04 +0200)] 
ERR: replace remnant ECerr() and EVPerr() calls in crypto/

except those throwing ERR_R_MALLOC_FAILURE

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

(cherry picked from commit bd07cc1c7e3ca38689e59868b5945dc223235a49)

18 months agoapps/speed.c: Lock buffer in memory
Juergen Christ [Mon, 29 Aug 2022 15:05:41 +0000 (17:05 +0200)] 
apps/speed.c: Lock buffer in memory

Lock the buffers used for throughput measurements into memory.  This removes
some side effects of paging.

Errors from the memory locking functions are ignored since they are not
critical to the application.

This feature is limited to Linux and Windows.

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

(cherry picked from commit 9710d72b95f4fc218ed613f42dc90ad0d263b14f)

18 months agoAdd config option for speed command
Kan [Tue, 21 Jun 2022 06:55:55 +0000 (14:55 +0800)] 
Add config option for speed command
Fixed #16986

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

(cherry picked from commit 8403c7350fd836ea44baf69c0b7dc3af1189253f)

18 months agotest/trace_api_test.c: fix gcc error on -Werror=strict-prototypes
Dr. David von Oheimb [Sat, 24 Sep 2022 21:57:19 +0000 (23:57 +0200)] 
test/trace_api_test.c: fix gcc error on -Werror=strict-prototypes

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

(cherry picked from commit 1fcd84c7017416a3c9461914d7a943591ad87a82)

18 months agoAdd tests for trace_api.
Daniel Fiala [Fri, 5 Aug 2022 02:44:51 +0000 (04:44 +0200)] 
Add tests for trace_api.

Fixes openssl#17422

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

(cherry picked from commit fcff5bd43c85418cc4aa8052e3dc3dba344d763e)

18 months agoFix AES-GCM on Power 8 CPUs
Tomas Mraz [Fri, 9 Sep 2022 12:46:24 +0000 (14:46 +0200)] 
Fix AES-GCM on Power 8 CPUs

Properly fallback to the default implementation on CPUs
missing necessary instructions.

Fixes #19163

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

(cherry picked from commit 9ab6b64ac856157a31a54c0d12207c2338bfa8e2)

18 months agoOSSL_CRYPTO_ALLOC attribute introduction proposal.
David Carlier [Thu, 8 Sep 2022 21:16:31 +0000 (22:16 +0100)] 
OSSL_CRYPTO_ALLOC attribute introduction proposal.

Giving hint to the compiler the returned pointer is not aliased
 (so realloc-like api is de facto excluded).

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

(cherry picked from commit e1035957eba1e6ebdefd0e18dcbad5cbfa7a969a)

18 months agoFix PROV_RC5_CTX's original structure name
Paul Yang [Fri, 9 Sep 2022 07:48:24 +0000 (15:48 +0800)] 
Fix PROV_RC5_CTX's original structure name

It looks like a typo when copy & pasting the structure from blowfish.

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

(cherry picked from commit 53ef02baf80130a81d019e85c528fdc13af9db33)

18 months agoopenssl.cnf: split option value and comment and remove leading space
a1346054 [Thu, 8 Sep 2022 08:11:53 +0000 (08:11 +0000)] 
openssl.cnf: split option value and comment and remove leading space

CLA: trivial

Signed-off-by: a1346054 <36859588+a1346054@users.noreply.github.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/19173)

(cherry picked from commit fd24de9f93049b05a54c48da5316f42882489230)

18 months agoCleanup EBCDIC string defintions
Todd Short [Thu, 1 Sep 2022 19:31:21 +0000 (15:31 -0400)] 
Cleanup EBCDIC string defintions

Use a single definiton for protocol string defintions.

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

(cherry picked from commit 44e47328178328198018c23e6918884af5e8ce4b)

18 months agoAdd some API tests for TLSv1.3 record padding
Matt Caswell [Wed, 31 Aug 2022 11:31:24 +0000 (12:31 +0100)] 
Add some API tests for TLSv1.3 record padding

We have some ssl_test_new tests for record padding. But these only use
the block padding approach set via a config file on the SSL_CTX. We add
tests for all the various API calls.

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

(cherry picked from commit f3f8e53c852f07d38c124e45f7c678e854be4a54)

18 months agoAdd a test for read_ahead data crossing a key change
Matt Caswell [Tue, 17 May 2022 13:36:39 +0000 (14:36 +0100)] 
Add a test for read_ahead data crossing a key change

If read_ahead is switched on, it should still work even if the data that
is read cross epochs.

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

(cherry picked from commit f7565348c22785f69239883feb1f3c91d1cfd675)

18 months agoprovider: cipher: aes: add riscv32 zkn (zbkb) support
Hongren (Zenithal) Zheng [Fri, 13 May 2022 16:01:11 +0000 (00:01 +0800)] 
provider: cipher: aes: add riscv32 zkn (zbkb) support

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

(cherry picked from commit 5ccee69b1384fa9377986a6f7730e0d9a372b42b)

18 months agoaes_platform: add riscv32 zkn asm support
Hongren (Zenithal) Zheng [Fri, 13 May 2022 15:44:31 +0000 (23:44 +0800)] 
aes_platform: add riscv32 zkn asm support

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

(cherry picked from commit cbb15b31b98f47276cf9e87453831d96274baf66)

18 months agoadd build support for riscv32 aes zkn
Hongren (Zenithal) Zheng [Fri, 13 May 2022 15:29:34 +0000 (23:29 +0800)] 
add build support for riscv32 aes zkn

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

(cherry picked from commit b733ce73a423b99c0354b42e268216e0656e556b)

18 months agoAdd RISC-V 32 cpuid support
Hongren (Zenithal) Zheng [Fri, 13 May 2022 16:02:44 +0000 (00:02 +0800)] 
Add RISC-V 32 cpuid support

Mainly from #17640

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

(cherry picked from commit 61170642b1ad084ae4f52e43d39c5c1e471b323a)

18 months agoAdd linux32-riscv32/BSD-riscv32 target
Hongren (Zenithal) Zheng [Fri, 13 May 2022 15:23:29 +0000 (23:23 +0800)] 
Add linux32-riscv32/BSD-riscv32 target

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

(cherry picked from commit 42ee6e7be43c57136d71e5612fed22a06f7f5d0e)

18 months agoAdd AES implementation in riscv32 zkn asm
Hongren (Zenithal) Zheng [Fri, 13 May 2022 14:24:43 +0000 (22:24 +0800)] 
Add AES implementation in riscv32 zkn asm

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

(cherry picked from commit b1b889d1b3fc92a56ead5536bee06f3415b78482)

18 months agoAdd BSD-armv4 target based on linux-armv4
Piotr Kubaj [Fri, 29 Jul 2022 10:47:29 +0000 (12:47 +0200)] 
Add BSD-armv4 target based on linux-armv4

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Todd Short <todd.short@me.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18910)

(cherry picked from commit a9389c0b75e69ebaf74fdc8fee0c983809e45931)

18 months agoImprove chacha20 perfomance on aarch64 by interleaving scalar with SVE/SVE2
Daniel Hu [Tue, 19 Jul 2022 17:43:28 +0000 (18:43 +0100)] 
Improve chacha20 perfomance on aarch64 by interleaving scalar with SVE/SVE2

The patch will process one extra block by scalar in addition to
blocks by SVE/SVE2 in parallel. This is esp. helpful in the
scenario where we only have 128-bit vector length.

The actual uplift to performance is complicated, depending on the
vector length and input data size. SVE/SVE2 implementation don't
always perform better than  Neon, but it should prevail in most
cases

On a CPU with 256-bit SVE/SVE2, interleaved processing can
handle 9 blocks in parallel (8 blocks by SVE and 1 by Scalar).
on 128-bit SVE/SVE2 it is 5 blocks. Input size that is a multiple
of 9/5 blocks on respective CPU can be typically handled at
maximum speed.

Here are test data for 256-bit and 128-bit SVE/SVE2 by running
"openssl speed -evp chacha20 -bytes 576" (and other size)

----------------------------------+---------------------------------
                256-bit SVE       |        128-bit SVE2
----------------------------------|---------------------------------
Input  576 bytes     512 bytes    |  320 bytes        256 bytes
----------------------------------|---------------------------------
SVE    1716361.91k   1556699.18k  |  1615789.06k      1302864.40k
----------------------------------|---------------------------------
Neon   1262643.44k   1509044.05k  |  680075.67k       1060532.31k
----------------------------------+---------------------------------

If the input size gets very large, the advantage of SVE/SVE2 over
Neon will fade out.

Signed-off-by: Daniel Hu <Daniel.Hu@arm.com>
Change-Id: Ieedfcb767b9c08280d7c8c9a8648919c69728fab

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

(cherry picked from commit 3f42f41ad19c631287386fd8d58f9e02466c5e3f)

18 months agoDrop the optimisation level for ppc64le cross-compile
Matt Caswell [Wed, 24 Aug 2022 14:10:56 +0000 (15:10 +0100)] 
Drop the optimisation level for ppc64le cross-compile

The default cross compiler (gcc 9.4.0) for ppc64le on Ubunut 20.04 seems
buggy and causes a seg fault in sslapitest. This doesn't impact any other
CI cross compile platforms and does not seem to impact the gcc 10.3.0 cross
compiler.

We just drop the optimisation level on that platform.

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

(cherry picked from commit 200d9521a0d406a7d02778d1c6c5a5230caeecf5)

18 months agoAdd CODE-OF-CONDUCT.md
Dr. Matthias St. Pierre [Mon, 15 Aug 2022 13:01:11 +0000 (15:01 +0200)] 
Add CODE-OF-CONDUCT.md

Fixes #18820

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

(cherry picked from commit 63df86b041aaafba3e4998b2e3872fa8695a2377)

18 months agoFix unrolled montgomery multiplication for POWER9
Rohan McLure [Thu, 30 Jun 2022 06:21:06 +0000 (16:21 +1000)] 
Fix unrolled montgomery multiplication for POWER9

In the reference C implementation in bn_asm.c, tp[num + 1] contains the
carry bit for accumulations into tp[num]. tp[num + 1] is only ever
assigned, never itself incremented.

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

(cherry picked from commit 2f1112b22a826dc8854b41b60a422c987f8ddafb)

18 months agoRevert "Revert "bn: Add fixed length (n=6), unrolled PPC Montgomery Multiplication""
Rohan McLure [Mon, 27 Jun 2022 02:14:55 +0000 (12:14 +1000)] 
Revert "Revert "bn: Add fixed length (n=6), unrolled PPC Montgomery Multiplication""

This reverts commit 712d9cc90e355b2c98a959d4e9398610d2269c9e.

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

(cherry picked from commit eae70100fadbc94f18ba7a729bf065cb524a9fc9)

18 months agotest/timing_load_creds.c: fix coding style and other (mostly minor) issues
Dr. David von Oheimb [Mon, 25 Jul 2022 07:19:40 +0000 (09:19 +0200)] 
test/timing_load_creds.c: fix coding style and other (mostly minor) issues

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
(Merged from https://github.com/openssl/openssl/pull/18821)

(cherry picked from commit 45479dcee1672661e4f5b6d8b6c9a50453581e65)

18 months agoRename the "timing" program to "timing_load_creds" and integrate it with test/build...
Dr. David von Oheimb [Mon, 18 Jul 2022 18:26:57 +0000 (20:26 +0200)] 
Rename the "timing" program to "timing_load_creds" and integrate it with test/build.info

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
(Merged from https://github.com/openssl/openssl/pull/18821)

(cherry picked from commit c02036e1ad759fca228a2201f1c4752670ad59bd)

18 months agoAdd a stand-alone "timing" program
Rich Salz [Thu, 29 Apr 2021 17:48:45 +0000 (13:48 -0400)] 
Add a stand-alone "timing" program

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
(Merged from https://github.com/openssl/openssl/pull/18821)

(cherry picked from commit 6212fc6814e8a8968bb35239cd454afd22b6a083)

18 months agoAdd ROTATE inline RISC-V zbb/zbkb asm for DES
Hongren (Zenithal) Zheng [Wed, 11 May 2022 10:32:13 +0000 (18:32 +0800)] 
Add ROTATE inline RISC-V zbb/zbkb asm for DES

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

(cherry picked from commit 6136408e6abf10672e399bf95be064868f2f7ca6)

18 months agoFix GHASH-ASM implementation on s390x
Juergen Christ [Tue, 2 Aug 2022 12:41:00 +0000 (14:41 +0200)] 
Fix GHASH-ASM implementation on s390x

s390x GHASH assembler implementation assumed it was called from a
gcm128_context structure where the Xi paramter to the ghash function was
embedded in that structure.  Since the structure layout resembles the paramter
block required for kimd-GHASH, the assembler code simply assumed the 128 bytes
after Xi are the hash subkey.

This assumption was broken with the introduction of AES-GCM-SIV which uses the
GHASH implementation without a gcm128_context structure.  Furthermore, the
bytes following the Xi input parameter to the GHASH function do not contain
the hash subkey.  To fix this, we remove the assumption about the calling
context and build the parameter block on the stack.  This requires some
copying of data to and from the stack.  While this introduces a performance
degradation, new systems anyway use kma for GHASH/AES-GCM.

Finally fixes #18693 for s390x.

Signed-off-by: Juergen Christ <jchrist@linux.ibm.com>
Reviewed-by: Todd Short <todd.short@me.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18939)

(cherry picked from commit cd854f225bbef9561fad680e2628dfd55be1b141)

18 months agoChange name of parameter in documentation from sigret to sig
Kurt Roeckx [Tue, 2 Aug 2022 16:49:40 +0000 (18:49 +0200)] 
Change name of parameter in documentation from sigret to sig

The rest of the documentation talks about sig, not sigret

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Todd Short <todd.short@me.com>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18943)

(cherry picked from commit 2bd8190aace8109a06aff495a3e20c863ef48653)

18 months agogcm_get_funcs(): Add missing fallback for ghash on x86_64
Tomas Mraz [Mon, 14 Nov 2022 18:31:17 +0000 (19:31 +0100)] 
gcm_get_funcs(): Add missing fallback for ghash on x86_64

Fixes #19673

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

(cherry picked from commit be0161ff100bf10c9549fc09ce4513681011da1c)

18 months agoFix regression from GCM mode refactoring
Tomas Mraz [Thu, 28 Jul 2022 14:23:51 +0000 (16:23 +0200)] 
Fix regression from GCM mode refactoring

Fixes #18896

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

(cherry picked from commit 186be8ed26f5561faf91d6da3ed14cd9cb6617dd)

18 months agos390x: Optimize kmac
Juergen Christ [Mon, 25 Jul 2022 09:31:20 +0000 (11:31 +0200)] 
s390x: Optimize kmac

Use hardware acceleration for kmac on s390x.  Since klmd does not support
kmac, perform padding of the last block by hand and use kimd.  Yields a
performance improvement of between 2x and 3x.

Signed-off-by: Juergen Christ <jchrist@linux.ibm.com>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18863)

(cherry picked from commit affc070aabc930aeaba50f0dd6b3e0b7a2ddc399)

18 months agos390x: Fix GCM setup
Juergen Christ [Mon, 25 Jul 2022 08:34:26 +0000 (10:34 +0200)] 
s390x: Fix GCM setup

Rework of GCM code did not include s390x causing NULL pointer dereferences on
GCM operations other than AES-GCM on platforms that support kma.  Fix this by
a proper setup of the function pointers.

Fixes: 92c9086e5c2b ("Use separate function to get GCM functions")
Signed-off-by: Juergen Christ <jchrist@linux.ibm.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18862)

(cherry picked from commit 48e35b99bd0071207cfe39da22eb2502db5c09dc)

18 months agoClean up GCM_MUL and remove GCM_FUNCREF_4BIT
Todd Short [Wed, 20 Jul 2022 15:11:41 +0000 (11:11 -0400)] 
Clean up GCM_MUL and remove GCM_FUNCREF_4BIT

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

(cherry picked from commit d50e0934e5b1537db0ea43986464b8f8f8b4e9fd)

18 months agoClean up use of GHASH macro
Todd Short [Wed, 20 Jul 2022 15:06:59 +0000 (11:06 -0400)] 
Clean up use of GHASH macro

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

(cherry picked from commit 95201ef45711220455e8abf1cc6b334393384af2)

18 months agoUse separate function to get GCM functions
Todd Short [Wed, 20 Jul 2022 14:54:24 +0000 (10:54 -0400)] 
Use separate function to get GCM functions

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

(cherry picked from commit 92c9086e5c2b63606cd28a7f13f09b9ff35a0de3)

18 months agoRemove some unused 4bit GCM code
Todd Short [Wed, 20 Jul 2022 14:04:34 +0000 (10:04 -0400)] 
Remove some unused 4bit GCM code

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

(cherry picked from commit 7da952bcc54604141ea8ed40ec5ed1fd2f74cc25)

18 months agoRemove unused 1bit GCM implementation
Todd Short [Wed, 20 Jul 2022 13:48:21 +0000 (09:48 -0400)] 
Remove unused 1bit GCM implementation

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

(cherry picked from commit 7b6e19fc4e6cc1a7000f71789ef50636dacdbb85)

18 months agoRemove unused 8bit GCM implementation
Todd Short [Wed, 20 Jul 2022 13:38:07 +0000 (09:38 -0400)] 
Remove unused 8bit GCM implementation

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

(cherry picked from commit a8b5128fd724bc23f7454d64e401d15129634a01)

18 months agoEmit rev8 on __riscv_zbkb as on __riscv_zbb
marcfedorow [Tue, 19 Jul 2022 16:15:44 +0000 (19:15 +0300)] 
Emit rev8 on __riscv_zbkb as on __riscv_zbb

Also add early clobber for two-insn bswap.

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

(cherry picked from commit 48b6776678d794406c625dcb5767102b73081962)

18 months agoCleanup : directly include of `internal/nelem.h` when required.
FdaSilvaYY [Sat, 20 Feb 2021 22:39:30 +0000 (23:39 +0100)] 
Cleanup : directly include of `internal/nelem.h` when required.

And so clean a few useless includes

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

(cherry picked from commit f2a6f83862be3e20260b708288a8f7d0928e9018)

18 months agoImprove FIPS RSA keygen performance.
slontis [Wed, 2 Nov 2022 03:20:55 +0000 (13:20 +1000)] 
Improve FIPS RSA keygen performance.

Reduce the Miller Rabin counts to the values specified by FIPS 186-5.
The old code was using a fixed value of 64.

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

(cherry picked from commit d2f6e66d2837bff1f5f7636bb2118e3a45c9df61)

18 months agoparams_api_test.c: Fix mistake in backported test fix
Tomas Mraz [Mon, 14 Nov 2022 19:02:13 +0000 (20:02 +0100)] 
params_api_test.c: Fix mistake in backported test fix

Fixup for e8f1d76b50204d87a0ef7f6879eb1dd507a54368.

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

18 months agoRelease the drbg in the global default context before engines
Tomas Mraz [Tue, 11 Oct 2022 15:26:23 +0000 (17:26 +0200)] 
Release the drbg in the global default context before engines

Fixes #17995
Fixes #18578

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/19386)

(cherry picked from commit a88e97fcace01ecf557b207f04328a72df5110df)

18 months agoAdd a test case for the engine crash with AES-256-CTR
Bernd Edlinger [Sat, 2 Apr 2022 11:41:12 +0000 (13:41 +0200)] 
Add a test case for the engine crash with AES-256-CTR

Implement the AES-256-CTR cipher in the dasync engine.

Use that to reproduce the reported problems with the
devcrypto engine in our normal test environment.

See #17995 and #17532 for details.

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

(cherry picked from commit bd363ef32403d58a8b41553b5abd602b30073b10)

18 months agoAdd an EVP signature demo using DSA
Daniel Fiala [Fri, 21 Oct 2022 04:28:12 +0000 (06:28 +0200)] 
Add an EVP signature demo using DSA

Fixes openssl#14114

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

(cherry picked from commit 858b5d12b85b0639519d21206c9da7e1bb976a00)

18 months agotest/recipes/80-test_cms.t: Fix the "CAdES ko" test
Richard Levitte [Tue, 22 Nov 2022 14:05:45 +0000 (15:05 +0100)] 
test/recipes/80-test_cms.t: Fix the "CAdES ko" test

This test had commands that assumes that runner_loop() is used to perform
the tests.  These tests still run fine because Unix accepts braces in file
names, but other operating systems might not.

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

18 months agoFix coverity issues in X509v3_addr
slontis [Thu, 17 Nov 2022 01:58:36 +0000 (11:58 +1000)] 
Fix coverity issues in X509v3_addr

CID 1516955 : Null pointer deref (REVERSE_INULL)
CID 1516954 : Null pointer deref (REVERSE_INULL)
CID 1516953 : RESOURCE_LEAK of child

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

(cherry picked from commit 26cfa4cd85f6b26dd7a48c2ff06bfa4a2cea4764)

18 months agoAdd missing HISTORY sections for OpenSSL 3.0 related documents.
slontis [Wed, 16 Nov 2022 21:26:06 +0000 (07:26 +1000)] 
Add missing HISTORY sections for OpenSSL 3.0 related documents.

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

(cherry picked from commit 4741c80c0556653c74252ec91425dcb74066b2ec)

18 months agoImprove FIPS RSA keygen performance.
slontis [Wed, 2 Nov 2022 02:01:34 +0000 (12:01 +1000)] 
Improve FIPS RSA keygen performance.

FIPS 186-4 has 5 different algorithms for key generation,
and all of them rely on testing GCD(a,n) == 1 many times.

Cachegrind was showing that during a RSA keygen operation,
the function BN_gcd() was taking a considerable percentage
of the total cycles.

The default provider uses multiprime keygen, which seemed to
be much faster. This is because it uses BN_mod_inverse()
instead.

For a 4096 bit key, the entropy of a key that was taking a
long time to generate was recorded and fed back into subsequent
runs. Roughly 40% of the cycle time was BN_gcd() with most of the
remainder in the prime testing. Changing to use the inverse
resulted in the cycle count being 96% in the prime testing.

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

(cherry picked from commit dd1d7bcb69994d81662e709b0ad838880b943870)

18 months agoFix no-dtls1_2
Matt Caswell [Fri, 22 Jul 2022 10:12:52 +0000 (11:12 +0100)] 
Fix no-dtls1_2

dtlstest.c needs some adjusting to handle no-dtls1_2 since commit
7bf2e4d7f0c banned DTLSv1 at the default security level - causing the
test to fail.

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

(cherry picked from commit a6843e6ae8ae0551aae8555783f06dab7951f112)

18 months agodhparam: Correct the documentation of -dsaparam
Tomas Mraz [Tue, 12 Jul 2022 10:32:44 +0000 (12:32 +0200)] 
dhparam: Correct the documentation of -dsaparam

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

(cherry picked from commit 2885b2ca4eee5586baa50208e41a1ca54532eb3a)

18 months agodhparam_test: Test that we add private key length on generation and print it
Tomas Mraz [Fri, 10 Jun 2022 08:06:24 +0000 (10:06 +0200)] 
dhparam_test: Test that we add private key length on generation and print it

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

(cherry picked from commit 2b11a8ecc8ed1355b99a6d88b8e7e7a75a67bd0a)

18 months agoUse as small dh key size as possible to support the security
Tomas Mraz [Mon, 6 Jun 2022 08:22:00 +0000 (10:22 +0200)] 
Use as small dh key size as possible to support the security

Longer private key sizes unnecessarily raise the cycles needed to
compute the shared secret without any increase of the real security.

We use minimum key sizes as defined in RFC7919.

For arbitrary parameters we cannot know whether they are safe
primes (we could test but that would be too inefficient) we have
to keep generating large keys.

However we now set a small dh->length when we are generating safe prime
parameters because we know it is safe to use small keys with them.

That means users need to regenerate the parameters if they
want to take the performance advantage of small private key.

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

(cherry picked from commit ddb13b283be84d771deba1e964610b1670641f03)

18 months agoAdd ROTATE inline RISC-V zbb/zbkb asm for chacha
Hongren (Zenithal) Zheng [Wed, 11 May 2022 10:09:46 +0000 (18:09 +0800)] 
Add ROTATE inline RISC-V zbb/zbkb asm for chacha

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

(cherry picked from commit ca6286c382a7eb527fac9aba2a018354acb27b16)

18 months agoAdd config option OPENSSL_NO_UNIX_SOCK
Max Bachmann [Thu, 5 May 2022 16:46:03 +0000 (18:46 +0200)] 
Add config option OPENSSL_NO_UNIX_SOCK

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

(cherry picked from commit 081f3484593cdd3be2b7fdd8818c3f928ce729bc)

18 months agoAdd a DTLS next epoch test
Matt Caswell [Fri, 17 Jun 2022 15:37:24 +0000 (16:37 +0100)] 
Add a DTLS next epoch test

Test that if we receive a packet from the next epoch, we can buffer it
and still use it.

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

(cherry picked from commit e1c153d31d4f913ebe2202a4bc20305919274d1f)

18 months agoVMS: For executables, process the use of /INCLUDE=main a bit differently
Richard Levitte [Wed, 5 Oct 2022 10:47:32 +0000 (12:47 +0200)] 
VMS: For executables, process the use of /INCLUDE=main a bit differently

The way it was implemented didn't play well with perl's join(), so it's
reimplemented a bit differently.

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

(cherry picked from commit 1ec0acf264652bd981e95842723e5414d634cd93)

18 months agoVMS: use selective search when linking with shareable images
Richard Levitte [Sat, 1 Oct 2022 09:18:57 +0000 (11:18 +0200)] 
VMS: use selective search when linking with shareable images

VMS linking complains a lot about multiply defined symbols unless told
otherwise, especially when shareable images are involved.  For example, this
involves the legacy provider, where there are overriding implementations of
certain ERR functions.

To quiet the linker down, we need to say that symbols should be searched
selectively in shareable images.

However, that's not quite enough.  The order in which the VMS linker
processes files isn't necessarily top to bottom as given on the command line
or the option file(s), which may result in some symbols appearing undefined,
even though they are.  To remedy that, it's necessary to explicitly include
all object files and object libraries into a cluster, thus ensuring that
they will be processed first.  This allows the search for remaining symbol
references to be done in the as desired in the shareable images that follow.

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

(cherry picked from commit c62a9cd720eccdbb388890ee4a36801d01315be4)

18 months agoAdd ROTATE inline asm support for SM3
Hongren (Zenithal) Zheng [Wed, 11 May 2022 09:18:27 +0000 (17:18 +0800)] 
Add ROTATE inline asm support for SM3

And move ROTATE inline asm to header.

Now this benefits SM3, SHA (when with Zbb only and no Zknh)
and other hash functions

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

(cherry picked from commit eea820f3e239a4c11d618741fd5d00a6bc877347)

18 months agoAdd SM3 implementation in RISC-V Zksh asm
Hongren (Zenithal) Zheng [Wed, 11 May 2022 08:11:18 +0000 (16:11 +0800)] 
Add SM3 implementation in RISC-V Zksh asm

This works for both RV32 and RV64

Signed-off-by: Hongren (Zenithal) Zheng <i@zenithal.me>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18287)

(cherry picked from commit 7ae2bc9df6e0916a8f16183f07dfa1815dd4b66d)

18 months agoAdd deprecation macro for 3.1 and deprecate OPENSSL_LH_stats
Hugo Landau [Tue, 22 Mar 2022 11:52:27 +0000 (11:52 +0000)] 
Add deprecation macro for 3.1 and deprecate OPENSSL_LH_stats

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

(cherry picked from commit 5317b6ee1fc3db20de5976fbb46cc49a45c0768a)

18 months agoOptimize chacha20 on aarch64 by SVE2
Daniel Hu [Wed, 25 May 2022 09:23:40 +0000 (10:23 +0100)] 
Optimize chacha20 on aarch64 by SVE2

This patch improves existing chacha20 SVE patch by using SVE2,
which is an optional architecture feature of aarch64, with XAR
instruction that can improve the performance of chacha20.

Signed-off-by: Daniel Hu <Daniel.Hu@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18522)

(cherry picked from commit bcb52bcc9f9c36a85d037976676fd5ca52f307cd)

18 months agoAdd test cases for verification of time stamping certificates
Lutz Jaenicke [Fri, 17 Jun 2022 11:11:31 +0000 (13:11 +0200)] 
Add test cases for verification of time stamping certificates

Test makes sure, that both time stamping certificate according to rfc3161 (no
requirements for keyUsage extension) and according to CAB forum (keyUsage
extension must be digitalSignature and be set critical) are accepted. Misuse
cases as stated in CAB forum are rejected, only exeption is a missing
"critial" flag on keyUsage.

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

(cherry picked from commit 386ab7f1fefdd77521e670d9593e9894e2774be0)

18 months agoRemove debug and other outdated build targets.
Daniel Fiala [Wed, 15 Jun 2022 06:54:39 +0000 (08:54 +0200)] 
Remove debug and other outdated build targets.

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

(cherry picked from commit 909d590fe7a0935e7856ec618afd652ae03a9260)

18 months ago[crypto/bn] BN_consttime_swap: remove superfluous early exit
Billy Brumley [Thu, 9 Jun 2022 21:03:23 +0000 (00:03 +0300)] 
[crypto/bn] BN_consttime_swap: remove superfluous early exit

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

(cherry picked from commit a644cb7c1c19c78e2ca393c8ca36989e7ca61715)

18 months agoproviders: cipher: aes: add riscv64 zkn support
Hongren (Zenithal) Zheng [Sat, 30 Apr 2022 09:59:05 +0000 (17:59 +0800)] 
providers: cipher: aes: add riscv64 zkn support

Signed-off-by: Hongren (Zenithal) Zheng <i@zenithal.me>
Tested-by: Jiatai He <jiatai2021@iscas.ac.cn>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18197)

(cherry picked from commit ee11118deb65d2b22b94721125a5649d05591e7b)

18 months agoaes_platform: add riscv64 zkn asm support
Hongren (Zenithal) Zheng [Fri, 29 Apr 2022 16:11:28 +0000 (00:11 +0800)] 
aes_platform: add riscv64 zkn asm support

Signed-off-by: Hongren (Zenithal) Zheng <i@zenithal.me>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18197)

(cherry picked from commit 77d29ff041edcdc6a3d33251d6270a4cfe0be9b3)

18 months agoAdd riscv scalar crypto extension capability
Hongren (Zenithal) Zheng [Fri, 29 Apr 2022 16:18:29 +0000 (00:18 +0800)] 
Add riscv scalar crypto extension capability

Signed-off-by: Hongren (Zenithal) Zheng <i@zenithal.me>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18197)

(cherry picked from commit d5dd608364074fadbf4776142ccd8c7b268845cc)

18 months agoadd build support for riscv64 aes zkn
Hongren (Zenithal) Zheng [Sat, 30 Apr 2022 09:37:46 +0000 (17:37 +0800)] 
add build support for riscv64 aes zkn

Signed-off-by: Hongren (Zenithal) Zheng <i@zenithal.me>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18197)

(cherry picked from commit 9912c38ed69c97ca737c66c68ae454c5cd265133)

18 months agoAdd AES implementation in riscv64 zkn asm
Hongren (Zenithal) Zheng [Wed, 27 Apr 2022 18:41:22 +0000 (02:41 +0800)] 
Add AES implementation in riscv64 zkn asm

Signed-off-by: Hongren (Zenithal) Zheng <i@zenithal.me>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18197)

(cherry picked from commit 608cadfbdbdba076a07e172f834a0afb6aafa59b)

18 months agoFix code format: BLOCK_CIPHER_custom
Jiuhai Zhang [Thu, 26 May 2022 11:10:31 +0000 (11:10 +0000)] 
Fix code format: BLOCK_CIPHER_custom

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

(cherry picked from commit 1c5a4e3b5e05494876ebba9d8272d2cbca1e20a3)

18 months agoMove types.h #undefs for wincrypt.h compatibility
Samuel Lee [Mon, 11 Apr 2022 14:36:16 +0000 (15:36 +0100)] 
Move types.h #undefs for wincrypt.h compatibility

+ Always undef the symbols that may have been #define-d
  by wincrypt.h after the first inclusion of types.h to
  avoid errors from wincrypt.h symbols being used to
  compile OpenSSL code
+ Also need to remove #pragma once for this approach to work
+ Define WINCRYPT_USE_SYMBOL_PREFIX to enable wincrypt
  symbol prefix at some point in future

Fixes #9981

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

(cherry picked from commit 3c58d447497b37f7b4f458aaa2956a7e226c6d65)

18 months agoMake running individual ssl-test easier
Todd Short [Wed, 25 May 2022 15:39:20 +0000 (11:39 -0400)] 
Make running individual ssl-test easier

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

(cherry picked from commit eec204f4b19f86e726aa09c5c919a57bdf2ee1d0)

18 months agoAdd riscv64 asm_arch to BSD-riscv64 target
Hongren (Zenithal) Zheng [Fri, 13 May 2022 19:35:27 +0000 (03:35 +0800)] 
Add riscv64 asm_arch to BSD-riscv64 target

Following cb2764f2a8 Add riscv64 asm_arch to linux64-riscv64 target
Current ASM does not have Linux specific thing thus this is
suitable for BSD

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

(cherry picked from commit d1460afdfcb3c90df612896d40d35c6627a5967c)

18 months agoApply the AES-GCM unroll8 optimization patch to Neoverse N2
XiaokangQian [Wed, 18 May 2022 02:27:55 +0000 (02:27 +0000)] 
Apply the AES-GCM unroll8 optimization patch to Neoverse N2

The loop unrolling and use of EOR3 can improve N2 performance
by up to 32%

Signed-off-by: XiaokangQian <xiaokang.qian@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18350)

(cherry picked from commit 9224a407f9bb4c2af087ecf6e691c9027b594ec0)

18 months agoperformance: improve ossl_lh_strcasehash
Pauli [Fri, 20 May 2022 00:15:55 +0000 (10:15 +1000)] 
performance: improve ossl_lh_strcasehash

This improvement seems to roughly halve the time it takes to run the
ossl_lh_strcasehash function.

It should have no impact on the strings we hash and search for often (algorithm
names, property strings).

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

(cherry picked from commit a4e21d18d5b7cb4fef66c10f13b1b3b55945439f)

18 months agoDrop ossl_namemap_add_name_n() and simplify ossl_namemap_add_names()
Tomas Mraz [Thu, 19 May 2022 09:38:23 +0000 (11:38 +0200)] 
Drop ossl_namemap_add_name_n() and simplify ossl_namemap_add_names()

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

(cherry picked from commit b00cf0e790661636e1df1026554f712cc513592d)

18 months agoossl_namemap_name2_num: Avoid unnecessary OPENSSL_strndup().
Tomas Mraz [Wed, 18 May 2022 14:45:20 +0000 (16:45 +0200)] 
ossl_namemap_name2_num: Avoid unnecessary OPENSSL_strndup().

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

(cherry picked from commit dab5098eacb9e264c32a33332ba047f234a3de68)

18 months agoAdd BSWAP4/BSWAP8 routines for riscv64 with Zbb
Henry Brausen [Fri, 28 Jan 2022 08:57:54 +0000 (01:57 -0700)] 
Add BSWAP4/BSWAP8 routines for riscv64 with Zbb

These routines make use of the rev8 instruction in the Zbb extension
to accelerate byte-swapping when OpenSSL is built specifically for
a machine that supports Zbb.

Reviewed-by: Philipp Tomsich <philipp.tomsich@vrull.eu>
Signed-off-by: Henry Brausen <henry.brausen@vrull.eu>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17640)

(cherry picked from commit e4fd3fc379d76d9cd33ea6699268485606447737)

18 months agoAdd clmul-based gmult for riscv64 with Zbb, Zbc
Henry Brausen [Fri, 28 Jan 2022 08:53:07 +0000 (01:53 -0700)] 
Add clmul-based gmult for riscv64 with Zbb, Zbc

ghash-riscv64.pl implements 128-bit galois field multiplication for
use in the GCM mode using RISC-V carryless multiplication primitives.

The clmul-accelerated routine can be selected by setting the Zbb and
Zbc bits of the OPENSSL_riscvcap environment variable at runtime.

Reviewed-by: Philipp Tomsich <philipp.tomsich@vrull.eu>
Signed-off-by: Henry Brausen <henry.brausen@vrull.eu>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17640)

(cherry picked from commit 999376dcf33986c468361ede16fa9de409dc4e2e)

18 months agoAdd basic RISC-V cpuid and OPENSSL_riscvcap
Henry Brausen [Fri, 28 Jan 2022 08:28:52 +0000 (01:28 -0700)] 
Add basic RISC-V cpuid and OPENSSL_riscvcap

RISC-V cpuid implementation allows bitmanip extensions Zb[abcs] to
be enabled at runtime using OPENSSL_riscvcap environment variable.

For example, to specify 64-bit RISC-V with the G,C,Zba,Zbb,Zbc
extensions, one could write: OPENSSL_riscvcap="rv64gc_zba_zbb_zbc"

Architecture string parsing is still very primitive, but can be
expanded in the future. Currently, only bitmanip extensions Zba, Zbb,
Zbc and Zbs are supported.

Includes implementation of constant-time CRYPTO_memcmp in riscv64 asm,
as well as OPENSSL_cleanse. Assembly implementations are written using
perlasm.

Reviewed-by: Philipp Tomsich <philipp.tomsich@vrull.eu>
Signed-off-by: Henry Brausen <henry.brausen@vrull.eu>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17640)

(cherry picked from commit 360f6dcc5aa1a86ec3ff9a94612b88e3d960ee2e)

18 months agoAdd AES implementation in generic riscv64 asm
Henry Brausen [Fri, 28 Jan 2022 08:13:04 +0000 (01:13 -0700)] 
Add AES implementation in generic riscv64 asm

This implementation is based on the four-table approach, along the same
lines as the non-constant-time implementation in aes_core.c The
implementation is in perlasm.

Utility functions are defined to automatically stack/unstack registers
as needed for prologues and epilogues. See riscv-elf-psabi-doc at
https://github.com/riscv-non-isa/riscv-elf-psabi-doc/ for ABI details.

Reviewed-by: Philipp Tomsich <philipp.tomsich@vrull.eu>
Signed-off-by: Henry Brausen <henry.brausen@vrull.eu>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17640)

(cherry picked from commit b3504b600c028a00f36cdbfedc928a48df9818ff)

18 months agoPrepare NonStop for fixed-size integer types.
Randall S. Becker [Mon, 16 May 2022 22:57:45 +0000 (16:57 -0600)] 
Prepare NonStop for fixed-size integer types.

This commit removes platform defines the interfere with loading and resolution
of platform and memory model variants of integer types and includes the
appropriate files, stdint.h and sys/types.h where the types are defined.

Fixes #17669

Signed-off-by: Randall S. Becker <rsbecker@nexbridge.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18325)

(cherry picked from commit ec26144288fd6dce6dd76bd9e2b192b495033723)

18 months agoadd tests for PBKDF2 with SHA-3
Hubert Kario [Fri, 6 Aug 2021 11:39:32 +0000 (13:39 +0200)] 
add tests for PBKDF2 with SHA-3

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

(cherry picked from commit 5702392f73e679fd9ed9dd912cf4c9dc613c4d71)

18 months agoadd support for SHA-3 based PRF to PBES2
Hubert Kario [Thu, 5 Aug 2021 20:41:11 +0000 (22:41 +0200)] 
add support for SHA-3 based PRF to PBES2

As there are no limitations for HMACs used in PBKDF2 inside PBES2,
as more specifically the SHA-3 hashes are drop-in replacements for
SHA-2 hashes, we can easily add support for SHA-3 here.

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

(cherry picked from commit c73ba81899c291d60851321e6de8913d4800c456)

18 months agoMake IV/buf in prov_cipher_ctx_st aligned
Hongren (Zenithal) Zheng [Mon, 9 May 2022 11:42:39 +0000 (19:42 +0800)] 
Make IV/buf in prov_cipher_ctx_st aligned

Make IV/buf aligned will drastically improve performance
as some architecture performs badly on misaligned memory
access.

Ref to
https://gist.github.com/ZenithalHourlyRate/7b5175734f87acb73d0bbc53391d7140#file-2-openssl-long-md
Ref to
openssl#18197

Signed-off-by: Hongren (Zenithal) Zheng <i@zenithal.me>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18267)

(cherry picked from commit 2787a709c984d3884e1726383c2f2afca428d795)

18 months agoAdd riscv64 asm_arch to linux64-riscv64 target
Henry Brausen [Fri, 28 Jan 2022 08:12:38 +0000 (01:12 -0700)] 
Add riscv64 asm_arch to linux64-riscv64 target

Reviewed-by: Philipp Tomsich <philipp.tomsich@vrull.eu>
Signed-off-by: Henry Brausen <henry.brausen@vrull.eu>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18275)

(cherry picked from commit cb2764f2a8165421dc5ab52159af99cbf766fa2c)

18 months agoRISC-V support for the SHA256
Mark Fedorov [Wed, 29 Sep 2021 17:49:59 +0000 (20:49 +0300)] 
RISC-V support for the SHA256

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

(cherry picked from commit 657d1927c68bdc3fb0250d16df2a8439e8e043f1)

18 months agoevp_md: assert digest is provided for algctx reuse
Benjamin Kaduk [Mon, 2 May 2022 17:40:57 +0000 (10:40 -0700)] 
evp_md: assert digest is provided for algctx reuse

When reusing an algctx (it was always freed on reinitialization,
prior to #18105), assert that the associated digest is provided.
We implicitly rely on this for algctx reuse to be safe (since
an implicit fetch could potentially change the digest object used,
including provider, which accordingly could change the layout of the
algctx object.

From code inspection, this is currently always the case -- the only
way to set an algctx requires the provider to be set, and the only
ways to change or remove a provider without destroying the entier
EVP_MD_CTX will also free the algctx.  Adding an assertion will help
ensure that this remains true as the code evolves.

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

(cherry picked from commit 221d65ba534d23a240ccadd0c2679b222aae35b1)

18 months agoExclude IPv6 code using OPENSSL_USE_IPV6 instead of AF_INET6
Max Bachmann [Thu, 5 May 2022 07:56:10 +0000 (09:56 +0200)] 
Exclude IPv6 code using OPENSSL_USE_IPV6 instead of AF_INET6

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

(cherry picked from commit 836bb0890dc4d139215824cc9ac35591361f8117)

18 months agoHeader file cleanup for C++20 header-units
Nathan Sidwell [Mon, 25 Apr 2022 17:50:36 +0000 (10:50 -0700)] 
Header file cleanup for C++20 header-units

C++20 adds 'header units' as a stepping-stone to modules.  Header
units are regular header-files that have a 'self-contained' property
-- they do not require previously-included headers to provide typedefs
and what not.

This addresses 2 problems discovered when using clang modules (as a
proxy for C++20 header-units).

a) Some headers that pay attention to OPENSSL_NO_STDIO to determine
whether to declare certain FILE*-taking functions do not #include
<stdio.h> themselves, relying on their includer already having done
that.  That breaks the above mentioned encapuslation requirement.
Fixed by conditionally including stdio.h in those headers.  I chose to
always include stdio.h in such headers, even when they included
another such header that transitively included stdio.  That way they
do not rely on an artifact of that intermediate header's behaviour.

b) Some headers have #includes inside 'extern "C" { ... }' regions.
That has a bad code-smell, but GCC and clang have extensions to permit
it with implementation-defined effects.  Clang needs annotation on the
included files to know that they themselves are entirely inside a
similar region.  GCC behavesq as-if there's an extern "C++" region
wrapping the included header (which must therefore wrap its contents
in extern "C", if that is what it wants.  In effect the includer's
extern "C" region is just misleading. I didn't audit all the headers
for this, only those I noticed when addressing #a.

\#a is necessary to build the headers as a set of clang-modules.  #b
is not necessary, but as I mentioned, avoids potentially
implementation-defined behaviour.

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

(cherry picked from commit eab9dbbdd1f102dc1a26549a77fcc5c167385cd5)

18 months agodoc: add not that DTLS 1.0, TLS 1.1 and before are disabled at security level 1
Pauli [Fri, 6 May 2022 00:42:16 +0000 (10:42 +1000)] 
doc: add not that DTLS 1.0, TLS 1.1 and before are disabled at security level 1

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

(cherry picked from commit 54b0c534eeb283878092e006e7f1e9315ec62ad6)

18 months agotls: ban SSL3, TLS1, TLS1.1 and DTLS1.0 at security level one and above
Pauli [Wed, 4 May 2022 03:01:35 +0000 (13:01 +1000)] 
tls: ban SSL3, TLS1, TLS1.1 and DTLS1.0 at security level one and above

This is in line with the NEWS entry (erroneously) announcing such for 3.0.

Fixes #18194

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

(cherry picked from commit 7bf2e4d7f0c7ae19b7a8c416910886a7171e9820)

18 months agoRemove the _fetch_by_number functions
Pauli [Wed, 4 May 2022 04:54:13 +0000 (14:54 +1000)] 
Remove the _fetch_by_number functions

These functions are unused and untested.  They are also implemented rather
inefficiently.  If we ever needed them in the future, they'd almost surely
need to be rewritten more efficiently.

Fixes #18227

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

(cherry picked from commit 16ff70a58cfb5c40197e6a940cf4666226f31b79)

18 months agoRemove duplicated #include headers
JHH20 [Mon, 2 May 2022 10:50:04 +0000 (19:50 +0900)] 
Remove duplicated #include headers

CLA: trivial

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

(cherry picked from commit e257d3e76ffb848b7607b04057257323dc51c3b4)