oweals/openssl.git
6 years agoFix some errors in the mem leaks docs
Matt Caswell [Thu, 29 Mar 2018 09:45:42 +0000 (10:45 +0100)]
Fix some errors in the mem leaks docs

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

6 years agoFix a text canonicalisation bug in CMS
Matt Caswell [Thu, 29 Mar 2018 08:17:11 +0000 (09:17 +0100)]
Fix a text canonicalisation bug in CMS

Where a CMS detached signature is used with text content the text goes
through a canonicalisation process first prior to signing or verifying a
signature. This process strips trailing space at the end of lines, converts
line terminators to CRLF and removes additional trailing line terminators
at the end of a file. A bug in the canonicalisation process meant that
some characters, such as form-feed, were incorrectly treated as whitespace
and removed. This is contrary to the specification (RFC5485). This fix
could mean that detached text data signed with an earlier version of
OpenSSL 1.1.0 may fail to verify using the fixed version, or text data
signed with a fixed OpenSSL may fail to verify with an earlier version of
OpenSSL 1.1.0. A workaround is to only verify the canonicalised text data
and use the "-binary" flag (for the "cms" command line application) or set
the SMIME_BINARY/PKCS7_BINARY/CMS_BINARY flags (if using CMS_verify()).

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

6 years agoChange the "offset too large" message to more generic wording
Bernd Edlinger [Mon, 2 Apr 2018 08:54:52 +0000 (10:54 +0200)]
Change the "offset too large" message to more generic wording

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/5826)

6 years agoRemove an unnecessary cast in the param to BUF_MEM_grow
Bernd Edlinger [Mon, 2 Apr 2018 08:35:29 +0000 (10:35 +0200)]
Remove an unnecessary cast in the param to BUF_MEM_grow

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/5826)

6 years agoFix range checks with -offset and -length in asn1parse
Bernd Edlinger [Mon, 2 Apr 2018 07:13:49 +0000 (09:13 +0200)]
Fix range checks with -offset and -length in asn1parse

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/5826)

6 years agoUse strtol instead of atoi in asn1parse
Bernd Edlinger [Sun, 1 Apr 2018 09:02:39 +0000 (11:02 +0200)]
Use strtol instead of atoi in asn1parse

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/5826)

6 years agoImprove diagnostics for invalid arguments in asn1parse -strparse
Bernd Edlinger [Sat, 31 Mar 2018 22:46:49 +0000 (00:46 +0200)]
Improve diagnostics for invalid arguments in asn1parse -strparse

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/5826)

6 years agoFix a crash in the asn1parse command
Bernd Edlinger [Sat, 31 Mar 2018 19:09:32 +0000 (21:09 +0200)]
Fix a crash in the asn1parse command

Thanks to Sem Voigtländer for reporting this issue.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/5826)

6 years agoUse gnu_printf format attribute to minimise MinGW warnings
Bernd Edlinger [Mon, 2 Apr 2018 15:20:04 +0000 (17:20 +0200)]
Use gnu_printf format attribute to minimise MinGW warnings

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5839)

6 years agoPrepare for 1.1.1-pre5-dev
Matt Caswell [Tue, 3 Apr 2018 13:26:16 +0000 (14:26 +0100)]
Prepare for 1.1.1-pre5-dev

Reviewed-by: Richard Levitte <levitte@openssl.org>
6 years agoPrepare for 1.1.1-pre4 release OpenSSL_1_1_1-pre4
Matt Caswell [Tue, 3 Apr 2018 13:24:18 +0000 (14:24 +0100)]
Prepare for 1.1.1-pre4 release

Reviewed-by: Richard Levitte <levitte@openssl.org>
6 years agoFix CHANGES
Matt Caswell [Tue, 3 Apr 2018 13:07:02 +0000 (14:07 +0100)]
Fix CHANGES

Fix the last release version number in CHANGES

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

6 years agoUpdate copyright year
Matt Caswell [Tue, 3 Apr 2018 12:57:12 +0000 (13:57 +0100)]
Update copyright year

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

6 years agoUse the private RNG for data that is not public
Kurt Roeckx [Fri, 3 Nov 2017 19:59:16 +0000 (20:59 +0100)]
Use the private RNG for data that is not public

Reviewed-by: Dr. Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Reviewed-by: Rich Salz <rsalz@openssl.org>
Fixes: #4641
GH: #4665

6 years agoDocumentation typo fix in EVP_EncryptInit.pod
Alexandre Perrin [Mon, 2 Apr 2018 11:15:31 +0000 (07:15 -0400)]
Documentation typo fix in EVP_EncryptInit.pod

Remove duplicate declaration of `EVP_CIPHER_key_length` in the synopsis.

CLA: trivial

Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5792)

6 years agofix typo in x509 documentation
Illya Gerasymchuk [Mon, 2 Apr 2018 11:13:19 +0000 (07:13 -0400)]
fix typo in x509 documentation

Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5829)

6 years agoRemove import/use of File::Spec::Function
Daniel Bevenius [Sun, 1 Apr 2018 14:17:52 +0000 (16:17 +0200)]
Remove import/use of File::Spec::Function

It looks like the usage of these functions were removed in
in commit 0a4edb931b883b9973721ae012e60c028387dd50 ("Unified - adapt
the generation of cpuid, uplink and buildinf to use GENERATE").

This commit removes the import/use of File::Spec::Functions module as it
is no longer needed by crypto/build.info.

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

6 years agoWindows builds: remove over-quotation of LIBZ macro
Richard Levitte [Sun, 1 Apr 2018 15:41:16 +0000 (17:41 +0200)]
Windows builds: remove over-quotation of LIBZ macro

The LIBZ macro definition was already quoted in BASE_windows, then got
quotified once more in windows-makefile.tmpl.  That's a bit too much
quotations, ending up with the compiler being asked to define the
macro |"LIBZ=\"ZLIB1\""| (no, not the macro LIBZ with the value
"ZLIB1").  This is solved by removing the extra quoting in
BASE_windows.

Along with this, change the quotation of macro definitions and include
file specification, so we end up with things like -I"QuotedPath" and
-D"Macro=\"some weird value\"" rather than "-IQuotedPath" and
"-DMacro=\"some weird value\"".

Fixes #5827

Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5833)

6 years agoMake sure we use a nonce when a nonce is required
Kurt Roeckx [Sat, 3 Mar 2018 22:19:03 +0000 (23:19 +0100)]
Make sure we use a nonce when a nonce is required

If a nonce is required and the get_nonce callback is NULL, request 50%
more entropy following NIST SP800-90Ar1 section 9.1.

Reviewed-by: Dr. Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
GH: #5503

6 years agoUpdate documentation on how to close a connection
Kurt Roeckx [Sat, 31 Mar 2018 12:43:01 +0000 (14:43 +0200)]
Update documentation on how to close a connection

Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
GH: #5823

6 years agoFix minor typo in comment in Configure
Daniel Bevenius [Sat, 31 Mar 2018 22:29:12 +0000 (18:29 -0400)]
Fix minor typo in comment in Configure

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5825)

6 years agoRemove -Wmisleading-indentation from gcc devteam warning options
Bernd Edlinger [Fri, 30 Mar 2018 18:03:37 +0000 (20:03 +0200)]
Remove -Wmisleading-indentation from gcc devteam warning options
because this one is enabled by default anyways

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5817)

6 years agoFix a gcc-8 warning -Wcast-function-type
Bernd Edlinger [Fri, 30 Mar 2018 17:17:39 +0000 (19:17 +0200)]
Fix a gcc-8 warning -Wcast-function-type

Casting to the generic function type "void (*)(void)"
prevents the warning.

Reviewed-by: Ben Kaduk <kaduk@mit.edu>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
(Merged from https://github.com/openssl/openssl/pull/5816)

6 years agoRefuse to run test_cipherlist unless shared library matches build
Richard Levitte [Mon, 26 Mar 2018 09:00:05 +0000 (11:00 +0200)]
Refuse to run test_cipherlist unless shared library matches build

test/cipherlist_test.c is an internal consistency check, and therefore
requires that the shared library it runs against matches what it was
built for.  test/recipes/test_cipherlist.t is made to refuse running
unless library version and build version match.

This adds a helper program test/versions.c, that simply displays the
library and the build version.

Partially fixes #5751

Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5753)

(cherry picked from commit cde87deafa7486f26bdf954867a6d72ca4ea06e7)

6 years agoFix a possible crash in BN_from_montgomery_word
Bernd Edlinger [Thu, 29 Mar 2018 09:27:29 +0000 (11:27 +0200)]
Fix a possible crash in BN_from_montgomery_word

Thanks to Darovskikh Andrei for for reporting this issue.

Fixes: #5785

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5793)

6 years agoRevert commit 4a56d9a2
Matt Caswell [Fri, 30 Mar 2018 13:35:52 +0000 (14:35 +0100)]
Revert commit 4a56d9a2

We have been unable to trace the contributor of that code to gain their
agreement for the licence change so the code has to be removed.

This commit reverts that contribution. The contribution had no functional
impact so the original way of doing things is still valid. However the
surrounding code has changed significantly so that the exact code as it
was orignally cannot be used. This commit uses the original code as a basis,
but rewrites it to use the PACKET API.

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

6 years agoGOST MAC algorithms don't support EVP_PKEY_new_raw_private_key()
Matt Caswell [Fri, 30 Mar 2018 13:33:55 +0000 (14:33 +0100)]
GOST MAC algorithms don't support EVP_PKEY_new_raw_private_key()

We should use the old EVP_PKEY_new_mac_key() instead.

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

6 years agoUpdate trace code to know about GOST ciphersuites
Matt Caswell [Fri, 30 Mar 2018 13:33:21 +0000 (14:33 +0100)]
Update trace code to know about GOST ciphersuites

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

6 years agoRemove some code
Rich Salz [Fri, 30 Mar 2018 16:40:08 +0000 (12:40 -0400)]
Remove some code

This commit removes the contribution of a user that we cannot
trace to gain their consent for the licence change.

I also cleaned up the return/error-return flow a bit.

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

6 years agoAdd documentation for the RAND_DRBG API
Dr. Matthias St. Pierre [Tue, 27 Feb 2018 18:02:24 +0000 (19:02 +0100)]
Add documentation for the RAND_DRBG API

The RAND_DRBG API was added in PR #5462 and modified by PR #5547.
This commit adds the corresponding documention.

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5461)

6 years agoEVP,KDF: Add more error code along some return 0 in ...
FdaSilvaYY [Thu, 29 Mar 2018 18:59:58 +0000 (20:59 +0200)]
EVP,KDF: Add more error code along some return 0 in ...
methods :
 - EVP_PBE_scrypt
 - EVP_PKEY_meth_add0
 - EVP_PKEY_meth_new
 - EVP_PKEY_CTX_dup

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/5783)

6 years agoBIO_s_accept.pod: add documentation for the new macros
Vitezslav Cizek [Tue, 9 Jan 2018 19:18:24 +0000 (20:18 +0100)]
BIO_s_accept.pod: add documentation for the new macros

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Ben Kaduk <kaduk@mit.edu>
(Merged from https://github.com/openssl/openssl/pull/5007)

6 years agoDocument BIO_{get,set}_conn_ip_family macros.
Vitezslav Cizek [Tue, 9 Jan 2018 16:56:57 +0000 (17:56 +0100)]
Document BIO_{get,set}_conn_ip_family macros.

Add BIO_get_conn_ip_family and BIO_set_conn_ip_family macros to
util/private.num and document them in BIO_s_connect.pod.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Ben Kaduk <kaduk@mit.edu>
(Merged from https://github.com/openssl/openssl/pull/5007)

6 years agoUpdate the BIO_s_connect documentation after the BIO refactoring.
Vitezslav Cizek [Tue, 2 Jan 2018 13:43:18 +0000 (14:43 +0100)]
Update the BIO_s_connect documentation after the BIO refactoring.

The BIO was refactored in 417be660e1cd21a2ee085569ff98b0c4249b5416,
but the manual wasn't fully updated to reflect some of the changes.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Ben Kaduk <kaduk@mit.edu>
(Merged from https://github.com/openssl/openssl/pull/5007)

6 years agoDocument RAND_DRBG fork-safety locking model
Benjamin Kaduk [Mon, 7 Aug 2017 14:55:48 +0000 (09:55 -0500)]
Document RAND_DRBG fork-safety locking model

Add some more exposition on why unlocked access to the global rand_fork_count
is safe, and provide a comment for the struct rand_drbg_st fork_count field.

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

6 years agoConfigurations/10-main.conf: fix VC-noCE-common template.
Andy Polyakov [Wed, 28 Mar 2018 08:07:32 +0000 (10:07 +0200)]
Configurations/10-main.conf: fix VC-noCE-common template.

picker() is type agnostic, but its output consumer is not. Or rather
it doesn't work if picker() picks nothing when consumer expects
array. So ensure array is returned when array is expected.

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

6 years agoConfigure: harmonize syntax.
Andy Polyakov [Wed, 28 Mar 2018 08:06:32 +0000 (10:06 +0200)]
Configure: harmonize syntax.

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

6 years agoFix setbuf use for VMS C
Richard Levitte [Thu, 29 Mar 2018 08:34:11 +0000 (10:34 +0200)]
Fix setbuf use for VMS C

The VMS C RTL has setbuf() working for short pointers only, probably
the FILE pointer will always be in P0 (the lower 4GB).  Fortunately,
this only generates a warning about possible data loss (doesn't apply
in this case) that we can simply turn off.

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

6 years ago.travis.yml: with fast fuzz testing, there is no point avoiding it
Richard Levitte [Wed, 28 Mar 2018 08:38:56 +0000 (10:38 +0200)]
.travis.yml: with fast fuzz testing, there is no point avoiding it

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

6 years agoFaster fuzz test: teach the fuzz test programs to handle directories
Richard Levitte [Wed, 28 Mar 2018 13:46:28 +0000 (15:46 +0200)]
Faster fuzz test: teach the fuzz test programs to handle directories

Instead of invoking the fuzz test programs once for every corpora
file, we invoke them once for each directory of corpora files.  This
dramatically reduces the number of program invikations, as well as the
time 99-test_fuzz.t takes to complete.

fuzz/test-corpus.c was enhanced to handle directories as well as
regular files.

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

6 years agoRevert "util/dofile.pl: only quote stuff that actually needs quoting"
Richard Levitte [Wed, 28 Mar 2018 12:46:27 +0000 (14:46 +0200)]
Revert "util/dofile.pl: only quote stuff that actually needs quoting"

This wasn't a good solution, too many things depend on the quotes being
there consistently.

This reverts commit 49cd47eaababc8c57871b929080fc1357e2ad7b8.

Fixes #5772

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5773)

6 years agocrypto/e_aes.c: use S390X_AES_FC macro
Patrick Steuer [Wed, 28 Mar 2018 12:23:56 +0000 (13:23 +0100)]
crypto/e_aes.c: use S390X_AES_FC macro

... to compute s390x aes function code from keylength.

Signed-off-by: Patrick Steuer <patrick.steuer@de.ibm.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5250)

6 years agocrypto/evp/e_aes.c: add size_t casts to increase readability
Patrick Steuer [Wed, 28 Mar 2018 12:21:29 +0000 (13:21 +0100)]
crypto/evp/e_aes.c: add size_t casts to increase readability

Signed-off-by: Patrick Steuer <patrick.steuer@de.ibm.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5250)

6 years agos390x assembly pack: add KMF code path for aes-cfb/cfb8
Patrick Steuer [Wed, 28 Mar 2018 12:09:24 +0000 (13:09 +0100)]
s390x assembly pack: add KMF code path for aes-cfb/cfb8

Signed-off-by: Patrick Steuer <patrick.steuer@de.ibm.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5250)

6 years agos390x assembly pack: add KMO code path for aes-ofb
Patrick Steuer [Wed, 28 Mar 2018 11:54:50 +0000 (12:54 +0100)]
s390x assembly pack: add KMO code path for aes-ofb

Signed-off-by: Patrick Steuer <patrick.steuer@de.ibm.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5250)

6 years agos390x assembly pack: add KM code path for aes-ecb
Patrick Steuer [Wed, 28 Mar 2018 11:43:15 +0000 (12:43 +0100)]
s390x assembly pack: add KM code path for aes-ecb

Signed-off-by: Patrick Steuer <patrick.steuer@de.ibm.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5250)

6 years agoRewrite the X509->alert mapping code
Rich Salz [Wed, 28 Mar 2018 19:34:16 +0000 (15:34 -0400)]
Rewrite the X509->alert mapping code

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

6 years agoRemove some code
Matt Caswell [Tue, 27 Mar 2018 16:31:56 +0000 (17:31 +0100)]
Remove some code

This commit removes the contribution of a user that we cannot trace to
gain their consent for the licence change.

After this commit the various IS_*() macros in the auto-generated file
conf_def.h may incorrectly return true if the supplied character has its
most significant bit set. The IS_*() macros should be able to correctly
handle 8-bit characters. Note that UTF-8 support is not a requirement.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5767)

6 years agoTolerate a Certificate using a non-supported group on server side
Matt Caswell [Mon, 12 Mar 2018 17:15:25 +0000 (17:15 +0000)]
Tolerate a Certificate using a non-supported group on server side

If a server has been configured to use an ECDSA certificate, we should
allow it regardless of whether the server's own supported groups list
includes the certificate's group.

Fixes #2033

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

6 years agoRevert "Temporarily disable some tests that hang"
Matt Caswell [Tue, 27 Mar 2018 21:37:19 +0000 (22:37 +0100)]
Revert "Temporarily disable some tests that hang"

This reverts commit 37a385956461ab526ecea2739a8a40364a8db259.

These tests should now be fixed by commit e6e9170d6.

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

6 years agoAllow NULL for some _free routines.
Rich Salz [Tue, 27 Mar 2018 20:25:08 +0000 (16:25 -0400)]
Allow NULL for some _free routines.

Based on the description in https://github.com/openssl/openssl/pull/5757,
this re-implements the "allow NULL to be passed" behavior of a number of
xxx_free routines.  I also fixed up some egregious formatting errors
that were nearby.

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

6 years agoo_time.c: use gmtime_s with MSVC
Miroslav Suk [Thu, 22 Mar 2018 08:20:43 +0000 (09:20 +0100)]
o_time.c: use gmtime_s with MSVC
ts/ts_rsp_sign.c: change to OPENSSL_gmtime.

Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5720)

6 years agodoc/man1/x509.pod: corrected "S/MIME signing" requirements
Konstantin Shemyak [Thu, 22 Mar 2018 17:53:59 +0000 (19:53 +0200)]
doc/man1/x509.pod: corrected "S/MIME signing" requirements

When the "certificate purpose" is checked and KeyUsage extension is present,
either 'digitalSignature' or 'nonRepudiation' is accepted.

Manual page corrected to reflect the above.

Signed-off-by: Konstantin Shemyak <konstantin@shemyak.com>
Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5727)

6 years agostatem/statem_clnt.c: omit redundant check in tls_construct_client_hello.
Philippe Antoine [Mon, 26 Mar 2018 08:29:56 +0000 (10:29 +0200)]
statem/statem_clnt.c: omit redundant check in tls_construct_client_hello.

Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5729)

6 years agorand/randfile.c: permit non-regular files in RAND_load_file.
Andy Polyakov [Fri, 23 Mar 2018 14:12:20 +0000 (15:12 +0100)]
rand/randfile.c: permit non-regular files in RAND_load_file.

Apparently applications rely on RAND_load_file's ability to work with
non-regular files, customarily with /dev/urandom, so that the ban was
not exactly appropriate.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5737)

6 years agoConfigure: make LIST command work with dynamic 15-android.conf.
Andy Polyakov [Mon, 26 Mar 2018 10:35:57 +0000 (12:35 +0200)]
Configure: make LIST command work with dynamic 15-android.conf.

This is quick-n-dirty ad-hoc solution, the problem asks for more
elegant one...

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

6 years agoTemporarily disable some tests that hang
Matt Caswell [Mon, 26 Mar 2018 22:36:37 +0000 (23:36 +0100)]
Temporarily disable some tests that hang

The previous commit causes some tests to hang so we temporarily disable them.

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

6 years agoRemove some code for a contributor that we cannot find
Matt Caswell [Mon, 26 Mar 2018 18:12:25 +0000 (19:12 +0100)]
Remove some code for a contributor that we cannot find

This removes some code because we cannot trace the original contributor
to get their agreement for the licence change (original commit e03ddfae).

After this change there will be numerous failures in the test cases until
someone rewrites the missing code.

All *_free functions should accept a NULL parameter. After this change
the following *_free functions will fail if a NULL parameter is passed:

BIO_ACCEPT_free()
BIO_CONNECT_free()
BN_BLINDING_free()
BN_CTX_free()
BN_MONT_CTX_free()
BN_RECP_CTX_free()
BUF_MEM_free()
COMP_CTX_free()
ERR_STATE_free()
TXT_DB_free()
X509_STORE_free()
ssl3_free()
ssl_cert_free()
SSL_SESSION_free()
SSL_free()

[skip ci]

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

6 years agoAssert that alpn_selected is NULL before we assign it
Matt Caswell [Wed, 21 Mar 2018 20:19:37 +0000 (20:19 +0000)]
Assert that alpn_selected is NULL before we assign it

The alpn_selected value in the session should be NULL before we first
populate it if this is a new session. We assert to make sure it is.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5715)

6 years agoDon't write out a bad OID
Matt Caswell [Thu, 22 Mar 2018 14:33:05 +0000 (14:33 +0000)]
Don't write out a bad OID

If we don't have OID data for an object then we should fail if we
are asked to encode the ASN.1 for that OID.

Fixes #5723

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5725)

6 years agoUpdate CHANGES and NEWS for the new release
Matt Caswell [Tue, 27 Mar 2018 09:58:34 +0000 (10:58 +0100)]
Update CHANGES and NEWS for the new release

Reviewed-by: Richard Levitte <levitte@openssl.org>
6 years agotest/test_test.c: add CRYPTO_memcmp regression test.
Andy Polyakov [Mon, 26 Mar 2018 08:55:35 +0000 (10:55 +0200)]
test/test_test.c: add CRYPTO_memcmp regression test.

Reviewed-by: Matt Caswell <matt@openssl.org>
6 years agopariscid.pl: fix nasty typo in CRYPTO_memcmp.
Andy Polyakov [Wed, 21 Mar 2018 22:48:10 +0000 (23:48 +0100)]
pariscid.pl: fix nasty typo in CRYPTO_memcmp.

Comparison was effectively reduced to least significant bits.

CVE-2018-0733

Reviewed-by: Matt Caswell <matt@openssl.org>
6 years agoAdd fuzz corpora file that found the ASN.1 stack depth issue
Matt Caswell [Fri, 26 Jan 2018 16:23:03 +0000 (16:23 +0000)]
Add fuzz corpora file that found the ASN.1 stack depth issue

Reviewed-by: Rich Salz <rsalz@openssl.org>
6 years agoLimit ASN.1 constructed types recursive definition depth
Matt Caswell [Thu, 22 Mar 2018 09:39:53 +0000 (09:39 +0000)]
Limit ASN.1 constructed types recursive definition depth

Constructed types with a recursive definition (such as can be found in
PKCS7) could eventually exceed the stack given malicious input with
excessive recursion. Therefore we limit the stack depth.

CVE-2018-0739

Credit to OSSFuzz for finding this issue.

Reviewed-by: Rich Salz <rsalz@openssl.org>
6 years agoRemove QNX support
Rich Salz [Mon, 26 Mar 2018 18:10:57 +0000 (14:10 -0400)]
Remove QNX support

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

6 years agoConfigurations/README: mention Libs.private in ex_libs description.
Andy Polyakov [Sun, 25 Mar 2018 14:51:55 +0000 (16:51 +0200)]
Configurations/README: mention Libs.private in ex_libs description.

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
6 years agoPreviously this x509 command line was working, restore that
Bernd Edlinger [Sun, 25 Mar 2018 12:00:33 +0000 (14:00 +0200)]
Previously this x509 command line was working, restore that

openssl x509 -in server.pem -signkey privkey.pem -out server.pem

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5746)

6 years agoFix dsaparam -genkey with DER outform
Bernd Edlinger [Sun, 25 Mar 2018 10:50:17 +0000 (12:50 +0200)]
Fix dsaparam -genkey with DER outform

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5744)

6 years agoFix ecparam -genkey with point compression or DER outform
Bernd Edlinger [Sat, 24 Mar 2018 14:17:11 +0000 (15:17 +0100)]
Fix ecparam -genkey with point compression or DER outform

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5741)

6 years agoAdds multiple checks to avoid buffer over reads
Philippe Antoine [Fri, 23 Mar 2018 19:51:38 +0000 (20:51 +0100)]
Adds multiple checks to avoid buffer over reads

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/5675)

6 years agoConfigurations/windows-makefile.tmpl: refine clean targets.
Andy Polyakov [Thu, 22 Mar 2018 21:55:35 +0000 (22:55 +0100)]
Configurations/windows-makefile.tmpl: refine clean targets.

'nmake clean' was leaving some artefacts behind.

Reviewed-by: Richard Levitte <levitte@openssl.org>
6 years agotest/shlibloadtest.c: make some variables block local
Richard Levitte [Fri, 23 Mar 2018 13:18:16 +0000 (14:18 +0100)]
test/shlibloadtest.c: make some variables block local

myDSO_dsobyaddr and myDSO_free are only used in a narrow block of
code, and can therefore be made local to that block.  Otherwise, some
compilers may warn that they are unused.

Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5733)

6 years agotest/shlibloadtest.c: fix various errors
Richard Levitte [Fri, 23 Mar 2018 00:05:41 +0000 (01:05 +0100)]
test/shlibloadtest.c: fix various errors

These errors were hidden because compiling this file didn't get the
macros derived from the dso_scheme attribute, and therefore, some code
never got compiled.

Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5733)

6 years agoInclude "internal/dso_conf.h" where needed and appropriate
Richard Levitte [Fri, 23 Mar 2018 00:05:23 +0000 (01:05 +0100)]
Include "internal/dso_conf.h" where needed and appropriate

Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5733)

6 years agoMove the handling of dso_scheme to dso_conf.h
Richard Levitte [Fri, 23 Mar 2018 00:02:08 +0000 (01:02 +0100)]
Move the handling of dso_scheme to dso_conf.h

The macros resulting from the dso_scheme attribute were defined for
libraries only, but there's a test program that uses the macros as
well.  The easier way is to move the handling of this macro to
crypto/include/internal/dso_conf.h and having the modules that need it
include it.

Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5733)

6 years agoConfigurations/unix-Makefile.tmpl: fix inconsistencies with resource files
Richard Levitte [Thu, 22 Mar 2018 21:15:04 +0000 (22:15 +0100)]
Configurations/unix-Makefile.tmpl: fix inconsistencies with resource files

.res files weren't treated consistently.  They weren't included at all
in the build of a shared library, and were named inconsistently; .res
sometimes, and .res.o otherwise.  Now we standardise it to .res.o,
which is the recommended way with GNU tools.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5730)

6 years agoConfigurations/10-main.conf: correct AIX targets.
Andy Polyakov [Wed, 21 Mar 2018 19:04:49 +0000 (20:04 +0100)]
Configurations/10-main.conf: correct AIX targets.

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

6 years agoHandle partial messages in TLSProxy
Bernd Edlinger [Thu, 22 Mar 2018 16:28:39 +0000 (17:28 +0100)]
Handle partial messages in TLSProxy

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

6 years agoFix resource files
Rich Salz [Thu, 22 Mar 2018 14:21:33 +0000 (10:21 -0400)]
Fix resource files

Add it to apps as well as libraries.
Fix the copyright year generation.
Thanks to user RTT for pointing this out.

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

6 years agoinclude/openssl/rand.h: omit intermediate typedef.
Andy Polyakov [Wed, 21 Mar 2018 12:12:15 +0000 (13:12 +0100)]
include/openssl/rand.h: omit intermediate typedef.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/4159)

6 years agoopenssl/rand.h: fix formatting.
Andy Polyakov [Mon, 14 Aug 2017 19:38:23 +0000 (21:38 +0200)]
openssl/rand.h: fix formatting.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/4159)

6 years agoRemove presumably temporary left-over file.
Andy Polyakov [Wed, 21 Mar 2018 15:34:11 +0000 (16:34 +0100)]
Remove presumably temporary left-over file.

Reviewed-by: Rich Salz <rsalz@openssl.org>
6 years agoman3/OPENSSL_ia32cap.pod: update assembler version requirements.
Andy Polyakov [Wed, 21 Mar 2018 15:20:59 +0000 (16:20 +0100)]
man3/OPENSSL_ia32cap.pod: update assembler version requirements.

Reviewed-by: Rich Salz <rsalz@openssl.org>
6 years agocurve448/field.h: relax alignment, as it doesn't work universally.
Andy Polyakov [Wed, 21 Mar 2018 10:19:58 +0000 (11:19 +0100)]
curve448/field.h: relax alignment, as it doesn't work universally.

Some platforms, cough-DJGPP, fail to compile claiming that requested
alignment is greater than maximum possible. Supposedly original
alignment was result of an attempt to utilize AVX2...

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5708)

6 years agobio/bss_log.c: on DJGPP syslog facility is part of sockets library.
Andy Polyakov [Wed, 21 Mar 2018 10:19:49 +0000 (11:19 +0100)]
bio/bss_log.c: on DJGPP syslog facility is part of sockets library.

In other words no-sock DJGPP build should suppress syslogging.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5708)

6 years agoo_fopen.c: compensate for e_os.h omission.
Andy Polyakov [Wed, 21 Mar 2018 10:16:50 +0000 (11:16 +0100)]
o_fopen.c: compensate for e_os.h omission.

At earlier point e_os.h was omitted from a number of headers (in order
to emphasize OS neutrality), but this affected o_fopen.c, which is not
OS-neutral, and contains some DJGPP-specific code.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5708)

6 years agoDon't call strsignal, just print the signal number.
Pauli [Mon, 19 Mar 2018 21:17:32 +0000 (07:17 +1000)]
Don't call strsignal, just print the signal number.
The strsignal call is not supported by some machines, so avoid its use.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5658)

6 years agoaes ctr_drbg: add cavs tests
Patrick Steuer [Sat, 10 Mar 2018 18:06:43 +0000 (19:06 +0100)]
aes ctr_drbg: add cavs tests

Signed-off-by: Patrick Steuer <patrick.steuer@de.ibm.com>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Rich Salz <rsalz@openssl.org>
GH: #5580

6 years agoDRBG: Use the EVP layer to do AES encryption
Kurt Roeckx [Sat, 10 Mar 2018 11:23:21 +0000 (12:23 +0100)]
DRBG: Use the EVP layer to do AES encryption

Reviewed-by: Rich Salz <rsalz@openssl.org>
GH: #5580

6 years agoUnify s_client/s_server srtp profiles option handling
FdaSilvaYY [Wed, 21 Mar 2018 20:01:24 +0000 (16:01 -0400)]
Unify s_client/s_server srtp profiles option handling

Add missing guards around STRP-related fields
Remove two unneeded global variables: my 2'cents to #4679
Merge definition and instantiation of srpsrvparm global.

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

6 years agoThe default conv_form is uncompressed
Matt Caswell [Wed, 21 Mar 2018 16:27:55 +0000 (16:27 +0000)]
The default conv_form is uncompressed

Fixes #5711

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5712)

6 years agoFixes integer underflow with SSL_trace support
Philippe Antoine [Wed, 21 Mar 2018 07:27:34 +0000 (08:27 +0100)]
Fixes integer underflow with SSL_trace support

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

6 years agoDocument EC_POINT_get_affine_coordinates_*.
David Benjamin [Tue, 6 Mar 2018 19:00:24 +0000 (14:00 -0500)]
Document EC_POINT_get_affine_coordinates_*.

In particular, x and y may be NULL, as used in ecdsa_ossl.c. Make use of
this in ecdh_ossl.c as well, to save an otherwise unnecessary temporary.

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

6 years agoCleanup the s_time command.
Bernd Edlinger [Wed, 21 Mar 2018 15:23:57 +0000 (16:23 +0100)]
Cleanup the s_time command.

Various code-cleanups.
Use SSL_CTX_set_mode(ctx, SSL_MODE_AUTO_RETRY) insead of handling
SSL_ERROR_WANT_READ everywhere.
Turn off the linger option on connected sockets to avoid failure.
Add BIO_set_conn_mode(conn, BIO_SOCK_NODELAY) to improve thruput.

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

6 years agoConvert _meth_get_ functions to const getters
Jack Bates [Thu, 5 Jan 2017 16:58:18 +0000 (09:58 -0700)]
Convert _meth_get_ functions to const getters

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

6 years agoDon't wait for dry at the end of a handshake
Matt Caswell [Tue, 16 Jan 2018 11:26:50 +0000 (11:26 +0000)]
Don't wait for dry at the end of a handshake

For DTLS/SCTP we were waiting for a dry event during the call to
tls_finish_handshake(). This function just tidies up various internal
things, and after it completes the handshake is over. I can find no good
reason for waiting for a dry event here, and nothing in RFC6083 suggests
to me that we should need to. More importantly though it seems to be
wrong. It is perfectly possible for a peer to send app data/alerts/new
handshake while we are still cleaning up our handshake. If this happens
then we will never get the dry event and so we cannot continue.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5084)

6 years agoCheck for alerts while waiting for a dry event
Matt Caswell [Tue, 16 Jan 2018 10:48:01 +0000 (10:48 +0000)]
Check for alerts while waiting for a dry event

At a couple of points in a DTLS/SCTP handshake we need to wait for a dry
event before continuing. However if an alert has been sent by the peer
then we will never receive that dry event and an infinite loop results.

This commit changes things so that we attempt to read a message if we
are waiting for a dry event but haven't got one yet. This should never
succeed, but any alerts will be processed.

Fixes #4763

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5084)

6 years agoFix stack-use-after-scope
Peter Wu [Tue, 20 Mar 2018 22:47:06 +0000 (23:47 +0100)]
Fix stack-use-after-scope

Fixes regression from #5667.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Ben Kaduk <kaduk@mit.edu>
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5701)

6 years agoo_fopen.c,rand/randfile.c: compensate for e_os.h omission.
Andy Polyakov [Mon, 19 Mar 2018 17:12:31 +0000 (18:12 +0100)]
o_fopen.c,rand/randfile.c: compensate for e_os.h omission.

At earlier point e_os.h was omitted from a number of headers (in order
to emphasize OS neutrality), but this affected o_fopen.c and randfile.c
which are not OS-neutral, and contain some Win32-specific code.

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