]> git.ipfire.org Git - thirdparty/openssl.git/log
thirdparty/openssl.git
3 years agoRemove the function EVP_PKEY_set_alias_type
Matt Caswell [Thu, 8 Apr 2021 15:22:51 +0000 (16:22 +0100)] 
Remove the function EVP_PKEY_set_alias_type

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

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

Fixes #14379

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

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

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

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

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

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

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

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

Fixes #13794

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

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

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

Fixes #14704

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

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

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

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

These functions are prerequisites for implementing EVP_PKEY_todata().

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

CLA: trivial

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

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

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

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

Fixes #13949

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

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

CLA: trivial

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

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

X509_VERIFY_PARAM_inherit() now copies hostflags independently of hosts.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Fixes #14371

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

This reverts commit 7e492f3372ed83af074a63d5920f13de7e3455b6.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

This reverts commit bec9289143c955b330a8f9ad32f26f3da76e2685.

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

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

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

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

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

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

Fixes #14720

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

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

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

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

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

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

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

Fixes #13732

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

Added X509_CRL_new_ex().

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Fixes #14763

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

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

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

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

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

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

They are actually integers.

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

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

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

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

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

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

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

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

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

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

3 years agoFix typo in store_meth.c
Nan Xiao [Tue, 6 Apr 2021 08:14:46 +0000 (16:14 +0800)] 
Fix typo in store_meth.c

CLA: trivial

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

3 years agoRemove unnecessary setting SSL_MODE_AUTO_RETRY
Nan Xiao [Tue, 30 Mar 2021 08:30:47 +0000 (16:30 +0800)] 
Remove unnecessary setting SSL_MODE_AUTO_RETRY

Since SSL_MODE_AUTO_RETRY is enabled by default, no need to set
it explicitly.

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

3 years agoAdds a new lock to read default_path and uses a strdup() on default_path before using it
Sahana Prasad [Mon, 22 Mar 2021 22:44:22 +0000 (23:44 +0100)] 
Adds a new lock to read default_path and uses a strdup() on default_path before using it
Fixes #14483
Signed-off-by: Sahana Prasad <sahana@redhat.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14650)

3 years agoEnsure that the negative flag is correct set for ASN1 integer types.
Pauli [Sun, 4 Apr 2021 03:58:22 +0000 (13:58 +1000)] 
Ensure that the negative flag is correct set for ASN1 integer types.

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

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

3 years agoCheck for integer overflow in i2a_ASN1_OBJECT and error out if found.
Pauli [Sun, 4 Apr 2021 03:52:06 +0000 (13:52 +1000)] 
Check for integer overflow in i2a_ASN1_OBJECT and error out if found.

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

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

3 years agoFix potential double free in sslapitest.c
Nan Xiao [Thu, 1 Apr 2021 05:55:04 +0000 (13:55 +0800)] 
Fix potential double free in sslapitest.c

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

3 years agoDeprecate the EVP_PKEY controls for CMS and PKCS#7
Tomas Mraz [Thu, 1 Apr 2021 15:14:43 +0000 (17:14 +0200)] 
Deprecate the EVP_PKEY controls for CMS and PKCS#7

Improve the ossl_rsa_check_key() to prevent non-signature
operations with PSS keys.

Do not invoke the EVP_PKEY controls for CMS and PKCS#7 anymore
as they are not needed anymore and deprecate them.

Fixes #14276

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

3 years agoInclude BN assembler alongside CPUID code
Richard Levitte [Wed, 15 Apr 2020 10:54:23 +0000 (12:54 +0200)] 
Include BN assembler alongside CPUID code

It turns out that some CPUID code requires the presence of some BN
assembler code, so we make sure it's included in the same manner as
the CPUID code itself.

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

3 years agoRefactor CPUID code
Richard Levitte [Wed, 11 Mar 2020 16:38:46 +0000 (17:38 +0100)] 
Refactor CPUID code

We were using CPUID coded in several modules, but it was unclear how
it actually got there, and could fail randomly.

To remedy that, this change separates the CPUID C code from the rest
of cryptlib.c, and ensures the right modules get both that and the
assembler sources explicitly.

Fixes #11281

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

3 years agoAPPS: Replace the use of OBJ_nid2ln() with name or description calls
Richard Levitte [Tue, 16 Mar 2021 13:45:07 +0000 (14:45 +0100)] 
APPS: Replace the use of OBJ_nid2ln() with name or description calls

With new provided algorithms added, we'd rather rely on the names and
descriptions that we get from the providers.

Specifically with the 'openssl list' command, we now display the
description of all algorithms.  For '-public-key-algorithms', we
additionally print key type information a bit more like we do for
legacy methods.

We also add descriptions to all our keymgmt functions, because the
built in EVP_PKEY_ASN1_METHODs had them.

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

3 years agoEVP: Add EVP_<TYPE>_description()
Richard Levitte [Tue, 16 Mar 2021 13:23:54 +0000 (14:23 +0100)] 
EVP: Add EVP_<TYPE>_description()

The following operation types are covered:

EVP_MD, EVP_CIPHER, EVP_MAC, EVP_RAND, EVP_KEYMGMT, EVP_SIGNATURE,
EVP_ASYM_CIPHER, EVP_KEM, EVP_KEYEXCH, EVP_KDF.  Also EVP_PKEY.

For EVP_MD and EVP_CIPHER, OBJ_nid2ln() is used as a fallback for
legacy implementations.

For EVP_PKEY, the info field of the EVP_PKEY_ASN1_METHOD is used as a
fallback for legacy implementations.

Fixes #14514

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

3 years agoAdd OSSL_STORE_LOADER_description()
Richard Levitte [Tue, 16 Mar 2021 13:30:59 +0000 (14:30 +0100)] 
Add OSSL_STORE_LOADER_description()

Fixes #14514

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

3 years agoAdd OSSL_DECODER_description() and OSSL_ENCODER_description()
Richard Levitte [Tue, 16 Mar 2021 13:21:42 +0000 (14:21 +0100)] 
Add OSSL_DECODER_description() and OSSL_ENCODER_description()

Fixes #14514

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

3 years agoCORE: Add an algorithm_description field to OSSL_ALGORITHM
Richard Levitte [Tue, 16 Mar 2021 13:14:43 +0000 (14:14 +0100)] 
CORE: Add an algorithm_description field to OSSL_ALGORITHM

This corresponds to the |info| field in EVP_PKEY_ASN1_METHOD, as well
as the generic use of OBJ_nid2ln() as a one line description.

We also add the base functionality to make use of this field.

Fixes #14514

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

3 years agoCorrected missing definitions from NonStop SPT build.
Randall S. Becker [Fri, 26 Mar 2021 12:34:49 +0000 (06:34 -0600)] 
Corrected missing definitions from NonStop SPT build.

This change includes swapping the PUT and SPT configuration,
includes of sys/stat.h and sys/types.h in the correct scope
to be picked up by SPT definitions.

Fixes: #14698
Fixes: #14734
CLA: The author has the permission to grant the OpenSSL Team the right to use this change.

Signed-off-by: Randall S. Becker <rsbecker@nexbridge.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14736)

3 years agoDSA_generate_parameters_ex: use the old method for all small keys
Tomas Mraz [Tue, 30 Mar 2021 11:23:12 +0000 (13:23 +0200)] 
DSA_generate_parameters_ex: use the old method for all small keys

Fixes #14733

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

3 years agoFix typos in ssl_lib.c
Nan Xiao [Wed, 31 Mar 2021 04:02:32 +0000 (12:02 +0800)] 
Fix typos in ssl_lib.c

CLA: trivial

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

3 years agoAdd riscv64 target
luyahan [Mon, 29 Mar 2021 07:33:23 +0000 (16:33 +0900)] 
Add riscv64 target

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

3 years agoRemove unnecessary BIO_do_handshake()s
Nan Xiao [Mon, 29 Mar 2021 09:24:01 +0000 (17:24 +0800)] 
Remove unnecessary BIO_do_handshake()s

Since BIO_do_connect() and BIO_do_handshake() are same, no
need to invoke BIO_do_handshake() once more after BIO_do_connect().

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

3 years agoAdd "save-parameters" encoder parameter
Tomas Mraz [Tue, 30 Mar 2021 15:41:03 +0000 (17:41 +0200)] 
Add "save-parameters" encoder parameter

The parameter makes the dsa key encoder to skip saving the DSA
key parameters similarly to what the legacy dsa key encoder did.

Fixes #14362

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

3 years agoAvoid going through NID when unnecessary
Tomas Mraz [Fri, 26 Mar 2021 16:57:16 +0000 (17:57 +0100)] 
Avoid going through NID when unnecessary

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

3 years agoEVP_CIPHER_type: fix misleading argument name
Tomas Mraz [Fri, 26 Mar 2021 16:53:59 +0000 (17:53 +0100)] 
EVP_CIPHER_type: fix misleading argument name

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

3 years agoDrop TODO 3.0 as we cannot get rid of legacy nids in 3.0
Tomas Mraz [Fri, 26 Mar 2021 16:53:00 +0000 (17:53 +0100)] 
Drop TODO 3.0 as we cannot get rid of legacy nids in 3.0

Fixes #14393

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

3 years agoOBJ_nid2sn(NID_sha256) is completely equivalent to OSSL_DIGEST_NAME_SHA2_256
Tomas Mraz [Fri, 26 Mar 2021 16:50:03 +0000 (17:50 +0100)] 
OBJ_nid2sn(NID_sha256) is completely equivalent to OSSL_DIGEST_NAME_SHA2_256

The comment is bogus as that call for NID_sha256 does not do
anything else than looking up the string in an internal table.

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

3 years agoEVP_PKEY_CTRL_CIPHER can be used with encrypt/decrypt with GOST
Tomas Mraz [Fri, 26 Mar 2021 16:48:31 +0000 (17:48 +0100)] 
EVP_PKEY_CTRL_CIPHER can be used with encrypt/decrypt with GOST

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

3 years agoAdd macosx build
Shane Lontis [Tue, 30 Mar 2021 05:39:27 +0000 (15:39 +1000)] 
Add macosx build

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

3 years agoTest miminal windows build using Github actions
Shane Lontis [Tue, 30 Mar 2021 03:04:52 +0000 (13:04 +1000)] 
Test miminal windows build using Github actions

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

3 years agoAdd a range check (from SP800-56Ar3) to DH key derivation.
Shane Lontis [Mon, 29 Mar 2021 03:38:00 +0000 (13:38 +1000)] 
Add a range check (from SP800-56Ar3) to DH key derivation.

Fixes #14401

Note that this moves the public key check out of DH compute_key() since
key validation does not belong inside this primitive..
The check has been moved to the EVP_PKEY_derive_set_peer() function so that
it generally applies to all exchange operations.. Use EVP_PKEY_derive_set_peer_ex()
to disable this behaviour.

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

3 years agoCHANGES.md: reflect OSSL_HTTP_REQ_CTX_i2d renamed to OSSL_HTTP_REQ_CTX_set1_req
Dr. David von Oheimb [Mon, 29 Mar 2021 17:39:57 +0000 (19:39 +0200)] 
CHANGES.md: reflect OSSL_HTTP_REQ_CTX_i2d renamed to OSSL_HTTP_REQ_CTX_set1_req

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

3 years agoOSSL_HTTP_REQ_CTX_transfer(): improve distinction of send error vs. receive error
Dr. David von Oheimb [Mon, 8 Mar 2021 12:47:33 +0000 (13:47 +0100)] 
OSSL_HTTP_REQ_CTX_transfer(): improve distinction of send error vs. receive error

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

3 years agoOSSL_parse_url(): Improve handling of IPv6 addresses
Dr. David von Oheimb [Mon, 8 Mar 2021 08:59:35 +0000 (09:59 +0100)] 
OSSL_parse_url(): Improve handling of IPv6 addresses

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

3 years ago80-test_cmp_http.t: Add diagnostic info on starting/stopping mock server
Dr. David von Oheimb [Mon, 8 Mar 2021 08:26:28 +0000 (09:26 +0100)] 
80-test_cmp_http.t: Add diagnostic info on starting/stopping mock server

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

3 years agohttp_client.c: Prevent spurious error queue entry on NULL mem argument
Dr. David von Oheimb [Mon, 8 Mar 2021 08:25:54 +0000 (09:25 +0100)] 
http_client.c: Prevent spurious error queue entry on NULL mem argument

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

3 years agoHTTP: Fix method_POST param by moving it to OSSL_HTTP_REQ_CTX_set_request_line()
Dr. David von Oheimb [Sat, 20 Mar 2021 21:04:58 +0000 (22:04 +0100)] 
HTTP: Fix method_POST param by moving it to OSSL_HTTP_REQ_CTX_set_request_line()

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

3 years agoAdd a local perl module to get year last changed
Rich Salz [Wed, 6 Jan 2021 01:26:05 +0000 (20:26 -0500)] 
Add a local perl module to get year last changed

This is used for generating a more-correct copyright statement
for the "build_generated" targets.

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

3 years agoSplit Makefile clean recipe for document sets into individual lines.
Randall S. Becker [Mon, 29 Mar 2021 19:45:40 +0000 (13:45 -0600)] 
Split Makefile clean recipe for document sets into individual lines.

This is needed for less capable platforms with limits on the size of
command line argument lists.

Fixes #14732

CLA: The author has the permission to grant the OpenSSL Team the right to use this change.

Signed-off-by: Randall S. Becker <rsbecker@nexbridge.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14735)