]> git.ipfire.org Git - thirdparty/openssl.git/log
thirdparty/openssl.git
3 years agoRemove -C from dhparam,dsaparam,ecparam
Rich Salz [Wed, 11 Nov 2020 23:03:38 +0000 (18:03 -0500)] 
Remove -C from dhparam,dsaparam,ecparam

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

3 years agoBIO: Undefine UNICODE in b_addr.c to get POSIX declaration of gai_strerror()
Richard Levitte [Tue, 10 Nov 2020 09:45:07 +0000 (10:45 +0100)] 
BIO: Undefine UNICODE in b_addr.c to get POSIX declaration of gai_strerror()

When UNICODE is defined, Windows headers push for WCHAR implementations,
which aren't compatible with POSIX declarations.

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

3 years agocrypto/provider_core.c: fix a couple of faulty ERR_raise_data() calls
Richard Levitte [Tue, 10 Nov 2020 09:28:16 +0000 (10:28 +0100)] 
crypto/provider_core.c: fix a couple of faulty ERR_raise_data() calls

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

3 years agoCRYPTO: refactor ERR_raise()+ERR_add_error_data() to ERR_raise_data()
Richard Levitte [Wed, 4 Nov 2020 15:14:00 +0000 (16:14 +0100)] 
CRYPTO: refactor ERR_raise()+ERR_add_error_data() to ERR_raise_data()

This is not done absolutely everywhere, as there are places where
the use of ERR_add_error_data() is quite complex, but at least the
simple cases are done.

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

3 years agoConvert all {NAME}err() in crypto/ to their corresponding ERR_raise() call
Richard Levitte [Wed, 4 Nov 2020 11:23:19 +0000 (12:23 +0100)] 
Convert all {NAME}err() in crypto/ to their corresponding ERR_raise() call

This includes error reporting for libcrypto sub-libraries in surprising
places.

This was done using util/err-to-raise

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

3 years agoEVP: Adapt EVP_PKEY2PKCS8() to better handle provider-native keys
Richard Levitte [Fri, 25 Sep 2020 18:02:56 +0000 (20:02 +0200)] 
EVP: Adapt EVP_PKEY2PKCS8() to better handle provider-native keys

It doesn't downgread the keys to legacy any more.  Instead, it uses
OSSL_ENCODER to encode the key to DER, and d2i_PKCS8_PRIV_KEY_INFO()
to make a PKCS8_PRIV_KEY_INFO structure from that.

Fixes #12990

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

3 years agoDragonFlyBSD build fix and update.
David Carlier [Wed, 11 Nov 2020 10:01:22 +0000 (10:01 +0000)] 
DragonFlyBSD build fix and update.

getentropy call is not supported however getrandom since the 5.7.x branch is.
current LTS stable is 5.8.

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

3 years agoRemove unused helper functions EVP_str2ctrl() & EVP_hex2ctrl().
Shane Lontis [Wed, 11 Nov 2020 05:04:56 +0000 (15:04 +1000)] 
Remove unused helper functions EVP_str2ctrl() & EVP_hex2ctrl().

These were added when the EVP_MAC work was being done.
I dont think these lightweight wrappers are required, and it seems better to remove them,
rather than adding documentation.

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

3 years ago[test/recipes] Split test_fuzz into separate recipes
Nicola Tuveri [Wed, 4 Nov 2020 13:39:42 +0000 (15:39 +0200)] 
[test/recipes] Split test_fuzz into separate recipes

When using `HARNESS_JOBS` to run the tests in parallel, no matter the
level of parallelism that can be used, the monolithic `test_fuzz` takes
a long time to run, conditioning the duration of the whole build.

This commit splits the single `test_fuzz` recipe into separate recipes
for each fuzzer.
The previous mechanism to select individual fuzz tests using the
`FUZZ_TESTS` environment variable is also dropped (and documentation
updated).

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

3 years agoOptimize AES-XTS mode in OpenSSL for aarch64
XiaokangQian [Fri, 13 Mar 2020 03:27:34 +0000 (03:27 +0000)] 
Optimize AES-XTS mode in OpenSSL for aarch64

Aes-xts mode can be optimized by interleaving cipher operation on
several blocks and loop unrolling. Interleaving needs one ideal
unrolling factor, here we adopt the same factor with aes-cbc,
which is described as below:
If blocks number > 5, select 5 blocks as one iteration,every
loop, decrease the blocks number by 5.
If left blocks < 5, treat them as tail blocks.
Detailed implementation has a little adjustment for squeezing
code space.
With this way, for small size such as 16 bytes, the performance is
similar as before, but for big size such as 16k bytes, the performance
improves a lot, even reaches to 2x uplift, for some arches such as A57,
the improvement even reaches more than 2x uplift. We collect many
performance datas on different micro-archs such as thunderx2,
ampere-emag, a72, a75, a57, a53 and N1, all of which reach 0.5-2x uplift.
The following table lists the encryption performance data on aarch64,
take a72, a75, a57, a53 and N1 as examples. Performance value takes the
unit of cycles per byte, takes the format as comparision of values.
List them as below:

A72:
                            Before optimization     After optimization  Improve
evp-aes-128-xts@16          8.899913518             5.949087263         49.60%
evp-aes-128-xts@64          4.525512668             3.389141845         33.53%
evp-aes-128-xts@256         3.502906908             1.633573479         114.43%
evp-aes-128-xts@1024        3.174210419             1.155952639         174.60%
evp-aes-128-xts@8192        3.053019303             1.028134888         196.95%
evp-aes-128-xts@16384       3.025292462             1.02021169          196.54%
evp-aes-256-xts@16          9.971105023             6.754233758         47.63%
evp-aes-256-xts@64          4.931479093             3.786527393         30.24%
evp-aes-256-xts@256         3.746788153             1.943975947         92.74%
evp-aes-256-xts@1024        3.401743802             1.477394648         130.25%
evp-aes-256-xts@8192        3.278769327             1.32950421          146.62%
evp-aes-256-xts@16384       3.27093296              1.325276257         146.81%

A75:
                            Before optimization     After optimization  Improve
evp-aes-128-xts@16          8.397965173             5.126839098         63.80%
evp-aes-128-xts@64          4.176860631             2.59817764          60.76%
evp-aes-128-xts@256         3.069126585             1.284561028         138.92%
evp-aes-128-xts@1024        2.805962699             0.932754655         200.83%
evp-aes-128-xts@8192        2.725820131             0.829820397         228.48%
evp-aes-128-xts@16384       2.71521905              0.823251591         229.82%
evp-aes-256-xts@16          11.24790935             7.383914448         52.33%
evp-aes-256-xts@64          5.294128847             3.048641998         73.66%
evp-aes-256-xts@256         3.861649617             1.570359905         145.91%
evp-aes-256-xts@1024        3.537646797             1.200493533         194.68%
evp-aes-256-xts@8192        3.435353012             1.085345319         216.52%
evp-aes-256-xts@16384       3.437952563             1.097963822         213.12%

A57:
                            Before optimization     After optimization  Improve
evp-aes-128-xts@16          10.57455446             7.165438012         47.58%
evp-aes-128-xts@64          5.418185447             3.721241202         45.60%
evp-aes-128-xts@256         3.855184592             1.747145379         120.66%
evp-aes-128-xts@1024        3.477199757             1.253049735         177.50%
evp-aes-128-xts@8192        3.36768104              1.091943159         208.41%
evp-aes-128-xts@16384       3.360373443             1.088942789         208.59%
evp-aes-256-xts@16          12.54559459             8.745489036         43.45%
evp-aes-256-xts@64          6.542808937             4.326387568         51.23%
evp-aes-256-xts@256         4.62668822              2.119908754         118.25%
evp-aes-256-xts@1024        4.161716505             1.557335554         167.23%
evp-aes-256-xts@8192        4.032462227             1.377749511         192.68%
evp-aes-256-xts@16384       4.023293877             1.371558933         193.34%

A53:
                            Before optimization     After optimization  Improve
evp-aes-128-xts@16          18.07842135             13.96980808         29.40%
evp-aes-128-xts@64          7.933818397             6.07159276          30.70%
evp-aes-128-xts@256         5.264604704             2.611155744         101.60%
evp-aes-128-xts@1024        4.606660117             1.722713454         167.40%
evp-aes-128-xts@8192        4.405160115             1.454379201         202.90%
evp-aes-128-xts@16384       4.401592028             1.442279392         205.20%
evp-aes-256-xts@16          20.07084054             16.00803726         25.40%
evp-aes-256-xts@64          9.192647294             6.883876732         33.50%
evp-aes-256-xts@256         6.336143161             3.108140452         103.90%
evp-aes-256-xts@1024        5.62502952              2.097960651         168.10%
evp-aes-256-xts@8192        5.412085608             1.807294191         199.50%
evp-aes-256-xts@16384       5.403062591             1.790135764         201.80%

N1:
                            Before optimization     After optimization  Improve
evp-aes-128-xts@16          6.48147613              4.209415473         53.98%
evp-aes-128-xts@64          2.847744115             1.950757468         45.98%
evp-aes-128-xts@256         2.085711968             1.061903238         96.41%
evp-aes-128-xts@1024        1.842014669             0.798486302         130.69%
evp-aes-128-xts@8192        1.760449052             0.713853939         146.61%
evp-aes-128-xts@16384       1.760763546             0.707702009         148.80%
evp-aes-256-xts@16          7.264142817             5.265970454         37.94%
evp-aes-256-xts@64          3.251356212             2.41176323          34.81%
evp-aes-256-xts@256         2.380488469             1.342095742         77.37%
evp-aes-256-xts@1024        2.08853022              1.041718215         100.49%
evp-aes-256-xts@8192        2.027432668             0.944571334         114.64%
evp-aes-256-xts@16384       2.00740782              0.941991415         113.10%

Add more XTS test cases to cover the cipher stealing mode and cases of different
number of blocks.

CustomizedGitHooks: yes
Change-Id: I93ee31b2575e1413764e27b599af62994deb4c96

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

3 years agoapps/passwd: remove the -crypt option.
Pauli [Wed, 4 Nov 2020 12:34:52 +0000 (22:34 +1000)] 
apps/passwd: remove the -crypt option.

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

3 years agorsa_test: add return value check
Pauli [Tue, 10 Nov 2020 07:05:30 +0000 (17:05 +1000)] 
rsa_test: add return value check

Fixes #13361

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

3 years agoDo not prepend $OPENSSL_CONF_INCLUDE to absolute include paths
Tomas Mraz [Tue, 3 Nov 2020 17:51:38 +0000 (18:51 +0100)] 
Do not prepend $OPENSSL_CONF_INCLUDE to absolute include paths

Also check for malloc failure and do not add '/' when
$OPENSSL_CONF_INCLUDE already ends with directory separator.

Fixes #13302

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

3 years agoAdd ossl_is_absolute_path function to detect absolute paths
Tomas Mraz [Tue, 3 Nov 2020 17:34:16 +0000 (18:34 +0100)] 
Add ossl_is_absolute_path function to detect absolute paths

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

3 years agoAvoid duplicate ends_with_dirsep functions
Tomas Mraz [Tue, 3 Nov 2020 17:15:46 +0000 (18:15 +0100)] 
Avoid duplicate ends_with_dirsep functions

Refactor them into inline ossl_ends_with_dirsep function in
internal/cryptlib.h.

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

3 years agotest/recipes/30-test_evp_libctx.t: use fips-and-base.cnf
Richard Levitte [Sat, 17 Oct 2020 09:45:19 +0000 (11:45 +0200)] 
test/recipes/30-test_evp_libctx.t: use fips-and-base.cnf

The FIPS provider module doesn't have any encoders, the base provider
is needed for that.

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

3 years agotest/evp_libctx_test.c: use OSSL_ENCODER instead of i2d_PublicKey()
Richard Levitte [Sat, 17 Oct 2020 09:44:43 +0000 (11:44 +0200)] 
test/evp_libctx_test.c: use OSSL_ENCODER instead of i2d_PublicKey()

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

3 years agotest/endecode_test.c: Update to specify output structures
Richard Levitte [Sat, 17 Oct 2020 06:59:48 +0000 (08:59 +0200)] 
test/endecode_test.c: Update to specify output structures

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

3 years agoAdapt libcrypto functionality to specify the desired output structure
Richard Levitte [Sat, 17 Oct 2020 06:55:39 +0000 (08:55 +0200)] 
Adapt libcrypto functionality to specify the desired output structure

This also modifies i2d_PublicKey() and i2d_KeyParams() to support
provided keys.

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

3 years agoPROV: Re-implement all the keypair encoders
Richard Levitte [Sat, 17 Oct 2020 06:34:47 +0000 (08:34 +0200)] 
PROV: Re-implement all the keypair encoders

The base functionality to implement the keypair encoders doesn't
change much, but this results in a more massive amount of
OSSL_DISPATCH and OSSL_ALGORITHM arrays, to support a fine grained
selection of implementation based on what parts of the keypair
structure (combinations of key parameters, public key and private key)
should be output, the output type ("TEXT", "DER" or "PEM") and the
outermost output structure ("pkcs8", "SubjectPublicKeyInfo", key
type specific structures, ...).

We add support for the generic structure name "type-specific", to
allow selecting that without knowing the exact name of that structure.

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

3 years agoENCODER: Add tracing
Richard Levitte [Wed, 28 Oct 2020 09:14:53 +0000 (10:14 +0100)] 
ENCODER: Add tracing

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

3 years agoENCODER: Add output structure support for EVP_PKEY encoding
Richard Levitte [Sat, 17 Oct 2020 06:23:43 +0000 (08:23 +0200)] 
ENCODER: Add output structure support for EVP_PKEY encoding

OSSL_ENCODER_CTX_new_by_EVP_PKEY() takes one more argument to express
the desired outermost structure for the output.

This also adds OSSL_ENCODER_CTX_prune_encoders(), which is used to
reduce the stack of encoders found according to criteria formed from
the combination of desired selection, output type and output
structure.

squash! ENCODER: Add output structure support for EVP_PKEY encoding

Replace the paragraph talking about OSSL_ENCODER_CTX_prune_encoders() with:

The encoding processor encoder_process() is enhanced with better
analysis of the stack of encoder implementations.  To avoid having to
keep an on the side array of information, it uses recursion.

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

3 years agoENCODER: Add support for OSSL_FUNC_encoder_does_selection()
Richard Levitte [Sat, 17 Oct 2020 06:17:41 +0000 (08:17 +0200)] 
ENCODER: Add support for OSSL_FUNC_encoder_does_selection()

OSSL_FUNC_encoder_does_selection() is a dispatchable encoder implementation
function that should return 1 if the given |selection| is supported by an
encoder implementation and 0 if not.  This can be used by libcrypto
functionality to figure out if an encoder implementation should be
considered or not.

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

3 years agoENCODER: Add support for specifying the outermost output structure
Richard Levitte [Sat, 17 Oct 2020 05:57:04 +0000 (07:57 +0200)] 
ENCODER: Add support for specifying the outermost output structure

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

3 years agoCORE: Add support for specifying the outermost object structure
Richard Levitte [Sat, 17 Oct 2020 05:58:32 +0000 (07:58 +0200)] 
CORE: Add support for specifying the outermost object structure

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

3 years agoConvert all {NAME}err() in providers/ to their corresponding ERR_raise() call
Richard Levitte [Wed, 4 Nov 2020 11:26:49 +0000 (12:26 +0100)] 
Convert all {NAME}err() in providers/ to their corresponding ERR_raise() call

This was done using util/err-to-raise

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

3 years agoSSL: refactor all SSLfatal() calls
Richard Levitte [Wed, 4 Nov 2020 13:39:57 +0000 (14:39 +0100)] 
SSL: refactor all SSLfatal() calls

Since SSLfatal() doesn't take a function code any more, we drop that
argument everywhere.  Also, we convert all combinations of SSLfatal()
and ERR_add_data() to an SSLfatal_data() call.

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

3 years agoSSL: refactor ossl_statem_fatal() and SSLfatal()
Richard Levitte [Wed, 4 Nov 2020 13:36:38 +0000 (14:36 +0100)] 
SSL: refactor ossl_statem_fatal() and SSLfatal()

ossl_statem_fatal() is refactored to be an extended ERR_set_error(),
and SSLfatal() is refactored to work like ERR_raise().  We also add
SSLfatal_data() to work like ERR_raise_data().

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

3 years agoConvert all {NAME}err() in ssl/ to their corresponding ERR_raise() call
Richard Levitte [Wed, 4 Nov 2020 11:18:33 +0000 (12:18 +0100)] 
Convert all {NAME}err() in ssl/ to their corresponding ERR_raise() call

This was done using util/err-to-raise

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

3 years agoOSSL_STORE: Make sure the called OSSL_DECODER knows what to expect
Richard Levitte [Wed, 28 Oct 2020 18:13:46 +0000 (19:13 +0100)] 
OSSL_STORE: Make sure the called OSSL_DECODER knows what to expect

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

3 years agoPEM: Have pem_read_bio_key() set the OSSL_STORE expected type
Richard Levitte [Wed, 28 Oct 2020 18:11:24 +0000 (19:11 +0100)] 
PEM: Have pem_read_bio_key() set the OSSL_STORE expected type

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

3 years agoRestore the legacy implementation of PEM_read_bio_DHparams()
Richard Levitte [Wed, 28 Oct 2020 16:35:48 +0000 (17:35 +0100)] 
Restore the legacy implementation of PEM_read_bio_DHparams()

It was an overstep to have it got through OSSL_STORE just to extract a
DH pointer from the resulting EVP_PKEY.

This partially reverts 1427d33cee59d6fe54efe1b5a322a1d7c8c03c20

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

3 years agoTEST: Adapt test/endecoder_test.c
Richard Levitte [Mon, 26 Oct 2020 15:38:40 +0000 (16:38 +0100)] 
TEST: Adapt test/endecoder_test.c

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

3 years agoDH: Move the code to set the DH sub-type
Richard Levitte [Mon, 26 Oct 2020 12:59:09 +0000 (13:59 +0100)] 
DH: Move the code to set the DH sub-type

It's been moved so the type is set by d2i_DHparams() and d2i_DHxparams()

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

3 years agoAdapt libcrypto functionality to specify the desired input structure
Richard Levitte [Mon, 26 Oct 2020 12:58:30 +0000 (13:58 +0100)] 
Adapt libcrypto functionality to specify the desired input structure

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

3 years agoPROV: Re-implement all the keypair decoders
Richard Levitte [Mon, 26 Oct 2020 12:22:54 +0000 (13:22 +0100)] 
PROV: Re-implement all the keypair decoders

The base functionality to implement the keypair decoders doesn't
change much, but this results in a more massive amount of
OSSL_DISPATCH and OSSL_ALGORITHM arrays, to support a fine grained
selection of implementation based on what parts of the keypair
structure (combinations of key parameters, public key and private key)
should be expected as input, the input type ("DER", "PEM", ...) and the
outermost input structure ("pkcs8", "SubjectPublicKeyInfo", key
type specific structures, ...).

We add support for the generic structure name "type-specific", to
allow selecting that without knowing the exact name of that structure.

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

3 years agoDECODER: Add tracing
Richard Levitte [Wed, 28 Oct 2020 09:13:24 +0000 (10:13 +0100)] 
DECODER: Add tracing

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

3 years agoDECODER: Add input structure support for EVP_PKEY decoding
Richard Levitte [Mon, 26 Oct 2020 12:17:42 +0000 (13:17 +0100)] 
DECODER: Add input structure support for EVP_PKEY decoding

OSSL_DECODER_CTX_new_by_EVP_PKEY() takes one more argument to express
the desired outermost structure for the input.

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

3 years agoDECODER: Add support for OSSL_FUNC_decoder_does_selection()
Richard Levitte [Mon, 26 Oct 2020 12:08:54 +0000 (13:08 +0100)] 
DECODER: Add support for OSSL_FUNC_decoder_does_selection()

OSSL_FUNC_decoder_does_selection() is a dispatchable decoder implementation
function that should return 1 if the given |selection| is supported by an
decoder implementation and 0 if not.  This can be used by libcrypto
functionality to figure out if an encoder implementation should be
considered or not.

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

3 years agoDECODER: Add support for specifying the outermost input structure
Richard Levitte [Mon, 26 Oct 2020 12:06:01 +0000 (13:06 +0100)] 
DECODER: Add support for specifying the outermost input structure

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

3 years ago25-test_x509.t: Re-add and improve a test on non-existence of ASN.1 parse errors
Dr. David von Oheimb [Mon, 9 Nov 2020 09:08:23 +0000 (10:08 +0100)] 
25-test_x509.t: Re-add and improve a test on non-existence of ASN.1 parse errors

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

3 years agocmp_msg.c: Use issuer of reference cert as default issuer entry in certTemplate
Dr. David von Oheimb [Tue, 27 Oct 2020 11:00:22 +0000 (12:00 +0100)] 
cmp_msg.c: Use issuer of reference cert as default issuer entry in certTemplate

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

3 years agoAdd support for making all of KBKDF FixedInput fields optional.
Shane Lontis [Wed, 28 Oct 2020 05:33:05 +0000 (15:33 +1000)] 
Add support for making all of KBKDF FixedInput fields optional.

Added settable integer parameters OSSL_KDF_PARAM_KBKDF_USE_L, OSSL_KDF_PARAM_KBKDF_USE_SEPARATOR.
This is required for CAVS tests that only use a combined blob of
inputdata. A test showing this use case has been added.

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

3 years agoRemove some redundant error messages in the apps
Matt Caswell [Mon, 9 Nov 2020 10:48:56 +0000 (10:48 +0000)] 
Remove some redundant error messages in the apps

We change the load_key() and load_pubkey() functions to make them more
consistent with the load_keyparams() function modified as a result of
PR #13317.

The error message on a NULL key is removed, because an error message has
already been displayed by load_key_certs_crls().

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

3 years agoFix the reading of DSA parameters files using the dsaparam app
Matt Caswell [Wed, 4 Nov 2020 14:20:36 +0000 (14:20 +0000)] 
Fix the reading of DSA parameters files using the dsaparam app

DSA parameters files were failing to load correctly. We also fix a number
of follow on issues which resulted in multiple similar errors messages
being displayed for the same problem, as well as a seg-fault.

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

3 years agoDocument pkcs12 alg NONE
Pali Rohár [Sun, 12 Jul 2020 22:52:26 +0000 (00:52 +0200)] 
Document pkcs12 alg NONE

To generate unencrypted PKCS#12 file it is needed to use options: -keypbe NONE -certpbe NONE

CLA: trivial

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

3 years agoopenssl-cmp.pod.in: Clean up doc of -verify_email, -verify_hostname, and -verify_ip
Dr. David von Oheimb [Mon, 28 Sep 2020 10:01:04 +0000 (12:01 +0200)] 
openssl-cmp.pod.in: Clean up doc of -verify_email, -verify_hostname, and -verify_ip

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

3 years agoopenssl.pod: Improve doc of -verify_email, -verify_hostname, and -verify_ip
Dr. David von Oheimb [Mon, 28 Sep 2020 09:28:08 +0000 (11:28 +0200)] 
openssl.pod: Improve doc of -verify_email, -verify_hostname, and -verify_ip

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

3 years agoopenssl-*.pod.in: Prevent newlines on empty engine_synopsis causing layout errors
Dr. David von Oheimb [Mon, 21 Sep 2020 09:56:01 +0000 (11:56 +0200)] 
openssl-*.pod.in: Prevent newlines on empty engine_synopsis causing layout errors

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

3 years agoopenssl-cmp.pod.in: Align order of options with apps/cmp.c; improve structuring of...
Dr. David von Oheimb [Mon, 21 Sep 2020 09:54:46 +0000 (11:54 +0200)] 
openssl-cmp.pod.in: Align order of options with apps/cmp.c; improve structuring of SYNOPSIS

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

3 years agoapps/cmp.c: Improve order of -path option: just after -server
Dr. David von Oheimb [Mon, 21 Sep 2020 09:53:10 +0000 (11:53 +0200)] 
apps/cmp.c: Improve order of -path option: just after -server

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

3 years agoPEM: Always use PEM_def_callback() when cb == NULL in pem_read_bio_key()
Richard Levitte [Sun, 8 Nov 2020 09:25:47 +0000 (10:25 +0100)] 
PEM: Always use PEM_def_callback() when cb == NULL in pem_read_bio_key()

Too many other functions depend on this being done.

Fixes #13340

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

3 years agoUI: Use OPENSSL_zalloc() in general_allocate_prompt()
Richard Levitte [Sun, 8 Nov 2020 09:23:54 +0000 (10:23 +0100)] 
UI: Use OPENSSL_zalloc() in general_allocate_prompt()

This is to ensure that fields we don't set explicitly are always zero.

Fixes #13340

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

3 years agoFix REF_PRINT_COUNT argument in ecx_key_free
Daniel Bevenius [Mon, 2 Nov 2020 12:33:01 +0000 (13:33 +0100)] 
Fix REF_PRINT_COUNT argument in ecx_key_free

Currently, when configuring OpenSSL using -DREF_PRINT the following
compilation error is generated:

In file included from include/crypto/ecx.h:21,
                 from crypto/ec/ecx_key.c:11:
crypto/ec/ecx_key.c: In function 'ecx_key_free':
crypto/ec/ecx_key.c:65:32: error: 'r' undeclared
(first use in this function)
   65 |     REF_PRINT_COUNT("ECX_KEY", r);
      |                                ^
include/internal/refcount.h:169:40: note: in definition of macro
'REF_PRINT_COUNT'
  169 |         fprintf(stderr, "%p:%4d:%s\n", b, b->references, a)
      |                                        ^
crypto/ec/ecx_key.c:65:32: note: each undeclared identifier is reported
only once for each function it appears in
   65 |     REF_PRINT_COUNT("ECX_KEY", r);
      |                                ^
include/internal/refcount.h:169:40: note: in definition of macro
'REF_PRINT_COUNT'
  169 |         fprintf(stderr, "%p:%4d:%s\n", b, b->references, a)
      |                                        ^
make[1]: *** [Makefile:14929: crypto/ec/libcrypto-lib-ecx_key.o] Error 1

This commit updates the argument passed in to be the ECX_KEY* key.

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

3 years agoRemove test that breaks on AIX.
Shane Lontis [Wed, 4 Nov 2020 02:48:03 +0000 (12:48 +1000)] 
Remove test that breaks on AIX.

The offending test checks that fopen("anydir/") fails. This looks fairly platform
specific. For the test involved this creates a file called
"anydir" on an AIX test machine.

This change was introduced on (Sept 24)
https://github.com/openssl/openssl/commit/29844ea5b3d2b7240d99b043a0d82cb177f0762d

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

3 years agoThis should fix a lock-order-inversion
Bernd Edlinger [Wed, 4 Nov 2020 19:55:36 +0000 (20:55 +0100)] 
This should fix a lock-order-inversion

Calling OPENSSL_init_crypto before acquiring the
ossl_property_read_lock in ossl_method_store_fetch
makes the second call to OPENSSL_init_crypto
from ossl_ctx_global_properties unnecessary.

Fixes #12869

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/13321)

3 years agotest/evp_extra_test.c: Modify to reflect provider support in test_EVP_PKEY_check
Richard Levitte [Fri, 6 Nov 2020 09:37:43 +0000 (10:37 +0100)] 
test/evp_extra_test.c: Modify to reflect provider support in test_EVP_PKEY_check

With our providers, RSA now supports public key check and key parameter check.

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

3 years agoEVP: Have all EVP_PKEY check functions export to provider if possible
Richard Levitte [Fri, 6 Nov 2020 07:04:59 +0000 (08:04 +0100)] 
EVP: Have all EVP_PKEY check functions export to provider if possible

Fixes #13322

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

3 years agoFix test/recipes/80-test_ca.t to skip_all properly in a subtest
Richard Levitte [Thu, 5 Nov 2020 20:54:36 +0000 (21:54 +0100)] 
Fix test/recipes/80-test_ca.t to skip_all properly in a subtest

It's perfectlt ok to 'plan skip_all' in a subtest, but in that case,
it must really be inside the subtest.

Fixes #13330

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

3 years agoCorrect system guessing for solaris64-x86_64-* targets
Matt Caswell [Thu, 5 Nov 2020 15:13:25 +0000 (15:13 +0000)] 
Correct system guessing for solaris64-x86_64-* targets

Previously the system guessing script was choosing a target that did not
exist for these platforms.

Fixes #13323

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

3 years agoDon't complain about uninitialized values when running Configure
Matt Caswell [Thu, 5 Nov 2020 14:56:45 +0000 (14:56 +0000)] 
Don't complain about uninitialized values when running Configure

If a system understands `uname -X` then the Configure script will attempt
to use uninitialized values.

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

3 years agoDon't clear the whole error stack when loading engines
Matt Caswell [Wed, 4 Nov 2020 11:34:15 +0000 (11:34 +0000)] 
Don't clear the whole error stack when loading engines

Loading the various built-in engines was unconditionally clearing the
whole error stack. During config file processing processing a .include
directive which fails results in errors being added to the stack - but
we carry on anyway. These errors were then later being removed by the
engine loading code, meaning that problems with the .include directive
never get shown.

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

3 years agoDon't clear errors on failure in CONF_modules_load_file_ex()
Matt Caswell [Wed, 4 Nov 2020 11:31:55 +0000 (11:31 +0000)] 
Don't clear errors on failure in CONF_modules_load_file_ex()

The call to CONF_modules_load() in CONF_modules_load_file_ex() can
return a negative number to indicate failure. This was incorrectly
being interpreted as "success" and therefore errors were being cleared
incorrectly.

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

3 years agox509_vfy.c: Call verification callback individually per strict check in check_chain()
David von Oheimb [Wed, 4 Nov 2020 12:07:08 +0000 (13:07 +0100)] 
x509_vfy.c: Call verification callback individually per strict check in check_chain()

Fixes #13283

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

3 years agox509_vfy.c: Introduce CHECK_CB macro simplifying use of cert verification cb function
David von Oheimb [Wed, 4 Nov 2020 11:24:41 +0000 (12:24 +0100)] 
x509_vfy.c: Introduce CHECK_CB macro simplifying use of cert verification cb function

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

3 years agoCHANGES.md: Mention (strict) checks recently added to X509_verify_cert()
David von Oheimb [Wed, 4 Nov 2020 11:23:34 +0000 (12:23 +0100)] 
CHANGES.md: Mention (strict) checks recently added to X509_verify_cert()

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

3 years agoImprove doc of X509_verify_cert(), also in openssl.pod
David von Oheimb [Wed, 4 Nov 2020 11:21:10 +0000 (12:21 +0100)] 
Improve doc of X509_verify_cert(), also in openssl.pod

in particular regarding the checks due to X509_V_FLAG_X509_STRICT/-x509_strict

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

3 years agoCheck the configuration file by default
Dmitry Belyavskiy [Wed, 4 Nov 2020 09:25:58 +0000 (12:25 +0300)] 
Check the configuration file by default

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

3 years agoPrepare for 3.0 alpha 9
Matt Caswell [Thu, 5 Nov 2020 14:04:11 +0000 (14:04 +0000)] 
Prepare for 3.0 alpha 9

Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
3 years agoPrepare for release of 3.0 alpha 8 openssl-3.0.0-alpha8
Matt Caswell [Thu, 5 Nov 2020 14:03:50 +0000 (14:03 +0000)] 
Prepare for release of 3.0 alpha 8

Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
3 years agoUpdate copyright year
Matt Caswell [Thu, 5 Nov 2020 13:37:26 +0000 (13:37 +0000)] 
Update copyright year

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

3 years agodefltprov: remove duplicate algorithm names.
Pauli [Wed, 4 Nov 2020 02:31:19 +0000 (12:31 +1000)] 
defltprov: remove duplicate algorithm names.

Ed25519 and Ed448 contained aliases that were the same as the primary name.
This removes the aliases leaving ED25519 and ED448 as the canonical names.

Matching is case insensitive, so no functionality is lost.  The FIPS provider
didn't include the duplicates.

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

3 years agoMoved OPENSSL_fork_prepare,_parent,_child from init.c to threads_pthread.c.
Randall S. Becker [Thu, 29 Oct 2020 15:17:25 +0000 (10:17 -0500)] 
Moved OPENSSL_fork_prepare,_parent,_child from init.c to threads_pthread.c.

These methods should ultimately be deprecated. The move is to insulate
non-UNIX platforms from these undefined symbols.

CLA: Permission is granted by the author to the OpenSSL team to use
these modifications.

Fixes #13273

Signed-off-by: Randall S. Becker <rsbecker@nexbridge.com>
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/13276)

3 years agoDo not export the submodules gost-engine
Hu Keping [Tue, 3 Nov 2020 20:14:36 +0000 (20:14 +0000)] 
Do not export the submodules gost-engine

Remove gost-engine from the distribution tarball.

Signed-off-by: Hu Keping <hukeping@huawei.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/13301)

3 years agofix typo in README
Ichinose Shogo [Sun, 1 Nov 2020 06:14:02 +0000 (15:14 +0900)] 
fix typo in README

CLA: trivial

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/13289)

3 years agoAdd more diagnostics to ossl_shim
Benjamin Kaduk [Mon, 26 Oct 2020 19:20:31 +0000 (12:20 -0700)] 
Add more diagnostics to ossl_shim

We had several cases where the connection failed but we did not
have an error message to differentiate which failure condition had
been triggered.  Add some more messages to help clarify what is
going wrong.

[extended tests]

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

3 years agoAdjust error reason for ssl_get_min_max_version() failure
Benjamin Kaduk [Mon, 26 Oct 2020 19:35:55 +0000 (12:35 -0700)] 
Adjust error reason for ssl_get_min_max_version() failure

Use SSL_R_NO_PROTOCOLS_AVAILABLE instead of ERR_R_INTERNAL_ERROR,
to match what the BoringSSL tests expect for this case.

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

3 years agoClear error queue entries from bad DLTS records
Benjamin Kaduk [Mon, 26 Oct 2020 19:30:16 +0000 (12:30 -0700)] 
Clear error queue entries from bad DLTS records

DTLS by design ignores records/packets with bad MAC or failed AEAD tag
validation.  However, recent changes to have provided cipher
implementations caused tls1_enc() to leave an entry on the error queue
for invalid GCM tags, e.g.:

800BEAEF487F0000:error::Provider routines:gcm_stream_update:cipher operation failed:providers/implementations/ciphers/ciphercommon_gcm.c:306

The BoringSSL tests check for entries on the error queue with
SSL_get_error() and so we were seeing spurious test failures
due to the additional item on the error queue.  To avoid leaving
such spurious entries on the error queue, set a mark before calling
the ssl3_enc 'enc' method, and pop to that mark before ignoring
invalid packets.

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

3 years agoPrevent potential UAF in init_thread_deregister()
jwalch [Thu, 29 Oct 2020 17:32:49 +0000 (13:32 -0400)] 
Prevent potential UAF in init_thread_deregister()

I discovered the potential for use-after-free on glob_tevent_reg &
its members in this function as a consequence of some static (de-)initialization
fiasco in C++ client code.

Long story short, an EVP_PKEY_free() was happening after
OPENSSL_cleanup(). Aside from being freed the EVP_PKEY object wasn't
actually being used after cleanup, it was basically just an
ordering issue.

Obviously the application behavior here is somewhat suspect,
but IMO is basically benign. Crashing (most typical outcome
of a UAF) doesn't seem the optimal response.

At any rate, the issue can be avoided (at least with regard to this function)
by simply updating the pointer to NULL rather than leaving it pointing
to the freed memory, as is the typical practice.

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

3 years agoEVP: Fix typo in EVP_PKEY_gen comment
Daniel Bevenius [Fri, 30 Oct 2020 12:34:06 +0000 (13:34 +0100)] 
EVP: Fix typo in EVP_PKEY_gen comment

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

3 years agoInitialize outl in evp_enc.c to 0, protect against NULL
jwalch [Thu, 29 Oct 2020 18:05:19 +0000 (14:05 -0400)] 
Initialize outl in evp_enc.c to 0, protect against NULL

Fixes #12734

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

3 years agoAdd AES KW inverse ciphers to the EVP layer
Shane Lontis [Thu, 29 Oct 2020 08:20:36 +0000 (18:20 +1000)] 
Add AES KW inverse ciphers to the EVP layer

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

3 years agoRemove FLOSS from all OSS builds on NonStop except for SPT threading.
Randall S. Becker [Thu, 29 Oct 2020 15:37:05 +0000 (10:37 -0500)] 
Remove FLOSS from all OSS builds on NonStop except for SPT threading.

The Standard POSIX Threads (SPT) implementation hangs in some test cases
if FLOSS is not used.

CLA: Permission is granted by the author to the OpenSSL team to use
these modifications.

Fixes #13277

Signed-off-by: Randall S. Becker <rsbecker@nexbridge.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/13279)

3 years agotest/recipes/90-test_shlibload.t: Skip when address sanitizer enabled
Richard Levitte [Fri, 30 Oct 2020 12:16:46 +0000 (13:16 +0100)] 
test/recipes/90-test_shlibload.t: Skip when address sanitizer enabled

Because this test loads the shared libraries dynamically, there are
cases where that results in errors because the ASAN library wasn't
loaded first.  That makes this test unsuitable in an ASAN build.

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

3 years agoutil/find-doc-nits: ignore OSSL_DEPRECATED*, alongside other reserved symbols
Richard Levitte [Mon, 26 Oct 2020 17:38:35 +0000 (18:38 +0100)] 
util/find-doc-nits: ignore OSSL_DEPRECATED*, alongside other reserved symbols

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

3 years agoSimplify and clarify doc/internal/man7/deprecation.pod
Richard Levitte [Sun, 25 Oct 2020 11:20:13 +0000 (12:20 +0100)] 
Simplify and clarify doc/internal/man7/deprecation.pod

doc/internal/man7/deprecation.pod was unclear in some areas, and
included general documentation that has no place there.

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

3 years agoPatch leak in EVP_PKEY2PKCS8() error path
jwalch [Thu, 29 Oct 2020 14:52:52 +0000 (10:52 -0400)] 
Patch leak in EVP_PKEY2PKCS8() error path

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

3 years agoAllow empty deprecation macros to be passed as macro arguments
Matt Caswell [Fri, 23 Oct 2020 13:26:48 +0000 (14:26 +0100)] 
Allow empty deprecation macros to be passed as macro arguments

The OSSL_DEPRECATEDIN_3_0 macro introduced in PR #13074 is intended to
be passed as a parameter to the various PEM declaration macros. However,
in some cases OSSL_DEPRECATEDIN_3_0 is defined to be empty, and it is
not allowed to pass empty macro arguments in C90. Therefore we ensure
these macros are always defined. In the case where they were empty
previously we use a no-op value instead.

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

3 years agoFix some missed usage of DEFINE_LHASH_OF()
Matt Caswell [Thu, 29 Oct 2020 12:46:28 +0000 (12:46 +0000)] 
Fix some missed usage of DEFINE_LHASH_OF()

PR#12860 fixed issues with the Lhash code. It replaced usage of
DEFINE_LHASH_OF() in the public headers. Unfortunately it missed a couple
of instances.

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

3 years agoAdd easy to digest selector macros for EVP_PKEYs
Richard Levitte [Fri, 9 Oct 2020 11:02:58 +0000 (13:02 +0200)] 
Add easy to digest selector macros for EVP_PKEYs

These are meant to be used with functions like
OSSL_ENCODER_CTX_new_by_EVP_PKEY()

The OSSL_ENCODER_CTX_new_by_EVP_PKEY() manual is also expanded on the
topics of output types and selections.

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

3 years agotest/recipes/15-test_gendh.t: don't try DER params
Richard Levitte [Wed, 28 Oct 2020 18:15:40 +0000 (19:15 +0100)] 
test/recipes/15-test_gendh.t: don't try DER params

There is no option to output DH params in DER form.  -outform doesn't
apply to -genparam with 'openssl genpkey', and it shouldn't.

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

3 years agoUnify ssl3_get_cipher_by_std_name() implementation
Benjamin Kaduk [Sun, 27 Sep 2020 22:01:12 +0000 (15:01 -0700)] 
Unify ssl3_get_cipher_by_std_name() implementation

The handling for the SCSVs was the same as for regular ciphers;
just merge them into the same table-driven handler.

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

3 years agocrypto/poly1305/asm: fix armv8 pointer authentication
Ard Biesheuvel [Tue, 27 Oct 2020 17:02:40 +0000 (18:02 +0100)] 
crypto/poly1305/asm: fix armv8 pointer authentication

PAC pointer authentication signs the return address against the value
of the stack pointer, to prevent stack overrun exploits from corrupting
the control flow. However, this requires that the AUTIASP is issued with
SP holding the same value as it held when the PAC value was generated.
The Poly1305 armv8 code got this wrong, resulting in crashes on PAC
capable hardware.

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

3 years agoafalg: add a NULL pointer check
Pauli [Wed, 28 Oct 2020 09:35:38 +0000 (19:35 +1000)] 
afalg: add a NULL pointer check

Fixes #13260

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

3 years agoRewrite the HPE NonStop Notes file in Markdown with more explanations.
Randall S. Becker [Sat, 24 Oct 2020 21:58:27 +0000 (17:58 -0400)] 
Rewrite the HPE NonStop Notes file in Markdown with more explanations.

CLA: Permission is granted by the author to the OpenSSL team to use
these modifications.

Fixes #13237

Signed-off-by: Randall S. Becker <rsbecker@nexbridge.com>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/13238)

3 years agoDH: stop setting the private key length arbitrarily
Richard Levitte [Thu, 15 Oct 2020 05:14:16 +0000 (07:14 +0200)] 
DH: stop setting the private key length arbitrarily

The private key length is supposed to be a user settable parameter.
We do check if it's set or not, and if not, we do apply defaults.

Fixes #12071

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

3 years agoconfigdata.pm.in, util/dofile.pl: Make a HERE document stricter.
Richard Levitte [Fri, 23 Oct 2020 01:05:49 +0000 (03:05 +0200)] 
configdata.pm.in, util/dofile.pl: Make a HERE document stricter.

Fixes #13221
Fixes #12743
Fixes #12078

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/13225)

3 years agoFix sparc t4 build error 'undefined symbol: cipher_hw_generic_cbc'
Shane Lontis [Thu, 22 Oct 2020 01:07:58 +0000 (11:07 +1000)] 
Fix sparc t4 build error 'undefined symbol: cipher_hw_generic_cbc'

cipher_hw_generic_##mode has been renamed to ossl_cipher_hw_generic_##mode.
There were a few missing renames for t4 in .inc files.

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

3 years agoEnsure we raise SSLfatal on error
Matt Caswell [Thu, 22 Oct 2020 12:53:27 +0000 (13:53 +0100)] 
Ensure we raise SSLfatal on error

We were missing a call to SSLfatal. A comment claimed that we had already
called it - but that is incorrect.

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

3 years agoAPPS: Remove the format argument where it's not used
Richard Levitte [Sat, 24 Oct 2020 14:31:57 +0000 (16:31 +0200)] 
APPS: Remove the format argument where it's not used

Also, restore a behaviour change, where load_cert() would look at
stdin when the input file name is NULL, and make sure to call
load_cert_pass() with a corresponding argument where load_cert() was
used in OpenSSL 1.1.1.

Fixes #13235

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