openssl.git
3 years agoFix a typo in the makefile templates
Matt Caswell [Thu, 23 Apr 2020 10:50:20 +0000 (11:50 +0100)]
Fix a typo in the makefile templates

The fips.so and legacy.so providers were not being installed because of
a typo in the makefile templates.

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

3 years agoMention the 3.0 wiki page in the release announcement emails
Matt Caswell [Tue, 21 Apr 2020 14:13:30 +0000 (15:13 +0100)]
Mention the 3.0 wiki page in the release announcement emails

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

3 years agoPROV: Ensure that EC keys have a default digest
Richard Levitte [Mon, 20 Apr 2020 19:35:03 +0000 (21:35 +0200)]
PROV: Ensure that EC keys have a default digest

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

3 years agoPROV: Ensure that ED25519 & ED448 keys have a mandatory digest
Richard Levitte [Mon, 20 Apr 2020 07:29:47 +0000 (09:29 +0200)]
PROV: Ensure that ED25519 & ED448 keys have a mandatory digest

This adds handling of the parameter "mandatory-digest" and responds
with an empty string, meaning that no digest may be used.

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

3 years agoEVP: Fix EVP_Digest{Sign,Verify}Init() to handle no default digest
Richard Levitte [Mon, 20 Apr 2020 07:29:16 +0000 (09:29 +0200)]
EVP: Fix EVP_Digest{Sign,Verify}Init() to handle no default digest

EVP_DigestSignInit() and EVP_DigestVerifyInit() would detect if there
is no default digest when using legacy (EVP_PKEY_ASN1_METHOD)
implementations.  However, it doesn't do that when provider side keys
are used.

Furthermore, because EVP_PKEY_get_default_digest_name() was used in
the portion of the code that uses the provider implementation, the
EVP_PKEY_ASN1_METHOD would be used if the key has one attached.  This
is now changed to use evp_keymgmt_util_get_deflt_digest_name()
instead.

Finally, we make sure to detect if the provider implementation
supports the digest name parameters (default or mandatory), and
returns with error if not.  This is what the legacy portion of the
code does.

Fixes #11571

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

3 years agoEVP: add internal evp_keymgmt_util_get_deflt_digest_name() and use it
Richard Levitte [Mon, 20 Apr 2020 07:14:59 +0000 (09:14 +0200)]
EVP: add internal evp_keymgmt_util_get_deflt_digest_name() and use it

evp_keymgmt_util_get_deflt_digest_name() is a refactor of the provider
side key part of EVP_PKEY_get_default_digest_name(), that takes
EVP_KEYMGMT and provider keydata pointers instead of an EVP_PKEY
pointer.

We also ensure that it uses SN_undef as the default name if the
provider implementation gave us an empty string, since this is what
EVP_PKEY_get_default_digest_name() responds when getting the digest
name via a EVP_PKEY_ASN1_METHOD ctrl call that returns NID_undef.

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

3 years agoFIPS: remove algorithms that are not being validated.
Pauli [Wed, 22 Apr 2020 07:08:30 +0000 (17:08 +1000)]
FIPS: remove algorithms that are not being validated.

Several MACs and one KDF are included in the FIPS provider with the property
"fips=yes" set but are not listed as being part of the OpenSSL validation.

This removes them from the FIPS provider.

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

3 years agoFix no-err
Matt Caswell [Mon, 20 Apr 2020 14:04:35 +0000 (15:04 +0100)]
Fix no-err

This fixes an assertion failure that can occur in the CMP code in the
event of a no-err build. The "improve_location_name" function assumed
that the fallback argument was always populated with something. However
in a no-err build this is not the case.

Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/11584)

3 years agoSkip a no-dsa test in the fipsinstall test
Matt Caswell [Mon, 20 Apr 2020 13:18:36 +0000 (14:18 +0100)]
Skip a no-dsa test in the fipsinstall test

In a similar way to the previous commit we also skip a fipsinstall test
if DSA has been disabled.

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

3 years agoSkip a test in a no-dh build
Matt Caswell [Mon, 20 Apr 2020 13:05:47 +0000 (14:05 +0100)]
Skip a test in a no-dh build

One of the sub-tests in the fipsinstall test corrupts a DH test to
confirm that fipsinstall fails. However that is never noticed in a
no-dh build - so we just skip that test in a no-dh build.

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

3 years agoFix some build failures with no-dh
Matt Caswell [Mon, 20 Apr 2020 13:05:23 +0000 (14:05 +0100)]
Fix some build failures with no-dh

Add some missing OPENSSL_NO_DH guards.

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

3 years agoFix no-ec
Matt Caswell [Mon, 20 Apr 2020 11:27:59 +0000 (12:27 +0100)]
Fix no-ec

This was missed by Travis because, although it has a no-ec build, the test
that failed only runs in a debug build. The Travis job with no-ec is not
a debug build and so the test was skipped.

Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/11581)

3 years agoAdd a link to wiki 3.0 upgrade notes
Matt Caswell [Mon, 20 Apr 2020 18:39:32 +0000 (19:39 +0100)]
Add a link to wiki 3.0 upgrade notes

Provide a link to the 3.0 upgrade notes so that users of the alpha/beta/
final releases can understand the differences between this version and
previous versions.

Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/11587)

3 years agoGOST2012 TLS Supported Groups Identifiers Support
Nikolay Morozov [Sat, 18 Apr 2020 20:59:45 +0000 (23:59 +0300)]
GOST2012 TLS Supported Groups Identifiers Support

For GOST2012-GOST8912-GOST8912 IANA introduce TLS Supported Groups Identifiers
https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-parameters-8

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/11568)

3 years agoevptest: set the DESX provider to be the legacy provider.
Pauli [Mon, 20 Apr 2020 02:43:49 +0000 (12:43 +1000)]
evptest: set the DESX provider to be the legacy provider.

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

3 years agoparams: add functionality to test if an OSSL_PARAM has been set.
Pauli [Tue, 21 Apr 2020 00:49:19 +0000 (10:49 +1000)]
params: add functionality to test if an OSSL_PARAM has been set.

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

3 years ago[crypto/ec] deprecate Jprojective_coordinates_GFp functions
Billy Brumley [Sun, 12 Apr 2020 15:17:19 +0000 (18:17 +0300)]
[crypto/ec] deprecate Jprojective_coordinates_GFp functions

Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/11527)

3 years agoAdd setter equivalents to X509_REQ_get0_signature
Dirk-Willem van Gulik [Fri, 10 Jan 2020 17:35:49 +0000 (18:35 +0100)]
Add setter equivalents to X509_REQ_get0_signature

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

3 years agoFix no-deprecated tests where the GOST engine is present
Matt Caswell [Mon, 20 Apr 2020 13:32:21 +0000 (14:32 +0100)]
Fix no-deprecated tests where the GOST engine is present

The GOST test only runs if it detects that the GOST engine is present.
This is the case for the run-checker environment. The GOST engine uses
some deprecated functions, so we disable that test in a no-deprecated
build.

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

3 years agoFix no-des
Matt Caswell [Mon, 20 Apr 2020 10:23:34 +0000 (11:23 +0100)]
Fix no-des

Disable a recently added CMS test in the case of no-des.

Reviewed-by: Paul Yang <kaishen.yy@antfin.com>
(Merged from https://github.com/openssl/openssl/pull/11578)

3 years agoFix an ssl_test_old test failure
Matt Caswell [Mon, 20 Apr 2020 16:06:40 +0000 (17:06 +0100)]
Fix an ssl_test_old test failure

In builds where SSLv3 is enabled ssl_test_old was failing. We need to
make sure we disable SSLv3 related tests when using the FIPS provider.

[extended tests]

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

3 years agoFix test_ssl_new test failure
Matt Caswell [Mon, 20 Apr 2020 16:04:57 +0000 (17:04 +0100)]
Fix test_ssl_new test failure

A couple of fetches of the MD5 and SHA1 digests were not using the
libctx in libssl and causing test_ssl_new to fail in travis. This
only occurs on builds with SSLv3 enabled (its disabled by default).

[extended tests]

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

3 years agoRevert "TEST: make and use a fipsinstall script"
Richard Levitte [Tue, 21 Apr 2020 10:24:44 +0000 (12:24 +0200)]
Revert "TEST: make and use a fipsinstall script"

Unfortunately, this won't work on MacOS because of system integrity
measures on that platform, which clears DYLD_LIBRARY_PATH before
starting a sub-process executable.

Ref: https://developer.apple.com/library/archive/documentation/Security/Conceptual/System_Integrity_Protection_Guide/RuntimeProtections/RuntimeProtections.html

This reverts commit ae6b654b669638882a6ddce012ff55adc7cf6a82.

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

3 years agoFix NULL dereference in SSL_check_chain() for TLS 1.3
Benjamin Kaduk [Fri, 10 Apr 2020 19:27:28 +0000 (12:27 -0700)]
Fix NULL dereference in SSL_check_chain() for TLS 1.3

In the tls1_check_sig_alg() helper function, we loop through the list of
"signature_algorithms_cert" values received from the client and attempt
to look up each one in turn in our internal table that maps wire
codepoint to string-form name, digest and/or signature NID, etc., in
order to compare the signature scheme from the peer's list against what
is used to sign the certificates in the certificate chain we're
checking.  Unfortunately, when the peer sends a value that we don't
support, the lookup returns NULL, but we unconditionally dereference the
lookup result for the comparison, leading to an application crash
triggerable by an unauthenticated client.

Since we will not be able to say anything about algorithms we don't
recognize, treat NULL return from lookup as "does not match".

We currently only apply the "signature_algorithm_cert" checks on TLS 1.3
connections, so previous TLS versions are unaffected.  SSL_check_chain()
is not called directly from libssl, but may be used by the application
inside a callback (e.g., client_hello or cert callback) to verify that a
candidate certificate chain will be acceptable to the client.

CVE-2020-1967

Reviewed-by: Matt Caswell <matt@openssl.org>
3 years agoAdd test for CVE-2020-1967
Benjamin Kaduk [Fri, 10 Apr 2020 19:27:28 +0000 (12:27 -0700)]
Add test for CVE-2020-1967

Add to test_sslsigalgs a TLSProxy test that injects a
"signature_algorithms_cert" extension that contains an unallocated
codepoint.

The test currently fails, since s_server segfaults instead of
ignoring the unrecognized value.

Since "signature_algorithms" and "signature_algorithms_cert" are very
similar, also add the analogous test for "signature_algorithms".

Reviewed-by: Matt Caswell <matt@openssl.org>
3 years agoDeveloper scripts: Release script
Richard Levitte [Mon, 6 Apr 2020 21:58:24 +0000 (23:58 +0200)]
Developer scripts: Release script

The old release script that exists in another repository has aged, and
risks becoming messy beyond maintainability if it's made to deal with
multiple OpenSSL version schemes.

A solution, which has been seen in other projects, is to have the
release script as part of the versioned source tree, and ensure it's
adapted for the ongoing version scheme in that source tree.

This introduces dev/, a directory of OpenSSL developer "stuff".  We
may expand it with other practical scripts to easy development setup
and other similar things that developers may need.  For now, it's the
release script dev/release.sh, with auxilliary files in dev/release-aux/.
The script is self describing, the manual is available by running the
command `./dev/release.sh --manual`.

The dev/ directory shall never appear in a source distribution.

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

3 years agoFix test_cmp_vfy failures with FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
Dr. David von Oheimb [Mon, 20 Apr 2020 15:19:50 +0000 (17:19 +0200)]
Fix test_cmp_vfy failures with FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION

[extended tests]

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

3 years agogendsa: remove unnecessary OPENSSL_SUPPRESS_DEPRECATED definition
Pauli [Sun, 19 Apr 2020 23:33:51 +0000 (09:33 +1000)]
gendsa: remove unnecessary OPENSSL_SUPPRESS_DEPRECATED definition

Reviewed-by: Paul Yang <kaishen.yy@antfin.com>
(Merged from https://github.com/openssl/openssl/pull/11570)

4 years agoTeach ssl_test_old to use the FIPS provider for its tests
Matt Caswell [Mon, 13 Apr 2020 13:32:51 +0000 (14:32 +0100)]
Teach ssl_test_old to use the FIPS provider for its tests

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

4 years agoTeach ssl_test_old how to run tests in a non-default library context
Matt Caswell [Fri, 10 Apr 2020 13:31:19 +0000 (14:31 +0100)]
Teach ssl_test_old how to run tests in a non-default library context

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

4 years agoUse a fetched MD if appropriate in ssl3_cbc_digest_record
Matt Caswell [Sat, 18 Apr 2020 10:54:23 +0000 (11:54 +0100)]
Use a fetched MD if appropriate in ssl3_cbc_digest_record

HMACs used via the legacy EVP_DigestSign interface are strange in
that they use legacy codepath's which eventually (under the covers)
transform the operation into a new style EVP_MAC. This can mean the
digest in use can be a legacy one, so we need to be careful with any
digest we extract from the ctx.

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

4 years agoTeach ssl_test_new how to test the FIPS module
Matt Caswell [Tue, 7 Apr 2020 16:03:19 +0000 (17:03 +0100)]
Teach ssl_test_new how to test the FIPS module

We load the FIPS module and make sure it is configured before running
the ssl_test_new tests.

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

4 years agoTeach ssl_test_new to have different tests for different loaded providers
Matt Caswell [Tue, 7 Apr 2020 15:22:49 +0000 (16:22 +0100)]
Teach ssl_test_new to have different tests for different loaded providers

We now run the tests twice: Once with no specific providers loaded and
just using the default libctx, and a second time with a non-default libctx
and the default provider.

In the second run we disable tests which use a PSS cert/key because we
don't yet have support for that.

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

4 years agoRun ssl_test_new with a non-default library context
Matt Caswell [Fri, 3 Apr 2020 14:40:00 +0000 (15:40 +0100)]
Run ssl_test_new with a non-default library context

We also prepare the way for a future commit to run ssl_test_new with
just the FIPS provider loaded.

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

4 years agoUpdate comment on crls_http_cb() as it does support non-blocking I/O since #10667
Dr. David von Oheimb [Sat, 7 Mar 2020 10:51:42 +0000 (11:51 +0100)]
Update comment on crls_http_cb() as it does support non-blocking I/O since #10667

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

4 years agoFix descriptions of credentials and verification options for various apps
Dr. David von Oheimb [Fri, 6 Mar 2020 20:46:33 +0000 (21:46 +0100)]
Fix descriptions of credentials and verification options for various apps

fix doc of s_client and s_server credentials and verification options
fix doc of verification options also for s_time, x509, crl, req, ts, and verify
correcting and extending texts regarding untrusted and trusted certs,
making the order of options in the docs and help texts more consistent,
etc.

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

4 years agoSwap parameters of evp_method_id()
Dr. Matthias St. Pierre [Thu, 16 Apr 2020 17:10:14 +0000 (19:10 +0200)]
Swap parameters of evp_method_id()

The order of the function's parameters `name_id` and `operation_id`
was reverted compared to their order of appearance in the comments
and assertions.

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

4 years agoFix an assertion (and a comment) of evp_method_id()
Dr. Matthias St. Pierre [Mon, 13 Apr 2020 22:12:48 +0000 (00:12 +0200)]
Fix an assertion (and a comment) of evp_method_id()

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

4 years agoFix DH_get_nid() so that it does not cache values.
Shane Lontis [Mon, 20 Apr 2020 01:07:38 +0000 (11:07 +1000)]
Fix DH_get_nid() so that it does not cache values.

DH_set0_pqg() is now responsible for caching the nid, q and length.

DH with or without named safe prime groups now default to using the maximum private key length (BN_num_bits(q) - 1)
when generating a DH private key. The code is now shared between fips and non fips mode for DH key generation.

The OSSL_PKEY_PARAM_DH_PRIV_LEN parameter can be used during keygen to override the maximum private key length to be
in the range (2 * strength ... bits(q) - 1). Where the strength depends on the length of p.

Added q = (p - 1) / 2 safe prime BIGNUMS so that the code is data driven (To simplify adding new names).
The BIGNUMS were code generated.

Fix error in documented return value for DH_get_nid

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

4 years agoDOC: Extend EVP_PKEY-DSA(7) / EVP_PKEY_DH(7) with FFC information
Shane Lontis [Thu, 16 Apr 2020 02:07:26 +0000 (12:07 +1000)]
DOC: Extend EVP_PKEY-DSA(7) / EVP_PKEY_DH(7) with FFC information

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

4 years agoDOC: Refactor provider-keymgmt(7) to give the keytypes their own pages
Richard Levitte [Tue, 14 Apr 2020 17:06:12 +0000 (19:06 +0200)]
DOC: Refactor provider-keymgmt(7) to give the keytypes their own pages

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

4 years agoBuild files: add module installation targets
Richard Levitte [Fri, 17 Apr 2020 13:38:45 +0000 (15:38 +0200)]
Build files: add module installation targets

We only installed engines, now we also install other modules.

Fixes #11559

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

4 years agoTEST: make and use a fipsinstall script
Richard Levitte [Sat, 18 Apr 2020 10:14:41 +0000 (12:14 +0200)]
TEST: make and use a fipsinstall script

We have copies of the exact same fipsinstall call in several test
recipes.  This refactors those calls into a single simple script.

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

4 years agoUse the libctx for all EVP_PKEY_CTX operations
Matt Caswell [Fri, 10 Apr 2020 15:32:16 +0000 (16:32 +0100)]
Use the libctx for all EVP_PKEY_CTX operations

There were a few places where we were not passing through the libctx
when constructing and EVP_PKEY_CTX.

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

4 years agoRe-enable FIPS testing in sslapitest.c
Matt Caswell [Sat, 21 Mar 2020 00:39:27 +0000 (00:39 +0000)]
Re-enable FIPS testing in sslapitest.c

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

4 years agoUse a non-default libctx in sslapitest
Matt Caswell [Wed, 18 Mar 2020 17:17:37 +0000 (17:17 +0000)]
Use a non-default libctx in sslapitest

We also don't load the default provider into the default libctx to make
sure there is no accidental "leakage".

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

4 years agodhparam: white space cleaning
Pauli [Sun, 19 Apr 2020 00:36:01 +0000 (10:36 +1000)]
dhparam: white space cleaning

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

4 years agoapps: undeprecate the conditioned out apps
Pauli [Fri, 17 Apr 2020 11:50:50 +0000 (21:50 +1000)]
apps: undeprecate the conditioned out apps

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

4 years agoopenssl: include the version a command was deprecated in the output text.
Pauli [Thu, 5 Mar 2020 00:06:29 +0000 (10:06 +1000)]
openssl: include the version a command was deprecated in the output text.

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

4 years agoapps: reinstate deprecated commands but using PKEY APIs
Pauli [Tue, 3 Mar 2020 07:40:00 +0000 (17:40 +1000)]
apps: reinstate deprecated commands but using PKEY APIs

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

4 years agodsaparam: update command line app to use EVP calls
Pauli [Tue, 3 Mar 2020 01:01:26 +0000 (11:01 +1000)]
dsaparam: update command line app to use EVP calls

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

4 years agoCHANGES: note which command line utilities are marked for deprecation but still avail...
Pauli [Thu, 12 Mar 2020 23:06:04 +0000 (09:06 +1000)]
CHANGES: note which command line utilities are marked for deprecation but still available.

Some of the utilities are much easier to use than their pkey alternatives.
These have been modified to use the PKEY APIs but still note that they are
deprecated.

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

4 years agoUndeprecate DH_get_length() and DH_set_length() functions
Pauli [Tue, 10 Mar 2020 05:10:37 +0000 (15:10 +1000)]
Undeprecate DH_get_length() and DH_set_length() functions

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

4 years agogendsa: update command line app to use EVP calls
Pauli [Tue, 10 Mar 2020 05:09:18 +0000 (15:09 +1000)]
gendsa: update command line app to use EVP calls

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

4 years agogenrsa: update command line app to use EVP calls
Pauli [Tue, 10 Mar 2020 05:08:05 +0000 (15:08 +1000)]
genrsa: update command line app to use EVP calls

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

4 years agoopenssl: include the version a command was deprecated in the output text.
Pauli [Thu, 5 Mar 2020 00:06:29 +0000 (10:06 +1000)]
openssl: include the version a command was deprecated in the output text.

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

4 years agoapps: reinstate deprecated commands but using PKEY APIs
Pauli [Tue, 3 Mar 2020 07:40:00 +0000 (17:40 +1000)]
apps: reinstate deprecated commands but using PKEY APIs

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

4 years agodhparam: update command line app to use EVP calls
Pauli [Tue, 3 Mar 2020 07:38:39 +0000 (17:38 +1000)]
dhparam: update command line app to use EVP calls

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

4 years agotests: reinstate tests for deprecated but non-removed functionality
Pauli [Tue, 3 Mar 2020 01:03:47 +0000 (11:03 +1000)]
tests: reinstate tests for deprecated but non-removed functionality

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

4 years agodsaparam: update command line app to use EVP calls
Pauli [Tue, 3 Mar 2020 01:01:26 +0000 (11:01 +1000)]
dsaparam: update command line app to use EVP calls

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

4 years agorsa: update command line app to use EVP calls
Pauli [Mon, 2 Mar 2020 04:30:36 +0000 (14:30 +1000)]
rsa: update command line app to use EVP calls

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

4 years agodsa: update command line app to use EVP calls
Pauli [Mon, 2 Mar 2020 04:30:26 +0000 (14:30 +1000)]
dsa: update command line app to use EVP calls

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

4 years agoPrevent crash in X509_NAME_cmp() etc. when cert has no issuer or no serialNumber
Dr. David von Oheimb [Wed, 8 Apr 2020 11:39:15 +0000 (13:39 +0200)]
Prevent crash in X509_NAME_cmp() etc. when cert has no issuer or no serialNumber

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/11386)

4 years agoAdd CMP error reason 'missing reference cert'
Dr. David von Oheimb [Fri, 17 Apr 2020 11:34:11 +0000 (13:34 +0200)]
Add CMP error reason 'missing reference cert'

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/11386)

4 years agoAdd CMP fuzzing to fuzz/cmp.c, including a couple of helpers in crypto/cmp/
Dr. David von Oheimb [Tue, 24 Mar 2020 09:33:16 +0000 (10:33 +0100)]
Add CMP fuzzing to fuzz/cmp.c, including a couple of helpers in crypto/cmp/

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/11386)

4 years agoAdd a couple of hints to fuzz/README.md
Dr. David von Oheimb [Wed, 1 Apr 2020 06:51:31 +0000 (08:51 +0200)]
Add a couple of hints to fuzz/README.md

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/11386)

4 years agoRename CMP_PROTECTEDPART to OSSL_CMP_PROTECTEDPART for consistency
Dr. David von Oheimb [Mon, 23 Mar 2020 13:42:34 +0000 (14:42 +0100)]
Rename CMP_PROTECTEDPART to OSSL_CMP_PROTECTEDPART for consistency

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/11386)

4 years agoGOST2012 TLS ClientCertificateType Identifiers support
Nikolay Morozov [Thu, 16 Apr 2020 15:55:36 +0000 (18:55 +0300)]
GOST2012 TLS ClientCertificateType Identifiers support

For GOST2012-GOST8912-GOST8912 IANA introduce ClientCertificateType Identifiers
https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-parameters-2

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/11558)

4 years agoDOC: Extend the description of EVP_PKEY_CTX_new_from_name()
Richard Levitte [Fri, 6 Mar 2020 13:55:49 +0000 (14:55 +0100)]
DOC: Extend the description of EVP_PKEY_CTX_new_from_name()

This adds text the should lead the user to documentation on different
KEYMGMT implementations.

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

4 years agoDOC: Add more description of EVP_PKEY_fromdata(), and examples
Richard Levitte [Mon, 2 Mar 2020 13:39:30 +0000 (14:39 +0100)]
DOC: Add more description of EVP_PKEY_fromdata(), and examples

Fixes #11131

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

4 years agoapps/speed: fix invalid final report when run SM2 benchmarks in parallel
张盛豪 [Thu, 16 Apr 2020 14:34:24 +0000 (22:34 +0800)]
apps/speed: fix invalid final report when run SM2 benchmarks in parallel

Fixed #11523
CLA: trivial

Signed-off-by: 张盛豪 <zhangshenghao1995@163.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Paul Yang <kaishen.yy@antfin.com>
(Merged from https://github.com/openssl/openssl/pull/11557)

4 years agoGOST cipher names adjustment
Dmitry Belyavskiy [Mon, 30 Mar 2020 11:29:10 +0000 (14:29 +0300)]
GOST cipher names adjustment

The erroneously introduced names grasshopper-* replaced with
kuznyechik-* according to official algorithm name translation.

Too long symbolic names replaced with human-enterable ones.

Also the mechanism of deprecating names in objects.txt is implemented

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

4 years agoINSTALL: document 'no-ui-console' rather than 'no-ui'
Richard Levitte [Thu, 16 Apr 2020 07:49:47 +0000 (09:49 +0200)]
INSTALL: document 'no-ui-console' rather than 'no-ui'

The UI interface itself is never disabled, but the console backend may
be.  'no-ui' is a deprecated backward compatibility alias for
'no-ui-console'.

Fixes #11551

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

4 years agoWhen calling the import_to function pass the libctx too
Matt Caswell [Fri, 10 Apr 2020 17:28:24 +0000 (18:28 +0100)]
When calling the import_to function pass the libctx too

Previously import_to just took an EVP_PKEY as the argument. However we
need to some additional context data as well - specifically the libctx.
Therefore we pass an EVP_PKEY_CTX instead to hold the combination of
both of these things.

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

4 years agoWindows: Add type casting in CRYPTO_atomic_add to remove warning
Kochise [Mon, 16 Mar 2020 19:04:04 +0000 (20:04 +0100)]
Windows: Add type casting in CRYPTO_atomic_add to remove warning

CLA: trivial

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

4 years agodoc: note that the FIPS provider contains some non-approved algorithms.
Pauli [Thu, 16 Apr 2020 00:17:07 +0000 (10:17 +1000)]
doc: note that the FIPS provider contains some non-approved algorithms.

Also note how to select them.

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

4 years agonews: note the addition of ECX and SHAKE256 to the FIPS provider as non-approved...
Pauli [Wed, 15 Apr 2020 21:55:17 +0000 (07:55 +1000)]
news: note the addition of ECX and SHAKE256 to the FIPS provider as non-approved algorithms

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

4 years agopkey: free key manager on error path
Pauli [Wed, 15 Apr 2020 02:32:01 +0000 (12:32 +1000)]
pkey: free key manager on error path

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

4 years agoecx: check for errors creating public keys from private ones.
Pauli [Wed, 15 Apr 2020 00:06:20 +0000 (10:06 +1000)]
ecx: check for errors creating public keys from private ones.

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

4 years agos390: ECX key generation fixes.
Pauli [Thu, 2 Apr 2020 04:37:26 +0000 (14:37 +1000)]
s390: ECX key generation fixes.

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

4 years agoecx: add key generation support.
Pauli [Tue, 17 Mar 2020 23:25:33 +0000 (09:25 +1000)]
ecx: add key generation support.

Specifically for x25519, x448, ed25519 and ed448.

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

4 years agoAdd ECX to FIPS provider as non-FIPS algorithms
Pauli [Fri, 20 Mar 2020 02:58:37 +0000 (12:58 +1000)]
Add ECX to FIPS provider as non-FIPS algorithms

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

4 years agoTEST: Add a test of keygen with an empty template in test/evp_extra_test.c
Richard Levitte [Wed, 15 Apr 2020 11:36:19 +0000 (13:36 +0200)]
TEST: Add a test of keygen with an empty template in test/evp_extra_test.c

We do it with RSA, which may seem strange.  However, an RSA "template"
is generally ignored, so this is safe.  This is modelled after the test
code given in github issue #11549.

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

4 years agoEVP: Fix calls to evp_pkey_export_to_provider()
Richard Levitte [Wed, 15 Apr 2020 07:54:11 +0000 (09:54 +0200)]
EVP: Fix calls to evp_pkey_export_to_provider()

The calls weren't quite right, as this function has changed its behaviour.
We also change the internal documentation of this function, and document
evp_pkey_downgrade().

Fixes #11549

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

4 years agoTLSEXT_SIGALG_gostr34102012 0x0840 and 0x0841 support
Nikolay Morozov [Tue, 7 Apr 2020 15:08:07 +0000 (18:08 +0300)]
TLSEXT_SIGALG_gostr34102012 0x0840 and 0x0841 support

For GOST2012-GOST8912-GOST8912 IANA introduce signature Signature Algorithm parametrs
https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-parameters-16

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

4 years agoDocument X509_verify_ex() and X509_REQ_verify_ex()
Matt Caswell [Thu, 9 Apr 2020 13:26:25 +0000 (14:26 +0100)]
Document X509_verify_ex() and X509_REQ_verify_ex()

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

4 years agoIntroduce an internal version of X509_check_issued()
Matt Caswell [Mon, 6 Apr 2020 11:14:30 +0000 (12:14 +0100)]
Introduce an internal version of X509_check_issued()

The internal version is library context aware.

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

4 years agoCreate a libctx aware X509_verify_ex()
Matt Caswell [Fri, 3 Apr 2020 17:01:04 +0000 (18:01 +0100)]
Create a libctx aware X509_verify_ex()

This is the same as X509_verify() except that it takes a libctx and propq
parameter and signature verification is done using those.

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

4 years agoPut sys-specific files in build.info
Rich Salz [Thu, 5 Mar 2020 17:58:00 +0000 (12:58 -0500)]
Put sys-specific files in build.info

Don't wrap whole files in if[n]def, test in build.info if they
should be compiled.  rand_win isn't done as there are multiple
ways to say "this is windows."

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

4 years agoUse build.info, not ifdef for crypto modules
Rich Salz [Thu, 5 Mar 2020 17:50:31 +0000 (12:50 -0500)]
Use build.info, not ifdef for crypto modules

Don't wrap conditionally-compiled files in global ifndef tests.
Instead, test if the feature is disabled and, if so, do not
compile it.

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

4 years agoAdd DH keygen to providers
Shane Lontis [Wed, 15 Apr 2020 15:14:00 +0000 (01:14 +1000)]
Add DH keygen to providers

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

4 years agoAdd DSA keygen to provider
Shane Lontis [Wed, 15 Apr 2020 11:02:52 +0000 (21:02 +1000)]
Add DSA keygen to provider

Moved some shared FFC code into the FFC files.
Added extra paramgen parameters for seed, gindex.
Fixed bug in ossl_prov util to print bignums.

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

4 years agoMake sure we always send an alert in libssl if we hit a fatal error
Matt Caswell [Mon, 13 Apr 2020 15:57:16 +0000 (16:57 +0100)]
Make sure we always send an alert in libssl if we hit a fatal error

We had a spot where a fatal error was occurring but we hadn't sent an
alert. This results in a later assertion failure.

Reviewed-by: Paul Yang <kaishen.yy@antfin.com>
Reviewed-by: Ben Kaduk <kaduk@mit.edu>
(Merged from https://github.com/openssl/openssl/pull/11537)

4 years agoWhen calling EC_POINT_point2buf we must use a libctx
Matt Caswell [Fri, 10 Apr 2020 17:27:11 +0000 (18:27 +0100)]
When calling EC_POINT_point2buf we must use a libctx

In a similar way to commit 76e23fc5 we must ensure that we use a libctx
whenever we call EC_POINT_point2buf because it can end up using crypto
algorithms.

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

4 years agoDocument the new libctx aware private key functions
Matt Caswell [Wed, 8 Apr 2020 10:54:53 +0000 (11:54 +0100)]
Document the new libctx aware private key functions

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

4 years agoMake sure we use the libctx in libssl when loading PrivateKeys
Matt Caswell [Mon, 6 Apr 2020 17:24:05 +0000 (18:24 +0100)]
Make sure we use the libctx in libssl when loading PrivateKeys

Since loading a private key might require algorithm fetches we should
make sure the correct libctx is used.

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

4 years agoTeach PEM_read_bio_PrivateKey about libctx
Matt Caswell [Mon, 6 Apr 2020 17:21:50 +0000 (18:21 +0100)]
Teach PEM_read_bio_PrivateKey about libctx

Now that d2i_PrivateKey_ex() and other similar functions exist we should
use it when loading a PEM PrivateKey.

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

4 years agoTeach the OSSL_STORE code about libctx
Matt Caswell [Mon, 6 Apr 2020 17:23:25 +0000 (18:23 +0100)]
Teach the OSSL_STORE code about libctx

We restrict this to just the PrivateKey loading code at the moment.

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

4 years agoUse the libctx in Ed448 private key decoding
Matt Caswell [Mon, 6 Apr 2020 17:19:30 +0000 (18:19 +0100)]
Use the libctx in Ed448 private key decoding

The Ed448 private key deconding needs to use a library ctx. So we
implement a priv_decode_with_libctx function for it.

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

4 years agoTeach d2i_PrivateKey et al about libctx
Matt Caswell [Mon, 6 Apr 2020 17:18:18 +0000 (18:18 +0100)]
Teach d2i_PrivateKey et al about libctx

The Ed448 private key decoding makes algorithm fetches. Therefore we teach
d2i_PrivateKey et al about libctx and make sure it is passed through the
layers.

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