oweals/openssl.git
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)

4 years agoFix no-pic static builds
Tomas Mraz [Tue, 14 Apr 2020 10:16:22 +0000 (12:16 +0200)]
Fix no-pic static builds

The cipher_tdes_common causes build failure as being duplicated
in libcrypto static builds.

[extended tests]

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

4 years agoEVP: fix memleak in evp_pkey_downgrade()
Richard Levitte [Sat, 11 Apr 2020 11:16:22 +0000 (13:16 +0200)]
EVP: fix memleak in evp_pkey_downgrade()

The EVP_KEYMGMT pointer in the pkey is removed when downgrading, but
wasn't necessarily freed when need, thus leaving an incorrect
reference count.

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

4 years agoEVP: Add a temporary SM2 hack to key generation
Richard Levitte [Thu, 19 Mar 2020 13:02:51 +0000 (14:02 +0100)]
EVP: Add a temporary SM2 hack to key generation

The reason to do this is many-fold.  We need EC key generation for
other work.  However, SM2 are currently closely related to EC keys
with legacy methods, but not with provider methods.

To avoid having to wait on provider support for SM2, we temporarly
do an extra check for what the legacy methods identify as SM2 keys
(either the EVP_PKEY_SM2 pkey id was used, or the SM2 curve), and
redirect to legacy code in one case, and in the other case, we
forcedly downgrade provider side EC keys with SM2 curves to legacy
SM2 keys, using available tools.

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

4 years agoEC: Refactor EVP_PKEY_CTX curve setting macros for param generation
Richard Levitte [Thu, 19 Mar 2020 13:02:42 +0000 (14:02 +0100)]
EC: Refactor EVP_PKEY_CTX curve setting macros for param generation

The macros are converted to functions, and are modified to support
provider implementations.

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

4 years agoPROV: Implement EC param / key generation
Richard Levitte [Thu, 19 Mar 2020 13:02:28 +0000 (14:02 +0100)]
PROV: Implement EC param / key generation

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

4 years agoKEYMGMT: Add functions to get param/key generation parameters
Richard Levitte [Thu, 19 Mar 2020 10:16:45 +0000 (11:16 +0100)]
KEYMGMT: Add functions to get param/key generation parameters

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

4 years agoFix Dynamic engine loading so that the call to ENGINE_load_builtin_engines() is perfo...
Shane Lontis [Tue, 14 Apr 2020 02:25:34 +0000 (12:25 +1000)]
Fix Dynamic engine loading so that the call to ENGINE_load_builtin_engines() is performed.

Fixes #11510

PR #11240 Added support for passing the libctx to the config loader.
As part of this work the call to OPENSSL_load_builtin_modules() + ENGINE_load_builtin_engines() was deferred until module_run() is called.
The call to ENGINE_load_builtin_engines() has been added to ENGINE_by_id().

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

4 years agomkerr: remove legacy guards from generated error headers
Dr. Matthias St. Pierre [Mon, 13 Apr 2020 21:09:45 +0000 (23:09 +0200)]
mkerr: remove legacy guards from generated error headers

In pull request #9333, legacy guards were added to the generated
error headers, but the mkerr.pl script was not adjusted accordingly.
So the legacy guards were removed by subsequent `make update` calls.

Fixing the mkerr.pl script properly was disproportionately complicated
by the fact that adding legacy guards only made sense for files which
already existed in version 1.1.1. To keep things simple, it was decided
to drop the legacy guards from the generated headers entirely.

Fixes #10569

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

4 years agoAdd ex_data to EVP_PKEY.
Aaron Thompson [Tue, 7 Apr 2020 00:18:09 +0000 (00:18 +0000)]
Add ex_data to EVP_PKEY.

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

4 years agoBIO_do_accept: correct error return value
scott [Thu, 9 Apr 2020 11:36:37 +0000 (12:36 +0100)]
BIO_do_accept: correct error return value

`BIO_do_accept` was returning incorrect values when unable to bind to a port.

Fixes #7717
CLA: trivial

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

4 years agoFix some errors in documentation
Richard Levitte [Mon, 6 Apr 2020 12:00:55 +0000 (14:00 +0200)]
Fix some errors in documentation

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

4 years agoInitialize files that declare internal symbols
Richard Levitte [Mon, 6 Apr 2020 11:58:41 +0000 (13:58 +0200)]
Initialize files that declare internal symbols

util/other-internal.syms is like util/other.syms, but for internal symbols.
Likewise, util/missingcrypto-internal.txt and util/missingssl-internal.txt
are like util/missingcrypto.txt and util/missingssl.txt

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

4 years agoRework util/find-doc-nits to distinguish internal documentation
Richard Levitte [Mon, 6 Apr 2020 11:51:36 +0000 (13:51 +0200)]
Rework util/find-doc-nits to distinguish internal documentation

We didn't really distinguish internal and public documentation, or
matched that with the state of the documented symbols.  we therefore
needed to rework the logic to account for the state of each symbol.

To simplify things, and make them consistent, we load all of
util/*.num, util/*.syms and util/missing*.txt unconditionally.

Also, we rework the reading of the manuals to happen only once (or
well, not quite, Pod::Checker reads from file too, but at the very
least, our script isn't reading the same file multiple times).

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

4 years agoAdd manpage entry for X509_check_purpose()
Jake Maynard [Wed, 30 Oct 2019 15:27:04 +0000 (11:27 -0400)]
Add manpage entry for X509_check_purpose()

Fixes #10263

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

4 years agoFix EVP_DigestSign interface when used with DES CMAC
Patrick Steuer [Thu, 9 Apr 2020 17:58:02 +0000 (19:58 +0200)]
Fix EVP_DigestSign interface when used with DES CMAC

DES implementations were missing the dup/copy ctx routines
required by CMAC implementation. A regression test is added.

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

4 years agoEVP: legacy_ctrl_to_param() to handle provider side keys
Richard Levitte [Thu, 9 Apr 2020 04:07:54 +0000 (06:07 +0200)]
EVP: legacy_ctrl_to_param() to handle provider side keys

There was one spot where this function would look at ctx->pmeth
directly to determine if it's for RSASSA-PSS, which fails when
presented with an EVP_PKEY_CTX holding a provider side key.
Switching to use EVP_PKEY_is_a() should make things better.

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

4 years agoCMS KARI: Temporarly downgrade newly generated EVP_PKEYs to legacy
Richard Levitte [Wed, 8 Apr 2020 13:41:05 +0000 (15:41 +0200)]
CMS KARI: Temporarly downgrade newly generated EVP_PKEYs to legacy

The EVP_PKEY_ASN1_METHOD code used by CMS_RecipientInfo_kari_decrypt()
and cms_RecipientInfo_kari_encrypt() is quite complex and needs more
careful thought to work with provider side keys.  Unfortunately, we
need to get key generation in place, among others for ECC keys, so we
add a temporary hack, similar to what's already done in TLS code, that
downgrades a provider side EVP_PKEY to become EVP_PKEY_ASN1_METHOD /
EVP_PKEY_METHOD based.

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

4 years agoDon't compile commands if disabled
Rich Salz [Wed, 4 Mar 2020 21:52:22 +0000 (16:52 -0500)]
Don't compile commands if disabled

Rather than wrapping whole files in "ifndef OPENSSL_NO_xxx" we handle
the changes in build.info

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/11250)

4 years agoFix krb5 external test
Benjamin Kaduk [Wed, 8 Apr 2020 17:05:27 +0000 (10:05 -0700)]
Fix krb5 external test

Since commit c3845ceba84aab9ddeb43f043549238fd10de63b ("Build file
templates: don't set OPENSSL_{ENGINES,MODULES}") the krb5 external test
has been failing.  This is because it relied on OPENSSL_MODULES already
being set -- even though it did assign to OPENSSL_MODULES itself (and
thus got skipped by the cleanup pass in that commit), it was doing so
only to canonicalize the existing value to an absolute path, not as a de
novo assignment.

Catch up to the rest of the tree and just set it directly as the
"providers" path from the build top (but still canonicalized to an
absolute path).

[extended tests]

Fixes: 11492

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

4 years agoAdd common internal crypto/ modules in liblegacy.a
Richard Levitte [Thu, 9 Apr 2020 10:49:23 +0000 (12:49 +0200)]
Add common internal crypto/ modules in liblegacy.a

Just as for the FIPS module, there's code in the legacy module that need
this.

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

4 years agoEnable Ed25519 signing/verifying to use the libctx
Matt Caswell [Tue, 7 Apr 2020 10:10:02 +0000 (11:10 +0100)]
Enable Ed25519 signing/verifying to use the libctx

Ed25519 needs to fetch a digest and so needs to use the correct libctx.

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

4 years agoAdd the auto generated der files to .gitignore
Matt Caswell [Wed, 8 Apr 2020 11:14:41 +0000 (12:14 +0100)]
Add the auto generated der files to .gitignore

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

4 years agoDocument the new library context aware CT functions
Matt Caswell [Tue, 7 Apr 2020 16:37:39 +0000 (17:37 +0100)]
Document the new library context aware CT functions

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

4 years agoEnsure libssl uses the new library context aware CT code
Matt Caswell [Fri, 3 Apr 2020 15:26:28 +0000 (16:26 +0100)]
Ensure libssl uses the new library context aware CT code

Ensure that when we create a CTLOG_STORE we use the new library context
aware function.

Also ensure that when we create a CT_POLICY_EVAL_CTX we associate it with
the library context.

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

4 years agoMake the CT code library context aware
Matt Caswell [Fri, 3 Apr 2020 15:25:18 +0000 (16:25 +0100)]
Make the CT code library context aware

Add the new functions CTLOG_STORE_new_with_libctx(),
CTLOG_new_with_libctx() and CTLOG_new_from_base64_with_libctx() to pass
in the library context/property query string to use a library context
is to be used.

We also add the function CT_POLICY_EVAL_CTX_new_with_libctx() to enable
the creation of a CT_POLICY_EVAL_CTX to be associated with a libctx and
property query string.

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

4 years agoEnable export_to functions to have access to the libctx
Matt Caswell [Mon, 6 Apr 2020 15:05:24 +0000 (16:05 +0100)]
Enable export_to functions to have access to the libctx

The EC export_to function calls EC_POINT_point2buf that can later
generate a random number in some circumstances. Therefore we pass in a
BN_CTX associated with the library context. This means we have to change
the export_to function signature to accept the library context.

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

4 years agoOpenSSL::OID: Don't use List::Util
Richard Levitte [Thu, 9 Apr 2020 10:10:24 +0000 (12:10 +0200)]
OpenSSL::OID: Don't use List::Util

It turns out that the pairwise functions of List::Util came into perl
far later than 5.10.0.  We can't use that under those conditions, so
must revert to a quick internal implementation of the functions we're
after.

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

4 years agoUpdate RAND_METHOD definition in man page
Jim Newsome [Tue, 7 Apr 2020 21:29:53 +0000 (16:29 -0500)]
Update RAND_METHOD definition in man page

The `add` and `seed` callbacks were changed to return `int` instead of
`void` in b6dcdbfc94c482f6c15ba725754fc9e827e41851 (first included in
tag OpenSSL_1_1_0-pre1).

The `add` callback was changed to take a `double` instead of an `int`
in 853f757ecea74a271a7c5cdee3f3b5fe0d3ae863.

CLA: trivial
Fixes: #10199

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Ben Kaduk <kaduk@mit.edu>
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/11486)

4 years agoTravis build matrix adjustments
Tomas Mraz [Fri, 3 Apr 2020 15:26:57 +0000 (17:26 +0200)]
Travis build matrix adjustments

- do not exclude all clang builds on Linux
- exclude the constantly timeouting -fsanitize=address build on OS/X
- drop some mostly duplicate builds
- change the base linux distro to Bionic
- drop sudo as that is no longer needed - always on
- drop -D__NO_STRING_INLINES where not needed
- memleak test is not working with old clang

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

4 years agoAdd a null provider which implements no algorithms.
Pauli [Wed, 8 Apr 2020 02:02:34 +0000 (12:02 +1000)]
Add a null provider which implements no algorithms.

By loading the null provider into the default context, it is possible
to verify that it is not accidentally being used.

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

4 years agoMove legacy ciphers into the legacy provider
Shane Lontis [Thu, 9 Apr 2020 02:47:46 +0000 (12:47 +1000)]
Move legacy ciphers into the legacy provider

DES, idea, seed, rc2, rc4, rc5, cast and blowfish have been moved out of the default provider.
Code shared between desx and tdes has been moved into a seperate file (cipher_tdes_common.c).
3 test recipes failed due to using app/openssl calls that used legacy ciphers.
These calls have been updated to supply both the default and legacy providers.
Fixed openssl app '-provider' memory leak

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

4 years agoDocument the new X509_STORE_CTX_new_with_libctx() function
Matt Caswell [Wed, 1 Apr 2020 15:15:39 +0000 (16:15 +0100)]
Document the new X509_STORE_CTX_new_with_libctx() function

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

4 years agoExplicitly cache the X509v3_extensions in one more place in libssl
Matt Caswell [Wed, 1 Apr 2020 15:10:08 +0000 (16:10 +0100)]
Explicitly cache the X509v3_extensions in one more place in libssl

Make sure we cache the extensions for a cert using the right libctx.

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

4 years agoUse the libctx and propq from the X509_STORE_CTX
Matt Caswell [Wed, 1 Apr 2020 15:09:05 +0000 (16:09 +0100)]
Use the libctx and propq from the X509_STORE_CTX

Now that X509_STORE_CTX contain a libctx we should use it in a couple of
places where we cache the X509v3 extensions.

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

4 years agoUse X509_STORE_CTX_new_with_libctx() in libssl
Matt Caswell [Wed, 1 Apr 2020 15:05:07 +0000 (16:05 +0100)]
Use X509_STORE_CTX_new_with_libctx() in libssl

Libssl is OPENSSL_CTX aware so we should use it when creating an
X509_STORE_CTX.

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

4 years agoAdd X509_STORE_CTX_new_with_libctx()
Matt Caswell [Wed, 1 Apr 2020 15:03:44 +0000 (16:03 +0100)]
Add X509_STORE_CTX_new_with_libctx()

Make it possible to create an X509_STORE_CTX with an associated libctx
and propq.

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

4 years agoTLS: Temporarly downgrade newly generated EVP_PKEYs to legacy
Richard Levitte [Mon, 23 Mar 2020 12:21:21 +0000 (13:21 +0100)]
TLS: Temporarly downgrade newly generated EVP_PKEYs to legacy

The transfer of TLS encodedpoint to backends isn't yet fully supported
in provider implementations.  This is a temporary measure so as not to
get stuck in other development.

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

4 years agoFix export of provided EC keys
Richard Levitte [Mon, 23 Mar 2020 12:19:40 +0000 (13:19 +0100)]
Fix export of provided EC keys

The exporter freed a buffer too soon, and there were attempts to use
its data later, which was overwritten by something else at that
point.

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

4 years agoEVP & TLS: Add necessary EC_KEY data extraction functions, and use them
Richard Levitte [Wed, 18 Mar 2020 14:54:47 +0000 (15:54 +0100)]
EVP & TLS: Add necessary EC_KEY data extraction functions, and use them

libssl code uses EVP_PKEY_get0_EC_KEY() to extract certain basic data
from the EC_KEY.  We replace that with internal EVP_PKEY functions.

This may or may not be refactored later on.

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

4 years agoEVP: add EVP_PKEY_is_a() and EVP_PKEY_can_sign()
Richard Levitte [Mon, 16 Mar 2020 17:55:32 +0000 (18:55 +0100)]
EVP: add EVP_PKEY_is_a() and EVP_PKEY_can_sign()

EVP_PKEY_is_a() is the provider side key checking function corresponding
to checking EVP_PKEY_id() or an EVP_PKEY against macros like EVP_PKEY_EC.
It also works with legacy internal keys.

We also add a warning indoc/man3/EVP_PKEY_set1_RSA.pod regarding the
reliability of certain functions that only understand legacy keys.

Finally, we take the opportunity to clean up doc/man3/EVP_PKEY_set1_RSA.pod
to better conform with man-page layout norms, see man-pages(7) on Linux.

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