oweals/openssl.git
4 years agoapps x509: passing PKCS#11 URL as -signkey
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

(cherry picked from commit 16d560439d8b1be5082228a87576a8f79b3525ac)

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

4 years agoClarify the usage of EVP_PKEY_get_raw_[private|public]_key()
Matt Caswell [Thu, 5 Mar 2020 09:21:56 +0000 (09:21 +0000)]
Clarify the usage of EVP_PKEY_get_raw_[private|public]_key()

EVP_PKEY_get_raw_private_key() and EVP_PKEY_get_raw_public_key() expect
the size of the key buffer to be populated in the |*len| parameter on
entry - but the docs made no mention of this.

Fixes #11245

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

(cherry picked from commit f529fc7d53bf4228fae61cb1efe73d97fe3eb35f)

4 years agoDOC: Fixups of X509_LOOKUP.pod
Richard Levitte [Tue, 3 Mar 2020 21:51:29 +0000 (22:51 +0100)]
DOC: Fixups of X509_LOOKUP.pod

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

4 years agoDOC: Add documentation related to X509_LOOKUPs
Richard Levitte [Fri, 31 Jan 2020 14:35:46 +0000 (15:35 +0100)]
DOC: Add documentation related to X509_LOOKUPs

Most of all, the base X509_LOOKUP functionality is now documented.
Furthermore, the names X509_LOOKUP_METHOD and X509_STORE are added for
reference.

Some functions were moved from X509_LOOKUP_meth_new.pod

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

4 years agocrypto/ec/curve448/eddsa.c: fix EBCDIC platforms
Patrick Steuer [Tue, 3 Mar 2020 12:29:03 +0000 (13:29 +0100)]
crypto/ec/curve448/eddsa.c: fix EBCDIC platforms

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

(cherry picked from commit af7f656cd91d99d62567e2b20c61f07cb4d81d0b)

4 years agoaes-s390x.pl: fix stg offset caused by typo in perlasm
Patrick Steuer [Tue, 3 Mar 2020 16:40:07 +0000 (17:40 +0100)]
aes-s390x.pl: fix stg offset caused by typo in perlasm

Signed-off-by: Patrick Steuer <patrick.steuer@de.ibm.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/11234)

(cherry picked from commit 7b2ce4a6e817e4385ff77fea0c6e349294c7b756)

4 years agoThis works around a gcc-9 crash
Bernd Edlinger [Wed, 4 Mar 2020 10:42:17 +0000 (11:42 +0100)]
This works around a gcc-9 crash

It happens when configured with ./config -ftest-coverage

see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94029

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

4 years agoFix comment placement in ecp_nistp256.ci
Scott Arciszewski [Mon, 24 Feb 2020 20:29:12 +0000 (12:29 -0800)]
Fix comment placement in ecp_nistp256.ci

CLA: trivial

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/11175)

(cherry picked from commit c590be6f12d0b725863961e41bc64a81c8cf30d6)

4 years agoapps x509: restrict CAkeyform option to OPT_FMT_PDE
Bastian Germann [Mon, 17 Feb 2020 11:50:08 +0000 (12:50 +0100)]
apps x509: restrict CAkeyform option to OPT_FMT_PDE

CAkeyform may be set to PEM, DER or ENGINE, but the current options
are not using the proper optionformat 'E' (OPT_FMT_PDE) for this.

Set the valtype for CAkeyform to 'E' and use OPT_FMT_PDE when extracting
the option value.

This amends bf4006a6f9 ("Fix regression on x509 keyform argument") which
did the same thing for keyform and changed the manpage synopsis entries
for both keyform and CAkeyform but did not change the option section.
Hence, change the option section.

CLA: trivial

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

4 years agoVMS: mitigate for the C++ compiler that doesn't understand certain pragmas
Richard Levitte [Mon, 24 Feb 2020 13:56:26 +0000 (14:56 +0100)]
VMS: mitigate for the C++ compiler that doesn't understand certain pragmas

This only affects __DECC_INCLUDE_EPILOGUE.H and __DECC_INCLUDE_PROLOGUE.H,
which are used automatically by HP and VSI C/C++ compilers.

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/11159)

4 years agoconfig: Drop linux-alpha-gcc+bwx
Matt Turner [Tue, 18 Feb 2020 18:08:27 +0000 (10:08 -0800)]
config: Drop linux-alpha-gcc+bwx

Its entry in Configuration/10-main.conf was dropped in commit
7ead0c89185c ("Configure: fold related configurations more aggressively
and clean-up.") probably because all but one of its bn_ops were removed
(RC4_CHAR remained). Benchmarks on an Alpha EV7 indicate that RC4_INT is
better than RC4_CHAR so rather than restoring the configuation, remove
it from config.

CLA: trivial
Bug: https://bugs.gentoo.org/697840

(cherry picked from commit 19ded1a717b6c72c3db241f06787a353f1190755)
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/11130)

4 years agoTeach more BIOs how to handle BIO_CTRL_EOF
Matt Caswell [Fri, 24 Jan 2020 16:07:51 +0000 (16:07 +0000)]
Teach more BIOs how to handle BIO_CTRL_EOF

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

4 years agoDetect EOF while reading in libssl
Matt Caswell [Fri, 17 Jan 2020 17:39:19 +0000 (17:39 +0000)]
Detect EOF while reading in libssl

If we hit an EOF while reading in libssl then we will report an error
back to the application (SSL_ERROR_SYSCALL) but errno will be 0. We add
an error to the stack (which means we instead return SSL_ERROR_SSL) and
therefore give a hint as to what went wrong.

Contains a partial fix for #10880

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

4 years agoAdd *.d.tmp files to .gitignore
Matt Caswell [Tue, 18 Feb 2020 16:08:30 +0000 (16:08 +0000)]
Add *.d.tmp files to .gitignore

These are temporary files generated by the build process that should not
be checked in.

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

(cherry picked from commit 7b5108dff4cfde059ca278147a188fb6254603d1)

4 years agoHandle max_fragment_length overflow for DTLS
Simon Cornish [Fri, 14 Feb 2020 22:16:09 +0000 (14:16 -0800)]
Handle max_fragment_length overflow for DTLS

Allow for encryption overhead in early DTLS size check
and send overflow if validated record is too long

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

(cherry picked from commit cc0663f697b05ed121a728241f0502250429802d)

4 years agoDo not silently truncate files on perlasm errors
David Benjamin [Mon, 17 Feb 2020 02:21:27 +0000 (12:21 +1000)]
Do not silently truncate files on perlasm errors

If one of the perlasm xlate drivers crashes, OpenSSL's build will
currently swallow the error and silently truncate the output to however
far the driver got. This will hopefully fail to build, but better to
check such things.

Handle this by checking for errors when closing STDOUT (which is a pipe
to the xlate driver).

This is the OpenSSL 1.1.1 version of
https://github.com/openssl/openssl/pull/10883 and
https://github.com/openssl/openssl/pull/10930.

Reviewed-by: Mark J. Cox <mark@awe.com>
Reviewed-by: Paul Dale David Benjamin <davidben@google.com>
(Merged from https://github.com/openssl/openssl/pull/10931)

4 years agoCheck that ed25519 and ed448 are allowed by the security level
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: Tomáš Mráz <tmraz@fedoraproject.org>
GH: #11062

4 years agoGenerate new Ed488 certificates
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
(cherry picked from commit 77c4d3972400adf1bcb76ceea359f5453cc3e8e4)

4 years agoDOC: document in more detail what a BIO_read_ex() via BIO_f_buffer() does
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)

(cherry picked from commit 9a4fd80ee0ad1833879b6a55c9c4673eeb8446a3)

4 years agoVMS: Correct error reporting in crypto/rand/rand_vms.c
Richard Levitte [Thu, 13 Feb 2020 12:11:50 +0000 (13:11 +0100)]
VMS: Correct error reporting in crypto/rand/rand_vms.c

The future style that's coming with OpenSSL 3.0 was used, we need to
revert that back to "traditional" style.

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

4 years agoVMS: Adapt descrip.mms template to the changed inclustion dirs
Richard Levitte [Thu, 13 Feb 2020 11:06:31 +0000 (12:06 +0100)]
VMS: Adapt descrip.mms template to the changed inclustion dirs

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

4 years agoAdjust minimal build config in 1.1.1 branch
Bernd Edlinger [Tue, 11 Feb 2020 16:34:36 +0000 (17:34 +0100)]
Adjust minimal build config in 1.1.1 branch

Backport of improvements from #9982 to 1.1.1 branch.
Adds some more exclusions which were previously missed.

[extended tests]

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

4 years agoForgotten GOST2012 support in non-vital places
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)

4 years agoFix no-tls1_3
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)

(cherry picked from commit 104a733df65dfd8c3dd110de9bd56f6ebfc8f2f6)

4 years agoAppveyor: update to Visual Studio 2017.
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)

(cherry picked from commit b03de7a9207645c72e22627b10709f15eed211bf)

4 years agoAvoid leak in error path of PKCS5_PBE_keyivgen
kinichiro [Sun, 12 Jan 2020 08:35:39 +0000 (17:35 +0900)]
Avoid leak in error path of PKCS5_PBE_keyivgen

CLA: trivial

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

(cherry picked from commit adc9086beb21a91ca59aaf0c619b38b82c223f9b)

4 years agoCoverity CID 1444960: Error handling issues
Pauli [Tue, 7 May 2019 00:42:58 +0000 (10:42 +1000)]
Coverity CID 1444960: Error handling issues

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

(cherry picked from commit a05bf83c7964bb3928b323fe356b9f70f105036d)

4 years agoFix misspelling errors and typos reported by codespell
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)

4 years agoPrevent compiler warning for unused static function.
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)

(cherry picked from commit 7b6a746721170a21519c38798041be8101e7361f)

4 years agodoc: Fix typo in EVP_DigestSignInit manpage
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)

(cherry picked from commit 099a398268a298557be784528ac1d94f0f44c97c)

4 years agoFix small misspelling in doc for OCSP_response_status
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)

(cherry picked from commit 924d041fe0c650a79449217f81880a6384ff06b2)

4 years agoStop accepting certificates signed using SHA1 at security level 1
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
(cherry picked from commit b744f915ca8bb37631909728dd2529289bda8438)

4 years agoCreate a new embeddedSCTs1 that's signed using SHA256
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
(cherry picked from commit 4d9e8c95544d7a86765e6a46951dbe17b801875a)

4 years agoconfig: ensure the perl Configure run is the last statement
Richard Levitte [Mon, 27 Jan 2020 07:42:20 +0000 (08:42 +0100)]
config: ensure the perl Configure run is the last statement

Running any statement after Configure means we lose its exit code

Fixes #10951

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

(cherry picked from commit 4bf3e989fef9268507ba02744e7f71ee5637681c)

4 years agoDon't acknowledge a servername following warning alert in servername cb
Matt Caswell [Mon, 2 Dec 2019 17:29:21 +0000 (17:29 +0000)]
Don't acknowledge a servername following warning alert in servername cb

If the servername cb decides to send back a warning alert then the
handshake continues, but we should not signal to the client that the
servername has been accepted.

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

(cherry picked from commit cd624ccd41ac3ac779c1c7a7a1e63427ce9588dd)

4 years agoProvide better documentation for SSL_get_servername()
Matt Caswell [Thu, 28 Nov 2019 12:03:00 +0000 (12:03 +0000)]
Provide better documentation for SSL_get_servername()

The behaviour of SSL_get_servername() is quite complicated and depends on
numerous factors such as whether it is called on the client or the server,
whether it is called before or after the handshake, what protocol version
was negotiated, and whether a resumption was attempted or was successful.

We attempt to document the behavior more clearly.

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

(cherry picked from commit 0dc7c8e8314f27ac093b2d7bc8f13d0dfd302bdb)

4 years agoTest that SSL_get_servername returns what we expect
Matt Caswell [Thu, 26 Sep 2019 15:16:06 +0000 (16:16 +0100)]
Test that SSL_get_servername returns what we expect

Test this on both the client and the server after a normal handshake,
and after a resumption handshake. We also test what happens if an
inconsistent SNI is set between the original handshake and the resumption
handshake. Finally all of this is also tested in TLSv1.2 and TLSv1.3.

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

(cherry picked from commit 49ef3d0719f132629ab76d4bcb4ab0c1e016277a)

4 years agoFix SSL_get_servername() and SNI behaviour
Matt Caswell [Wed, 25 Sep 2019 16:06:06 +0000 (17:06 +0100)]
Fix SSL_get_servername() and SNI behaviour

The SNI behaviour for TLSv1.3 and the behaviour of SSL_get_servername()
was not quite right, and not entirely consistent with the RFC.

The TLSv1.3 RFC explicitly says that SNI is negotiated on each handshake
and the server is not required to associate it with the session. This was
not quite reflected in the code so we fix that.

Additionally there were some additional checks around early_data checking
that the SNI between the original session and this session were
consistent. In fact the RFC does not require any such checks, so they are
removed.

Finally the behaviour of SSL_get_servername() was not quite right. The
behaviour was not consistent between resumption and normal handshakes,
and also not quite consistent with historical behaviour. We clarify the
behaviour in various scenarios and also attempt to make it match historical
behaviour as closely as possible.

Fixes #8822

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

(cherry picked from commit 7955c1f16e72dc944677fd1dbf4b1300e75f1c84)

4 years agoFix type name typo in d2i/i2d documentation.
David Makepeace [Thu, 23 Jan 2020 01:07:18 +0000 (11:07 +1000)]
Fix type name typo in d2i/i2d documentation.

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

(cherry picked from commit 68229aebce159ecea7b887d6a0edd47d881a659b)

4 years agoOpenSSL::Test: bring back the relative paths
Richard Levitte [Tue, 21 Jan 2020 06:53:40 +0000 (07:53 +0100)]
OpenSSL::Test: bring back the relative paths

Because there was a bug in File::Spec::Unix' abs2rel when it was given
relative paths as both PATH and BASE arguments, the directories we
deal with were made to be all absolute.  Unfortunately, this meant
getting paths in our verbose test output which are difficult to use
anywhere else (such as a separate test build made for comparison), due
to the constant need to edit all the paths all the time.

We're therefore getting back the relative paths, by doing an extra
abs2rel() in __srctop_file, __srctop_dir, __bldtop_file and
__bldtop_dir, with a 'Cwd::getcwd' call as BASE argument.

Fixes #10628

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/10913)

(cherry picked from commit 612539e8a678c6099131dfd0e5e4b85fa774eb1a)

4 years agoCheck that the default signature type is allowed
Kurt Roeckx [Thu, 2 Jan 2020 21:53:32 +0000 (22:53 +0100)]
Check that the default signature type is allowed

TLS < 1.2 has fixed signature algorithms: MD5+SHA1 for RSA and SHA1 for the
others. TLS 1.2 sends a list of supported ciphers, but allows not sending
it in which case SHA1 is used. TLS 1.3 makes sending the list mandatory.

When we didn't receive a list from the client, we always used the
defaults without checking that they are allowed by the configuration.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
GH: #10784
(cherry picked from commit b0031e5dc2c8c99a6c04bc7625aa00d3d20a59a5)

4 years agoReplace apps/server.pem with certificate with a sha256 signature.
Kurt Roeckx [Sun, 12 Jan 2020 15:44:01 +0000 (16:44 +0100)]
Replace apps/server.pem with certificate with a sha256 signature.

It replaces apps/server.pem that used a sha1 signature with a copy of
test/certs/servercert.pem that is uses sha256.

This caused the dtlstest to start failing. It's testing connection
sbetween a dtls client and server. In particular it was checking that if
we drop a record that the handshake recovers and still completes
successfully. The test iterates a number of times. The first time
through it drops the first record. The second time it drops the second
one, and so on. In order to do this it has a hard-coded value for the
expected number of records it should see in a handshake. That's ok
because we completely control both sides of the handshake and know what
records we expect to see. Small changes in message size would be
tolerated because that is unlikely to have an impact on the number of
records. Larger changes in message size however could increase or
decrease the number of records and hence cause the test to fail.

This particular test uses a mem bio which doesn't have all the CTRLs
that the dgram BIO has. When we are using a dgram BIO we query that BIO
to determine the MTU size. The smaller the MTU the more fragmented
handshakes become. Since the mem BIO doesn't report an MTU we use a
rather small default value and get quite a lot of records in our
handshake. This has the tendency to increase the likelihood of the
number of records changing in the test if the message size changes.

It so happens that the new server certificate is smaller than the old
one. AFAICT this is probably because the DNs for the Subject and Issuer
are significantly shorter than previously. The result is that the number
of records used to transmit the Certificate message is one less than it
was before. This actually has a knock on impact for subsequent messages
and how we fragment them resulting in one less ServerKeyExchange record
too (the actual size of the ServerKeyExchange message hasn't changed,
but where in that message it gets fragmented has). In total the number
of records used in the handshake has decreased by 2 with the new
server.pem file.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
GH: #10784
(cherry picked from commit 5fd72d96a592c3c4ef28ff11c6ef334a856b0cd1)

4 years agoopenssl-config: add example libssl system-defaults
Benjamin Kaduk [Fri, 24 Jan 2020 01:08:34 +0000 (17:08 -0800)]
openssl-config: add example libssl system-defaults

Provide a "simple" example for affecting the systemwide default behavior
of libssl.  The large number of mandatory nested sections makes this
less simple than the main description might suggest.

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

(cherry picked from commit 3472082b4b6d73e0803a7c47f03e96ec0a69f77b)

4 years agoRemove remaining references to crypto/include
Bernd Edlinger [Sun, 19 Jan 2020 12:16:05 +0000 (13:16 +0100)]
Remove remaining references to crypto/include

Configure creates an empty crypto/include which
gets not cleaned up with make distclean.

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/10893)

4 years agoFix TLS not using aes_cbc_hmac_sha ciphers
Bernd Edlinger [Sun, 19 Jan 2020 11:23:40 +0000 (12:23 +0100)]
Fix TLS not using aes_cbc_hmac_sha ciphers

AES_ASM was repaced by AESNI_ASM, so use that.

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

4 years agoFix unwind info in crypto/rc4/asm/rc4-x86_64.pl
H.J. Lu [Thu, 16 Jan 2020 21:37:14 +0000 (13:37 -0800)]
Fix unwind info in crypto/rc4/asm/rc4-x86_64.pl

Move .cfi_startproc to the right place for RC4.  Add missing
.cfi_startproc and .cfi_endproc to RC4_options.

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/10872)

(cherry picked from commit 967ef73013becef2aec3439f8c45204b24121018)

4 years agoFor all assembler scripts where it matters, recognise clang > 9.x
Richard Levitte [Wed, 15 Jan 2020 20:14:05 +0000 (21:14 +0100)]
For all assembler scripts where it matters, recognise clang > 9.x

Fixes #10853

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

4 years agoUpdate SSL_CTX_sess_set_new_cb(3) docs for refcounts
Benjamin Kaduk [Wed, 15 Jan 2020 00:22:52 +0000 (16:22 -0800)]
Update SSL_CTX_sess_set_new_cb(3) docs for refcounts

The existing documentation for the new-session callback was unclear
about the requirements on the callback with respect to reference-handling
of the session object being created.  Be more explicit about the
(non-)requirements on the callback code for "success" (1) and "ignore"
(0) return values.

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

(cherry picked from commit 188d4ec82a9b0085ac5841cce3eda95efb94f2b4)

4 years agoFix documentation of return value for EVP_Digest{Sign,Verify}Init()
Richard Levitte [Sun, 12 Jan 2020 00:05:01 +0000 (01:05 +0100)]
Fix documentation of return value for EVP_Digest{Sign,Verify}Init()

They never returned the negative values that the documentation stated.

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

4 years agoAvoid leak in error path of asn1_parse2
kinichiro [Thu, 9 Jan 2020 14:22:25 +0000 (23:22 +0900)]
Avoid leak in error path of asn1_parse2

CLA: trivial

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

(cherry picked from commit 6a165fab239ec5b00b3cd68169a63b509207177d)

4 years agoConfigure: use $list_separator_re only for defines and includes
Richard Levitte [Thu, 9 Jan 2020 13:49:53 +0000 (14:49 +0100)]
Configure: use $list_separator_re only for defines and includes

This regexp was used a bit too uncontrolled, which had it split flag
values where it should not have.

Fixes #10792

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

(cherry picked from commit bbe486cf6154df3d3aaedbae6c5b82d4ed31a5f8)

4 years agofix a glitch in the documentation of OCSP_sendreq_bio()
Dr. David von Oheimb [Fri, 27 Dec 2019 09:54:38 +0000 (10:54 +0100)]
fix a glitch in the documentation of OCSP_sendreq_bio()

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

4 years agoFix pkeyutl -verifyrecover
Matt Caswell [Thu, 29 Aug 2019 16:15:16 +0000 (17:15 +0100)]
Fix pkeyutl -verifyrecover

When performing a pkeyutl -verifyrecover operation the input file is not
a hash - it is the signature itself. Therefore don't do the check to make
sure it looks like a hash.

Fixes #9658

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

(cherry picked from commit 5ffc33244cd4d66e47dfa66ce89cb38d0f3074cc)

4 years agoRevert "Move random-related defines from e_os.h to rand_unix.c"
Dr. Matthias St. Pierre [Sun, 5 Jan 2020 23:28:20 +0000 (00:28 +0100)]
Revert "Move random-related defines from e_os.h to rand_unix.c"

This reverts commit 7b18d1a53f932391bbc599a4717d6f98a597849c, which moved the
DEVRANDOM and DEVRANDOM_EGD defines into rand_unix.c. That change introduced
the regression that the compiler complains about missing declarations in
apps/version.c when OpenSSL is configured using `--with-rand-seed=devrandom`
(resp. `--with-rand-seed=egd`):

apps/version.c:173:42: error: 'DEVRANDOM' undeclared
             static const char *dev[] = { DEVRANDOM, NULL };
                                          ^~~~~~~~~

Fixes #10759

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

4 years agoDon't store an HMAC key for longer than we need
Matt Caswell [Fri, 3 Jan 2020 09:37:19 +0000 (09:37 +0000)]
Don't store an HMAC key for longer than we need

The HMAC_CTX structure stores the original key in case the ctx is reused
without changing the key.

However, HMAC_Init_ex() checks its parameters such that the only code path
where the stored key is ever used is in the case where HMAC_Init_ex is
called with a NULL key and an explicit md is provided which is the same as
the md that was provided previously. But in that case we can actually reuse
the pre-digested key that we calculated last time, so we can refactor the
code not to use the stored key at all.

With that refactor done it is no longer necessary to store the key in the
ctx at all. This means that long running ctx's will not keep the key in
memory for any longer than required. Note though that the digested key
*is* still kept in memory for the duration of the life of the ctx.

Fixes #10743

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

4 years agoFix incorrect return code on ECDSA key verification
Andrew Hoang [Tue, 24 Dec 2019 04:19:24 +0000 (20:19 -0800)]
Fix incorrect return code on ECDSA key verification

ECDSA_do_verify() is a function that verifies a ECDSA signature given a hash and a public EC key. The function is supposed to return 1 on valid signature, 0 on invalid signature and -1 on error. Previously, we returned 0 if the key did not have a verify_sig method. This is actually an error case and not an invalid signature. Consequently, this patch updates the return code to -1.

Fixes #8766

Reviewed-by: Nicola Tuveri <nic.tuv@gmail.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/10693)

(cherry picked from commit 26583f6aa8dc28e3598e61db66e54e2fdf8b195f)

4 years agoFix disabled ecdsa in apps/speed
fangming.fang [Fri, 27 Dec 2019 03:36:36 +0000 (03:36 +0000)]
Fix disabled ecdsa in apps/speed

This came from f3fdfbf78c6b. run = 1 should be done in pkey_print_message
as well, otherwise other tests printed with pkey_print_message won't run.

Change-Id: I0ba0b05256ad6509ada4735b26d10f8a73fd89ec

Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/10710)

(cherry picked from commit 6e49b514067a2b6a30d064d2ae1fdfd8050c184b)

4 years agoFix side channel in ecp_nistz256-armv8.pl
Fangming.Fang [Mon, 30 Dec 2019 12:15:37 +0000 (12:15 +0000)]
Fix side channel in ecp_nistz256-armv8.pl

This change addresses a potential side-channel vulnerability in
the internals of nistz256 low level operations for armv8.

Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/9239)

(cherry picked from commit f5a659b6dfcc735a62c712dcca64d116d2289b97)

4 years agoFix side channel in the ecp_nistz256.c reference implementation
Bernd Edlinger [Thu, 29 Aug 2019 20:45:18 +0000 (22:45 +0200)]
Fix side channel in the ecp_nistz256.c reference implementation

This is only used if configured with
./config -DECP_NISTZ256_REFERENCE_IMPLEMENTATION

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

(cherry picked from commit 7d4716648e8348dea862e198b9395478fae01907)

4 years agoImprove side channel fix in ecp_nistz256-x86_64.pl
Bernd Edlinger [Sun, 25 Aug 2019 01:47:01 +0000 (03:47 +0200)]
Improve side channel fix in ecp_nistz256-x86_64.pl

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

(cherry picked from commit e9fe87950db2e6169029b2ecf3ed09d64265bc9c)

4 years agoFix side channel in ecp_nistz256-armv4.pl
Bernd Edlinger [Sun, 25 Aug 2019 01:45:31 +0000 (03:45 +0200)]
Fix side channel in ecp_nistz256-armv4.pl

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

(cherry picked from commit 3d139746ca72f0906c036d0a4a3e176c7b61ed1b)

4 years agoFix side channel in ecp_nistz256-x86.pl
Bernd Edlinger [Sun, 25 Aug 2019 01:03:55 +0000 (03:03 +0200)]
Fix side channel in ecp_nistz256-x86.pl

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

(cherry picked from commit 0de3399b691f025153c8001045d5eeb0909dfd7a)

4 years agoAvoid leaking intermediate states in point doubling special case.
David Benjamin [Fri, 14 Jun 2019 21:06:52 +0000 (17:06 -0400)]
Avoid leaking intermediate states in point doubling special case.

Cherry picked from
https://github.com/google/boringssl/commit/12d9ed670da3edd64ce8175cfe0e091982989c18

Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/9239)

(cherry picked from commit 2baea7c7e0896658b74956cac6084dd7e82e8c1b)

4 years agoFix potential SCA vulnerability in some EC_METHODs
Nicola Tuveri [Sat, 8 Jun 2019 09:48:47 +0000 (12:48 +0300)]
Fix potential SCA vulnerability in some EC_METHODs

This commit addresses a potential side-channel vulnerability in the
internals of some elliptic curve low level operations.
The side-channel leakage appears to be tiny, so the severity of this
issue is rather low.

The issue was reported by David Schrammel and Samuel Weiser.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/9239)

(cherry picked from commit 3cb914c463ed1c9e32cfb773d816139a61b6ad5f)

4 years agoRun make update
Matt Caswell [Thu, 2 Jan 2020 13:48:00 +0000 (13:48 +0000)]
Run make update

The New Year has caused various files to appear out of date to "make
update". This causes Travis to fail. Therefore we update those files.

Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/10739)

4 years agoUpdate tls13_enc.c
dcruette [Tue, 24 Dec 2019 21:48:19 +0000 (22:48 +0100)]
Update tls13_enc.c

Fix double + in hkdflabel declaration (FIXES #10675)
CLA: trivial

Reviewed-by: Matt Caswell <matt@openssl.org>
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/10700)

(cherry picked from commit 2de5a5fbdd14f514e962cccfe90482c37786c183)

4 years agoTemporarily disable external pyca tests
Dr. Matthias St. Pierre [Sun, 29 Dec 2019 12:24:04 +0000 (13:24 +0100)]
Temporarily disable external pyca tests

The pyca-cryptography external test has been failing for a long time.
It looks like upstream needs to make some changes to adapt to 1.1.1.

Backported from #10689

[extended tests]

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

4 years agoUpdate the krb5 submodule
Benjamin Kaduk [Mon, 23 Dec 2019 18:35:48 +0000 (10:35 -0800)]
Update the krb5 submodule

Bring us up to date with upstream's 1.17.1 release.  Among other
things, it includes commit c2497d46b4bad473e164943d67b58cd1ae261c3a
which fixes several issues that affect running the test suite under
Travis CI.  Hopefully those will work transitively for us as well.

[extended tests]

Reviewed-by: Matt Caswell <matt@openssl.org>
(cherry picked from commit 3e73f558af600ea068bb2132988c31ddb444e13e)

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/10690)

4 years agoFix a race condition in the speed command
Bernd Edlinger [Sun, 22 Dec 2019 18:40:03 +0000 (19:40 +0100)]
Fix a race condition in the speed command

The timer alarm sets run = 0, while the benchmark
does run = 1 in the initialization code.  That is
a race condition, if the timer goes off too early
the benchmark runs forever.

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

(cherry picked from commit f3fdfbf78c6bfc97abf9c70b03859a28ebf6b66d)

4 years agoAdd some missing cfi frame info in rc4-md5-x86_64.pl
Bernd Edlinger [Sun, 22 Dec 2019 17:50:51 +0000 (18:50 +0100)]
Add some missing cfi frame info in rc4-md5-x86_64.pl

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
(Merged from https://github.com/openssl/openssl/pull/10679)

(cherry picked from commit b2a00f62209add348deb8283c588ddbd572dc216)

4 years agoAdd some missing cfi frame info in poly1305-x86_64.pl
Bernd Edlinger [Sun, 22 Dec 2019 15:29:17 +0000 (16:29 +0100)]
Add some missing cfi frame info in poly1305-x86_64.pl

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
(Merged from https://github.com/openssl/openssl/pull/10678)

(cherry picked from commit 048fa13e5ef4ccd730561f79a6c91f38365994d1)

4 years agoAdd some missing cfi frame info in aesni-gcm-x86_64.pl
Bernd Edlinger [Sun, 22 Dec 2019 14:39:58 +0000 (15:39 +0100)]
Add some missing cfi frame info in aesni-gcm-x86_64.pl

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
(Merged from https://github.com/openssl/openssl/pull/10677)

(cherry picked from commit 275a048ffc1585a731e39d7e8e3f53766e8f48d7)

4 years agoAdd some missing cfi frame info in x25519-x86_64.pl
Bernd Edlinger [Sun, 22 Dec 2019 10:48:54 +0000 (11:48 +0100)]
Add some missing cfi frame info in x25519-x86_64.pl

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
(Merged from https://github.com/openssl/openssl/pull/10676)

(cherry picked from commit 9d079f2744b9b624c6fe75f95fc0f766ef88ffcf)

4 years agoFix aesni_cbc_sha256_enc_avx2 backtrace info
Bernd Edlinger [Sat, 21 Dec 2019 21:09:45 +0000 (22:09 +0100)]
Fix aesni_cbc_sha256_enc_avx2 backtrace info

We store a secondary frame pointer info for the debugger
in the red zone.  This fixes a crash in the unwinder when
this function is interrupted.

Additionally the missing cfi function annotation is added
to aesni_cbc_sha256_enc_shaext.

[extended tests]

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

(cherry picked from commit 665de4d48aef2507022a7d74f5c7f6e339d5e6bc)

4 years agoAdd some missing cfi frame info in ecp_nistz256-x86_64.pl
Bernd Edlinger [Fri, 20 Dec 2019 23:20:31 +0000 (00:20 +0100)]
Add some missing cfi frame info in ecp_nistz256-x86_64.pl

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
(Merged from https://github.com/openssl/openssl/pull/10672)

(cherry picked from commit eff5076a78502d1ac04669e44127d4bd7c0a9ce7)

4 years agoFix evp_extra_test with no-dh
Matt Caswell [Wed, 18 Dec 2019 11:00:42 +0000 (11:00 +0000)]
Fix evp_extra_test with no-dh

The new DH test in evp_extra_test.c broke the no-dh build so we add some
guards to fix it.

Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/10644)

(cherry picked from commit 501fcfb8cfc1aa114ffde437039c2dc2827554ae)

4 years agoAdd some missing cfi frame info in aesni-sha and sha-x86_64.pl
Bernd Edlinger [Wed, 18 Dec 2019 22:15:03 +0000 (23:15 +0100)]
Add some missing cfi frame info in aesni-sha and sha-x86_64.pl

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
(Merged from https://github.com/openssl/openssl/pull/10655)

(cherry picked from commit b0d3442efc10b635863b915c2d014345f6e5a219)

4 years agoAdd some missing cfi frame info in keccak1600-x86_64.pl
Bernd Edlinger [Wed, 18 Dec 2019 21:31:00 +0000 (22:31 +0100)]
Add some missing cfi frame info in keccak1600-x86_64.pl

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
(Merged from https://github.com/openssl/openssl/pull/10654)

(cherry picked from commit 95bbe6eff7aadc681e282ec957379b49d6f80ca8)

4 years agoAdd some missing cfi frame info in aesni-x86_64.pl
Bernd Edlinger [Wed, 18 Dec 2019 19:20:53 +0000 (20:20 +0100)]
Add some missing cfi frame info in aesni-x86_64.pl

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
(Merged from https://github.com/openssl/openssl/pull/10653)

(cherry picked from commit a5fe7825b970a6c937118a4f707f9ad367413794)

4 years agoAdd some missing cfi frame info in rsaz-x86_64
Bernd Edlinger [Wed, 18 Dec 2019 18:27:55 +0000 (19:27 +0100)]
Add some missing cfi frame info in rsaz-x86_64

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
(Merged from https://github.com/openssl/openssl/pull/10652)

(cherry picked from commit 013c2e8d1a272df444f47b8b54de1d51bc499887)

4 years agoAdd some missing cfi frame info in x86_64-mont5.pl
Bernd Edlinger [Wed, 18 Dec 2019 17:35:12 +0000 (18:35 +0100)]
Add some missing cfi frame info in x86_64-mont5.pl

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
(Merged from https://github.com/openssl/openssl/pull/10651)

(cherry picked from commit 0190c52ab8b4cdf5fe577b3d924576167c892a15)

4 years agoAdd some missing cfi frame info in camellia-x86_64.pl
Bernd Edlinger [Wed, 18 Dec 2019 09:12:26 +0000 (10:12 +0100)]
Add some missing cfi frame info in camellia-x86_64.pl

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
(Merged from https://github.com/openssl/openssl/pull/10642)

(cherry picked from commit 6b913be708f98b1d971586d38e608218ee6de6fa)

4 years agoFix regression on x509 keyform argument
Jussi Keranen [Wed, 11 Dec 2019 13:08:04 +0000 (15:08 +0200)]
Fix regression on x509 keyform argument

In OpenSSL pre 1.1.0, 'openssl x509 -keyform engine' was possible
and supported.  In 1.1.0, type of keyform argument is OPT_FMT_PEMDER
which doesn't support engine. This changes type of keyform argument
to OPT_FMT_PDE which means PEM, DER or engine and updates the manpage
including keyform and CAkeyform.

This restores the pre 1.1.0 behavior.

This issue is very similar than https://github.com/openssl/openssl/issues/4366

CLA: trivial

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

(cherry picked from commit 0ab6fc79a9a63370be1a615729dc2a6ed0d6c89b)

4 years agoConfiguration: compute openssl_other_defines and related info later
Richard Levitte [Wed, 4 Dec 2019 09:39:24 +0000 (10:39 +0100)]
Configuration: compute openssl_other_defines and related info later

The computation of macros and configdata.pm related data from %disabled
was done much too early, leaving later disablings without real support.

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

4 years agoDisable devcryptoeng on newer OpenBSD versions
Richard Levitte [Tue, 3 Dec 2019 23:10:04 +0000 (00:10 +0100)]
Disable devcryptoeng on newer OpenBSD versions

It's reported that /dev/crypto support has been dropped in OpenBSD 5.7.

Fixes #10552

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

4 years agoFix unwind info for some trivial functions
Bernd Edlinger [Tue, 17 Dec 2019 08:05:32 +0000 (09:05 +0100)]
Fix unwind info for some trivial functions

While stack unwinding works with gdb here, the
function _Unwind_Backtrace gives up when something outside
.cfi_startproc/.cfi_endproc is found in the call stack, like
OPENSSL_cleanse, OPENSSL_atomic_add, OPENSSL_rdtsc, CRYPTO_memcmp
and other trivial functions which don't save anything in the stack.

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
(Merged from https://github.com/openssl/openssl/pull/10635)

(cherry picked from commit 8913378a552e470c66277c47b19699f20b84aa3b)

4 years agoapps/speed.c: Fix eddsa sign and verify output with -multi option
Saritha [Tue, 29 Oct 2019 06:40:55 +0000 (12:10 +0530)]
apps/speed.c: Fix eddsa sign and verify output with -multi option

Fixes #10261
CLA: trivial

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

(cherry picked from commit 1ac7e15375be39c8f03171c02658cf703f58217a)

4 years agoUpdate the HISTORY entry for RSA_get0_pss_params()
Matt Caswell [Wed, 4 Dec 2019 10:21:52 +0000 (10:21 +0000)]
Update the HISTORY entry for RSA_get0_pss_params()

Make a note of when this function was first introduced

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

4 years agoBackport the RSA_get0_pss_params() function from master
Matt Caswell [Wed, 4 Dec 2019 10:21:06 +0000 (10:21 +0000)]
Backport the RSA_get0_pss_params() function from master

This is a missing accessor in order to obtain PSS parameters from an
RSA key, which should also be available in 1.1.1.

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

4 years agoTest that EVP_PKEY_set1_DH() correctly identifies the DH type
Matt Caswell [Mon, 9 Dec 2019 12:03:02 +0000 (12:03 +0000)]
Test that EVP_PKEY_set1_DH() correctly identifies the DH type

Provide a test to check tat when we assign a DH object we know whether
we are dealing with PKCS#3 or X9.42 DH keys.

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

(cherry picked from commit e295de1d8433ed07092845cb6c56aa424ff35c6d)

4 years agoEnsure EVP_PKEY_set1_DH detects X9.42 keys
Matt Caswell [Mon, 9 Dec 2019 11:51:48 +0000 (11:51 +0000)]
Ensure EVP_PKEY_set1_DH detects X9.42 keys

OpenSSL supports both PKCS#3 and X9.42 DH keys. By default we use PKCS#3
keys. The function `EVP_PKEY_set1_DH` was assuming that the supplied DH
key was a PKCS#3 key. It should detect what type of key it is and assign
the correct type as appropriate.

Fixes #10592

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

(cherry picked from commit 32c869ffaba67822602ea9fec611272ff8e8db58)

4 years agoReturn 1 when openssl req -addext kv is duplicated
kinichiro [Thu, 5 Dec 2019 11:00:50 +0000 (20:00 +0900)]
Return 1 when openssl req -addext kv is duplicated

CLA: trivial

Fixes #10273

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

(cherry picked from commit 1aeec3dbc2d62f902698b1eba9ed31cbd436f9dc)

4 years agorand_lib.c: fix null pointer dereferences after RAND_get_rand_method() failure
Dr. Matthias St. Pierre [Wed, 20 Nov 2019 23:09:11 +0000 (00:09 +0100)]
rand_lib.c: fix null pointer dereferences after RAND_get_rand_method() failure

RAND_get_rand_method() can return a NULL method pointer in the case of a
malloc failure, so don't dereference it without a check.

Reported-by: Zu-Ming Jiang (detected by FIFUZZ)
Fixes #10480

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

4 years agoutil/mkerr.pl: revert accidental change of header guards
Dr. Matthias St. Pierre [Fri, 13 Dec 2019 11:25:15 +0000 (12:25 +0100)]
util/mkerr.pl: revert accidental change of header guards

This change was backported accidentally from master in commit fbbfd128c9aa.

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

4 years agoParse large GOST ClientKeyExchange messages
Dmitry Belyavskiy [Thu, 7 Nov 2019 14:35:13 +0000 (17:35 +0300)]
Parse large GOST ClientKeyExchange messages

Large GOST ClientKeyExchange messages are sent by VipNet CSP, one of
Russian certified products implementing GOST TLS, when a server
certificate contains 512-bit keys.

This behaviour was present in 1.0.2 branch and needs to be restored.
Backport of #10376

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

4 years agoCheck return value after loading config file
kinichiro [Wed, 11 Dec 2019 12:12:53 +0000 (21:12 +0900)]
Check return value after loading config file

CLA: trivial

Reviewed-by: Paul Yang <kaishen.yy@antfin.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/10607)

(cherry picked from commit dd0139f416257ec5632414ed3ad8c61d07ba07ec)

4 years agoEnrich arm64 tests in Travis matrix
Fangming.Fang [Fri, 15 Nov 2019 07:47:22 +0000 (07:47 +0000)]
Enrich arm64 tests in Travis matrix

1, Remove simple test just with --strict-warnings enabled.
2, Share the three common envs with amd64.
3, Add matrix item running test in bionic(default xenial) for arm64.
4, Enable MSan test on arm64 for extended test.
5, Enable UBSan test on arm64 for extended test.

Change-Id: Ic1f2c5e39ee6fbafed6ede74a925301121463520

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

(cherry picked from commit 77fedcdc8cf5446354a1e7ff9123d8ada5b79b06)

4 years agoFix docs for CRYPTO_secure_allocated
Rich Salz [Tue, 26 Nov 2019 14:16:41 +0000 (09:16 -0500)]
Fix docs for CRYPTO_secure_allocated

Fixes #9300

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

(cherry picked from commit 20c09f00346aec3a20ceacc9c9d44c5f050e13dd)

4 years agoFix some typos
Veres Lajos [Sat, 30 Nov 2019 23:18:47 +0000 (23:18 +0000)]
Fix some typos

Reported-by: misspell-fixer <https://github.com/vlajos/misspell-fixer>
CLA: trivial

Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10544)

(cherry picked from commit 79c44b4e3044aee9dc9618850d4f1ce067757b4b)

4 years agoDifference between EVP_CipherInit and EVP_CipherInit_ex
Dmitry Belyavskiy [Sun, 1 Dec 2019 08:53:14 +0000 (11:53 +0300)]
Difference between EVP_CipherInit and EVP_CipherInit_ex

Fixes #10455

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