]> git.ipfire.org Git - thirdparty/openssl.git/log
thirdparty/openssl.git
2 years agoAdd a negative testcase for BN_mod_sqrt
Tomas Mraz [Mon, 28 Feb 2022 17:26:35 +0000 (18:26 +0100)] 
Add a negative testcase for BN_mod_sqrt

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
2 years agoAdd documentation of BN_mod_sqrt()
Tomas Mraz [Mon, 28 Feb 2022 17:26:30 +0000 (18:26 +0100)] 
Add documentation of BN_mod_sqrt()

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
2 years agoFix possible infinite loop in BN_mod_sqrt()
Tomas Mraz [Mon, 28 Feb 2022 17:26:21 +0000 (18:26 +0100)] 
Fix possible infinite loop in BN_mod_sqrt()

The calculation in some cases does not finish for non-prime p.

This fixes CVE-2022-0778.

Based on patch by David Benjamin <davidben@google.com>.

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
2 years agoFix signed integer overflow in evp_enc
Hugo Landau [Fri, 11 Mar 2022 06:57:26 +0000 (06:57 +0000)] 
Fix signed integer overflow in evp_enc

Fixes #17869.

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

2 years agoFixed typo in inner_evp_generic_fetch() error handling
Oliver Roberts [Sat, 12 Mar 2022 14:39:01 +0000 (14:39 +0000)] 
Fixed typo in inner_evp_generic_fetch() error handling

Fixes #17876

CLA: trivial

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

2 years agoFix IV length caching in EVP encryption code
Hugo Landau [Thu, 10 Mar 2022 12:42:05 +0000 (12:42 +0000)] 
Fix IV length caching in EVP encryption code

The IV length cache value was being invalidated excessively, causing IV
length caching to be ineffective.

Related to #17064.

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

2 years agoaes-gcm-avx512.pl: Fixed mingw64 build
Andrey Matyukov [Thu, 10 Mar 2022 21:27:33 +0000 (14:27 -0700)] 
aes-gcm-avx512.pl: Fixed mingw64 build

Decoration prefix for some assembler labels in aes-gcm-avx512.pl was
fixed for mingw64 build.

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

2 years agoAdd EVP demo for SIPHASH
Hugo Landau [Wed, 2 Mar 2022 07:38:15 +0000 (07:38 +0000)] 
Add EVP demo for SIPHASH

Fixes #14121.

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

2 years agoFix bug in scrypt KDF provider dup method
Hugo Landau [Fri, 11 Mar 2022 14:02:39 +0000 (14:02 +0000)] 
Fix bug in scrypt KDF provider dup method

The scrypt KDF provider's dup method calls kdf_scrypt_new passing a
libctx, but a provider context is expected. Since the provider context
is passed as void *, this was not caught.

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

2 years agoevp_test: Add testcases for DH KEX with X9.42 KDF
Tomas Mraz [Thu, 10 Mar 2022 17:41:30 +0000 (18:41 +0100)] 
evp_test: Add testcases for DH KEX with X9.42 KDF

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/17859)

2 years agoFix documentation of parameters for DH and ECDH KEX
Tomas Mraz [Thu, 10 Mar 2022 12:13:40 +0000 (13:13 +0100)] 
Fix documentation of parameters for DH and ECDH KEX

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/17859)

2 years agoDH: Make padding always on when X9.42 KDF is used
Tomas Mraz [Thu, 10 Mar 2022 12:11:21 +0000 (13:11 +0100)] 
DH: Make padding always on when X9.42 KDF is used

Fixes #17834

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/17859)

2 years agoAdd manpages for SSL_get_certificate, SSL_get_private_key
Hugo Landau [Fri, 4 Mar 2022 12:53:50 +0000 (12:53 +0000)] 
Add manpages for SSL_get_certificate, SSL_get_private_key

This is as I understand these functions from reading the code.

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

2 years agocrypto/pem/pem_lib.c: Add check for BIO_read
Jiasheng Jiang [Mon, 7 Mar 2022 09:51:25 +0000 (17:51 +0800)] 
crypto/pem/pem_lib.c: Add check for BIO_read

As the potential failure of the BIO_read(),
it should be better to add the check and return
error if fails.
Also, in order to decrease the same code, using
'out_free' will be better.

Signed-off-by: Jiasheng Jiang <jiasheng@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/17754)

2 years agoAdd EVP demo for RSA key generation
Hugo Landau [Mon, 7 Mar 2022 13:29:49 +0000 (13:29 +0000)] 
Add EVP demo for RSA key generation

Fixes #14111.

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

2 years agoReplace handling of negative verification result with SSL_set_retry_verify()
Tomas Mraz [Mon, 7 Mar 2022 14:46:58 +0000 (15:46 +0100)] 
Replace handling of negative verification result with SSL_set_retry_verify()

Provide a different mechanism to indicate that the application wants
to retry the verification. The negative result of the callback function
now indicates an error again.

Instead the SSL_set_retry_verify() can be called from the callback
to indicate that the handshake should be suspended.

Fixes #17568

Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17825)

2 years agoFixed conditional statement testing 64 and 256 bytes
Danny Tsen [Wed, 23 Feb 2022 19:18:35 +0000 (13:18 -0600)] 
Fixed conditional statement testing 64 and 256 bytes

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

2 years agoEVP_MD performance fix (refcount cache contention)
Hugo Landau [Thu, 10 Mar 2022 09:38:09 +0000 (09:38 +0000)] 
EVP_MD performance fix (refcount cache contention)

Partial fix for #17064. Avoid excessive writes to the cache line
containing the refcount for an EVP_MD object to avoid extreme
cache contention when using a single EVP_MD at high frequency on
multiple threads. This changes performance in 3.0 from being double
that of 1.1 to only slightly higher than that of 1.1.

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

2 years agoMake ossltest engine use in test/recipes/20-test_dgst.t platform agnostic
Richard Levitte [Thu, 10 Mar 2022 12:29:25 +0000 (13:29 +0100)] 
Make ossltest engine use in test/recipes/20-test_dgst.t platform agnostic

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

2 years agoOSSL_CMP_CTX_setup_CRM(): Fix handling of defaults from CSR and refcert
Dr. David von Oheimb [Thu, 17 Feb 2022 18:40:29 +0000 (19:40 +0100)] 
OSSL_CMP_CTX_setup_CRM(): Fix handling of defaults from CSR and refcert

Also update and complete related documentation.

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

2 years agoDOC: TLS compression is disabled by default
Todd Short [Wed, 9 Mar 2022 22:05:45 +0000 (17:05 -0500)] 
DOC: TLS compression is disabled by default

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

2 years agoREADME: add missing link to OpenSSL 3.0 manual pages
Dr. Matthias St. Pierre [Wed, 9 Mar 2022 22:58:02 +0000 (23:58 +0100)] 
README: add missing link to OpenSSL 3.0 manual pages

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

2 years agoAdd TFO support to socket BIO and s_client/s_server
Todd Short [Wed, 8 Sep 2021 20:23:04 +0000 (16:23 -0400)] 
Add TFO support to socket BIO and s_client/s_server

Supports Linux, MacOS and FreeBSD
Disabled by default, enabled via `enabled-tfo`
Some tests

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

2 years agoDrop ariacbc demo binary
Tomas Mraz [Wed, 9 Mar 2022 08:48:42 +0000 (09:48 +0100)] 
Drop ariacbc demo binary

Reviewed-by: Patrick Steuer <patrick.steuer@de.ibm.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17848)

2 years agoAllow to *just* print key and IV of unstreamable modes when no input files
EasySec [Wed, 9 Mar 2022 00:00:19 +0000 (01:00 +0100)] 
Allow to *just* print key and IV of unstreamable modes when no input files

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

2 years agocheck the return of OPENSSL_sk_new_null
xkernel [Tue, 8 Mar 2022 11:48:54 +0000 (19:48 +0800)] 
check the return of OPENSSL_sk_new_null

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Patrick Steuer <patrick.steuer@de.ibm.com>
(Merged from https://github.com/openssl/openssl/pull/17836)

2 years agoSet protocol in init_client()
Todd Short [Tue, 8 Mar 2022 14:36:43 +0000 (09:36 -0500)] 
Set protocol in init_client()

If TCP is being used, protocol = 0 is passed to init_client(), then
protocol == IPPROTO_TCP fails when attempting to set BIO_SOCK_NODELAY.

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

2 years agoAvoid potential memory leak
Dmitry Belyavskiy [Mon, 7 Mar 2022 16:05:57 +0000 (17:05 +0100)] 
Avoid potential memory leak

Resolves #17827

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

2 years agocheck the return value of BIO_new_file()
xkernel [Mon, 7 Mar 2022 07:43:16 +0000 (15:43 +0800)] 
check the return value of BIO_new_file()

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

2 years agoasync_posix: Make ASYNC_set_mem_functions threadsafe
Arran Cudbard-Bell [Tue, 1 Mar 2022 20:10:47 +0000 (14:10 -0600)] 
async_posix: Make ASYNC_set_mem_functions threadsafe

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

2 years agoasync_posix: Allow custom stack allocation functions to be specified for POSIX contexts
Arran Cudbard-Bell [Thu, 24 Feb 2022 18:13:25 +0000 (13:13 -0500)] 
async_posix: Allow custom stack allocation functions to be specified for POSIX contexts

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

2 years agoasync_posix: raise a memory allocation error if we fail to allocate stack memory
Arran Cudbard-Bell [Wed, 23 Feb 2022 18:56:36 +0000 (13:56 -0500)] 
async_posix: raise a memory allocation error if we fail to allocate stack memory

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

2 years agoREADME: add link to migration_guide manual page
Dr. Matthias St. Pierre [Tue, 8 Mar 2022 16:36:37 +0000 (17:36 +0100)] 
README: add link to migration_guide manual page

which replaces the link to the  OpenSSL 3.0 Wiki.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Patrick Steuer <patrick.steuer@de.ibm.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17840)

2 years agoSome platforms don't have pthread_atfork
Matt Caswell [Tue, 8 Mar 2022 17:04:59 +0000 (17:04 +0000)] 
Some platforms don't have pthread_atfork

We've had a report of a linker failure on some platforms (this one was
linux ARM) that apparently did not have pthread_atfork. It's strange that
this has not been reported before but the simplest solution is just to
remove this from the library since it isn't really used anyway.

Currently it is called to set up the fork handlers OPENSSL_fork_prepare,
OPENSSL_fork_parent and OPENSSL_fork_child. However all of those functions
are no-ops. This is a remnant from earlier code that got removed. We can
safely remove it now.

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

2 years agoandroid-x86 target: Add -latomic
Marcel Raad [Wed, 2 Mar 2022 18:57:24 +0000 (19:57 +0100)] 
android-x86 target: Add -latomic

Fixes https://github.com/openssl/openssl/issues/14083 again after being
broken by https://github.com/openssl/openssl/pull/15640.

CLA: trivial

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

2 years agoAdd external testing with oqsprovider
Michael Baentsch [Tue, 8 Mar 2022 06:46:05 +0000 (07:46 +0100)] 
Add external testing with oqsprovider

Including running the oqsprovider external test in the
CI external test build.

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

2 years agoUse Perl to generate bsaes-armv8.S
Tom Cosgrove [Thu, 17 Jun 2021 11:21:23 +0000 (12:21 +0100)] 
Use Perl to generate bsaes-armv8.S

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

2 years agoARM assembly pack: translate bit-sliced AES implementation to AArch64
Ben Avison [Wed, 10 Mar 2021 15:54:44 +0000 (15:54 +0000)] 
ARM assembly pack: translate bit-sliced AES implementation to AArch64

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

2 years agoFix test failure when testing with Test::Harness
Hugo Landau [Mon, 7 Mar 2022 10:48:13 +0000 (10:48 +0000)] 
Fix test failure when testing with Test::Harness

Fixes an issue where, when the test suite was being run with the older
Test::Harness package, the test suite would not complete correctly due
to evaluation of $harness->runtests()->has_errors, which is only
available for the newer TAP::Parser::Aggregator code path.

Fixes #17818.

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

2 years agoAdd EVP demos for RSA-PSS signing and verification
Hugo Landau [Wed, 2 Mar 2022 17:39:28 +0000 (17:39 +0000)] 
Add EVP demos for RSA-PSS signing and verification

Two demos are provided: one using RSA-PSS directly in which a digest
must be provided, and one using RSA-PSS with the EVP_DigestSign APIs
which performs the hashing for you.

Fixes #14113.

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

2 years agoAdd EVP demo for Poly1305 demonstrating Poly1305-AES
Hugo Landau [Wed, 2 Mar 2022 09:50:41 +0000 (09:50 +0000)] 
Add EVP demo for Poly1305 demonstrating Poly1305-AES

Fixes #14122.

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

2 years agoFurther acceleration for SM4-GCM on ARM
Daniel Hu [Wed, 2 Mar 2022 12:55:39 +0000 (12:55 +0000)] 
Further acceleration for SM4-GCM on ARM

This patch will allow the SM4-GCM function to leverage the SM4
high-performance CTR crypto interface already implemented for ARM,
which is faster than current single block cipher routine used
for GCM

It does not address the acceleration of GHASH function of GCM,
which can be a future task, still we can see immediate uplift of
performance (up to 4X)

Before this patch:
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes  16384 bytes
SM4-GCM         186432.92k   394234.05k   587916.46k   639365.12k   648486.91k   652924.25k

After the patch:
SM4-GCM         193924.87k   860940.35k  1696083.71k  2302548.31k  2580411.73k  2607398.91k

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

2 years agoAdd demo for ARIA-256-CBC.
Daniel [Mon, 28 Feb 2022 20:57:06 +0000 (20:57 +0000)] 
Add demo for ARIA-256-CBC.

Fixes #14104

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

2 years agoEVP demo for XOF digest using SHAKE256
Hugo Landau [Thu, 3 Mar 2022 08:20:05 +0000 (08:20 +0000)] 
EVP demo for XOF digest using SHAKE256

This demo optionally accepts a single command line argument, allowing
the output length to be specified.

Fixes #14106.

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

2 years agoapps: several return value checks for BIO_new()
xkernel [Wed, 5 Jan 2022 07:54:10 +0000 (15:54 +0800)] 
apps: several return value checks for BIO_new()

Also check return value of functions that call BIO_new() internally
such as dup_bio_out().

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

2 years agoRework dependencies between config files and build files
Richard Levitte [Wed, 23 Feb 2022 10:00:39 +0000 (11:00 +0100)] 
Rework dependencies between config files and build files

Before PR #15310, which reworked how build files (Makefile, ...) were
generated, everything was done when configuring, so configdata.pm
could depend on build file templates and we'd get away with it.

However, since building configdata.pm is now independent of the build
file templates, that dependency is unnecessary, and would lead to
surprises of the build file template is updated, with an unexpected
full reconfiguration as a result, when all that's needed is to run
configdata.pm with no flags to get the build file re-generated.

This change is therefore a completion of what was forgotten in #15310.

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

2 years agoFix build issue with aes-gcm-armv8-unroll8_64.S on older aarch64 assemblers
XiaokangQian [Wed, 2 Mar 2022 03:27:43 +0000 (03:27 +0000)] 
Fix build issue with aes-gcm-armv8-unroll8_64.S on older aarch64 assemblers

The EOR3 instruction is implemented with .inst, and the code here is enabled
using run-time detection of the CPU capabilities, so no need to explicitly
ask for the sha3 extension.

Fixes #17773

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

2 years agoAdd EVP demo for X25519 key exchange
Hugo Landau [Wed, 2 Mar 2022 13:08:53 +0000 (13:08 +0000)] 
Add EVP demo for X25519 key exchange

This offers both a known answer test with fixed keys and also
demonstrates a more realistic usage with random keys.

Fixes #14118.

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

2 years agoFix typo in EVP_MD-BLAKE2(7)
Hugo Landau [Tue, 1 Mar 2022 17:48:11 +0000 (17:48 +0000)] 
Fix typo in EVP_MD-BLAKE2(7)

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

2 years agos_server: Do not use SSL_sendfile when KTLS is not being used
Hugo Landau [Tue, 1 Mar 2022 16:47:03 +0000 (16:47 +0000)] 
s_server: Do not use SSL_sendfile when KTLS is not being used

Fix a bug in `openssl s_server -WWW` where it would attempt to invoke
`SSL_sendfile` if `-ktls -sendfile` was passed on the command line, even
if KTLS has not actually been enabled, for example because it is not
supported by the host. Since `SSL_sendfile` is only supported when KTLS
is actually being used, this resulted in a failure to serve requests.

Fixes #17503.

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

2 years agoPerturb the malloc output during tests
Matt Caswell [Thu, 24 Feb 2022 16:20:14 +0000 (16:20 +0000)] 
Perturb the malloc output during tests

Set the environment variable MALLOC_PERTURB_ during tests to perturb the
output from OPENSSL_malloc() calls (see the mallopt man page for details
about this environment variable). This could be a low cost way of spotting
uninit reads in "make test" runs in some situations.

In tests I have found it to be a little unreliable (sometimes it seemed to
not perturb the output for inexplicable reasons) - but since this is easy
to implement I think it is worthwhile.

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

2 years agoasn1_string_to_time_t: Use timegm on FreeBSD.
John Baldwin [Thu, 24 Feb 2022 01:18:22 +0000 (17:18 -0800)] 
asn1_string_to_time_t: Use timegm on FreeBSD.

FreeBSD does not provide a global timezone variable containing the
offset to UTC.  Instead, FreeBSD's libc includes a legacy timezone
function dating back to Version 7 AT&T UNIX.  As a result,
asn1_string_to_time_t currently fails to compile on FreeBSD as it
subtracts a function from a time_t value:

../crypto/asn1/a_time.c:625:37: error: invalid operands to binary expression ('time_t' (aka 'long') and 'char *(int, int)')
    timestamp_utc = timestamp_local - timezone;
                    ~~~~~~~~~~~~~~~ ^ ~~~~~~~~
1 error generated.

However, FreeBSD's libc does include a non-standard (but widely
available) timegm function which converts a struct tm directly to a
UTC time_t value.  Use this on FreeBSD instead of mktime.

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

2 years agoAdd testing of OBJ_find_sigid_by_algs()
Michael Baentsch [Wed, 2 Mar 2022 07:48:46 +0000 (08:48 +0100)] 
Add testing of OBJ_find_sigid_by_algs()

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

2 years agoenable CMS sign/verify for provider-implemented PKEYs
Michael Baentsch [Fri, 18 Feb 2022 13:10:04 +0000 (14:10 +0100)] 
enable CMS sign/verify for provider-implemented PKEYs

We need to handle signatures with and without digest algs
and we generalize the ossl_cms_ecdsa_dsa_sign() function
to other algorithms that are handled in the same way.

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

2 years agoSM4 optimization for non-asm mode
zhangzhilei [Thu, 24 Feb 2022 04:26:57 +0000 (12:26 +0800)] 
SM4 optimization for non-asm mode

This patch use table-lookup borrow from aes in crypto/aes/aes_core.c.

Test on my PC(AMD Ryzen Threadripper 3990X 64-Core Processor),

before and after optimization:

debug mode:

Before:
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes  16384 bytes
SM4-CBC          40101.14k    41453.80k    42073.86k    42174.81k    42216.11k    42227.03k
SM4-ECB          41222.60k    42074.88k    42673.66k    42868.05k    42896.04k    42844.16k
SM4-CTR          35867.22k    36874.47k    37004.97k    37083.82k    37052.42k    37076.99k

After:
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes  16384 bytes
SM4-CBC          47273.51k    48957.40k    49665.19k    49810.77k    49859.24k    49834.67k
SM4-ECB          48100.01k    49323.34k    50224.04k    50273.28k    50533.72k    50730.12k
SM4-CTR          41352.64k    42621.29k    42971.22k    43061.59k    43089.92k    43100.84k

non-debug mode:

Before:
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes  16384 bytes
SM4-CBC         141596.59k   145102.93k   146794.50k   146540.89k   146650.45k   146877.10k
SM4-ECB         144774.71k   155106.28k   158166.36k   158279.00k   158520.66k   159280.97k
SM4-CTR         138021.10k   141577.60k   142493.53k   142736.38k   142852.10k   143125.16k

After:
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes  16384 bytes
SM4-CBC         142016.95k   150068.48k   152238.25k   152773.97k   153094.83k   152027.14k
SM4-ECB         148842.94k   159919.87k   163628.37k   164515.84k   164697.43k   164790.27k
SM4-CTR         141774.23k   146206.89k   147470.25k   147816.28k   146770.60k   148346.20k

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

2 years agoFix NULL pointer dereference for BN_mod_exp2_mont
Hugo Landau [Tue, 1 Mar 2022 14:08:12 +0000 (14:08 +0000)] 
Fix NULL pointer dereference for BN_mod_exp2_mont

This fixes a bug whereby BN_mod_exp2_mont can dereference a NULL pointer
if BIGNUM argument m represents zero.

Regression test added. Fixes #17648.

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

2 years agoEnable openssl req -x509 to create certificates from CSRs
Hugo Landau [Tue, 1 Mar 2022 12:55:03 +0000 (12:55 +0000)] 
Enable openssl req -x509 to create certificates from CSRs

`openssl req -x509` has code allowing it to generate certificates from CSRs
as a replacement for `openssl x509`, but a bug prevents it from working
properly. -CA and -CAkey can now be passed to generate a CA-signed
certificate as documented in openssl-req(1).

Regression testing has been added to `openssl req`.

Fixes #17736.

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

2 years agoImprove documentation of BIO_FLAGS_BASE64_NO_NL flag.
Daniel [Mon, 21 Feb 2022 12:25:25 +0000 (13:25 +0100)] 
Improve documentation of BIO_FLAGS_BASE64_NO_NL flag.

Fixes #12491.

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

2 years ago[ssl] Add tests for Perfect Forward Secrecy criteria on SECLEVEL >= 3
Nicola Tuveri [Wed, 23 Feb 2022 21:05:22 +0000 (23:05 +0200)] 
[ssl] Add tests for Perfect Forward Secrecy criteria on SECLEVEL >= 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/17763)

2 years ago[ssl] Add SSL_kDHEPSK and SSL_kECDHEPSK as PFS ciphersuites for SECLEVEL >= 3
Nicola Tuveri [Tue, 22 Feb 2022 14:26:26 +0000 (16:26 +0200)] 
[ssl] Add SSL_kDHEPSK and SSL_kECDHEPSK as PFS ciphersuites for SECLEVEL >= 3

Fixes #17743

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

2 years ago[ssl] Prefer SSL_k(EC)?DHE to the SSL_kE(EC)?DH alias
Nicola Tuveri [Tue, 22 Feb 2022 12:47:11 +0000 (14:47 +0200)] 
[ssl] Prefer SSL_k(EC)?DHE to the SSL_kE(EC)?DH alias

`SSL_kECDHE` and `SSL_kEECDH`, and `SSL_kDHE` and `SSL_kEDH` are already
marked as aliases of each other in the headers.
This commit, for each pair, replaces the leftover uses of the latter
synonym with the first one, which is considered more common.

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

2 years agoaarch64: Fix async_fibre_swapcontext() on clang BTI builds
Tom Cosgrove [Mon, 14 Feb 2022 11:23:57 +0000 (11:23 +0000)] 
aarch64: Fix async_fibre_swapcontext() on clang BTI builds

Reverting to using swapcontext() when compiling with clang on BTI-enabled
builds fixes the BTI setjmp() failure seen when running asynctest.

The issue with setjmp/longjmp is a known clang bug: see
https://github.com/llvm/llvm-project/issues/48888

Change-Id: I6eeaaa2e15f402789f1b3e742038f84bef846e29

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

2 years agocrypto/x509/v3_utl.c: Add missing check for OPENSSL_strndup
Jiasheng Jiang [Mon, 21 Feb 2022 01:51:54 +0000 (09:51 +0800)] 
crypto/x509/v3_utl.c: Add missing check for OPENSSL_strndup

Since the potential failure of memory allocation, it
should be better to check the return value of the
OPENSSL_strndup(), like x509v3_add_len_value().
And following the comment of 'if (astrlen < 0)',
return -1 if fails.

Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
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/17737)

2 years agofuzz/fuzz_rand.c: Add check for OSSL_LIB_CTX_new
Jiasheng Jiang [Mon, 21 Feb 2022 02:10:23 +0000 (10:10 +0800)] 
fuzz/fuzz_rand.c: Add check for OSSL_LIB_CTX_new

As the potential failure of the OPENSSL_zalloc(), the OSSL_LIB_CTX_new()
could return NULL.
Therefore, it should be better to check it and return error if fails in
order to guarantee the success of the initialization.

Signed-off-by: Jiasheng Jiang <jiasheng@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/17738)

2 years agoCorrect the UnsafeLegacyServerConnect docs
Matt Caswell [Tue, 22 Feb 2022 10:40:33 +0000 (10:40 +0000)] 
Correct the UnsafeLegacyServerConnect docs

This option is no longer set by default from OpenSSL 3.0.

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Ben Kaduk <kaduk@mit.edu>
(Merged from https://github.com/openssl/openssl/pull/17748)

2 years agocheck the return value of CRYPTO_strdup()
xkernel [Mon, 21 Feb 2022 07:17:46 +0000 (15:17 +0800)] 
check the return value of CRYPTO_strdup()

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

2 years agoChange `strlen' argument name to `strlength' to avoid c++ reserved words.
Pauli [Wed, 23 Feb 2022 22:52:52 +0000 (09:52 +1100)] 
Change `strlen' argument name to `strlength' to avoid c++ reserved words.

Fixes #17753

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

2 years agofetch: convert a NULL property query to ""
Pauli [Fri, 25 Feb 2022 02:37:08 +0000 (13:37 +1100)] 
fetch: convert a NULL property query to ""

Previously, a NULL property query was never cached and this lead to a
performance degregation.  Now, such a query is converted to an empty string
and cached.

Fixes #17752
Fixes https://github.openssl.org/openssl/openssl/issues/26

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

2 years agoVMS: copy prologue/epilogue headers when header files are generated
Richard Levitte [Wed, 23 Feb 2022 08:05:10 +0000 (09:05 +0100)] 
VMS: copy prologue/epilogue headers when header files are generated

This is crucial when the build tree isn't the source tree, as they
only take effect in directories where included header files reside.

The issue only comes up when linking with the static libraries, since
the shared libraries have upper case aliases of all symbols.

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

2 years agotest/crltest.c: Add check for glue2bio
Jiasheng Jiang [Thu, 17 Feb 2022 09:47:00 +0000 (17:47 +0800)] 
test/crltest.c: Add check for glue2bio

As the glue2bio() could return NULL pointer if fails,
it should be better to check the return value in order
to avoid the use of NULL pointer.

Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17718)

2 years agobio_enc.c: add check for BIO_new_mem_buf
Jiasheng Jiang [Fri, 18 Feb 2022 02:13:08 +0000 (10:13 +0800)] 
bio_enc.c: add check for BIO_new_mem_buf

Since the memory allocation may fail, the BIO_new_mem_buf() may
return NULL pointer.
Therefore, it should be better to check it and return error if fails.

Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17730)

2 years agoX509_VERIFY_PARAM_set_flags.pod: fix typos
Carlo Teubner [Fri, 18 Feb 2022 10:00:52 +0000 (10:00 +0000)] 
X509_VERIFY_PARAM_set_flags.pod: fix typos

CLA: trivial

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

2 years agoAdd -quiet option to pkcs7 for -print_certs
Raul Ferrando [Tue, 15 Feb 2022 15:02:41 +0000 (16:02 +0100)] 
Add -quiet option to pkcs7 for -print_certs

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

2 years agoUndeprecate OPENSSL_VERSION_NUMBER and OpenSSL_version_num()
Matt Caswell [Tue, 22 Feb 2022 11:49:04 +0000 (11:49 +0000)] 
Undeprecate OPENSSL_VERSION_NUMBER and OpenSSL_version_num()

This macro and function were deprecated in the documentation but not in
the source.

Following an OTC vote the deprecation has been removed from the
documentation.

See https://github.com/openssl/technical-policies/issues/26

Fixes #17517

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

2 years agodoc: Fix KDF example for scrypt
msa42 [Mon, 21 Feb 2022 18:23:34 +0000 (18:23 +0000)] 
doc: Fix KDF example for scrypt

CLA: trivial

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

2 years agoFix a failure in sslapitest
Matt Caswell [Wed, 23 Feb 2022 11:16:07 +0000 (11:16 +0000)] 
Fix a failure in sslapitest

The SNI test in test_cert_cb_int() was always failing because it used
SSL_CTX_new() instead of SSL_CTX_new_ex() and was therefore not using the
correct libctx. PR #17739 amended the test to check the return value from
SSL_CTX_new() which made the failure obvious.

Fixes #17757

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

2 years agocheck *libctx which is allocated by OSSL_LIB_CTX_new()
xkernel [Mon, 21 Feb 2022 07:29:25 +0000 (15:29 +0800)] 
check *libctx which is allocated by OSSL_LIB_CTX_new()

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

2 years agotest/sslapitest.c: Add check for SSL_CTX_new
Jiasheng Jiang [Mon, 21 Feb 2022 02:54:29 +0000 (10:54 +0800)] 
test/sslapitest.c: Add check for SSL_CTX_new

As the potential failure of the memory allocation, it should
be better to check the return value of SSL_CTX_new() and return
error if fails, like SSL_CTX_new_ex().

Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17739)

2 years agoX509V3_get_d2i.pod: use I<> for arguments and remove B<> around NULL
Dr. David von Oheimb [Fri, 18 Feb 2022 08:36:00 +0000 (09:36 +0100)] 
X509V3_get_d2i.pod: use I<> for arguments and remove B<> around NULL

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

2 years agoX509V3_get_d2i.pod: Fix glitch on X509V3_get{,_ext}_d2i and align order
Dr. David von Oheimb [Thu, 17 Feb 2022 18:43:55 +0000 (19:43 +0100)] 
X509V3_get_d2i.pod: Fix glitch on X509V3_get{,_ext}_d2i and align order

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

2 years agoCMP: add subject of any provided CSR as default message sender
Dr. David von Oheimb [Thu, 17 Feb 2022 18:46:29 +0000 (19:46 +0100)] 
CMP: add subject of any provided CSR as default message sender

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

2 years agochacha20 performance optimizations for ppc64le with 8x lanes,
Deepankar Bhattacharjee [Mon, 20 Sep 2021 14:45:15 +0000 (10:45 -0400)] 
chacha20 performance optimizations for ppc64le with 8x lanes,
Performance increase around 50%.

Co-authored-by: Madhusudhanan Duraisamy <madurais@in.ibm.com>
Co-authored-by: Nilamjyoti Goswami <nilamgoswami@in.ibm.com>
Co-authored-by: Siva Sundar Anbareeswaran <srisivasundar@in.ibm.com>
Reviewed-by: Danny Tsen <dtsen@us.ibm.com>
Tested-by: Danny Tsen <dtsen@us.ibm.com>
Signed-off-by: Danny <dtsen@us.ibm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/16637)

2 years agox509: handle returns from X509_TRUST_get_by_id() more consistently
Pauli [Tue, 15 Feb 2022 23:41:58 +0000 (10:41 +1100)] 
x509: handle returns from X509_TRUST_get_by_id() more consistently

Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/17709)

2 years agorand: Add missing check for rand_get_global
Jiasheng Jiang [Tue, 15 Feb 2022 09:45:04 +0000 (17:45 +0800)] 
rand: Add missing check for rand_get_global

As the potential failure of the rand_get_global(),
for example fail to get lock, 'dgbl' could be NULL
pointer and be dereferenced later.
Therefore, it should be better to check it and return
error if fails, like RAND_get0_primary() and other callers.

Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/17690)

2 years agofuzz/asn1.c: Add missing check for BIO_new
Jiasheng Jiang [Sat, 12 Feb 2022 11:27:09 +0000 (19:27 +0800)] 
fuzz/asn1.c: Add missing check for BIO_new

Since the BIO_new may fail, the 'bio' could be NULL pointer and be used.
Therefore, it should be better to check it and skip the print if fails.

Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/17690)

2 years agotest/mdc2test.c: Add check for OSSL_PROVIDER_load
Jiasheng Jiang [Fri, 18 Feb 2022 01:15:50 +0000 (09:15 +0800)] 
test/mdc2test.c: Add check for OSSL_PROVIDER_load

Since the potential failure of the OSSL_PROVIDER_load(),
for example there is no lock, the provider could fail to
be loaded into the library context.
Therefore, it should be better to check it and return error
if fails.
Also, in order to avoid free unknown pointer, 'c' should be
initialized as NULL.

Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/17729)

2 years agodoc: Refactored the example in crypto.pod
yangyangtiantianlonglong [Wed, 16 Feb 2022 15:33:17 +0000 (23:33 +0800)] 
doc: Refactored the example in crypto.pod

Added return value and error code in the sample

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

2 years agodoc: Update "SSL/TLS" old documentation description in openssl.pod
yangyangtiantianlonglong [Wed, 16 Feb 2022 15:01:38 +0000 (23:01 +0800)] 
doc: Update "SSL/TLS" old documentation description in openssl.pod

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

2 years agoFix typo
Dimitris Apostolou [Wed, 16 Feb 2022 08:05:35 +0000 (10:05 +0200)] 
Fix typo

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

2 years agoAdd changes logs caption for the next release 1.1.1n
Oleg Pekar [Wed, 16 Feb 2022 16:58:14 +0000 (18:58 +0200)] 
Add changes logs caption for the next release 1.1.1n

Co-authored-by: Matthias St. Pierre <matthias.st.pierre@ncp-e.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/17714)

2 years agoFixed the date of changes of 1.1.1m
Oleg Pekar [Wed, 16 Feb 2022 11:59:01 +0000 (13:59 +0200)] 
Fixed the date of changes of 1.1.1m

Fixed the date in the heading of "Changes between 1.1.1l and 1.1.1m" to 14 Dec 2021

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/17714)

2 years agoenc : add support for wrap mode
EasySec [Sat, 12 Feb 2022 01:07:34 +0000 (02:07 +0100)] 
enc : add support for wrap mode

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

2 years agoPrefix output to avoid random ok to confuse test parser
Armin Fuerst [Fri, 11 Feb 2022 18:46:12 +0000 (19:46 +0100)] 
Prefix output to avoid random ok to confuse test parser

Prefix output of generated dh parameters to avoid misinterpretation
of lines beginning with ok[^a-zA-Z0-9] as a testresult.

Also corrected indent and removed useless comma after last item.

Fixes #17480

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

2 years agoapps/s_server: Add missing check for BIO_new
Jiasheng Jiang [Wed, 16 Feb 2022 03:27:23 +0000 (11:27 +0800)] 
apps/s_server: Add missing check for BIO_new

As the potential failure of the BIO_new(), it should be better to check the return value and return error if fails in order to avoid the dereference of NULL pointer.
And because 'bio_s_msg' is checked before being used everytime, which has no need to add the check.
But 'bio_s_out' is not.
And since the check 'if (bio_s_out == NULL)' is redundant, it can be removed to make the code succincter.
Also the 'sbio' and so forth should be checked like the other places in the same file.

Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17710)

2 years agoapps/ocsp: Add check for OPENSSL_strdup
Jiasheng Jiang [Thu, 10 Feb 2022 07:41:40 +0000 (15:41 +0800)] 
apps/ocsp: Add check for OPENSSL_strdup

Just assert 'bn' to be non-NULL is not enough.
The check for 'itmp' is still needed.
If 'bn' is 0, the 'itmp' is assigned by OPENSSL_strdup().
Since OPENSSL_strdup() may fail because of the lack of memory,
the 'itmp' will be NULL and be an valid parameter hashed in
TXT_DB_get_by_index(), returning a wrong result.

Signed-off-by: Jiasheng Jiang <jiasheng@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/17677)

2 years agos_server: Add check for OPENSSL_strdup
Jiasheng Jiang [Wed, 9 Feb 2022 15:04:25 +0000 (23:04 +0800)] 
s_server: Add check for OPENSSL_strdup

Since the OPENSSL_strdup() may return NULL if allocation
fails, the 'port' could be NULL.
And then it will be used in do_server(), which can accept
NULL as an valid parameter.
That means that the system could run with a wrong parameter.
Therefore it should be better to check it, like the other
memory allocation.

Signed-off-by: Jiasheng Jiang <jiasheng@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/17673)

2 years agoAdd back check for the DH public key size
Tomas Mraz [Thu, 10 Feb 2022 10:49:37 +0000 (11:49 +0100)] 
Add back check for the DH public key size

This is needed for TLS-1.3.

Also add check for uncompressed point format for ECDHE as
the other formats are not allowed by RFC 8446.

Fixes #17667

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

2 years agoAdd define guards to avoid multi-inclusion
Weiguo Li [Wed, 9 Feb 2022 18:30:25 +0000 (02:30 +0800)] 
Add define guards to avoid multi-inclusion

This header files are included by multiple other headers.
It's better to add define guards to prevent multi-inclusion.
Adhere to the coding style, all preprocessor directives inside
the guards gain a space.

Signed-off-by: Weiguo Li <liwg06@foxmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/17666)

2 years agotest/helpers/handshake.c: Add check for OPENSSL_strdup
Jiasheng Jiang [Tue, 15 Feb 2022 02:46:38 +0000 (10:46 +0800)] 
test/helpers/handshake.c: Add check for OPENSSL_strdup

As the potential failure of the memory allocation, the OPENSSL_strdup()
could return NULL pointer and then be assigned to 'server_ctx'.
In order to tell the callers the failure of the configuration, it should
be better to return error.

Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
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/17705)

2 years agoForce macOS 10.15 or later to be 64-bit
Todd Short [Wed, 9 Feb 2022 20:59:37 +0000 (15:59 -0500)] 
Force macOS 10.15 or later to be 64-bit

macOS Catalina (10.15) no longer supports 32-bit applications.
Do not wait 5 seconds to give the user the option of using KERNEL_BITS=32
Do not accept the KERNEL_BITS=32 option

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