]> git.ipfire.org Git - thirdparty/openssl.git/log
thirdparty/openssl.git
3 years agoAdd more negative checks for integers passed to OPENSSL_malloc().
Shane Lontis [Mon, 12 Apr 2021 03:58:14 +0000 (13:58 +1000)] 
Add more negative checks for integers passed to OPENSSL_malloc().

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

3 years agoSipHash: Fix CTRL API for the digest size.
Pauli [Tue, 13 Apr 2021 02:11:41 +0000 (12:11 +1000)] 
SipHash: Fix CTRL API for the digest size.

Adds a mapping from "digestsize" to "size" for setting a param.

Fixes #14370

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

3 years agoGithub workflows: re-implement a no-shared build
Richard Levitte [Wed, 31 Mar 2021 05:59:48 +0000 (07:59 +0200)] 
Github workflows: re-implement a no-shared build

We do this both on Ubuntu and MacOS X

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/14753)

3 years agoAdd EVP_PKEY_todata() and EVP_PKEY_export() functions.
Shane Lontis [Thu, 8 Apr 2021 10:05:14 +0000 (20:05 +1000)] 
Add EVP_PKEY_todata() and EVP_PKEY_export() functions.

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

3 years agoAdd OID for mdc2WithRSASignature and remove related TODO 3.0
Tomas Mraz [Wed, 14 Apr 2021 14:35:28 +0000 (16:35 +0200)] 
Add OID for mdc2WithRSASignature and remove related TODO 3.0

Fixes #14366

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

3 years agoRename EVP_PKEY_get0_first_alg_name to EVP_PKEY_get0_type_name
Tomas Mraz [Wed, 14 Apr 2021 10:42:30 +0000 (12:42 +0200)] 
Rename EVP_PKEY_get0_first_alg_name to EVP_PKEY_get0_type_name

We use type elsewhere and documenting the 'first' in the
name of the call is a little bit superfluous making the
name too mouthful.

Also rename EVP_PKEY_typenames_do_all to
EVP_PKEY_type_names_do_all to keep the words separated by
underscore.

Fixes #14701

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

3 years agochanges: note that some ctrl calls have a different error return.
Pauli [Wed, 14 Apr 2021 02:26:41 +0000 (12:26 +1000)] 
changes: note that some ctrl calls have a different error return.

Providers do not distinguish between invalid and other errors via the return
code.

Fixes #14442

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

3 years agoDo not allow creating empty RSA keys by duplication
Tomas Mraz [Thu, 8 Apr 2021 17:27:06 +0000 (19:27 +0200)] 
Do not allow creating empty RSA keys by duplication

Also avoid crashing in rsa_get_params on empty keys.

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/14793)

3 years agoRemove keymgmt_copy function from the provider API
Tomas Mraz [Thu, 8 Apr 2021 17:02:44 +0000 (19:02 +0200)] 
Remove keymgmt_copy function from the provider API

It is superceded by the keymgmt_dup.

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/14793)

3 years agoAdd selection support to the provider keymgmt_dup function
Tomas Mraz [Thu, 8 Apr 2021 16:25:26 +0000 (18:25 +0200)] 
Add selection support to the provider keymgmt_dup function

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/14793)

3 years agoImplement provider-side keymgmt_dup function
Tomas Mraz [Wed, 7 Apr 2021 17:35:13 +0000 (19:35 +0200)] 
Implement provider-side keymgmt_dup function

To avoid mutating key data add OSSL_FUNC_KEYMGMT_DUP function
to the provider API and implement it for all asym-key key
managements.

Use it when copying everything to an empty EVP_PKEY
which is the case with EVP_PKEY_dup().

Fixes #14658

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/14793)

3 years ago80-test_cmp_http.t: Extend diagnostics of mock server launch
Dr. David von Oheimb [Sat, 3 Apr 2021 13:53:16 +0000 (15:53 +0200)] 
80-test_cmp_http.t: Extend diagnostics of mock server launch

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

3 years ago80-test_cmp_http.t: Silence check for availability of 'kill' and 'lsof' commands
Dr. David von Oheimb [Sat, 3 Apr 2021 12:28:17 +0000 (14:28 +0200)] 
80-test_cmp_http.t: Silence check for availability of 'kill' and 'lsof' commands

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

3 years ago80-test_cmp_http.t: Fix resumption when skipping after mock server launch failed
Dr. David von Oheimb [Sat, 3 Apr 2021 12:25:54 +0000 (14:25 +0200)] 
80-test_cmp_http.t: Fix resumption when skipping after mock server launch failed

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

3 years agoapps/cmp: Add generic random state options, e.g., for nonce generation
Dr. David von Oheimb [Sat, 3 Apr 2021 10:19:10 +0000 (12:19 +0200)] 
apps/cmp: Add generic random state options, e.g., for nonce generation

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

3 years agoopenssl-cmp.pod.in: Fix missing provider options description
Dr. David von Oheimb [Sat, 3 Apr 2021 11:08:16 +0000 (13:08 +0200)] 
openssl-cmp.pod.in: Fix missing provider options description

Also correct layout of engines description

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

3 years agocmp_util.c: Fix OSSL_CMP_log_open() in case OPENSSL_NO_TRACE
Dr. David von Oheimb [Sat, 3 Apr 2021 09:29:54 +0000 (11:29 +0200)] 
cmp_util.c: Fix OSSL_CMP_log_open() in case OPENSSL_NO_TRACE

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

3 years agoAPPS and TEST: Make sure prog name is set for usage output
Dr. David von Oheimb [Sat, 3 Apr 2021 12:05:09 +0000 (14:05 +0200)] 
APPS and TEST: Make sure prog name is set for usage output

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

3 years agoAPPS: make apps strict on app_RAND_load() and app_RAND_write() failure
Dr. David von Oheimb [Sat, 3 Apr 2021 10:53:51 +0000 (12:53 +0200)] 
APPS: make apps strict on app_RAND_load() and app_RAND_write() failure

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

3 years agoDocument the invariants for the empty X509_NAME encoding
Tomas Mraz [Mon, 12 Apr 2021 17:22:04 +0000 (19:22 +0200)] 
Document the invariants for the empty X509_NAME encoding

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

3 years agoX509_NAME_cmp: if canon_enclen is 0 for both names return 0
Tomas Mraz [Mon, 12 Apr 2021 07:58:27 +0000 (09:58 +0200)] 
X509_NAME_cmp: if canon_enclen is 0 for both names return 0

We do not care whether canon_enc is NULL in this case.

Fixes #14813

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

3 years agobio_printf: add \0 terminators for error returns in floating point conversions.
Pauli [Mon, 12 Apr 2021 21:47:31 +0000 (07:47 +1000)] 
bio_printf: add \0 terminators for error returns in floating point conversions.

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

3 years agobio: note that BIO_sprintf null terminates on insufficient space.
Pauli [Mon, 12 Apr 2021 03:52:19 +0000 (13:52 +1000)] 
bio: note that BIO_sprintf null terminates on insufficient space.

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

3 years agobio: add a malloc failed error to BIO_print
Pauli [Mon, 12 Apr 2021 01:36:50 +0000 (11:36 +1000)] 
bio: add a malloc failed error to BIO_print

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

3 years agoAdd some additional NULL checks to prevent segfaults.
Shane Lontis [Mon, 12 Apr 2021 01:19:21 +0000 (11:19 +1000)] 
Add some additional NULL checks to prevent segfaults.

Fixes #14809

PR #14752 attempted to pass the libctx, propq in a few places related to
X509 signing. There were a few places that needed additional NULL checks so that they behavethe same as they did before.

OCSP_basic_sign() was changed to call EVP_DigestSignInit_ex() which passed the parameter EVP_MD_name(dgst). Since dgst can be NULL EVP_MD_name() was segfaulting.
Adding an additional NULL check EVP_MD_name() resolves this issue.

The other NULL checks are required to produce errors rather than
segfaults if the certificate is NULL.

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

3 years agoAdd domain parameter match check for DH and ECDH key exchange.
Shane Lontis [Sun, 11 Apr 2021 23:06:24 +0000 (09:06 +1000)] 
Add domain parameter match check for DH and ECDH key exchange.

Fixes #14808

Validation checks were moved into EVP_PKEY_derive_set_peer() which broke
an external negative test. Originally the old code was semi working by checking the peers public key was in the range of other parties p. It was not actually ever
checking that the domain parameters were consistent between the 2
parties. It now checks the parameters match as well as validating the
peers public key.

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

3 years agoRemove a TODO(3.0) from X509_PUBKEY_set
Matt Caswell [Mon, 12 Apr 2021 14:52:05 +0000 (15:52 +0100)] 
Remove a TODO(3.0) from X509_PUBKEY_set

The comment talks about the EVP_PKEY that is contained within an
X509_PUBKEY object and whether it has to be exactly the same as the one
passed by the caller in X509_PUBKEY_set(). IMO it does, so the TODO should
be dropped.

Fixes #14378

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

3 years agocrypto: raise error on malloc failure
FdaSilvaYY [Wed, 28 Mar 2018 21:15:38 +0000 (23:15 +0200)] 
crypto: raise error on malloc failure
clean a few style nits.

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

3 years agonits: fix a few typo in template code
FdaSilvaYY [Sun, 6 May 2018 15:50:23 +0000 (17:50 +0200)] 
nits: fix a few typo in template code

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

3 years agodoc: Fix formatting
Jakub Wilk [Mon, 12 Apr 2021 10:41:27 +0000 (12:41 +0200)] 
doc: Fix formatting

CLA: trivial

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

3 years agoHandle set_alpn_protos inputs better.
Todd Short [Mon, 22 Mar 2021 16:56:36 +0000 (12:56 -0400)] 
Handle set_alpn_protos inputs better.

It's possible to set an invalid protocol list that will be sent in a
ClientHello. This validates the inputs to make sure this does not
happen.

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

3 years agoutil/wrap.pl: use the apps/openssl.cnf from the source tree
Dr. Matthias St. Pierre [Mon, 8 Feb 2021 23:16:55 +0000 (00:16 +0100)] 
util/wrap.pl: use the apps/openssl.cnf from the source tree

The `make install_fips` target failed

    msp@debian:~/src/openssl$ make install_fips
    *** Installing FIPS module
    install providers/fips.so -> /opt/openssl-dev/lib/ossl-modules/fips.so
    *** Installing FIPS module configuration
    fipsinstall /opt/openssl-dev/ssl/fipsmodule.cnf
    FATAL: Startup failure (dev note: apps_startup()) for ./apps/openssl
    ... No such file or directory:crypto/conf/conf_def.c:771:calling stat(fipsmodule.cnf)
    ...
    make: *** [Makefile:3341: install_fips] Error 1

because the `openssl fipsinstall` command was loading a previously installed
configuration file instead of the copy shipped with the source tree.

    msp@debian:~/src/openssl$ strace -f make install_fips |& grep openssl.cnf
    [pid 128683] openat(AT_FDCWD, "/opt/openssl-dev/ssl/openssl.cnf", O_RDONLY) = 3

This issue reveiled a more general problem, which applies to the tests as well:
unless openssl is installed, the openssl app must not use any preinstalled
configuration file. This holds in particular when the preinstalled configuration
file load providers, which caused the above failure.

The most consistent way to achieve this behaviour is to set the OPENSSL_CONF
environment variable to the correct location in the util/wrap.pl perl wrapper.

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

3 years agoapps: call ERR_print_errors when OSSL_PROVIDER_load fails
Petr Gotthard [Sat, 10 Apr 2021 09:08:58 +0000 (11:08 +0200)] 
apps: call ERR_print_errors when OSSL_PROVIDER_load fails

The ERR_print_errors often displays the reason why the provider
couldn't be loaded. Hence it is quite important for debugging.

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

3 years agoNote deprecated function/macros with no replacement.
Pauli [Mon, 12 Apr 2021 00:24:18 +0000 (10:24 +1000)] 
Note deprecated function/macros with no replacement.

These functions are deprecated with no replacement specified:

    DH_clear_flags, DH_get_1024_160, DH_get_2048_224, DH_get_2048_256,
    DH_set_flags, DH_test_flags, DSA_clear_flags, DSA_dup_DH,
    DSAparams_dup, DSA_set_flags, DSA_test_flags, RSA_blinding_off,
    RSA_blinding_on, RSA_clear_flags, RSA_get_version, RSAPrivateKey_dup,
    RSAPublicKey_dup, RSA_set_flags, RSA_setup_blinding and
    RSA_test_flags.

The flags that are going are:

    DH_FLAG_CACHE_MONT_P, DSA_FLAG_CACHE_MONT_P,
    RSA_FLAG_BLINDING, RSA_FLAG_CACHE_PRIVATE, RSA_FLAG_CACHE_PUBLIC,
    RSA_FLAG_EXT_PKEY, RSA_FLAG_NO_BLINDING, RSA_FLAG_THREAD_SAFE and
    RSA_METHOD_FLAG_NO_CHECK.

These two flags are "readable" via EVP_is_a().  They are not writable:

    DH_FLAG_TYPE_DHX and DH_FLAG_TYPE_DH.

Fixes #14616

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/14824)

3 years agoFix windows compiler error in kmac_prov.c
Shane Lontis [Tue, 13 Apr 2021 02:24:25 +0000 (12:24 +1000)] 
Fix windows compiler error in kmac_prov.c

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

3 years agoAdd FIPS Self test for AES_ECB decrypt
Shane Lontis [Mon, 12 Apr 2021 00:38:16 +0000 (10:38 +1000)] 
Add FIPS Self test for AES_ECB decrypt

Fixes #14807

Compliance with IG 9.4 requires that an inverse cipher function be
tested if one is implemented. Just running AES_GCM encrypt/decrypt does not meet this
requirement (Since only ECB, CBC, XTS, KW, KWP support the inverse
function during decryption mode).

Added a mode to the cipher test so that the AES_GCM only does an encrypt
and AES_ECB only does a decrypt. TDES still does both.

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

3 years agoRemove the function EVP_PKEY_set_alias_type
Matt Caswell [Thu, 8 Apr 2021 15:22:51 +0000 (16:22 +0100)] 
Remove the function EVP_PKEY_set_alias_type

OTC recently voted that EVP_PKEY types will be immutable in 3.0. This
means that EVP_PKEY_set_alias_type can no longer work and should be
removed entirely (applications will need to be rewritten not to use it).

It was primarily used for SM2 which no longer needs this call.
Applications should generate SM2 keys directly (without going via an EC
key first), or otherwise when loading keys they should automatically be
detected as SM2 keys.

Fixes #14379

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

3 years agoUpdate KTLS documentation
Matt Caswell [Wed, 7 Apr 2021 18:36:45 +0000 (19:36 +0100)] 
Update KTLS documentation

KTLS support has been changed to be off by default, and configuration is
via a single "option" rather two "modes". Documentation is updated
accordingly.

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

3 years agoOnly enable KTLS if it is explicitly configured
Matt Caswell [Wed, 7 Apr 2021 15:53:28 +0000 (16:53 +0100)] 
Only enable KTLS if it is explicitly configured

It has always been the case that KTLS is not compiled by default. However
if it is compiled then it was automatically used unless specifically
configured not to. This is problematic because it avoids any crypto
implementations from providers. A user who configures all crypto to use
the FIPS provider may unexpectedly find that TLS related crypto is actually
being performed outside of the FIPS boundary.

Instead we change KTLS so that it is disabled by default.

We also swap to using a single "option" (i.e. SSL_OP_ENABLE_KTLS) rather
than two separate "modes", (i.e. SSL_MODE_NO_KTLS_RX and
SSL_MODE_NO_KTLS_TX).

Fixes #13794

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

3 years agoAlways reset IV for CBC, OFB, and CFB mode on cipher context reinit
Tomas Mraz [Fri, 9 Apr 2021 10:01:16 +0000 (12:01 +0200)] 
Always reset IV for CBC, OFB, and CFB mode on cipher context reinit

This is necessary to keep compatibility with 1.1.1 implementation
of the CBC, OFB, and CFB mode ciphers.

Fixes #14704

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

3 years agoReplace OSSL_PARAM_BLD_free_params() with OSSL_PARAM_free().
Shane Lontis [Wed, 7 Apr 2021 03:45:19 +0000 (13:45 +1000)] 
Replace OSSL_PARAM_BLD_free_params() with OSSL_PARAM_free().

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

3 years agoAdd OSSL_PARAM_dup() and OSSL_PARAM_merge().
Shane Lontis [Wed, 7 Apr 2021 01:27:18 +0000 (11:27 +1000)] 
Add OSSL_PARAM_dup() and OSSL_PARAM_merge().

These functions are prerequisites for implementing EVP_PKEY_todata().

OSSL_PARAM_dup() is required to make a deep copy of the exported
params (since the provider export() uses a OSSL_PARAM_BLD which throws away the
data after the call), and then use OSSL_PARAM_merge() to add some additional params
that can be passed to the EVP_PKEY_todata().

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

3 years agokmac: update the documention for the customisation string maximum length
Pauli [Fri, 9 Apr 2021 06:36:18 +0000 (16:36 +1000)] 
kmac: update the documention for the customisation string maximum length

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/14810)

3 years agokmac: fix customistation string overflow bug
Pauli [Fri, 9 Apr 2021 06:20:15 +0000 (16:20 +1000)] 
kmac: fix customistation string overflow bug

Previously there was an off by two error allowing a stack buffer overrun.
Avoided this by allocating a correct sized buffer on the stack.  A side effect
is that the maximum size of the customisation string can be increased.

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/14810)

3 years agokmac: add long customisation string example
Pauli [Fri, 9 Apr 2021 05:20:16 +0000 (15:20 +1000)] 
kmac: add long customisation string example

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/14810)

3 years agoAdd additional KMAC error
Pauli [Sat, 10 Apr 2021 02:40:59 +0000 (12:40 +1000)] 
Add additional KMAC error

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/14810)

3 years agoapps: fix warning about size_t / int conversion
Armin Fuerst [Sat, 6 Mar 2021 11:19:18 +0000 (12:19 +0100)] 
apps: fix warning about size_t / int conversion

Windows builds show the following warning:
(..\apps\ca.c(2643): warning C4267: 'function': conversion
from 'size_t' to 'int', possible loss of data)

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

3 years agocrl2pkcs7 shouldn't include empty optional sets
Dave Coombs [Tue, 6 Apr 2021 16:49:21 +0000 (12:49 -0400)] 
crl2pkcs7 shouldn't include empty optional sets

If using crl2pkcs7 -nocrl and with no -certfiles, we shouldn't include
the implicitly tagged [0] certs and [1] crls sets as they are marked
optional and would be empty.

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

3 years agoFix typos in x509.pod
Nan Xiao [Wed, 7 Apr 2021 01:18:29 +0000 (09:18 +0800)] 
Fix typos in x509.pod

CLA: trivial

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

3 years agoSmall fixes and cleanups of provider API documentation
Tomas Mraz [Wed, 31 Mar 2021 11:22:25 +0000 (13:22 +0200)] 
Small fixes and cleanups of provider API documentation

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

3 years agoprovider-decoder.pod: Documentation of provider side decoder API
Tomas Mraz [Wed, 31 Mar 2021 11:20:21 +0000 (13:20 +0200)] 
provider-decoder.pod: Documentation of provider side decoder API

Fixes #13949

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

3 years agoFix typo in statem_clnt.c
Nan Xiao [Wed, 7 Apr 2021 09:10:25 +0000 (17:10 +0800)] 
Fix typo in statem_clnt.c

CLA: trivial

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

3 years agoInherit hostflags verify params even without hosts
Christian Heimes [Tue, 30 Mar 2021 10:02:42 +0000 (12:02 +0200)] 
Inherit hostflags verify params even without hosts

X509_VERIFY_PARAM_inherit() now copies hostflags independently of hosts.

Previously hostflags were only copied when at least one host was set.
Typically applications don't configure hosts on SSL_CTX. The change
enables applications to configure hostflags on SSL_CTX and have OpenSSL
copy the flags from SSL_CTX to SSL.

Fixes: https://github.com/openssl/openssl/issues/14579
Signed-off-by: Christian Heimes <christian@python.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14743)

3 years agod2i_PrivateKey_decoder(): Fix premature exit on unsuccessful OSSL_DECODER_CTX_new_for...
Dr. David von Oheimb [Thu, 25 Mar 2021 15:20:48 +0000 (16:20 +0100)] 
d2i_PrivateKey_decoder(): Fix premature exit on unsuccessful OSSL_DECODER_CTX_new_for_pkey()

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

3 years agoPEM_X509_INFO_read_bio_ex(): Generalize to allow parsing any type of private key
Dr. David von Oheimb [Mon, 22 Mar 2021 15:23:24 +0000 (16:23 +0100)] 
PEM_X509_INFO_read_bio_ex(): Generalize to allow parsing any type of private key

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

3 years agod2i_PrivateKey{,_ex}() and PEM_X509_INFO_read_bio_ex(): Fix handling of RSA/DSA/EC...
Dr. David von Oheimb [Mon, 22 Mar 2021 13:16:56 +0000 (14:16 +0100)] 
d2i_PrivateKey{,_ex}() and PEM_X509_INFO_read_bio_ex(): Fix handling of RSA/DSA/EC private key

This is needed to correct d2i_PrivateKey() after it was changed by commit 576892d78f80cf9a.

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

3 years agoPEM_X509_INFO_read,{_bio}_ex(): Complete documentation in PEM_X509_INFO_read_bio_ex.pod
Dr. David von Oheimb [Sat, 20 Mar 2021 22:32:15 +0000 (23:32 +0100)] 
PEM_X509_INFO_read,{_bio}_ex(): Complete documentation in PEM_X509_INFO_read_bio_ex.pod

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

3 years agoapps: fix Camellia CBC performance loop
Pauli [Wed, 7 Apr 2021 02:48:14 +0000 (12:48 +1000)] 
apps: fix Camellia CBC performance loop

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

3 years agoPrepare for 3.0 alpha 15
Matt Caswell [Thu, 8 Apr 2021 12:15:59 +0000 (13:15 +0100)] 
Prepare for 3.0 alpha 15

Reviewed-by: Tomas Mraz <tomas@openssl.org>
3 years agoPrepare for release of 3.0 alpha 14 openssl-3.0.0-alpha14
Matt Caswell [Thu, 8 Apr 2021 12:15:48 +0000 (13:15 +0100)] 
Prepare for release of 3.0 alpha 14

Reviewed-by: Tomas Mraz <tomas@openssl.org>
3 years agoUpdate copyright year
Matt Caswell [Thu, 8 Apr 2021 12:04:41 +0000 (13:04 +0100)] 
Update copyright year

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

3 years agoRemove a TODO in EVP_set_default_properties
Matt Caswell [Thu, 25 Mar 2021 17:05:49 +0000 (17:05 +0000)] 
Remove a TODO in EVP_set_default_properties

Fixes #14371

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

3 years agoUpdate the algorithm fetching documentation links
Matt Caswell [Thu, 25 Mar 2021 17:02:25 +0000 (17:02 +0000)] 
Update the algorithm fetching documentation links

The documentation on algorithm fetching has moved. There were a lot of
references to the old location so we update all of those locations.

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

3 years agoUpdate provider.pod
Matt Caswell [Thu, 25 Mar 2021 16:55:51 +0000 (16:55 +0000)] 
Update provider.pod

The previous commits moved some content out of provider.pod into other
pages, so that content is now removed. provider.pod is now exclusively
focussed on provider authors.

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

3 years agoAdd additional glossary entries
Matt Caswell [Thu, 25 Mar 2021 15:54:56 +0000 (15:54 +0000)] 
Add additional glossary entries

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

3 years agoExpand the libcrypto documentation
Matt Caswell [Wed, 24 Mar 2021 17:41:01 +0000 (17:41 +0000)] 
Expand the libcrypto documentation

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

3 years agocurve448: Integrate 64-bit reference implementation
Amitay Isaacs [Tue, 19 Jan 2021 03:14:25 +0000 (14:14 +1100)] 
curve448: Integrate 64-bit reference implementation

Signed-off-by: Amitay Isaacs <amitay@ozlabs.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14784)

3 years agoConfigure: Check if 128-bit integers are supported by compiler
Amitay Isaacs [Tue, 6 Apr 2021 02:52:44 +0000 (12:52 +1000)] 
Configure: Check if 128-bit integers are supported by compiler

Add a config variable "use_int128" to indicate if 128-bit integers are
supported or not at the configure time.  This makes it easier to
automatically select 64-bit versus 32-bit implementation for curve448.

Signed-off-by: Amitay Isaacs <amitay@ozlabs.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14784)

3 years agocurve448: Use constant time zero check function
Amitay Isaacs [Mon, 1 Feb 2021 05:22:16 +0000 (16:22 +1100)] 
curve448: Use constant time zero check function

Signed-off-by: Amitay Isaacs <amitay@ozlabs.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14784)

3 years agoAdd a constant time zero check function for 64-bit integers
Amitay Isaacs [Mon, 1 Feb 2021 05:20:12 +0000 (16:20 +1100)] 
Add a constant time zero check function for 64-bit integers

Signed-off-by: Amitay Isaacs <amitay@ozlabs.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14784)

3 years agocurve448: Remove the unrolled loop version
Amitay Isaacs [Tue, 19 Jan 2021 03:05:24 +0000 (14:05 +1100)] 
curve448: Remove the unrolled loop version

Signed-off-by: Amitay Isaacs <amitay@ozlabs.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14784)

3 years agocurve448: Use NLIMBS where appropriate to simplify the code
Amitay Isaacs [Mon, 29 Mar 2021 06:26:41 +0000 (17:26 +1100)] 
curve448: Use NLIMBS where appropriate to simplify the code

Signed-off-by: Amitay Isaacs <amitay@ozlabs.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14784)

3 years agocurve448: Modernise reference 64-bit code
Amitay Isaacs [Tue, 19 Jan 2021 03:04:48 +0000 (14:04 +1100)] 
curve448: Modernise reference 64-bit code

Signed-off-by: Amitay Isaacs <amitay@ozlabs.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14784)

3 years agocurve448: Rename arch_ref64 to arch_64
Amitay Isaacs [Tue, 19 Jan 2021 02:52:52 +0000 (13:52 +1100)] 
curve448: Rename arch_ref64 to arch_64

Signed-off-by: Amitay Isaacs <amitay@ozlabs.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14784)

3 years agoPartially Revert "Remove curve448 architecture specific files"
Amitay Isaacs [Tue, 19 Jan 2021 02:50:18 +0000 (13:50 +1100)] 
Partially Revert "Remove curve448 architecture specific files"

This reverts commit 7e492f3372ed83af074a63d5920f13de7e3455b6.

This brings back the 64-bit reference implementation for curve448.

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

3 years agocurve448: Use relative includes to avoid explicit dependencies
Amitay Isaacs [Mon, 29 Mar 2021 08:08:58 +0000 (19:08 +1100)] 
curve448: Use relative includes to avoid explicit dependencies

Signed-off-by: Amitay Isaacs <amitay@ozlabs.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14784)

3 years agoUse numbers definition of int128_t and uint128_t
Amitay Isaacs [Mon, 29 Mar 2021 07:20:53 +0000 (18:20 +1100)] 
Use numbers definition of int128_t and uint128_t

Signed-off-by: Amitay Isaacs <amitay@ozlabs.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14784)

3 years agonumbers: Define 128-bit integers if compiler supports
Amitay Isaacs [Mon, 29 Mar 2021 07:06:13 +0000 (18:06 +1100)] 
numbers: Define 128-bit integers if compiler supports

Signed-off-by: Amitay Isaacs <amitay@ozlabs.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14784)

3 years agotest: add extra secure memory test case.
Pauli [Tue, 6 Apr 2021 23:05:05 +0000 (09:05 +1000)] 
test: add extra secure memory test case.

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

3 years agoparam_build: check for the usage of secure memory better.
Pauli [Tue, 6 Apr 2021 22:48:59 +0000 (08:48 +1000)] 
param_build: check for the usage of secure memory better.

The param build now checks the string types and locates them in secure memory
if the original string is.

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

3 years agoRevert "Fix AES-CBC perf test failure issue"
Pauli [Thu, 8 Apr 2021 02:26:08 +0000 (12:26 +1000)] 
Revert "Fix AES-CBC perf test failure issue"

This reverts commit bec9289143c955b330a8f9ad32f26f3da76e2685.

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

3 years agoproperty: lock the lib ctx when updating the property definition cache
Pauli [Wed, 7 Apr 2021 01:32:59 +0000 (11:32 +1000)] 
property: lock the lib ctx when updating the property definition cache

Although the store being used is adequately and properly locked, the library
context is not.  Due to the mechanisms used for fetching, it is possible for
multiple stores to live within the same library context for short periods.
This fix prevents threading issues resulting from such coincidences.

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

3 years agotest: fix problem with threads test using default library context.
Pauli [Tue, 30 Mar 2021 02:27:44 +0000 (12:27 +1000)] 
test: fix problem with threads test using default library context.

Also add a new test that deliberately tests the default library context.

Fixes #14720

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

3 years agoproperty: check return values from the property locking calls.
Pauli [Tue, 30 Mar 2021 00:29:01 +0000 (10:29 +1000)] 
property: check return values from the property locking calls.

A failure to obtain a lock would have resulted in much badness, now it results
in a failure return.

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

3 years agoapps: fix AES CBC performance loop
Pauli [Tue, 6 Apr 2021 12:26:25 +0000 (22:26 +1000)] 
apps: fix AES CBC performance loop

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

3 years agoFix more certificate related lib_ctx settings.
Shane Lontis [Wed, 31 Mar 2021 05:10:22 +0000 (15:10 +1000)] 
Fix more certificate related lib_ctx settings.

Fixes #13732

Fix a few places that were not using the '_ex' variants of
ASN1_item_sign/verify.

Added X509_CRL_new_ex().

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

3 years agofix coverity 1466710: resource leak
Pauli [Sun, 21 Mar 2021 22:37:56 +0000 (08:37 +1000)] 
fix coverity 1466710: resource leak

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

3 years agodh: fix coverity 1473238: argument cannot be negative
Pauli [Fri, 19 Mar 2021 04:54:40 +0000 (14:54 +1000)] 
dh: fix coverity 1473238: argument cannot be negative

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

3 years agoevp: fix coverity 1473631: argument cannot be negative
Pauli [Fri, 19 Mar 2021 04:50:43 +0000 (14:50 +1000)] 
evp: fix coverity 1473631: argument cannot be negative

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

3 years agoevp: fix coverity 1451509: argument cannot be negative
Pauli [Fri, 19 Mar 2021 04:50:28 +0000 (14:50 +1000)] 
evp: fix coverity 1451509: argument cannot be negative

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

3 years agoevp: fix coverity 1451510: argument cannot be negative
Pauli [Fri, 19 Mar 2021 04:50:11 +0000 (14:50 +1000)] 
evp: fix coverity 1451510: argument cannot be negative

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

3 years agoevp: fix coverity 1472682: argument cannot be negative
Pauli [Fri, 19 Mar 2021 04:49:57 +0000 (14:49 +1000)] 
evp: fix coverity 1472682: argument cannot be negative

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

3 years agotest: fix coverity 1473234 & 1473239: argument cannot be negative
Pauli [Fri, 19 Mar 2021 04:49:42 +0000 (14:49 +1000)] 
test: fix coverity 1473234 & 1473239: argument cannot be negative

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

3 years agotest/recipes/02-test_errstr.t: Do not test negative system error codes
Richard Levitte [Tue, 6 Apr 2021 13:30:38 +0000 (15:30 +0200)] 
test/recipes/02-test_errstr.t: Do not test negative system error codes

It's been deemed unlikely that these will end up in OpenSSL error
records, so we simply don't test them if they happen to be among the
error codes that perl has support for.

Fixes #14763

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

3 years agotest: fix coverity 1475940: negative return
Pauli [Sun, 4 Apr 2021 08:00:26 +0000 (18:00 +1000)] 
test: fix coverity 1475940: negative return

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

3 years agotest: fix coverity 1475941: resource leak
Pauli [Sun, 4 Apr 2021 07:58:32 +0000 (17:58 +1000)] 
test: fix coverity 1475941: resource leak

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

3 years agoDisallow ASN.1 enumerated types to be treated as strings.
Pauli [Tue, 6 Apr 2021 00:23:12 +0000 (10:23 +1000)] 
Disallow ASN.1 enumerated types to be treated as strings.

They are actually integers.

Problem reported by: Scott McPeak <scott.g.mcpeak@gmail.com>

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

3 years agoRemove locking in CRYPTO_secure_allocated()
Pauli [Tue, 6 Apr 2021 02:25:58 +0000 (12:25 +1000)] 
Remove locking in CRYPTO_secure_allocated()

The check for being in secure memory is against the arena.  The arena is only
ever modified by sh_init() and sh_done() and in both cases, it is done without
locking.  Thus, it is safe for the CRYPTO_secure_allocated() to not lock.

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

3 years agoMake the lock in CRYPTO_secure_allocated() a read lock
Pauli [Tue, 6 Apr 2021 02:24:06 +0000 (12:24 +1000)] 
Make the lock in CRYPTO_secure_allocated() a read lock

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

3 years agoFix AES-CBC perf test failure issue
Fangming.Fang [Fri, 2 Apr 2021 11:17:05 +0000 (11:17 +0000)] 
Fix AES-CBC perf test failure issue

As ossl_cipher_generic dosen't support to set key length, and
"openssl speed aes-(128|192|256)-cbc" tests fail. A small fix by
adding OSSL_CIPHER_PARAM_KEYLEN params.

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