Pauli [Sun, 16 Feb 2020 07:58:45 +0000 (17:58 +1000)]
Coverity
1458439: fix resource leak
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/11101)
Dr. David von Oheimb [Sat, 15 Feb 2020 13:57:32 +0000 (14:57 +0100)]
chunk 7 of CMP contribution to OpenSSL
add CMP message validation and related tests; while doing so:
* add ERR_add_error_mem_bio() to crypto/err/err_prn.c
* move ossl_cmp_add_error_txt() as ERR_add_error_txt() to crypto/err/err_prn.c
* add X509_STORE_CTX_print_verify_cb() to crypto/x509/t_x509.c,
adding internally x509_print_ex_brief(), print_certs(), and print_store_certs()
* move {ossl_cmp_,}X509_STORE_get1_certs() to crypto/x509/x509_lu.c
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/10620)
Dr. David von Oheimb [Fri, 13 Dec 2019 19:07:08 +0000 (20:07 +0100)]
fix various formatting nits in CMP contribution chunks 1-6 found by the new util/check-format.pl
in addition:
correct wording in doc, comments, and parameter names: self-signed -> self-issued where appropriate
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/10620)
Dr. David von Oheimb [Fri, 13 Dec 2019 18:50:20 +0000 (19:50 +0100)]
improve CMP logging according to comments on CMP chunk 7 preview
in particular:
consolidate documentation of CMP logging and error reporting functions
fix compilation problem with clang on some platforms
rename OSSL_CMP_log etc. to ossl_cmp_log etc. since these macros are CMP-internal
move chopping of trailing separator to ossl_cmp_add_error_txt(), also fix handling of leading separator
internalize X509_print_ex_brief() as x509_print_ex_brief()
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/10620)
Dr. David von Oheimb [Fri, 13 Dec 2019 17:54:15 +0000 (18:54 +0100)]
add internal doc files actually belonging to CMP contribution chunk 6
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/10620)
David Benjamin [Mon, 17 Feb 2020 02:17:53 +0000 (12:17 +1000)]
Also check for errors in x86_64-xlate.pl.
In https://github.com/openssl/openssl/pull/10883, I'd meant to exclude
the perlasm drivers since they aren't opening pipes and do not
particularly need it, but I only noticed x86_64-xlate.pl, so
arm-xlate.pl and ppc-xlate.pl got the change.
That seems to have been fine, so be consistent and also apply the change
to x86_64-xlate.pl. Checking for errors is generally a good idea.
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: David Benjamin <davidben@google.com>
(Merged from https://github.com/openssl/openssl/pull/10930)
Rich Salz [Wed, 15 Jan 2020 16:41:07 +0000 (11:41 -0500)]
Add $debug variable and use it
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/10852)
simplelins [Fri, 3 Jan 2020 14:56:18 +0000 (22:56 +0800)]
Fix a bug for aarch64 BigEndian
FIXES #10692 #10638
a bug for aarch64 bigendian with instructions 'st1' and 'ld1' on AES-GCM mode.
CLA: trivial
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/10751)
Wataru Ashihara [Sat, 1 Feb 2020 06:01:40 +0000 (15:01 +0900)]
crypto/bn: fix debug build
Fixes:
gcc -I. -Iinclude -Iproviders/common/include -Iproviders/implementations/include -Icrypto/include -DSTATIC_LEGACY -DBN_DEBUG -DREF_DEBUG -DCONF_DEBUG -DBN_CTX_DEBUG -DOPENSSL_NO_ASM -ggdb -g2 -Wformat -Wshadow -Wmissing-prototypes -Wmissing-declarations -Werror -DOPENSSL_BUILDING_OPENSSL -DOPENSSLDIR="\"/home/wsh/opt/openssl/ssl\"" -DENGINESDIR="\"/home/wsh/opt/openssl/lib/engines-3\"" -DMODULESDIR="\"/home/wsh/opt/openssl/lib/ossl-modules\"" -MMD -MF crypto/bn/libcrypto-lib-bn_conv.d.tmp -MT crypto/bn/libcrypto-lib-bn_conv.o -c -o crypto/bn/libcrypto-lib-bn_conv.o crypto/bn/bn_conv.c
In file included from crypto/bn/bn_conv.c:12:
crypto/bn/bn_conv.c: In function 'BN_hex2bn':
crypto/bn/bn_local.h:178:31: error: implicit declaration of function 'ossl_assert'; did you mean 'ossl_ssize_t'? [-Werror=implicit-function-declaration]
(void)ossl_assert((_top == 0 && !_bnum2->neg) || \
^~~~~~~~~~~
crypto/bn/bn_conv.c:188:5: note: in expansion of macro 'bn_check_top'
bn_check_top(ret);
^~~~~~~~~~~~
CLA: trivial
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/10993)
Shane Lontis [Sun, 16 Feb 2020 03:03:46 +0000 (13:03 +1000)]
Add FFC param/key validation
Embed libctx in dsa and dh objects and cleanup internal methods to not pass libctx (This makes it consistent with the rsa changes)
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10910)
H.J. Lu [Fri, 31 Jan 2020 12:17:26 +0000 (04:17 -0800)]
x86_64: Add endbranch at function entries for Intel CET
To support Intel CET, all indirect branch targets must start with
endbranch. Here is a patch to add endbranch to function entries
in x86_64 assembly codes which are indirect branch targets as
discovered by running openssl testsuite on Intel CET machine and
visual inspection.
Verified with
$ CC="gcc -Wl,-z,cet-report=error" ./Configure shared linux-x86_64 -fcf-protection
$ make
$ make test
and
$ CC="gcc -mx32 -Wl,-z,cet-report=error" ./Configure shared linux-x32 -fcf-protection
$ make
$ make test # <<< passed with https://github.com/openssl/openssl/pull/10988
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10982)
Richard Levitte [Thu, 13 Feb 2020 11:50:32 +0000 (12:50 +0100)]
include/openssl/whrlpool.h: correct unbalanced deprecation guards
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/11087)
Richard Levitte [Sun, 19 Jan 2020 02:19:31 +0000 (03:19 +0100)]
DOC: document in more detail what a BIO_read_ex() via BIO_f_buffer() does
The BIO_f_buffer() documentation tells in enough detail how it affects
BIO_gets(), but not how it affects BIO_read_ex(). This change
remedies that.
Fixes #10859
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10890)
Richard Levitte [Wed, 12 Feb 2020 12:05:09 +0000 (13:05 +0100)]
Document OSSL_SERIALIZER_PUBKEY_TO_DER_PQ and friends
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/11071)
Richard Levitte [Thu, 13 Feb 2020 17:17:43 +0000 (18:17 +0100)]
PROV: Build the main FIPS module code with FIPS_MODE defined
Without that, its main source wasn't compiled correctly.
Fixes #11089
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/11090)
Bastian Germann [Thu, 13 Feb 2020 10:58:27 +0000 (11:58 +0100)]
apps x509: passing PKCS#11 URL as -signkey
OpenSSL 1.1.0 has extended option checking, and rejects passing a PKCS#11
engine URL to "-signkey" option. The actual code is ready to take it.
Change the option parsing to allow an engine URL to be passed and modify
the manpage accordingly.
CLA: trivial
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/11086)
Rich Salz [Wed, 5 Feb 2020 19:28:37 +0000 (14:28 -0500)]
Make secure-memory be a config option
Adding support for "no-secure-memory" was simple, a one-liner.
Fixing all the "ifdef OPENSSL_SECURE_MEMORY" to be "ifndef NO_xxx"
was a bit more work. My original goof, for not following the OpenSSL
pattern "ifndef NO_" used everywhere else.
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/11023)
Richard Levitte [Wed, 12 Feb 2020 17:58:15 +0000 (18:58 +0100)]
Adapt i2d_PUBKEY for provider only keys
It uses EVP_PKEY serializers to get the desired results.
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/11078)
Richard Levitte [Tue, 11 Feb 2020 05:29:08 +0000 (06:29 +0100)]
Adapt i2d_PrivateKey for provider only keys
It uses EVP_PKEY serializers to get the desired results.
One might think that ddoing this might make things a bit dicy for
existing serializers, as they should obviously use i2d functions.
However, since our serializers use much more primitive functions
such as i2d_ASN1_INTEGER(), or keytype specific ones such as
i2d_RSAPrivateKey(), there is no clash.
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/11056)
Nikolay Morozov [Wed, 12 Feb 2020 12:20:41 +0000 (15:20 +0300)]
Forgotten GOST2012 support in non-vital places
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/11072)
Pauli [Wed, 12 Feb 2020 22:02:08 +0000 (08:02 +1000)]
dsatest: fix the non-deprecated version of the test run.
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/11081)
Pauli [Wed, 12 Feb 2020 10:05:29 +0000 (20:05 +1000)]
Apps: don't build deprecated DH and DSA apps.
This also means that there doesn't need to be any conditional checks in the .c
files to avoid deprecated builds.
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/11067)
Shane Lontis [Mon, 10 Feb 2020 01:45:27 +0000 (11:45 +1000)]
Fix coverity issues
CID :
1458169 RESOURCE LEAK ffc_params_generate.c - False positive, but addressed another Leak in adjacent code
CID :
1458171 UNCHECKED RET apps/pkeyutl.c
CID :
1458173 DEAD CODE ffc_params_generate.c
CID :
1458174 RESOURCE LEAK ssl_lib.c
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/11048)
H.J. Lu [Fri, 31 Jan 2020 17:13:27 +0000 (09:13 -0800)]
x86_64: Always generate .note.gnu.property section for ELF outputs
We should always generate .note.gnu.property section in x86_64 assembly
codes for ELF outputs to mark Intel CET support since all input files
must be marked with Intel CET support in order for linker to mark output
with Intel CET support. Also .note.gnu.property section in x32 should
be aligned to 4 bytes, not 8 bytes and .p2align should be used
consistently.
Verified with
$ CC="gcc -Wl,-z,cet-report=error" ./Configure shared linux-x86_64 -fcf-protection
$ make
$ make test
and
$ CC="gcc -mx32 -Wl,-z,cet-report=error" ./Configure shared linux-x32 -fcf-protection
$ make
$ make test # <<< 90-test_sslapi.t failed because 8-byte pointer size.
Fix #10896
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/10985)
Matt Caswell [Wed, 12 Feb 2020 11:55:30 +0000 (11:55 +0000)]
Fix a mem leak in libssl
Make sure we free up any ENGINE references after we have finished using
them.
Fixes #11064
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/11070)
Matt Caswell [Fri, 17 Jan 2020 15:54:09 +0000 (15:54 +0000)]
Add Asymmetric RSA cipher tests in FIPS provider
We also add some DSA tests for code that is already in the FIPS provider.
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/10881)
Matt Caswell [Fri, 17 Jan 2020 14:47:18 +0000 (14:47 +0000)]
Make the RSA ASYM_CIPHER implementation available inside the FIPS module
RSA ASYM_CIPHER was already available within the default provider. We
now make it also available from inside the FIPS module.
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/10881)
Christopher J Zurcher [Thu, 6 Feb 2020 02:56:53 +0000 (18:56 -0800)]
Add assembly config targets for UEFI build
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/11054)
Matt Caswell [Wed, 12 Feb 2020 09:19:41 +0000 (09:19 +0000)]
Fix no-ec build
Don't attempt to build ecx related source files in a "no-ec" build.
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/11065)
Richard Levitte [Tue, 11 Feb 2020 05:23:58 +0000 (06:23 +0100)]
Add OSSL_SERIALIZER_PUBKEY_TO_DER_PQ and friends
It's already used internally, there's no reason the DER serializer
propqueries shouldn't be present alongside the PEM and TEXT ones.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/11055)
Dr. David von Oheimb [Tue, 11 Feb 2020 15:07:00 +0000 (16:07 +0100)]
fix build for new HTTP client in case OPENSSL_NO_CMP or OPENSSL_NO_OCSP
fix also formatting nits w.r.t. #if indentations in ocsp.h
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/11058)
Pauli [Mon, 10 Feb 2020 23:19:19 +0000 (09:19 +1000)]
Remove unused ossl_param_bld_to_param_ex() function.
The recently introduced ossl_param_bld_to_param_ex() function is only
called by the unit tests.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/11053)
Pauli [Mon, 10 Feb 2020 23:13:33 +0000 (09:13 +1000)]
Remove unused OSSL_PARAM_construct_from_text() function.
This function is recently introduced and never called by the library or tests.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/11053)
Pauli [Mon, 10 Feb 2020 00:23:57 +0000 (10:23 +1000)]
Add NEWS entry about deprecation of command line public tools
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10977)
Pauli [Thu, 6 Feb 2020 22:09:53 +0000 (08:09 +1000)]
dsa: deprecate applications that depend on the low level DSA functions.
speed is updated to not support DSA instead of being removed.
The dhparam, dsaparam, dsa and gendsa commands are deprecated but still
exist without NO_DEPRECATED defined.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10977)
Pauli [Wed, 5 Feb 2020 01:27:23 +0000 (11:27 +1000)]
app: add a deprecation warning to all deprecated commands.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10977)
Richard Levitte [Thu, 6 Feb 2020 11:12:49 +0000 (12:12 +0100)]
test/recipes/80-test_ssl_old.t: Replace 'openssl gendsa'
Use 'openssl genpkey' instead.
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/10977)
Pauli [Thu, 6 Feb 2020 23:00:15 +0000 (09:00 +1000)]
test_dsa: fix deprecation logic
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10977)
Richard Levitte [Thu, 6 Feb 2020 11:10:23 +0000 (12:10 +0100)]
test/recipes/15-test_dsa.t: Deal with deprecation of 'openssl dsa'
Do not run programs that depend on deprecated APIs when
'no-deprecated' is configured.
We still retain the conversion tests that use 'openssl pkey', and add
the one that's missing.
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/10977)
Pauli [Wed, 29 Jan 2020 21:23:39 +0000 (07:23 +1000)]
Deprecate the low level DSA functions.
Use of the low level DSA functions has been informally discouraged for a
long time. We now formally deprecate them.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10977)
Pauli [Wed, 29 Jan 2020 04:40:43 +0000 (14:40 +1000)]
dsa.h: fix preprocessor indentation
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10977)
Pauli [Mon, 3 Feb 2020 01:41:31 +0000 (11:41 +1000)]
DSA: fix the DSA parameter logic in test.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10977)
Matt Caswell [Tue, 4 Feb 2020 16:41:19 +0000 (16:41 +0000)]
Add S390 support for provider based X25519/X448
Reviewed-by: Patrick Steuer <patrick.steuer@de.ibm.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/10964)
Matt Caswell [Fri, 24 Jan 2020 17:13:40 +0000 (17:13 +0000)]
Add X25519/X448 Key Exchange to the default provider
Reviewed-by: Patrick Steuer <patrick.steuer@de.ibm.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/10964)
Matt Caswell [Mon, 27 Jan 2020 16:57:03 +0000 (16:57 +0000)]
Implement Provider side Key Management for X25519 and X448
Reviewed-by: Patrick Steuer <patrick.steuer@de.ibm.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/10964)
Matt Caswell [Mon, 27 Jan 2020 16:50:47 +0000 (16:50 +0000)]
Implement a stricter ECX_KEY type
Add ref counting and control how we allocate storage for the private key.
We will need this type in following commits where we move the ecx code
to be provider aware.
Reviewed-by: Patrick Steuer <patrick.steuer@de.ibm.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/10964)
Kurt Roeckx [Sun, 9 Feb 2020 18:28:15 +0000 (19:28 +0100)]
Check that
ed25519 and ed448 are allowed by the security level
Signature algorithms not using an MD weren't checked that they're
allowed by the security level.
Reviewed-by: Matt Caswell <matt@openssl.org>
GH: #10785
Kurt Roeckx [Thu, 2 Jan 2020 22:16:30 +0000 (23:16 +0100)]
Generate new Ed488 certificates
Create a whole chain of Ed488 certificates so that we can use it at security
level 4 (192 bit). We had an 2048 bit RSA (112 bit, level 2) root sign the
Ed488 certificate using SHA256 (128 bit, level 3).
Reviewed-by: Matt Caswell <matt@openssl.org>
GH: #10785
Bernd Edlinger [Fri, 13 Sep 2019 07:24:53 +0000 (09:24 +0200)]
Add a minimal build target for Travis and Appveyor
[extended tests]
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9982)
Richard Levitte [Fri, 7 Feb 2020 08:13:21 +0000 (09:13 +0100)]
X509_PUBKEY_set(): Fix memory leak
With the provided method of creating the new X509_PUBKEY, an extra
EVP_PKEY is created and needs to be properly cleaned away.
(note: we could choose to keep it just as well, but there are
consequences, explained in a comment in the code)
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/11038)
Dr. David von Oheimb [Wed, 30 Oct 2019 22:39:35 +0000 (23:39 +0100)]
Generalize the HTTP client so far implemented mostly in crypto/ocsp/ocsp_ht.c
The new client has become an independent libcrpyto module in crypto/http/ and
* can handle any types of requests and responses (ASN.1-encoded and plain)
* does not include potentially busy loops when waiting for responses but
* makes use of a new timeout mechanism integrated with socket-based BIO
* supports the use of HTTP proxies and TLS, including HTTPS over proxies
* supports HTTP redirection via codes 301 and 302 for GET requests
* returns more useful diagnostics in various error situations
Also adapts - and strongly simplifies - hitherto uses of HTTP in crypto/ocsp/,
crypto/x509/x_all.c, apps/lib/apps.c, and apps/{ocsp,s_client,s_server}.c
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/10667)
Dr. David von Oheimb [Tue, 4 Feb 2020 08:55:35 +0000 (09:55 +0100)]
add BIO_socket_wait(), BIO_wait(), and BIO_connect_retry() improving timeout support
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/10667)
Richard Levitte [Fri, 7 Feb 2020 08:09:50 +0000 (09:09 +0100)]
PROV: Ensure the AlgorithmIdentifier registers in DSA signature impl
When setting up the hash function for DSA signature, the encoded
AlgorithmIdentifier for the DSA+hash combination is queried, but not
stored, which leads to problems when signing ASN.1 items in libcrypto.
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/11037)
Davide Galassi [Mon, 10 Feb 2020 06:49:10 +0000 (16:49 +1000)]
Memory allocator code cleanup
Typedefs of CRYPTO malloc, realloc and free.
MEM_CHECK "modes" are used only as a CRYPTO_mem_ctrl() parameter
The CRYPTO_mem_ctrl is defined only if OPENSSL_NO_CRYPTO_MDEBUG is
defined, thus define the MEM_CHECK modes under the same condition.
Maybe the macros can be removed at all since:
1. CRYPTO_mem_ctrl() just returns -1 and ignores the parameter
2. CRYPTO_mem_ctr() is declared as DEPRECATED by 3.0
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/11042)
H.J. Lu [Sat, 14 Dec 2019 17:48:18 +0000 (09:48 -0800)]
x86: Always generate .note.gnu.property section for ELF outputs
We should always generate .note.gnu.property section in x86 assembly
codes for ELF outputs to mark Intel CET support since all input files
must be marked with Intel CET support in order for linker to mark output
with Intel CET support.
Verified with
$ CC="gcc -Wl,-z,cet-report=error" ./Configure shared linux-x86 -fcf-protection
$ make
$ make test
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/11044)
Matt Caswell [Wed, 5 Feb 2020 17:42:40 +0000 (17:42 +0000)]
Don't compile AESNI code if we're not AESNI capable
Compile failures were occuring on systems that weren't AESNI capable
because the detection wasn't quite right in a couple of files.
This fixes a run-checker build failure for the 386 compile option.
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/11022)
Matt Caswell [Thu, 6 Feb 2020 16:59:49 +0000 (16:59 +0000)]
Fix no-des
Don't attempt to self-test DES in the FIPS provider if we have been built
without FIPS support.
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/11034)
Matt Caswell [Thu, 6 Feb 2020 15:54:09 +0000 (15:54 +0000)]
Fix no-engine
We don't need to check if an engine has a cipher/digest in a no-engine
build.
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/11031)
Matt Caswell [Thu, 6 Feb 2020 15:30:24 +0000 (15:30 +0000)]
Fix no-dh
Don't use DH specific macros that might need to be used in a no-dh build.
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/11030)
Matt Caswell [Thu, 6 Feb 2020 15:17:28 +0000 (15:17 +0000)]
Fix no-ec
Recent SM2 related changes were not properly guarded with OPENSSL_NO_EC
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/11029)
H.J. Lu [Sat, 14 Dec 2019 00:46:07 +0000 (16:46 -0800)]
Use swapcontext for Intel CET
When Intel CET is enabled, makecontext will create a different shadow
stack for each context. async_fibre_swapcontext cannot use _longjmp.
It must call swapcontext to swap shadow stack as well as normal stack.
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10983)
Richard Levitte [Thu, 6 Feb 2020 10:31:41 +0000 (11:31 +0100)]
Adapt all build.info and test recipes to the new $disabled{'deprecated-x.y'}
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/11027)
Richard Levitte [Thu, 6 Feb 2020 10:26:22 +0000 (11:26 +0100)]
Configure: Add easy to use disabled deprecated functionality indicators
In C, we have macros like OPENSSL_NO_DEPRECATED_3_0 to check if some
section of code should be disabled to simulate a removal of things
deprecated in the version.
In perl, we had to check $disabled{deprecated} and compare
$config{api} with the proper version code, which is doable but tedious
and error prone.
This change adds $disabled{'deprecated-x.y'} (x.y being a version
number) which directly corresponds to OPENSSL_NO_DEPRECATED_x_y, for
use in build.info conditions, test recipes and other perl stuff.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/11027)
Dr. Matthias St. Pierre [Fri, 31 Jan 2020 12:32:11 +0000 (13:32 +0100)]
tests/drbgtest: use new RAND_DRBG callback_data API instead of ex_data
It took me a little while to realize why the test_rand_drbg_reseed test
kept crashing after replacing the RAND_DRBG_{gs}et_ex_data() calls by
RAND_DRBG_{gs}et_callback_data().
The reason was that the ex_data API prohibits modifying the callbacks
or callback data of chained DRBGs and returned an error which was
ignored by the `test_rand_drbg_reseed` test, for good reasons.
The `test_rand_drbg_reseed` test is special in this respect, because
it needs to install callbacks for all DRBGs, in order to intercept
and count the reseeding events.
Since the drbgtest module has access to the internal structures of
the DRBG anyway, the problem could be solved by accessing the members
directly. I added a warning comment in hook_drbg().
[extended tests]
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/10950)
Dr. Matthias St. Pierre [Sun, 26 Jan 2020 21:18:23 +0000 (22:18 +0100)]
RAND_DRBG: add a callback data for entropy and nonce callbacks
The callback data allows passing context specific data from the
application of the DRBG to to the entropy callbacks.
This a rather specialized feature which is useful for implementing
known answer tests (KATs) or deterministic signatures (RFC6979),
which require passing a specified entropy and nonce for instantiating
the DRBG.
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/10950)
FdaSilvaYY [Sat, 19 Oct 2019 16:24:49 +0000 (18:24 +0200)]
Appveyor: update to Visual Studio 2017.
Default image was currently "Visual Studio 2015"
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/10327)
Richard Levitte [Tue, 4 Feb 2020 16:49:28 +0000 (17:49 +0100)]
KEYMGMT: Require both get_params and gettable_params, or none
The same go for the pairs import + import_types and export + export_types.
This required some additional changes in our KEYMGMT implementations.
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/11006)
Richard Levitte [Mon, 3 Feb 2020 15:36:24 +0000 (16:36 +0100)]
Adapt existing SERIALIZER implementations to the redesigned interface
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/11006)
Richard Levitte [Mon, 3 Feb 2020 14:36:15 +0000 (15:36 +0100)]
Adapt test/keymgmt_internal_test.c to the redesigned interface
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/11006)
Richard Levitte [Mon, 3 Feb 2020 11:00:53 +0000 (12:00 +0100)]
Adapt existing KEYMGMT implementations to the redesigned interface
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/11006)
Richard Levitte [Sun, 2 Feb 2020 17:56:07 +0000 (18:56 +0100)]
Redesign the KEYMGMT libcrypto <-> provider interface - the basics
The KEYMGMT libcrypto <-> provider interface currently makes a few
assumptions:
1. provider side domain parameters and key data isn't mutable. In
other words, as soon as a key has been created in any (loaded,
imported data, ...), it's set in stone.
2. provider side domain parameters can be strictly separated from the
key data.
This does work for the most part, but there are places where that's a
bit too rigid for the functionality that the EVP_PKEY API delivers.
Key data needs to be mutable to allow the flexibility that functions
like EVP_PKEY_copy_parameters promise, as well as to provide the
combinations of data that an EVP_PKEY is generally assumed to be able
to hold:
- domain parameters only
- public key only
- public key + private key
- domain parameters + public key
- domain parameters + public key + private key
To remedy all this, we:
1. let go of the distinction between domain parameters and key
material proper in the libcrypto <-> provider interface.
As a consequence, functions that still need it gain a selection
argument, which is a set of bits that indicate what parts of the
key object are to be considered in a specific call. This allows
a reduction of very similar functions into one.
2. Rework the libcrypto <-> provider interface so provider side key
objects are created and destructed with a separate function, and
get their data filled and extracted in through import and export.
(future work will see other key object constructors and other
functions to fill them with data)
Fixes #10979
squash! Redesign the KEYMGMT libcrypto <-> provider interface - the basics
Remedy 1 needs a rewrite:
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/11006)
Richard Levitte [Mon, 3 Feb 2020 04:42:48 +0000 (05:42 +0100)]
Reorganize the internal evp_keymgmt functions
Some of the evp_keymgmt_ functions are just wrappers around the
EVP_KEYMGMT function pointers. We move those from keymgmt_lib.c to
keymgmt_meth.c.
Other evp_keymgmt_ functions are utility functions to help the rest of
the EVP functions. Since their names are easily confused with the
functions that were moved to keymgmt_meth.c, we rename them so they
all start with evp_keymgmt_util_.
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/11006)
Matt Caswell [Tue, 4 Feb 2020 14:33:21 +0000 (14:33 +0000)]
Temporariy add ASN1_item_verify_ctx() missingcrypto.txt
PR #10942 introduced the new function ASN1_item_verify_ctx(), but did
not document it with the promise that documentation would follow soon.
We temporarily add this function to missingcrypto.txt until it has been
done.
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/10980)
Matt Caswell [Fri, 31 Jan 2020 09:43:35 +0000 (09:43 +0000)]
Don't ignore ASN1 when checking for undocumented symbols
When we run "make doc-nits" (which happens during travis runs) it will
complain if we add any new symbols that aren't documented. However it
was suppressing anything starting with ASN1. There's no reason why we
should allow ASN1 symbols to go undocumented any more than any others.
Therefore we remove that exception.
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/10980)
Rich Salz [Mon, 27 Jan 2020 20:39:17 +0000 (15:39 -0500)]
Remove unused HAS_LFN_SUPPORT
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/10959)
Dr. Matthias St. Pierre [Sun, 2 Feb 2020 21:54:01 +0000 (22:54 +0100)]
Fix misspelling errors and typos reported by codespell
Fixes #10998
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/11000)
Rich Salz [Mon, 3 Feb 2020 21:06:42 +0000 (16:06 -0500)]
More accurate doc of -ssl_config option
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/10972)
Rich Salz [Thu, 30 Jan 2020 17:19:13 +0000 (12:19 -0500)]
Update command list
Add -standard-commands option to list command (documented)
Update standard commands list in openssl.pod
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/10972)
Rich Salz [Wed, 29 Jan 2020 16:18:39 +0000 (11:18 -0500)]
Add cmd-nits to travis build
Update CHANGES to have a complete and uniform description.
Fixes #9730
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/10972)
Rich Salz [Wed, 29 Jan 2020 18:21:19 +0000 (13:21 -0500)]
The -hmac option to speed is now #ifdef'd
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/10972)
Rich Salz [Wed, 29 Jan 2020 16:18:24 +0000 (11:18 -0500)]
Add missing s_client options
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/10972)
Davide Galassi [Sat, 25 Jan 2020 11:56:44 +0000 (12:56 +0100)]
Prevent compiler warning for unused static function.
Prepend missing ossl_unused in front of lh_type_new to make the compiler
happy.
CLA: trivial
Reviewed-by: Richard Levitte <levitte@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/10946)
Davide Galassi [Sat, 25 Jan 2020 11:50:41 +0000 (12:50 +0100)]
Removed unused ssl_dane struct declaration.
The actually used structure is named ssl_dane_st.
CLA: trivial
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/10945)
Jakub Jelen [Tue, 14 Jan 2020 15:03:23 +0000 (16:03 +0100)]
doc: Fix typo in EVP_DigestSignInit manpage
CLA: trivial
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/10841)
thekuwayama [Sat, 11 Jan 2020 11:20:20 +0000 (20:20 +0900)]
Fix small misspelling in doc for OCSP_response_status
CLA: trivial
Reviewed-by: Paul Yang <kaishen.yy@antfin.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/10810)
Matt Caswell [Tue, 4 Feb 2020 17:29:37 +0000 (17:29 +0000)]
Fix no-sm2
Fix ecdsatest to not run the SM2 test if SM2 has been disabled.
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/11015)
Shane Lontis [Thu, 6 Feb 2020 12:28:36 +0000 (22:28 +1000)]
Add FFC param/key generation
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10909)
Matt Caswell [Tue, 4 Feb 2020 17:11:07 +0000 (17:11 +0000)]
Fix no-tls1_3
The hostname_cb in sslapitest.c was originally only defined if TLSv1.3
was enabled. A recently added test now uses this unconditionally, so we
move the function implementation earlier in the file, and always compile
it in.
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/11014)
Matt Caswell [Fri, 31 Jan 2020 23:28:45 +0000 (23:28 +0000)]
Fix builds with no-dh
The various functions in bn_const.c return primes that are
specified for use in DH. However they were not being excluded from
a no-dh build - and was therefore causing the build to fail.
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10990)
Matt Caswell [Wed, 15 Jan 2020 14:48:57 +0000 (14:48 +0000)]
Add a test for SSL_CTX_new_with_libctx()
We test that SSL_CTX_new_with_libctx() can be used to control the libctx
that is in use for SSL operations.
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/10854)
Matt Caswell [Wed, 15 Jan 2020 11:20:58 +0000 (11:20 +0000)]
Use the OPENSSL_CTX and property query string in EVP_PKEY_CTX
When we use an EVP_PKEY_CTX in libssl we should be doing so with the
OPENSSL_CTX and property query string that were specified when the
SSL_CTX object was first created.
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/10854)
Matt Caswell [Thu, 16 Jan 2020 12:14:27 +0000 (12:14 +0000)]
Explicitly fetch ciphers and digests in libssl
We modify libssl to use explicitly fetched ciphers, digests and other
algorithms as required based on the configured library context and
property query string for the SSL_CTX that is being used.
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/10854)
Pauli [Wed, 5 Feb 2020 05:13:49 +0000 (15:13 +1000)]
Params: change UTF8 construct calls to avoid explicit strlen(3) calls.
It is better, safer and smaller to let the library routine handle the
strlen(3) call.
Added a note to the documentation suggesting this.
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/11019)
Kurt Roeckx [Thu, 2 Jan 2020 22:25:27 +0000 (23:25 +0100)]
Stop accepting certificates signed using SHA1 at security level 1
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
GH: #10786
Kurt Roeckx [Wed, 22 Jan 2020 23:24:35 +0000 (00:24 +0100)]
Create a new embeddedSCTs1 that's signed using SHA256
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
GH: #10786
Matt Caswell [Mon, 3 Feb 2020 15:30:05 +0000 (15:30 +0000)]
Fix no-multiblock
Minor fixes to resolve compilation errors with the no-multiblock
Configure option.
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/11004)
Ross Kinsey [Wed, 5 Feb 2020 03:47:05 +0000 (13:47 +1000)]
Author: Ross Kinsey <RossIKinsey@gmail.com>
Date: Wed Jan 29 00:19:40 2020 -0500
Removed unnecessary switch statements from bio/bf_* callback_ctrl functions
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/10967)
H.J. Lu [Fri, 31 Jan 2020 13:07:01 +0000 (05:07 -0800)]
x86: Add endbranch to indirect branch targets for Intel CET
To support Intel CET, all indirect branch targets must start with
endbranch. Here is a patch to add endbranch to all function entries
in x86 assembly codes which are indirect branch targets as discovered
by running openssl testsuite on Intel CET machine and visual inspection.
Since x86 cbc.pl uses indirect branch with a jump table, we also need
to add endbranch to all jump targets.
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/10984)
Pauli [Tue, 4 Feb 2020 23:09:29 +0000 (09:09 +1000)]
Make minimum size for secure memory a size_t.
The minimum size argument to CRYPTO_secure_malloc_init() was an int but ought
to be a size_t since it is a size.
From an API perspective, this is a change. However, the minimum size is
verified as being a positive power of two and it will typically be a small
constant.
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
(Merged from #11003)
Richard Levitte [Sun, 2 Feb 2020 12:09:29 +0000 (13:09 +0100)]
EVP_MD_CTX_ctrl(): Remove unnecessary control
A check was present as to what operation is performed with this
context. It may have been useful at some point, but isn't any more.
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/10947)