openssl.git
3 years agoGithub CI: run also on repository pushes
Tomas Mraz [Wed, 16 Dec 2020 08:39:31 +0000 (09:39 +0100)]
Github CI: run also on repository pushes

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

3 years agoAdd necessary checks of OPENSSL_NO_DH, OPENSSL_NO_DSA and OPENSSL_NO_EC
Richard Levitte [Wed, 2 Dec 2020 17:30:55 +0000 (18:30 +0100)]
Add necessary checks of OPENSSL_NO_DH, OPENSSL_NO_DSA and OPENSSL_NO_EC

When OpenSSL is configured with 'no-dh', 'no-dsa' and 'no-ec'
combined, some static functions have no use, which the compiler may
complain about.  We therefore add extra guards to silence it.

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

3 years agoDrop unnecessary checks of OPENSSL_NO_DH, OPENSSL_NO_DSA and OPENSSL_NO_EC
Richard Levitte [Wed, 2 Dec 2020 17:27:03 +0000 (18:27 +0100)]
Drop unnecessary checks of OPENSSL_NO_DH, OPENSSL_NO_DSA and OPENSSL_NO_EC

The apps, the CMS library and the X.509 library are primarly affected.

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

3 years agoEVP_PKEY & EC_KEY: Make EC EVP_PKEY_CTX parameter ctrls / setters more available
Richard Levitte [Tue, 1 Dec 2020 18:21:04 +0000 (19:21 +0100)]
EVP_PKEY & EC_KEY: Make EC EVP_PKEY_CTX parameter ctrls / setters more available

EVP_PKEY_CTX_set_ec_ functions were only available when EC was enabled
('no-ec' not configured).  However, that makes it impossible to use
these functions with an engine or a provider that happens to implement
EC_KEY.  This change solves that problem by shuffling these functions
to more appropriate places.

Partially fixes #13550

squash! EVP_PKEY & EC_KEY: Make EC EVP_PKEY_CTX parameter ctrls / setters more available

By consequence, there are a number of places where we can remove the
check of OPENSSL_NO_EC.  This requires some re-arrangements of
internal tables to translate between numeric identities and names.

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

3 years agoEVP_PKEY & DH: Make DH EVP_PKEY_CTX parameter ctrls / setters more available
Richard Levitte [Tue, 1 Dec 2020 18:11:59 +0000 (19:11 +0100)]
EVP_PKEY & DH: Make DH EVP_PKEY_CTX parameter ctrls / setters more available

EVP_PKEY_CTX_set_dh_ functions were only available when DH was enabled
('no-dsa' not configured).  However, that makes it impossible to use
these functions with an engine or a provider that happens to implement
DH.  This change solves that problem by shuffling these functions to
more appropriate places.

By consequence, there are a number of places where we can remove the
check of OPENSSL_NO_DH.  This requires some re-arrangements of
internal tables to translate between numeric identities and names.

Partially fixes #13550

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

3 years agoEVP_PKEY & DSA: move dsa_ctrl.c to be included only on libcrypto
Richard Levitte [Tue, 1 Dec 2020 18:09:39 +0000 (19:09 +0100)]
EVP_PKEY & DSA: move dsa_ctrl.c to be included only on libcrypto

These functions aren't used by the FIPS module, so there's no reason
to include it there.

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

3 years agoPROV: Add MSBLOB and PVK encoders
Richard Levitte [Wed, 9 Dec 2020 10:54:56 +0000 (11:54 +0100)]
PROV: Add MSBLOB and PVK encoders

This allows 15-test_rsa.t to succeed, and provides the same OSSL_ENCODER
support for these formats as for all other formats supported in OpenSSL.

Fixes #13379

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

3 years agoTEST: Fix test/recipes/15-test_rsa.t
Richard Levitte [Wed, 9 Dec 2020 10:30:10 +0000 (11:30 +0100)]
TEST: Fix test/recipes/15-test_rsa.t

Perl strings should be compared with 'eq', not '=='.
This only generates a perl warning, so wasn't immediately noticed.

Also, remove the check of disabled 'dsa'.  That never made reak sense.

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

3 years agoAPPS: Correct the output structure for public keys in 'openssl rsa'
Richard Levitte [Wed, 9 Dec 2020 10:28:35 +0000 (11:28 +0100)]
APPS: Correct the output structure for public keys in 'openssl rsa'

'openssl rsa' would output a PKCS#1 structure when asked for a
SubjectPublicKeyInfo and vice versa.

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

3 years agoCheck non-option arguments
Rich Salz [Sat, 28 Nov 2020 21:12:58 +0000 (16:12 -0500)]
Check non-option arguments

Make sure all commands check to see if there are any "extra" arguments
after the options, and print an error if so.

Made all error messages consistent (which is to say, minimal).

Fixes: #13527
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/13563)

3 years agotest: document the random test ordering env variable
Pauli [Sat, 12 Dec 2020 11:38:17 +0000 (21:38 +1000)]
test: document the random test ordering env variable

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

3 years agotest: print OPENSSL_TEST_RAND_ORDER=x when a randomised test fails.
Pauli [Sat, 12 Dec 2020 11:25:40 +0000 (21:25 +1000)]
test: print OPENSSL_TEST_RAND_ORDER=x when a randomised test fails.

The previous message "random seed x" is a lot less descriptive.

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

3 years agoDocument OCSP_REQ_CTX_i2d.
Rich Salz [Fri, 11 Dec 2020 19:18:46 +0000 (14:18 -0500)]
Document OCSP_REQ_CTX_i2d.

Based on comments from David von Oheimb.

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

3 years agoDeprecate OCSP_REQ_CTX_set1_req
Rich Salz [Sat, 5 Dec 2020 15:42:18 +0000 (10:42 -0500)]
Deprecate OCSP_REQ_CTX_set1_req

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

3 years agoSkip tests depending on deprecated list -*-commands options
Dmitry Belyavskiy [Sat, 12 Dec 2020 05:23:20 +0000 (06:23 +0100)]
Skip tests depending on deprecated list -*-commands options

Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/13669)

3 years agoDocumenting the options deprecating in CHANGES.md
Dmitry Belyavskiy [Fri, 11 Dec 2020 05:15:04 +0000 (06:15 +0100)]
Documenting the options deprecating in CHANGES.md

Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/13669)

3 years agoDocumenting the options deprecating
Dmitry Belyavskiy [Fri, 11 Dec 2020 05:13:41 +0000 (06:13 +0100)]
Documenting the options deprecating

Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/13669)

3 years agoSkip unavailable digests and ciphers in -*-commands
Dmitry Belyavskiy [Fri, 11 Dec 2020 02:15:09 +0000 (03:15 +0100)]
Skip unavailable digests and ciphers in -*-commands

Fixes #13594

Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/13669)

3 years agoDeprecate -cipher-commands and -digest-commands options
Dmitry Belyavskiy [Fri, 11 Dec 2020 00:31:30 +0000 (01:31 +0100)]
Deprecate -cipher-commands and -digest-commands options

Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/13669)

3 years agoOPENSSL_NO_GOST has nothing to do with low-level algos
Dmitry Belyavskiy [Fri, 11 Dec 2020 00:23:02 +0000 (01:23 +0100)]
OPENSSL_NO_GOST has nothing to do with low-level algos

Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/13669)

3 years agoConfigurations: PowerPC is big endian
Sebastian Andrzej Siewior [Sun, 5 Jul 2020 18:52:39 +0000 (20:52 +0200)]
Configurations: PowerPC is big endian

Define B_ENDIAN on PowerPC because it is a big endian architecture. With
this change the BN* related tests pass.

Fixes: #12199
Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/12371)

3 years agoChange AES-CTS modes CS2 and CS3 to also be inside the fips module.
Shane Lontis [Wed, 9 Dec 2020 02:32:47 +0000 (12:32 +1000)]
Change AES-CTS modes CS2 and CS3 to also be inside the fips module.

The initial thought was that only CS1 mode (the NIST variant) was allowed.
The lab has asked if these other modes should be included.
The algorithm form indicates that these are able to be validated.

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

3 years agoFix Segfault in EVP_PKEY_CTX_dup when the ctx has an undefined operation.
Shane Lontis [Wed, 25 Nov 2020 05:21:52 +0000 (15:21 +1000)]
Fix Segfault in EVP_PKEY_CTX_dup when the ctx has an undefined operation.

Fixes #12438

Note: This worked in 1.1.1 so just returning an error is not valid.

Reviewed-by: Ben Kaduk <kaduk@mit.edu>
(Merged from https://github.com/openssl/openssl/pull/13505)

3 years agoFix no-threads
Matt Caswell [Wed, 9 Dec 2020 16:26:29 +0000 (16:26 +0000)]
Fix no-threads

Make OPENSSL_fork_prepare() et al always available even in a no-threads
build. These functions are no-ops anyway so this shouldn't make any
difference.

This fixes an issue where the symbol_presence test fails in a no-threads
build. This is because these functions have not been marked in
libcrypto.num as being dependent on thread support. Enclosing the
declarations of the functions in the header with an appropriate guard
does not help because we never define OPENSSL_NO_THREADS (we define the
opposite OPENSSL_THREADS). This confuses the scripts which only consider
OPENSSL_NO_* guards. The simplest solution is to just make them always
available.

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

3 years agoopenssl.pod: Fix openSSL options doc
Ankita Shetty [Wed, 9 Dec 2020 20:56:51 +0000 (21:56 +0100)]
openssl.pod: Fix openSSL options doc

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
(Merged from https://github.com/openssl/openssl/pull/13651)

3 years agoRemove unnecessary guards around MSBLOB and PVK readers and writers
Richard Levitte [Wed, 9 Dec 2020 16:50:20 +0000 (17:50 +0100)]
Remove unnecessary guards around MSBLOB and PVK readers and writers

The OPENSSL_NO_RC4 guard remain around protected PVK tests in
test/endecoder_test.c.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/13648)

3 years agoPEM: Unlock MSBLOB and PVK functions from 'no-dsa' and 'no-rc4'
Richard Levitte [Wed, 9 Dec 2020 16:30:01 +0000 (17:30 +0100)]
PEM: Unlock MSBLOB and PVK functions from 'no-dsa' and 'no-rc4'

All these functions are usable with RSA keys, there's no reason why
they should be unaccessible when DSA or RC4 are disabled.

When DSA is disabled, it's not possible to use these functions for
DSA EVP_PKEYs.  That's fine, and supported.

When RC4 is disabled, it's not possible to use these functions to
write encrypted PVK output.  That doesn't even depend on the
definition of OPENSSL_NO_RC4, but if the RC4 algorithm is accessible
via EVP, something that isn't known when building libcrypto.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/13648)

3 years agoBuilding: Fix the library file names for MSVC builds to include multilib
Richard Levitte [Fri, 11 Dec 2020 15:25:13 +0000 (16:25 +0100)]
Building: Fix the library file names for MSVC builds to include multilib

In OpenSSL 1.1.1, VC-WIN64I and VC-WIN64A have a 'multilib' attribute
set, which affect the names of the produced libcrypto and libssl DLLs.
This restores that for OpenSSL 3.0.

Fixes #13659

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

3 years agoDOCS: Improve documentation of the EVP_PKEY type
Richard Levitte [Mon, 7 Dec 2020 11:28:57 +0000 (12:28 +0100)]
DOCS: Improve documentation of the EVP_PKEY type

This type was previously described in a note, which is hard to find
unless you already know where to look.

This change makes the description more prominent, and allows indexing
by adding it in the NAMES section.

The EVP_PKEY description is altered to conceptually allow an EVP_PKEY
to contain a private key without a corresponding public key.  This is
related to an OTC vote:

https://mta.openssl.org/pipermail/openssl-project/2020-December/002474.html

The description of EVP_PKEY for MAC purposes is amended to fit.

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/13629)

3 years agoparams: add integer conversion test cases.
Pauli [Fri, 11 Dec 2020 00:23:19 +0000 (10:23 +1000)]
params: add integer conversion test cases.

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

3 years agoparams: allow more variations in integer conversions.
Pauli [Fri, 11 Dec 2020 00:21:44 +0000 (10:21 +1000)]
params: allow more variations in integer conversions.

Allow any sized integer to be converted to any other size integer via the
helpers.

Support for converting reals to/from integers remains restricted.

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

3 years agoDOCS: Update OSSL_DECODER_CTX_new_by_EVP_PKEY.pod to match declarations
Richard Levitte [Tue, 1 Dec 2020 09:42:53 +0000 (10:42 +0100)]
DOCS: Update OSSL_DECODER_CTX_new_by_EVP_PKEY.pod to match declarations

Fixes #13441

We're also starting on a glossary, doc/man7/openssl-glossary.pod,
where terms we use should be explained.  There's no need to explain
terms as essays, but at least a few quick lines, and possibly a
reference to some external documentation.

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

3 years agoFix some typos in EVP_PKEY-DH.pod
Matt Caswell [Wed, 9 Dec 2020 10:40:56 +0000 (10:40 +0000)]
Fix some typos in EVP_PKEY-DH.pod

A missing newline messes up how the code sample is rendered. Also a few
miscellaneous typos are fixed.

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

3 years agoSkip cms tests using RC2 if no legacy provider
Matt Caswell [Wed, 2 Dec 2020 13:19:52 +0000 (13:19 +0000)]
Skip cms tests using RC2 if no legacy provider

Fixes #12510

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

3 years agoDon't run a legacy specific PKCS12 test if no legacy provider
Matt Caswell [Wed, 2 Dec 2020 13:16:33 +0000 (13:16 +0000)]
Don't run a legacy specific PKCS12 test if no legacy provider

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

3 years agoDon't use the legacy provider in test_store if its not available
Matt Caswell [Wed, 2 Dec 2020 13:09:28 +0000 (13:09 +0000)]
Don't use the legacy provider in test_store if its not available

If we don't have the legacy provider then we avoid having to use it.

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

3 years agoDon't load the legacy provider in test_evp_libctx unnecessarily
Matt Caswell [Wed, 2 Dec 2020 13:01:54 +0000 (13:01 +0000)]
Don't load the legacy provider in test_evp_libctx unnecessarily

We don't need the legacy provider, so don't load it. This avoids
problems in a no-legacy build

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

3 years agoDon't load the legacy provider if not available in test_enc_more
Matt Caswell [Wed, 2 Dec 2020 12:56:16 +0000 (12:56 +0000)]
Don't load the legacy provider if not available in test_enc_more

If the legacy provider isn't available then we shouldn't attempt to
load or use it.

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

3 years agoSkip testing ciphers in the legacy provider if no legacy
Matt Caswell [Wed, 2 Dec 2020 12:45:47 +0000 (12:45 +0000)]
Skip testing ciphers in the legacy provider if no legacy

test_enc should not test ciphers that are not available due to a lack
of the legacy provider

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

3 years agoDon't load the legacy provider in endecoder_legacy_test
Matt Caswell [Wed, 2 Dec 2020 12:28:31 +0000 (12:28 +0000)]
Don't load the legacy provider in endecoder_legacy_test

In spite of the name the endecoder_legacy_test does not need the
legacy provider. Therefore we avoid loading it so that no-legacy
builds still run the test successfully.

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

3 years agoDon't use legacy provider if not available in test_ssl_old
Matt Caswell [Wed, 2 Dec 2020 12:23:37 +0000 (12:23 +0000)]
Don't use legacy provider if not available in test_ssl_old

If we've been configured with no-legacy then we should not attempt to
load the legacy provider.

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

3 years agoFix sslapitest.c if built with no-legacy
Matt Caswell [Wed, 2 Dec 2020 12:03:31 +0000 (12:03 +0000)]
Fix sslapitest.c if built with no-legacy

We skip a test that uses the no-legacy option. Unfortuantely there is
no OPENSSL_NO_LEGACY to test, so we just check whether we were successful
in loading the legacy provider - and if not we skip the test.

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

3 years agoSkip evp_test cases where we need the legacy prov and its not available
Matt Caswell [Wed, 2 Dec 2020 11:56:31 +0000 (11:56 +0000)]
Skip evp_test cases where we need the legacy prov and its not available

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

3 years agoDon't use no-asm in the Github CIs
Matt Caswell [Thu, 3 Dec 2020 15:23:00 +0000 (15:23 +0000)]
Don't use no-asm in the Github CIs

no-asm has proven to be too slow, therefore we don't use it in the Github
CI builds and instead rely on it being covered by run-checker.

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

3 years agoAdd fips self tests for all included kdf
Shane Lontis [Mon, 23 Nov 2020 04:55:48 +0000 (14:55 +1000)]
Add fips self tests for all included kdf

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

3 years agoAdd validate method to ECX keymanager
Shane Lontis [Fri, 20 Nov 2020 09:14:14 +0000 (19:14 +1000)]
Add validate method to ECX keymanager

Fixes #11619

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

3 years agoapps/{ca,req,x509}.c: Improve diag and doc mostly on X.509 extensions, fix multiple...
Dr. David von Oheimb [Mon, 7 Dec 2020 18:37:46 +0000 (19:37 +0100)]
apps/{ca,req,x509}.c: Improve diag and doc mostly on X.509 extensions, fix multiple instances

This includes a general correction in the code (now using the X509V3_CTX_REPLACE flag)
and adding a prominent clarification in the documentation:

    If multiple entries are processed for the same extension name,
    later entries override earlier ones with the same name.

This is due to an RFC 5280 requirement - the intro of its section 4.2 says:

    A certificate MUST NOT include more than one instance of a particular extension.

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

3 years agoopenssl_hexstr2buf_sep(): Prevent misleading 'malloc failure' errors on short input
Dr. David von Oheimb [Mon, 7 Dec 2020 17:25:10 +0000 (18:25 +0100)]
openssl_hexstr2buf_sep(): Prevent misleading 'malloc failure' errors on short input

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

3 years agov2i_AUTHORITY_KEYID(): Correct out-of-memory behavior and avoid mem leaks
Dr. David von Oheimb [Mon, 7 Dec 2020 16:45:09 +0000 (17:45 +0100)]
v2i_AUTHORITY_KEYID(): Correct out-of-memory behavior and avoid mem leaks

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

3 years agoX509V3_EXT_add_nconf_sk(): Improve description and use of 'sk' arg, which may be...
Dr. David von Oheimb [Mon, 7 Dec 2020 12:28:39 +0000 (13:28 +0100)]
X509V3_EXT_add_nconf_sk(): Improve description and use of 'sk' arg, which may be NULL

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

3 years agoopenssl-ca.pod.in: Clarify the -extensions/-crlexts options vs. x509_extensions/crl_e...
Dr. David von Oheimb [Mon, 7 Dec 2020 12:25:34 +0000 (13:25 +0100)]
openssl-ca.pod.in: Clarify the -extensions/-crlexts options vs. x509_extensions/crl_extensions

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

3 years agoapps/x509.c: Factor out common aspects of X509 signing
Dr. David von Oheimb [Fri, 4 Dec 2020 11:42:24 +0000 (12:42 +0100)]
apps/x509.c: Factor out common aspects of X509 signing

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

3 years agoapps/{req,x509,ca}.c: Cleanup: move shared X509{,_REQ,_CRL} code to apps/lib/apps.c
Dr. David von Oheimb [Fri, 4 Dec 2020 10:09:29 +0000 (11:09 +0100)]
apps/{req,x509,ca}.c: Cleanup: move shared X509{,_REQ,_CRL} code to apps/lib/apps.c

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

3 years agoapps/{req,x509,ca}.c: Clean up code setting X.509 cert version v3
Dr. David von Oheimb [Fri, 4 Dec 2020 10:01:08 +0000 (11:01 +0100)]
apps/{req,x509,ca}.c: Clean up code setting X.509 cert version v3

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

3 years agox509v3_config.pod: Clarify semantics of subjectKeyIdentifier and authorityKeyIdentifier
Dr. David von Oheimb [Fri, 4 Dec 2020 08:26:25 +0000 (09:26 +0100)]
x509v3_config.pod: Clarify semantics of subjectKeyIdentifier and authorityKeyIdentifier

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

3 years agoapps/req.c: Improve diagnostics on multiple/overriding X.509 extensions defined via...
Dr. David von Oheimb [Thu, 3 Dec 2020 16:09:20 +0000 (17:09 +0100)]
apps/req.c: Improve diagnostics on multiple/overriding X.509 extensions defined via -reqext option

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

3 years agoUse adapted test_get_libctx() for simpler test setup and better error reporting
Dr. David von Oheimb [Sat, 26 Sep 2020 13:21:48 +0000 (15:21 +0200)]
Use adapted test_get_libctx() for simpler test setup and better error reporting

Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/13001)

3 years agoRead MIDR_EL1 system register on aarch64
Fangming.Fang [Tue, 28 Apr 2020 02:33:50 +0000 (02:33 +0000)]
Read MIDR_EL1 system register on aarch64

MIDR_EL1 system register exposes microarchitecture information so that
people can make micro-arch related optimization such as exposing as
much instruction level parallelism as possible.

MIDR_EL1 register can be read only if HWCAP_CPUID feature is supported.

Change-Id: Iabb8a36c5d31b184dba6399f378598058d394d4e

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/11744)

3 years agoTest that we can negotiate TLSv1.3 if we have an SNI callback
Matt Caswell [Tue, 3 Nov 2020 15:51:23 +0000 (15:51 +0000)]
Test that we can negotiate TLSv1.3 if we have an SNI callback

If an SNI callback has been set then we may have no certificuates suitable
for TLSv1.3 use configured for the current SSL_CTX. This should not prevent
us from negotiating TLSv1.3, since we may change the SSL_CTX by the time we
need a suitable certificate.

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

3 years agoModify is_tls13_capable() to take account of the servername cb
Matt Caswell [Tue, 3 Nov 2020 14:01:46 +0000 (14:01 +0000)]
Modify is_tls13_capable() to take account of the servername cb

A servername cb may change the available certificates, so if we have one
set then we cannot rely on the configured certificates to determine if we
are capable of negotiating TLSv1.3 or not.

Fixes #13291

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

3 years agov3nametest: Make the gennames structure static
Tomas Mraz [Tue, 8 Dec 2020 16:45:32 +0000 (17:45 +0100)]
v3nametest: Make the gennames structure static

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

3 years agoFix typo in OPENSSL_malloc.pod
Nan Xiao [Tue, 8 Dec 2020 04:35:31 +0000 (12:35 +0800)]
Fix typo in OPENSSL_malloc.pod

CLA: trivial

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

3 years agorand: allow seed-src to be missing
Pauli [Wed, 9 Dec 2020 09:55:08 +0000 (19:55 +1000)]
rand: allow seed-src to be missing

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

3 years agorand: don't leak memory
Pauli [Wed, 9 Dec 2020 11:43:21 +0000 (21:43 +1000)]
rand: don't leak memory

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

3 years agorand seed: include lock and unlock functions.
Pauli [Wed, 9 Dec 2020 09:39:27 +0000 (19:39 +1000)]
rand seed: include lock and unlock functions.

This satisfies EVP's RAND layer.

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

3 years agoFix error clash in build
Pauli [Wed, 9 Dec 2020 04:29:44 +0000 (14:29 +1000)]
Fix error clash in build

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

3 years agorand: add a provider side seed source.
Pauli [Thu, 19 Nov 2020 22:45:34 +0000 (08:45 +1000)]
rand: add a provider side seed source.

This allows the operating system sources that OpenSSL supports to be
used directly as RNGs.  It also allows DRBG seeding to be explicitly
specified rather than being left to a fall back case.

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

3 years agoTLS: Use EVP_PKEY_get_group_name() to get the group name
Richard Levitte [Wed, 18 Nov 2020 09:43:50 +0000 (10:43 +0100)]
TLS: Use EVP_PKEY_get_group_name() to get the group name

For the moment, we translate the result to a NID, because that's still
used in several locations in libssl.  Future development should change
all the internals to be name based instead.

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

3 years agoEVP: Add EVP_PKEY_get_group_name() to extract the group name of a pkey
Richard Levitte [Fri, 4 Dec 2020 05:32:24 +0000 (06:32 +0100)]
EVP: Add EVP_PKEY_get_group_name() to extract the group name of a pkey

This replaces the internal evp_pkey_get_EC_KEY_curve_nid()

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

3 years agoEVP: constify the EVP_PKEY_get_*_param() argument |pkey|
Richard Levitte [Fri, 4 Dec 2020 05:30:28 +0000 (06:30 +0100)]
EVP: constify the EVP_PKEY_get_*_param() argument |pkey|

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

3 years agoAdd MAP_CONCEAL from OpenBSD which has similar purpose but on mmap
David Carlier [Fri, 13 Nov 2020 10:16:55 +0000 (10:16 +0000)]
Add MAP_CONCEAL from OpenBSD which has similar purpose but on mmap
call level.

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/13394)

3 years agoCRYPTO_secure_malloc_init: Add FreeBSD support for secure-malloc dont-dump-region.
David Carlier [Fri, 13 Nov 2020 06:07:52 +0000 (06:07 +0000)]
CRYPTO_secure_malloc_init: Add FreeBSD support for secure-malloc dont-dump-region.

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/13394)

3 years agoSTORE: clear err after ossl_store_get0_loader_int
Daniel Bevenius [Thu, 17 Sep 2020 07:48:29 +0000 (09:48 +0200)]
STORE: clear err after ossl_store_get0_loader_int

This commit clears the error that might have been set when
ossl_store_get0_loader_int has been called as it will try to retrieve
a loader for the scheme on an empty store, which will cause the error
OSSL_STORE_R_UNREGISTERED_SCHEME to be set.

The motivation for this after returning from
ossl_store_get0_loader_int, OSSL_STORE_attach will continue and try to
fetch a OSSL_STORE_LOADER from the provider.

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

3 years agoFix no-err
Matt Caswell [Wed, 2 Dec 2020 16:18:16 +0000 (16:18 +0000)]
Fix no-err

The ERR_load_*_strings() functions were not being defined in a no-err
build. This is an API break since in 1.1.1 they were still present in a
no-err build, but were no-ops. This was also causing a failure in
test_symbol_presence. We revert to the way things were done in 1.1.1,
i.e. in a no-err build the functions are still present but are no-ops.

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

3 years agoFix a compilation failure with no-tls_1_2
Matt Caswell [Wed, 2 Dec 2020 15:58:39 +0000 (15:58 +0000)]
Fix a compilation failure with no-tls_1_2

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

3 years agoFix a test failure with no-tls1_3
Matt Caswell [Wed, 2 Dec 2020 15:40:34 +0000 (15:40 +0000)]
Fix a test failure with no-tls1_3

If we're using TLSv1.2 then the test_sigalgs_available test needs to be
careful which ciphersuite is selected in order for the test to behave
correctly.

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

3 years agoproviders/common/der/build.info: Improve checks of disabled algos
Richard Levitte [Mon, 7 Dec 2020 08:53:12 +0000 (09:53 +0100)]
providers/common/der/build.info: Improve checks of disabled algos

This protects us from unwanted GENERATE statements in particular.

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

3 years agoUpdate CHANGES and NEWS for new release
Matt Caswell [Tue, 8 Dec 2020 11:19:41 +0000 (11:19 +0000)]
Update CHANGES and NEWS for new release

Reviewed-by: Richard Levitte <levitte@openssl.org>
3 years agoAdd a test for encoding/decoding using an invalid ASN.1 Template
Matt Caswell [Mon, 30 Nov 2020 14:46:47 +0000 (14:46 +0000)]
Add a test for encoding/decoding using an invalid ASN.1 Template

If you have a CHOICE type that it must use explicit tagging - otherwise
the template is invalid. We add tests for this.

Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
3 years agoAdd a test for GENERAL_NAME_cmp
Matt Caswell [Mon, 30 Nov 2020 13:50:52 +0000 (13:50 +0000)]
Add a test for GENERAL_NAME_cmp

Based on a boringssl test contributed by David Benjamin

Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
3 years agoComplain if we are attempting to encode with an invalid ASN.1 template
Matt Caswell [Thu, 12 Nov 2020 14:55:31 +0000 (14:55 +0000)]
Complain if we are attempting to encode with an invalid ASN.1 template

It never makes sense for multi-string or CHOICE types to have implicit
tagging. If we have a template that uses the in this way then we
should immediately fail.

Thanks to David Benjamin from Google for reporting this issue.

Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
3 years agoCheck that multi-strings/CHOICE types don't use implicit tagging
Matt Caswell [Thu, 12 Nov 2020 11:58:12 +0000 (11:58 +0000)]
Check that multi-strings/CHOICE types don't use implicit tagging

It never makes sense for multi-string or CHOICE types to use implicit
tagging since the content would be ambiguous. It is an error in the
template if this ever happens. If we detect it we should stop parsing.

Thanks to David Benjamin from Google for reporting this issue.

Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
3 years agoCorrectly compare EdiPartyName in GENERAL_NAME_cmp()
Matt Caswell [Wed, 11 Nov 2020 16:12:58 +0000 (16:12 +0000)]
Correctly compare EdiPartyName in GENERAL_NAME_cmp()

If a GENERAL_NAME field contained EdiPartyName data then it was
incorrectly being handled as type "other". This could lead to a
segmentation fault.

Many thanks to David Benjamin from Google for reporting this issue.

CVE-2020-1971

Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
3 years agoDirectoryString is a CHOICE type and therefore uses explicit tagging
Matt Caswell [Wed, 11 Nov 2020 15:19:34 +0000 (15:19 +0000)]
DirectoryString is a CHOICE type and therefore uses explicit tagging

EDIPartyName has 2 fields that use a DirectoryString. However they were
marked as implicit tagging - which is not correct for a CHOICE type.

Additionally the partyName field was marked as Optional when, according to
RFC5280 it is not.

Many thanks to github user @filipnavara for reporting this issue. Also to
David Benjamin from Google who independently identified and reported it.

Fixes #6859

Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
3 years agoDeprecate EC_POINT_bn2point and EC_POINT_point2bn.
Shane Lontis [Mon, 2 Nov 2020 02:46:38 +0000 (12:46 +1000)]
Deprecate EC_POINT_bn2point and EC_POINT_point2bn.

Fixes #10366

The one place that actually used was in the legacy printing of ecparams.
This has been replaced by the pointtobuf variant.

The ecparam app was using one of these functions - this line has just been
removed as another PR will remove all the code generated lines..

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

3 years agoChange OPENSSL_hexstr2buf_ex() & OPENSSL_buf2hexstr_ex() to pass the separator
Shane Lontis [Mon, 2 Nov 2020 02:41:23 +0000 (12:41 +1000)]
Change OPENSSL_hexstr2buf_ex() & OPENSSL_buf2hexstr_ex() to pass the separator

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

3 years agoopenssl.pod: Carve out Trusted Certificate, Pass Phrase, Name Format, and Format...
Ankita Shetty [Fri, 27 Nov 2020 16:05:30 +0000 (17:05 +0100)]
openssl.pod: Carve out Trusted Certificate, Pass Phrase, Name Format, and Format Options

Move detailed doc to specific new files in doc/man1/openssl-*-options.pod

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

3 years agoopenssl.pod: Move verification doc to new doc/man1/openssl-verification-options.pod
David von Oheimb [Wed, 4 Nov 2020 13:04:27 +0000 (14:04 +0100)]
openssl.pod: Move verification doc to new doc/man1/openssl-verification-options.pod

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

3 years agofind-doc-nits: fix regexp and point out that CA.pl and tsget.pod are special
Dr. David von Oheimb [Fri, 20 Nov 2020 11:29:32 +0000 (12:29 +0100)]
find-doc-nits: fix regexp and point out that CA.pl and tsget.pod are special

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

3 years agoPEM: Add a more generic way to implement PEM _ex functions for libctx
Richard Levitte [Mon, 14 Sep 2020 09:30:14 +0000 (11:30 +0200)]
PEM: Add a more generic way to implement PEM _ex functions for libctx

This also adds the following functions, for completeness:

PEM_write_PrivateKey_ex(), PEM_write_bio_PrivateKey_ex(),
PEM_write_PUBKEY_ex, PEM_write_bio_PUBKEY_ex

Fixes #13542

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

3 years agoEVP: Adjust EVP_PKEY_size(), EVP_PKEY_bits() and EVP_PKEY_security_bits()
Richard Levitte [Fri, 4 Dec 2020 08:34:25 +0000 (09:34 +0100)]
EVP: Adjust EVP_PKEY_size(), EVP_PKEY_bits() and EVP_PKEY_security_bits()

These functions are documented to return 0 if the size they are
supposed to return 0 if the size isn't available.  They needed a bit
of adjustment to actually do so, since the backend functions they call
might return negative numbers in that case.

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

3 years agoDSA: Make DSA_bits() and DSA_size() check that there are key parameters
Richard Levitte [Fri, 4 Dec 2020 07:55:19 +0000 (08:55 +0100)]
DSA: Make DSA_bits() and DSA_size() check that there are key parameters

Without these check, a DSA structure without key parameters will cause
these functions to crash.  This is also the case in pre-3.0 OpenSSL,
but since we now extract these data early, to cache them in the
EVP_PKEY structure, the same crash happens earlier and much more
internally.

The added checks are of the same kind as DSA_security_bits() already
does.

Fixes #13610

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

3 years agoSwitch deprecation method for X.509
Richard Levitte [Fri, 20 Nov 2020 09:10:06 +0000 (10:10 +0100)]
Switch deprecation method for X.509

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

3 years agoSwitch deprecation method for Whirlpool
Richard Levitte [Fri, 20 Nov 2020 09:09:55 +0000 (10:09 +0100)]
Switch deprecation method for Whirlpool

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

3 years agoSwitch deprecation method for OSSL_STORE
Richard Levitte [Fri, 20 Nov 2020 09:09:42 +0000 (10:09 +0100)]
Switch deprecation method for OSSL_STORE

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

3 years agoSwitch deprecation method for SSL
Richard Levitte [Fri, 20 Nov 2020 09:09:29 +0000 (10:09 +0100)]
Switch deprecation method for SSL

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

3 years agoSwitch deprecation method for SRP
Richard Levitte [Fri, 20 Nov 2020 09:09:15 +0000 (10:09 +0100)]
Switch deprecation method for SRP

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

3 years agoSwitch deprecation method for SHA
Richard Levitte [Fri, 20 Nov 2020 09:09:06 +0000 (10:09 +0100)]
Switch deprecation method for SHA

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

3 years agoSwitch deprecation method for SEED
Richard Levitte [Fri, 20 Nov 2020 09:08:58 +0000 (10:08 +0100)]
Switch deprecation method for SEED

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

3 years agoSwitch deprecation method for RIPEMD
Richard Levitte [Fri, 20 Nov 2020 09:08:49 +0000 (10:08 +0100)]
Switch deprecation method for RIPEMD

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