oweals/openssl.git
4 years agoFix some misunderstandings in our providers' main modules
Richard Levitte [Sat, 9 May 2020 08:11:14 +0000 (10:11 +0200)]
Fix some misunderstandings in our providers' main modules

This started with adding forward declarations of all provider side
interface functions, and fixing all compiler errors.

Furthermore, diminish the faulty assumption that the provider context
is and always will be just a library context.  That means adding a
teardown function in all providers that aren't necessarily built into
libcrypto.

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

4 years agoCORE: Fix the signature of OSSL_provider_query_operation_fn
Richard Levitte [Sat, 9 May 2020 07:59:05 +0000 (09:59 +0200)]
CORE: Fix the signature of OSSL_provider_query_operation_fn

For some reason, the 'no_cache' parameter was declare 'const', when
it's in fact supposed to be modifiable.

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

4 years agoFix d2i_PrivateKey_ex() to work as documented
Richard Levitte [Mon, 11 May 2020 07:14:11 +0000 (09:14 +0200)]
Fix d2i_PrivateKey_ex() to work as documented

d2i_PrivateKey(), and thereby d2i_PrivateKey_ex(), is documented to
return keys of the type given as first argument |type|, unconditionally.
Most specifically, the manual says this:

> An error occurs if the decoded key does not match type.

However, when faced of a PKCS#8 wrapped key, |type| was ignored, which
may lead to unexpected results.

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

4 years agoFix CHANGES.md issues reported by markdownlint
Richard Levitte [Mon, 11 May 2020 07:55:53 +0000 (09:55 +0200)]
Fix CHANGES.md issues reported by markdownlint

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

4 years agodoc: fix two invalid <B> tags
Beat Bolli [Thu, 7 May 2020 12:19:22 +0000 (14:19 +0200)]
doc: fix two invalid <B> tags

Signed-off-by: Beat Bolli <dev@drbeat.li>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
Reviewed-by: Ben Kaduk <kaduk@mit.edu>
(Merged from https://github.com/openssl/openssl/pull/11759)

4 years agoExtract HTTP server code from apps/ocsp.c to apps/lib/http_server.c
Dr. David von Oheimb [Mon, 4 May 2020 18:29:25 +0000 (20:29 +0200)]
Extract HTTP server code from apps/ocsp.c to apps/lib/http_server.c

Also adds apps/include/http_server.h.
This is used so far by apps/ocsp.c and is going to be used for apps/cmp.c
and will be helpful also for any future app acting as HTTP server.

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

4 years agoFix bio_wait() in crypto/bio/bio_lib.c in case OPENSSL_NO_SOCK
Dr. David von Oheimb [Mon, 4 May 2020 18:21:34 +0000 (20:21 +0200)]
Fix bio_wait() in crypto/bio/bio_lib.c in case OPENSSL_NO_SOCK

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

4 years agoConstify 'req' parameter of OSSL_HTTP_post_asn1()
Dr. David von Oheimb [Mon, 4 May 2020 17:54:43 +0000 (19:54 +0200)]
Constify 'req' parameter of OSSL_HTTP_post_asn1()

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

4 years agoFix bug in OSSL_CMP_SRV_process_request() on transaction renewal
Dr. David von Oheimb [Mon, 4 May 2020 17:53:09 +0000 (19:53 +0200)]
Fix bug in OSSL_CMP_SRV_process_request() on transaction renewal

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

4 years agodoc: remove deprecation notes for apps that are staying.
Pauli [Mon, 20 Apr 2020 07:22:41 +0000 (17:22 +1000)]
doc: remove deprecation notes for apps that are staying.

The apps that are staying are: dhparam, dsa, dsaparam, ec, ecparam, gendsa and
rsa.

The rsautl app remains deprecated.

The -dsaparam option to dhparam also remains deprecated.

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

4 years agoFix PEM certificate loading that sometimes fails
Maximilian Blenk [Tue, 7 Apr 2020 17:33:39 +0000 (19:33 +0200)]
Fix PEM certificate loading that sometimes fails

As described in https://github.com/openssl/openssl/issues/9187, the
loading of PEM certificates sometimes fails if a line of base64
content has the length of a multiple of 254.
The problem is in get_header_and_data(). When such a line with a
length of 254 (or a multiple) has been read, the next read will
only read a newline. Due to this get_header_and_data() expects to be
in the header not in the data area. This commit fixes that by checking
if lines have been read completely or only partially. In case of a
previous partial read, a newline will be ignored.

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
Reviewed-by: Ben Kaduk <kaduk@mit.edu>
(Merged from https://github.com/openssl/openssl/pull/11741)

4 years agoFix issues reported by markdownlint
Rich Salz [Thu, 7 May 2020 11:44:01 +0000 (13:44 +0200)]
Fix issues reported by markdownlint

Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/11739)

4 years agotravis: enable markdownlint checks
Rich Salz [Thu, 7 May 2020 11:42:14 +0000 (13:42 +0200)]
travis: enable markdownlint checks

Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/11739)

4 years agoEVP: when setting the operation to EVP_PKEY_OP_UNDEFINED, clean up!
Richard Levitte [Wed, 6 May 2020 18:48:25 +0000 (20:48 +0200)]
EVP: when setting the operation to EVP_PKEY_OP_UNDEFINED, clean up!

There were a few instances where we set the EVP_PKEY_CTX operation to
EVP_PKEY_OP_UNDEFINED, but forgot to clean up first.  After the
operation is made undefined, there's no way to know what should be
cleaned away, so that must be done first, in all spots.

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

4 years agoFix use-after-free in BIO_C_SET_SSL callback
Dr. Matthias St. Pierre [Wed, 6 May 2020 15:24:13 +0000 (17:24 +0200)]
Fix use-after-free in BIO_C_SET_SSL callback

Since the BIO_SSL structure was renewed by `ssl_free(b)/ssl_new(b)`,
the `bs` pointer needs to be updated before assigning to `bs->ssl`.

Thanks to @suishixingkong for reporting the issue and providing a fix.

Closes #10539

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

4 years agoSSL_OP_DISABLE_TLSEXT_CA_NAMES option implementation
Nikolay Morozov [Sat, 2 May 2020 09:22:43 +0000 (12:22 +0300)]
SSL_OP_DISABLE_TLSEXT_CA_NAMES option implementation

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

4 years agoAdd documentation for CMS_EnvelopedData_create()
Jakub Zelenka [Sun, 12 Apr 2020 20:29:41 +0000 (21:29 +0100)]
Add documentation for CMS_EnvelopedData_create()

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

4 years agoRemove legacy FIPS_mode functions
Shane Lontis [Thu, 7 May 2020 06:08:18 +0000 (16:08 +1000)]
Remove legacy FIPS_mode functions

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

4 years agoAdd RSA SHA512 truncated digest support
Shane Lontis [Thu, 30 Apr 2020 03:41:05 +0000 (13:41 +1000)]
Add RSA SHA512 truncated digest support

Partial Fix for #11648.

Some additional work still needs to be done to support RSA-PSS mode.

RSA legacy digests will be addressed in another PR.

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

4 years agoAdd OIDS for md4 and ripemd160 to der_rsa
Shane Lontis [Fri, 1 May 2020 00:31:27 +0000 (10:31 +1000)]
Add OIDS for md4 and ripemd160 to der_rsa

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

4 years agoRemove gen_get_params & gen_gettable_params from keygen operation
Shane Lontis [Thu, 7 May 2020 05:31:05 +0000 (15:31 +1000)]
Remove gen_get_params & gen_gettable_params from keygen operation

EVP_PKEY_CTX_gettable_params() was missing code for the keygen operation.
After adding it it was noticed that it is probably not required for this type, so instead
the gen_get_params and gen_gettable_params have been remnoved from the provider interface.
gen_get_params was only implemented for ec to get the curve name. This seems redundant
since normally you would set parameters into the keygen_init() and then generate a key.
Normally you would expect to extract data from the key - not the object that we just set up
to do the keygen.

Added a simple settable and gettable test into a test that does keygen.

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

4 years agoRemove cipher table lookup from EVP_CipherInit_ex
Shane Lontis [Tue, 5 May 2020 06:51:32 +0000 (16:51 +1000)]
Remove cipher table lookup from EVP_CipherInit_ex

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

4 years agoConfigure: avoid perl regexp bugs
Richard Levitte [Tue, 5 May 2020 14:53:43 +0000 (16:53 +0200)]
Configure: avoid perl regexp bugs

It seems that in older perl versions '(?P' doesn't interact very well
with '(?|' or '(?:'.

Since we make extensive use of '(?P' in build.info parsing, we avoid
combining that with '(?|' and '(?:' when parsing build.info variables,
and end up parsing variable modifier twice (first generally, and then
parse that result into the modifier components).

Fixes #11694

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

4 years agos_server normal shutdown
Dmitry Belyavskiy [Tue, 5 May 2020 12:26:32 +0000 (15:26 +0300)]
s_server normal shutdown

Partially fixes #11209

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

4 years agoExtend test_ssl_get_shared_ciphers
Matt Caswell [Fri, 1 May 2020 11:24:57 +0000 (12:24 +0100)]
Extend test_ssl_get_shared_ciphers

Ensure we test scenarios where a FIPS peer is communication with a
non-FIPS peer. Check that a FIPS client doesn't offer ciphersuites it
doesn't have, and that a FIPS server only chooses ciphersuites it can
support.

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

4 years agoDon't offer or accept ciphersuites that we can't support
Matt Caswell [Fri, 1 May 2020 08:17:40 +0000 (09:17 +0100)]
Don't offer or accept ciphersuites that we can't support

We were not correctly detecting whether TLSv1.3 ciphersuites could
actually be supported by the available provider implementations. For
example a FIPS client would still offer CHACHA20-POLY1305 based
ciphersuites even though it couldn't actually use them. Similarly on
the server would try to use CHACHA20-POLY1305 and then fail the
handshake.

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

4 years agoFix a memory leak in CONF .include handling
Matt Caswell [Fri, 1 May 2020 14:15:13 +0000 (15:15 +0100)]
Fix a memory leak in CONF .include handling

If OPENSSL_CONF_INCLUDE has been set then we may leak the "include"
buffer.

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

4 years agoCentralise Environment Variables for the tests
Matt Caswell [Thu, 30 Apr 2020 15:08:57 +0000 (16:08 +0100)]
Centralise Environment Variables for the tests

The test_includes test was failing if OPENSSL_CONF_INCLUDE happened to
be set in the user's environment. To ensure that no tests accidentally
use this or other enviroment variables from the user's environment we
automatically set them centrally for all tests.

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

4 years agoThe synthesized OPENSSL_VERSION_NUMBER must be long
Tomas Mraz [Tue, 5 May 2020 07:52:25 +0000 (09:52 +0200)]
The synthesized OPENSSL_VERSION_NUMBER must be long

(to keep API compatibility with older releases)

Fixes #11716

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

4 years agoFix up whitespace nits introduced by PR #11416
Benjamin Kaduk [Mon, 4 May 2020 18:50:25 +0000 (11:50 -0700)]
Fix up whitespace nits introduced by PR #11416

Expand a couple literal tabs, and de-indent the body of a function.

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

4 years agoUse fips=yes consistently in documentation
Christian Heimes [Mon, 4 May 2020 12:26:12 +0000 (14:26 +0200)]
Use fips=yes consistently in documentation

The documentation for ``EVP_default_properties_is_fips_enabled()`` uses
``fips=yes`` in one place and ``fips=true`` in another place. Stick to
``fips=yes`` like everywhere else.

Signed-off-by: Christian Heimes <christian@python.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/11723)

4 years agoStrengthen X509_STORE_CTX_print_verify_cb() to print expected host etc.
Dr. David von Oheimb [Thu, 30 Apr 2020 17:31:07 +0000 (19:31 +0200)]
Strengthen X509_STORE_CTX_print_verify_cb() to print expected host etc.

Add X509_VERIFY_PARAM_get0_host(), X509_VERIFY_PARAM_get0_email(),
and X509_VERIFY_PARAM_get1_ip_asc() to support this,
as well as the internal helper function ipaddr_to_asc(), which
is used also for simplifying other IP address output functions.

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

4 years agoImprove SSL_shutdown documentation.
Kurt Roeckx [Mon, 13 Apr 2020 11:01:29 +0000 (13:01 +0200)]
Improve SSL_shutdown documentation.

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

4 years agoFix aix compile error in cmp_ctx_test.c
Shane Lontis [Fri, 1 May 2020 07:09:01 +0000 (17:09 +1000)]
Fix aix compile error in cmp_ctx_test.c

Errors were of the form 1506-226 (S) The ":" operator is not allowed between "int" and "char*".
I think it is valid syntax the way it was written, But just rewrote so it compiled.
The aix compiler must be looking at the type of blah() when doing test ? (blah(), NULL) : X.

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

4 years agoFix incorrect default keysize for CAST ofb and cfb modes.
Shane Lontis [Sat, 2 May 2020 03:51:35 +0000 (13:51 +1000)]
Fix incorrect default keysize for CAST ofb and cfb modes.

Fixes #11459

It was incorrectly using 8 bytes instead of 16 as the default.
This was verified by expanding the macros used in e_cast.c.
The issue occurs if EVP_CIPHER_CTX_set_key_length() is not called.
evp_test.c hides this issue as it always calls EVP_CIPHER_CTX_set_key_length() before
using EVP_CipherInit_ex(...., key, ..).

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

4 years agoAllow OSSL_PARAM_get_octet_string() to pass a NULL buffer
Matt Caswell [Tue, 28 Apr 2020 16:45:53 +0000 (17:45 +0100)]
Allow OSSL_PARAM_get_octet_string() to pass a NULL buffer

We may just want to know the number of octets so allow passing a NULL
buffer.

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

4 years agoAdd some tests for the newly added raw private/public key functions
Matt Caswell [Mon, 27 Apr 2020 16:17:05 +0000 (17:17 +0100)]
Add some tests for the newly added raw private/public key functions

We already had soem tests for the older raw private/public key functions
so we expand those to call the new versions as well and pass in a libctx.

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

4 years agoDocument the new raw private/public key functions
Matt Caswell [Mon, 27 Apr 2020 15:48:18 +0000 (16:48 +0100)]
Document the new raw private/public key functions

Document the newly added EVP_PKEY_new_raw_private_key_with_libctx and
EVP_PKEY_new_raw_public_key_with_libctx functions.

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

4 years agoImplement key match functionality for ECX keys
Matt Caswell [Mon, 27 Apr 2020 15:14:16 +0000 (16:14 +0100)]
Implement key match functionality for ECX keys

This makes EVP_PKEY_cmp work for provider side ECX keys.

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

4 years agoFix the KEYNID2TYPE macro
Matt Caswell [Fri, 24 Apr 2020 16:40:31 +0000 (17:40 +0100)]
Fix the KEYNID2TYPE macro

This macro was not correctly handling Ed25519 keys

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

4 years agoDon't export ECX key data twice
Matt Caswell [Fri, 24 Apr 2020 15:20:27 +0000 (16:20 +0100)]
Don't export ECX key data twice

We had a redundant couple of lines where we exported key data twice.

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

4 years agoEnsure EVP_PKEY_get_raw_[private|public]_key work with provider keys
Matt Caswell [Fri, 24 Apr 2020 15:19:25 +0000 (16:19 +0100)]
Ensure EVP_PKEY_get_raw_[private|public]_key work with provider keys

If the key is a provider key then we should export it from the provider.

Fixes #11627

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

4 years agoAdd the library ctx into an ECX_KEY
Matt Caswell [Fri, 24 Apr 2020 14:43:20 +0000 (15:43 +0100)]
Add the library ctx into an ECX_KEY

At various points we need to be able to retrieve the current library
context so we store it in the ECX_KEY structure.

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

4 years agoAdd the ability to ECX to import keys with only the private key
Matt Caswell [Fri, 24 Apr 2020 14:32:34 +0000 (15:32 +0100)]
Add the ability to ECX to import keys with only the private key

ECX keys can very easily crete the public key from the private key.
Therefore when we import ecx keys it is sufficent to just have the private
key.

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

4 years agoEnsure OSSL_PARAM_BLD_free() can accept a NULL
Matt Caswell [Fri, 24 Apr 2020 10:44:15 +0000 (11:44 +0100)]
Ensure OSSL_PARAM_BLD_free() can accept a NULL

All OpenSSL free functions should accept NULL.

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

4 years agoMake EVP_new_raw_[private|public]_key provider aware
Matt Caswell [Fri, 24 Apr 2020 10:33:33 +0000 (11:33 +0100)]
Make EVP_new_raw_[private|public]_key provider aware

We also introduce variants which are OPENSSL_CTX aware

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

4 years agorand_unix.c: Ensure requests to KERN_ARND don't exceed 256 bytes.
nia [Thu, 30 Apr 2020 13:43:04 +0000 (14:43 +0100)]
rand_unix.c: Ensure requests to KERN_ARND don't exceed 256 bytes.

Requests for more than 256 bytes will fail.

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

4 years agorand_unix.c: Only enable hack for old FreeBSD versions on FreeBSD
nia [Thu, 30 Apr 2020 13:42:09 +0000 (14:42 +0100)]
rand_unix.c: Only enable hack for old FreeBSD versions on FreeBSD

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

4 years agorand_unix.c: Include correct headers for sysctl() on NetBSD
nia [Thu, 30 Apr 2020 13:41:07 +0000 (14:41 +0100)]
rand_unix.c: Include correct headers for sysctl() on NetBSD

This allows sysctl(KERN_ARND) to be detected properly.

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

4 years agoCIFuzz turning dry_run off
Leo Neat [Tue, 17 Mar 2020 01:15:50 +0000 (18:15 -0700)]
CIFuzz turning dry_run off

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

4 years agoWPACKET: don't write DER length when we don't want to
Richard Levitte [Fri, 1 May 2020 16:06:18 +0000 (18:06 +0200)]
WPACKET: don't write DER length when we don't want to

With endfirst writing, it could be that we want to abandon any zero
length sub-packet.  That's what WPACKET_FLAGS_ABANDON_ON_ZERO_LENGTH
was supposed to make happen, but the DER length writing code didn't
look at that flag.  Now it does.

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

4 years agoFix reason code clash
Richard Levitte [Sat, 2 May 2020 08:48:59 +0000 (10:48 +0200)]
Fix reason code clash

EVP_R_NULL_MAC_PKEY_CTX vs EVP_R_SET_DEFAULT_PROPERTY_FAILURE

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

4 years agoutil/perl/OpenSSL/OID.pm: remove the included unit test
Richard Levitte [Fri, 1 May 2020 17:24:50 +0000 (19:24 +0200)]
util/perl/OpenSSL/OID.pm: remove the included unit test

The unit test uses features that appeared in perl 5.12, and is
therefore a source of trouble when building.

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

4 years agoAdd solaris assembler fixes for legacy provider
Shane Lontis [Fri, 1 May 2020 05:15:02 +0000 (15:15 +1000)]
Add solaris assembler fixes for legacy provider

The legacy provider contains assembler references. Most code is automagically pulled in from the libcrypto - but the platform specific assembler functions will not be visible in the symbol table. Copying BNASM and DESASM into liblegacy seems to be a better solution than exposing platform specific function in libcrypto.num.

Added a missing call in the des_cbc code for sparc.

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

4 years agoAdd default property API's to enable and test for fips
Shane Lontis [Sat, 2 May 2020 04:17:54 +0000 (14:17 +1000)]
Add default property API's to enable and test for fips

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

4 years agomake update for SSL_new_session_ticket
Benjamin Kaduk [Thu, 2 Apr 2020 00:08:10 +0000 (17:08 -0700)]
make update for SSL_new_session_ticket

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

4 years agoAdd test for SSL_new_session_ticket()
Benjamin Kaduk [Tue, 17 Mar 2020 17:08:11 +0000 (10:08 -0700)]
Add test for SSL_new_session_ticket()

Run a normal handshake and then request some extra tickets,
checking that the new_session_cb is called the expected number of
times.  Since the tickets are generated in the same way as other
tickets, there should not be a need to verify that these specific ones
can be used to resume.

Run the test with both zero and a non-zero number of tickets issued in the
initial handshake.

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

4 years agoAdd SSL_new_session_ticket() API
Benjamin Kaduk [Mon, 16 Mar 2020 18:25:58 +0000 (11:25 -0700)]
Add SSL_new_session_ticket() API

This API requests that the TLS stack generate a (TLS 1.3)
NewSessionTicket message the next time it is safe to do so (i.e., we do
not have other data pending write, which could be mid-record).  For
efficiency, defer actually generating/writing the ticket until there
is other data to write, to avoid producing server-to-client traffic when
not needed.

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

4 years agoFix whitespace nit in ossl_statem_server_pre_work
Benjamin Kaduk [Mon, 16 Mar 2020 18:25:12 +0000 (11:25 -0700)]
Fix whitespace nit in ossl_statem_server_pre_work

An 'if' clause was nestled against a previous closing brace as it if was
an 'else if', but should properly stand on its own line.

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

4 years agoAdd a test for EVP_PKEY_*_check functions for "DSA" keys
Mat Berchtold [Wed, 22 Apr 2020 00:30:40 +0000 (19:30 -0500)]
Add a test for EVP_PKEY_*_check functions for "DSA" keys

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

4 years agoWhen a private key is validated and there is no private key, return early.
Mat Berchtold [Tue, 21 Apr 2020 19:13:16 +0000 (14:13 -0500)]
When a private key is validated and there is no private key, return early.

Affected functions:

dsa_validate_public
dsa_validate_private
dh_validate_public
dh_validate_private

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

4 years agocoverity 1462581 Dereference after null check
Pauli [Sun, 26 Apr 2020 23:32:14 +0000 (09:32 +1000)]
coverity 1462581 Dereference after null check

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

4 years agocoverity 1462580 Improper use of negative value
Pauli [Sun, 26 Apr 2020 23:28:55 +0000 (09:28 +1000)]
coverity 1462580 Improper use of negative value

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

4 years agocoverity 1462578 Resource leak
Pauli [Sun, 26 Apr 2020 23:26:48 +0000 (09:26 +1000)]
coverity 1462578 Resource leak

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

4 years agocoverity 1462576 Resource leak
Pauli [Sun, 26 Apr 2020 23:25:42 +0000 (09:25 +1000)]
coverity 1462576 Resource leak

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

4 years agocoverity 1462567: Null pointer dereferences
Pauli [Sun, 26 Apr 2020 21:48:32 +0000 (07:48 +1000)]
coverity 1462567: Null pointer dereferences

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

4 years agocoverity 1462574 Resource leak
Pauli [Sun, 26 Apr 2020 23:19:11 +0000 (09:19 +1000)]
coverity 1462574 Resource leak

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

4 years agocoverity 1462573 Dereference after null check
Pauli [Sun, 26 Apr 2020 23:17:48 +0000 (09:17 +1000)]
coverity 1462573 Dereference after null check

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

4 years agocoverity 1462572 Dereference after null check
Pauli [Sun, 26 Apr 2020 23:16:04 +0000 (09:16 +1000)]
coverity 1462572 Dereference after null check

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

4 years agocoverity 1462571 Dereference after null check
Pauli [Sun, 26 Apr 2020 23:13:46 +0000 (09:13 +1000)]
coverity 1462571 Dereference after null check

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

4 years agocoverity 1462570 Resource leak
Pauli [Sun, 26 Apr 2020 23:10:15 +0000 (09:10 +1000)]
coverity 1462570 Resource leak

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

4 years agocoverity 1462566 Resource leak
Pauli [Sun, 26 Apr 2020 23:06:14 +0000 (09:06 +1000)]
coverity 1462566 Resource leak

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

4 years agocoverity 1462564 Improper use of negative value
Pauli [Sun, 26 Apr 2020 23:04:05 +0000 (09:04 +1000)]
coverity 1462564 Improper use of negative value

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

4 years agocoverity 1462562 Dereference before null check
Pauli [Sun, 26 Apr 2020 22:58:59 +0000 (08:58 +1000)]
coverity 1462562 Dereference before null check

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

4 years agocoverity 1462561 Uninitialized scalar variable
Pauli [Sun, 26 Apr 2020 22:57:38 +0000 (08:57 +1000)]
coverity 1462561 Uninitialized scalar variable

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

4 years agocoverity 1462560 Resource leak
Pauli [Sun, 26 Apr 2020 22:54:28 +0000 (08:54 +1000)]
coverity 1462560 Resource leak

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

4 years agocoverity 1462556 Resource leak
Pauli [Sun, 26 Apr 2020 22:45:04 +0000 (08:45 +1000)]
coverity 1462556 Resource leak

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

4 years agocoverity 1462554 Dereference after null check
Pauli [Sun, 26 Apr 2020 22:42:20 +0000 (08:42 +1000)]
coverity 1462554 Dereference after null check

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

4 years agocoverity 1462549 Dereference before null check
Pauli [Sun, 26 Apr 2020 22:33:27 +0000 (08:33 +1000)]
coverity 1462549 Dereference before null check

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

4 years agocoverity 1462548 Resource leak
Pauli [Sun, 26 Apr 2020 22:30:49 +0000 (08:30 +1000)]
coverity 1462548 Resource leak

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

4 years agocoverity 1462546 Dereference after null check
Pauli [Sun, 26 Apr 2020 22:26:39 +0000 (08:26 +1000)]
coverity 1462546 Dereference after null check

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

4 years agocoverity 1462545 Dereference after null check
Pauli [Sun, 26 Apr 2020 22:25:33 +0000 (08:25 +1000)]
coverity 1462545 Dereference after null check

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

4 years agocoverity: 1462544 Dereference after null check
Pauli [Sun, 26 Apr 2020 22:21:06 +0000 (08:21 +1000)]
coverity: 1462544 Dereference after null check

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

4 years agocoverity 1462543 Logically dead code
Pauli [Sun, 26 Apr 2020 22:05:23 +0000 (08:05 +1000)]
coverity 1462543 Logically dead code

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

4 years agocoverity 1462541 Dereference after null check
Pauli [Sun, 26 Apr 2020 22:01:28 +0000 (08:01 +1000)]
coverity 1462541 Dereference after null check

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

4 years agocoverity 1462550 Resource leak
Pauli [Sun, 26 Apr 2020 21:59:02 +0000 (07:59 +1000)]
coverity 1462550 Resource leak

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

4 years agocoverity 1462565: Null pointer dereferences
Pauli [Sun, 26 Apr 2020 21:51:16 +0000 (07:51 +1000)]
coverity 1462565: Null pointer dereferences

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

4 years agocoverity 1462577: Incorrect expression
Pauli [Sun, 26 Apr 2020 21:40:17 +0000 (07:40 +1000)]
coverity 1462577: Incorrect expression

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

4 years agoparam bld: avoid freeing the param builder structure on error paths.
Pauli [Sun, 26 Apr 2020 21:32:43 +0000 (07:32 +1000)]
param bld: avoid freeing the param builder structure on error paths.

The param builder was recently modified so that it doesn't free the passed in
param builder structure.  Some of the error paths didn't get synced up with this
change and resulted in double frees.

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

4 years agoFix snprintf missing for windows build
Shane Lontis [Wed, 29 Apr 2020 06:19:16 +0000 (16:19 +1000)]
Fix snprintf missing for windows build

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

4 years agoUndeprecate DH, DSA and RSA _bits() functions.
Pauli [Tue, 28 Apr 2020 09:03:05 +0000 (19:03 +1000)]
Undeprecate DH, DSA and RSA _bits() functions.

These were deemed information and useful and that they should not be
deprecated.

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

4 years agoEVP: Fix evp_keymgmt_util_copy() for to->keymgmt == NULL
Richard Levitte [Tue, 28 Apr 2020 06:41:20 +0000 (08:41 +0200)]
EVP: Fix evp_keymgmt_util_copy() for to->keymgmt == NULL

evp_keymgmt_util_copy() didn't treat the case to->keymgmt correctly.
The proper change is to use from->keymgmt when to->keymgmt is NULL.

Fixes coverity #1462553

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

4 years agoAmend references to "OpenSSL license"
Shourya Shukla [Mon, 27 Apr 2020 04:59:50 +0000 (10:29 +0530)]
Amend references to "OpenSSL license"

A small number of files contain references to the "OpenSSL license"
which has been deprecated and replaced by the "Apache License 2.0".
Amend the occurences.

Fixes #11649

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

4 years agoUpdate EVP_PKEY_fromdata.pod
opensignature [Mon, 27 Apr 2020 09:47:44 +0000 (11:47 +0200)]
Update EVP_PKEY_fromdata.pod

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

4 years agoinclude/openssl/ts.h: clean away a misplaced EVP_MD stack definition
Richard Levitte [Mon, 27 Apr 2020 09:59:17 +0000 (11:59 +0200)]
include/openssl/ts.h: clean away a misplaced EVP_MD stack definition

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

4 years agoinclude/openssl/x509v3.h: restore previous stack definition arrangement
Richard Levitte [Mon, 27 Apr 2020 06:36:53 +0000 (08:36 +0200)]
include/openssl/x509v3.h: restore previous stack definition arrangement

It turned out that configuration options may affect the definition and
use of diverse stacks and how they relate to the underlying types.
For example, the configuration option 'no-rfc3779' results in a build
error around STACK_OF(IPAddressFamily) and related stacks.

Previously, STACK_OF definitions were located near the definition of
the underlying type, which are also affected by configuration options,
which made this easier to maintain.  We relocate the new stack
definitions back to those locations for that reason.

We apply the same type of relocation in other header files as well, following
the general rule that it's better to use DEFINE_OR_DECLARE_STACK_OF after the
type it defines a stack for has been defined.

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

4 years agoUpdate README.ssltests.md
Matt Caswell [Mon, 27 Apr 2020 09:36:35 +0000 (10:36 +0100)]
Update README.ssltests.md

The ssltest docs were out of date because gneerate_ssl_tests now needs
a provider to be specified on the command line.

Fixes #11639

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

4 years agoRename FIPS_MODE to FIPS_MODULE
Richard Levitte [Mon, 13 Apr 2020 20:34:56 +0000 (22:34 +0200)]
Rename FIPS_MODE to FIPS_MODULE

This macro is used to determine if certain pieces of code should
become part of the FIPS module or not.  The old name was confusing.

Fixes #11538

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

4 years agoConfigurations: Identify the shell variables around MANSUFFIX
Sebastian Andrzej Siewior [Sat, 25 Apr 2020 18:29:48 +0000 (20:29 +0200)]
Configurations: Identify the shell variables around MANSUFFIX

With MANSUFFIX=A the statement '$$fn$(MANSUFFIX)' is reaplaces with
'$fnA' and left empty because the `fnA' variables is not recognized
within the shell.

With {} around fn it is then bocomes ${fn}A and works as expected.
While here, add the MANSUFFIX to the ECHO line so it is properly printed
during build.

Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/11643)

4 years agoFix GOST curve sec bits
Nikolay Morozov [Wed, 22 Apr 2020 09:09:38 +0000 (12:09 +0300)]
Fix GOST curve sec bits

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