openssl.git
6 years agoRemove the curve448 specific constant time implementation
Matt Caswell [Thu, 1 Feb 2018 13:53:56 +0000 (13:53 +0000)]
Remove the curve448 specific constant time implementation

Instead we should use the standard OpenSSL constant time routines.

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

6 years agoAdd some new constant time functions needed by curve448
Matt Caswell [Thu, 1 Feb 2018 13:51:53 +0000 (13:51 +0000)]
Add some new constant time functions needed by curve448

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

6 years agoUse the NLIMBS macro rather than try and calculate the number of limbs
Matt Caswell [Wed, 31 Jan 2018 13:53:45 +0000 (13:53 +0000)]
Use the NLIMBS macro rather than try and calculate the number of limbs

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

6 years agoRename a function to avoid a clash
Matt Caswell [Wed, 31 Jan 2018 13:43:15 +0000 (13:43 +0000)]
Rename a function to avoid a clash

We already have a constant_time_select() function so, to avoid
confusion/clashing we shouldn't have a second one.

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

6 years agoRemove curve448 architecture specific files
Matt Caswell [Wed, 31 Jan 2018 13:14:48 +0000 (13:14 +0000)]
Remove curve448 architecture specific files

Remove all architecture specific files except for the reference arch_32
version. These files provide archicture specific performance optimisation.
However they have not been integrated yet. In order to avoid review issues
they are removed for now. They may be reintroduced at a later time.

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

6 years agoFix AppVeyor failure in eddsa.c
Matt Caswell [Fri, 19 Jan 2018 15:37:34 +0000 (15:37 +0000)]
Fix AppVeyor failure in eddsa.c

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

6 years agoFix travis failure in f_impl.c
Matt Caswell [Thu, 18 Jan 2018 14:15:46 +0000 (14:15 +0000)]
Fix travis failure in f_impl.c

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

6 years agoFix a typo in a comment
Matt Caswell [Thu, 18 Jan 2018 13:27:45 +0000 (13:27 +0000)]
Fix a typo in a comment

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

6 years agoUpdate Curve448 copyright for 2018
Matt Caswell [Thu, 18 Jan 2018 13:12:46 +0000 (13:12 +0000)]
Update Curve448 copyright for 2018

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

6 years agoCode tidy up
Matt Caswell [Wed, 13 Dec 2017 09:57:48 +0000 (09:57 +0000)]
Code tidy up

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

6 years agoFixes for compilation using clang
Matt Caswell [Wed, 13 Dec 2017 09:57:12 +0000 (09:57 +0000)]
Fixes for compilation using clang

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

6 years agoUpdate the curve448 internal test to use testutil.h
Matt Caswell [Tue, 12 Dec 2017 20:32:19 +0000 (20:32 +0000)]
Update the curve448 internal test to use testutil.h

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

6 years agoMove curve448_test.c to be a full internal test
Matt Caswell [Tue, 12 Dec 2017 19:55:38 +0000 (19:55 +0000)]
Move curve448_test.c to be a full internal test

This ensures that this test is run as part of the test suite

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

6 years agoFix build errors for Curve448 code on Windows (VC-WIN32 and VC-WIN64A)
Matt Caswell [Tue, 12 Dec 2017 14:17:40 +0000 (14:17 +0000)]
Fix build errors for Curve448 code on Windows (VC-WIN32 and VC-WIN64A)

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

6 years agoRemove some gcc/clang specific attributes we don't support
Matt Caswell [Mon, 11 Dec 2017 17:00:07 +0000 (17:00 +0000)]
Remove some gcc/clang specific attributes we don't support

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

6 years agoRemove duplicated 448 in the names of various things
Matt Caswell [Wed, 6 Dec 2017 13:06:13 +0000 (13:06 +0000)]
Remove duplicated 448 in the names of various things

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

6 years agoMerge f_field.h into field.h
Matt Caswell [Tue, 5 Dec 2017 17:09:39 +0000 (17:09 +0000)]
Merge f_field.h into field.h

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

6 years agoMerge f_arithmetic.c into f_generic.c
Matt Caswell [Tue, 5 Dec 2017 16:59:42 +0000 (16:59 +0000)]
Merge f_arithmetic.c into f_generic.c

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

6 years agoRemove references to libdecaf
Matt Caswell [Tue, 5 Dec 2017 16:37:57 +0000 (16:37 +0000)]
Remove references to libdecaf

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

6 years agoRemove some unneeded code
Matt Caswell [Tue, 5 Dec 2017 16:14:11 +0000 (16:14 +0000)]
Remove some unneeded code

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

6 years agoManual formatting tweaks to Curve448 code
Matt Caswell [Mon, 4 Dec 2017 13:30:53 +0000 (13:30 +0000)]
Manual formatting tweaks to Curve448 code

Following running openssl-format-source there were a lot of manual tweaks
that were requried.

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

6 years agoRun util/openssl-format-source on the Curve448 code
Matt Caswell [Mon, 4 Dec 2017 11:38:58 +0000 (11:38 +0000)]
Run util/openssl-format-source on the Curve448 code

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

6 years agoUpdate the imported curve448 code to use OpenSSL copyright headers
Matt Caswell [Fri, 1 Dec 2017 18:12:25 +0000 (18:12 +0000)]
Update the imported curve448 code to use OpenSSL copyright headers

Some files talk about the MIT license. This code was contributed under
CLA and was relicensed to the OpenSSL licence when imported.

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

6 years agoFix the ED448 key lengths
Matt Caswell [Tue, 28 Nov 2017 18:23:51 +0000 (18:23 +0000)]
Fix the ED448 key lengths

Unlike X448 the key lengths for ED448 are 57 bytes (as opposed to 56)

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

6 years agoIntegrate Curve448 into the build system
Matt Caswell [Tue, 28 Nov 2017 16:19:57 +0000 (16:19 +0000)]
Integrate Curve448 into the build system

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

6 years agoConvert to C90 from C99
Matt Caswell [Thu, 18 Jan 2018 12:55:23 +0000 (12:55 +0000)]
Convert to C90 from C99

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

6 years agoRename the decaf files to curve448 files
Matt Caswell [Tue, 28 Nov 2017 14:56:43 +0000 (14:56 +0000)]
Rename the decaf files to curve448 files

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

6 years agoRemove portable_endian.h
Matt Caswell [Tue, 28 Nov 2017 13:59:43 +0000 (13:59 +0000)]
Remove portable_endian.h

It is no longer used

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

6 years agoRemove the old shake256 implementation
Matt Caswell [Tue, 28 Nov 2017 12:23:33 +0000 (12:23 +0000)]
Remove the old shake256 implementation

We have fully converted curve448 to use the OpenSSL shake256 implementation
so we can now remove the old one.

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

6 years agoConvert Curve448 internals to use OpenSSL shake256
Matt Caswell [Tue, 28 Nov 2017 12:09:23 +0000 (12:09 +0000)]
Convert Curve448 internals to use OpenSSL shake256

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

6 years agoUse OpenSSL shake256
Matt Caswell [Tue, 28 Nov 2017 11:34:54 +0000 (11:34 +0000)]
Use OpenSSL shake256

Convert the curve448 test to use the OpenSSL implementation of shake256.

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

6 years agoAdd tests for Ed448ph
Matt Caswell [Tue, 28 Nov 2017 09:53:58 +0000 (09:53 +0000)]
Add tests for Ed448ph

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

6 years agoAdd Ed448 tests
Matt Caswell [Mon, 27 Nov 2017 11:32:03 +0000 (11:32 +0000)]
Add Ed448 tests

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

6 years agoRemove inclusion of header files that we can't rely on due to portability
Matt Caswell [Thu, 23 Nov 2017 16:50:42 +0000 (16:50 +0000)]
Remove inclusion of header files that we can't rely on due to portability

Some non-portable includes are left because they are already suitably
guarded.

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

6 years agoRemove DECAF_NOINLINE
Matt Caswell [Thu, 16 Nov 2017 17:35:10 +0000 (17:35 +0000)]
Remove DECAF_NOINLINE

OpenSSL does not have this concept

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

6 years agoRemove DECAF_NONNULL
Matt Caswell [Thu, 16 Nov 2017 17:27:05 +0000 (17:27 +0000)]
Remove DECAF_NONNULL

OpenSSL does not currently have this concept. It only provides compiler
warnings so just remove it.

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

6 years agoRemove all instances of DECAF_API_VIS
Matt Caswell [Thu, 16 Nov 2017 17:18:57 +0000 (17:18 +0000)]
Remove all instances of DECAF_API_VIS

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

6 years agoReplace DECAF_WARN_UNUSED with __owur
Matt Caswell [Thu, 16 Nov 2017 17:13:18 +0000 (17:13 +0000)]
Replace DECAF_WARN_UNUSED with __owur

Most of these were in point_448.h. While I was at it I spotted some unused
declarations, so I deleted those too.

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

6 years agoReplace DECAF_INLINE with ossl_inline
Matt Caswell [Thu, 16 Nov 2017 17:07:21 +0000 (17:07 +0000)]
Replace DECAF_INLINE with ossl_inline

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

6 years agoRemove some vestiges of the old decaf template approach
Matt Caswell [Thu, 16 Nov 2017 16:58:20 +0000 (16:58 +0000)]
Remove some vestiges of the old decaf template approach

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

6 years agoRename decaf_448_* to curve448_*
Matt Caswell [Thu, 16 Nov 2017 16:27:48 +0000 (16:27 +0000)]
Rename decaf_448_* to curve448_*

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

6 years agoRemove some more unneeded code
Matt Caswell [Thu, 16 Nov 2017 16:20:34 +0000 (16:20 +0000)]
Remove some more unneeded code

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

6 years agoRemove some uneeded macros and conditionally compiled code
Matt Caswell [Thu, 16 Nov 2017 16:22:00 +0000 (16:22 +0000)]
Remove some uneeded macros and conditionally compiled code

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

6 years agoRemove some unneeded stuff
Matt Caswell [Thu, 16 Nov 2017 14:08:23 +0000 (14:08 +0000)]
Remove some unneeded stuff

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

6 years agoAdd a local test
Matt Caswell [Thu, 16 Nov 2017 11:52:06 +0000 (11:52 +0000)]
Add a local test

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

6 years agoAdd the X448() and X448_public_from_private() functions
Matt Caswell [Thu, 16 Nov 2017 11:13:53 +0000 (11:13 +0000)]
Add the X448() and X448_public_from_private() functions

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

6 years agoRemove the decaf_bzero function and replace with OPENSSL_cleanse()
Matt Caswell [Wed, 15 Nov 2017 16:39:33 +0000 (16:39 +0000)]
Remove the decaf_bzero function and replace with OPENSSL_cleanse()

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

6 years agoRemove the curve448/decaf sub-directory
Matt Caswell [Wed, 15 Nov 2017 16:24:32 +0000 (16:24 +0000)]
Remove the curve448/decaf sub-directory

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

6 years agoRemove some unneeded code
Matt Caswell [Wed, 15 Nov 2017 16:21:42 +0000 (16:21 +0000)]
Remove some unneeded code

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

6 years agoRemove some deprecated curve 448 code and remove some unneeded defines
Matt Caswell [Wed, 15 Nov 2017 16:19:15 +0000 (16:19 +0000)]
Remove some deprecated curve 448 code and remove some unneeded defines

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

6 years agoRemove some unneeded files and further flatten the curve 448 structure
Matt Caswell [Wed, 15 Nov 2017 16:15:18 +0000 (16:15 +0000)]
Remove some unneeded files and further flatten the curve 448 structure

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

6 years agoFlatten the Curve 448 source structure
Matt Caswell [Wed, 15 Nov 2017 15:59:27 +0000 (15:59 +0000)]
Flatten the Curve 448 source structure

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

6 years agoImport Curve 448 support
Matt Caswell [Wed, 15 Nov 2017 15:27:21 +0000 (15:27 +0000)]
Import Curve 448 support

This imports selected files from the src directory of this repository:

https://sourceforge.net/p/ed448goldilocks/code/ci/v0.9.4/tree/

This is from the version tagged as "v0.9.4" with commit id 7527e9.

This code was originally writting by Mike Hamburg and the import is done by
kind permission of Rambus and Mike Hamburg under CLA. As this is under CLA
the files are being relicensed under the OpenSSL licence. Subsequent
commits will correct any licence notices in the individual files.

These files should provide complete self-contained support for X448 and
Ed448. They are imported "as is" from the source repository and this
commit does not attempt to integrate them into the OpenSSL build system,
or modify them in any way to fit OpenSSL style guidelines. That will be
done by subsequent commits.

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

6 years agoAdd BIO_bind function to bind local address for a socket.
John Hughes [Thu, 8 Feb 2018 09:49:02 +0000 (10:49 +0100)]
Add BIO_bind function to bind local address for a socket.

Add -bind option to s_client application to allow specification of
local address for connection.

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

6 years ago Add X509_get0_authority_key_id() function
Massimiliano Pala [Mon, 19 Feb 2018 20:47:02 +0000 (15:47 -0500)]
  Add X509_get0_authority_key_id() function

  This function makes it easier to retrieve a reference to the
  authority key identifier (akid->keyid) inside a certificate.

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

6 years agoThe record version for ClientHello2 should be TLS1.2
Matt Caswell [Thu, 15 Feb 2018 14:29:45 +0000 (14:29 +0000)]
The record version for ClientHello2 should be TLS1.2

According to TLSv1.3 draft-24 the record version for ClientHello2 should
be TLS1.2, and not TLS1.0 as it is now.

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

6 years agosha/asm/keccak1600-armv8.pl: add hardware-assisted ARMv8.2 subroutines.
Andy Polyakov [Tue, 13 Feb 2018 20:59:15 +0000 (21:59 +0100)]
sha/asm/keccak1600-armv8.pl: add hardware-assisted ARMv8.2 subroutines.

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

6 years agotest_ssl_old: avoid empty strings for flags
Richard Levitte [Fri, 16 Feb 2018 22:34:32 +0000 (23:34 +0100)]
test_ssl_old: avoid empty strings for flags

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

6 years agoOpenSSL::Test::quotify: put quotes around empty arguments
Richard Levitte [Fri, 16 Feb 2018 22:28:31 +0000 (23:28 +0100)]
OpenSSL::Test::quotify: put quotes around empty arguments

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

6 years agoAvoid mentioning uninitialised contexts.
Pauli [Fri, 16 Feb 2018 01:24:51 +0000 (11:24 +1000)]
Avoid mentioning uninitialised contexts.

All contexts must be initialised because they can only be created using the _new() calls.
Remove the outdated mentions of uninitialised and initialised contexts.

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

6 years agoConfigure: avoid uninit data in configdata.pm
Richard Levitte [Sat, 17 Feb 2018 06:33:17 +0000 (07:33 +0100)]
Configure: avoid uninit data in configdata.pm

Fixes #5394

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

6 years agopkeyparam.pod: correct the command description
Dr. Matthias St. Pierre [Fri, 16 Feb 2018 09:26:55 +0000 (10:26 +0100)]
pkeyparam.pod: correct the command description

The description was probably copy&pasted from pkey.pod and forgotten.

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

6 years agoConfigure: move down the treatment of seed sources
Richard Levitte [Thu, 15 Feb 2018 17:08:54 +0000 (18:08 +0100)]
Configure: move down the treatment of seed sources

Most of all, this is so it doesn't output mysterious text when we're
treating the phony config targets LISH, HASH and TABLE

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

6 years agoAIX: make sure that the arflags value includes the command letter (r)
Richard Levitte [Thu, 15 Feb 2018 21:38:24 +0000 (22:38 +0100)]
AIX: make sure that the arflags value includes the command letter (r)

In previous OpenSSL versions, this letter was part of the make
variable AR.  However, following the usual convention (read: GNU),
this letter is supposed to be part of ARFLAGS.

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

6 years agoCheck the return code from ASN1_TIME_diff()
Matt Caswell [Mon, 12 Feb 2018 17:47:50 +0000 (17:47 +0000)]
Check the return code from ASN1_TIME_diff()

The function can fail so we should check the return code.

Found by Coverity

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

6 years agoThe function X509_gmtime_adj() can fail
Matt Caswell [Mon, 12 Feb 2018 17:43:38 +0000 (17:43 +0000)]
The function X509_gmtime_adj() can fail

Check for a failure and free a_tm as appropriate.

Found by Coverity

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

6 years agoIf s->ctx is NULL then this is an internal error
Matt Caswell [Mon, 12 Feb 2018 16:24:59 +0000 (16:24 +0000)]
If s->ctx is NULL then this is an internal error

Coverity was complaining because we checked if s->ctx is NULL and then
later on in the function deref s->ctx anyway. In reality if s->ctx is
NULL then this is an internal error.

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

6 years agoDRBG: make locking api truly private
Dr. Matthias St. Pierre [Thu, 15 Feb 2018 09:29:56 +0000 (10:29 +0100)]
DRBG: make locking api truly private

In PR #5295 it was decided that the locking api should remain private
and used only inside libcrypto. However, the locking functions were added
back to `libcrypto.num` by `mkdef.pl`, because the function prototypes
were still listed in `internal/rand.h`. (This header contains functions
which are internal, but shared between libcrypto and libssl.)

This commit moves the prototypes to `rand_lcl.h` and changes the names
to lowercase, following the convention therein. It also corrects an
outdated documenting comment.

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

6 years agoFix a gcc warning about possible fall through
Bernd Edlinger [Wed, 14 Feb 2018 20:30:32 +0000 (21:30 +0100)]
Fix a gcc warning about possible fall through

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
(Merged from https://github.com/openssl/openssl/pull/5373)

6 years agoNOTES.UNIX: add additional note about --enable-new-dtags
Richard Levitte [Thu, 15 Feb 2018 09:06:15 +0000 (10:06 +0100)]
NOTES.UNIX: add additional note about --enable-new-dtags

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

6 years agoAuto-size more of configdata.pm "disabled features"
Benjamin Kaduk [Wed, 14 Feb 2018 18:04:16 +0000 (12:04 -0600)]
Auto-size more of configdata.pm "disabled features"

configdata.pm -d prints out a lot of information, including a table
of what features are disabled, why, and the effect of that disablement
(in terms of preprocessor symbols defined and directories skipped).
The first column is already auto-sized, to easily accomodate future
disableable features with long names.  Also auto-size the second column,
to accomodate future reasons for disablement with long names as well.

Failing to take such precautions results in stderr spew from
configdata.pm -d when such long reasons are in use:

   Negative repeat count does nothing at ./configdata.pm line 14504.

Such output is pretty distracting from the actual desired output,
so try to avoid it if possible.

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

6 years agoOSSL_STORE: Add OSSL_STORE_vctrl()
Richard Levitte [Wed, 14 Feb 2018 09:28:08 +0000 (10:28 +0100)]
OSSL_STORE: Add OSSL_STORE_vctrl()

It's a convenient complement to OSSL_STORE_ctrl()

Suggested by Norm Green

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

6 years agoPEM_read_bio_PrivateKey.pod: replace geek speek by something more serious
Dr. Matthias St. Pierre [Wed, 14 Feb 2018 15:56:09 +0000 (16:56 +0100)]
PEM_read_bio_PrivateKey.pod: replace geek speek by something more serious

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

6 years agoVMS: build ia64 assembler files if 'ias' is available
Richard Levitte [Tue, 13 Feb 2018 19:51:07 +0000 (20:51 +0100)]
VMS: build ia64 assembler files if 'ias' is available

Avoid using crypto/modes/ghash-ia64.s, as it uses features that are
explicitely prohibited on VMS.

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

6 years agoVMS: modify crypto/bn/asm/ia64.S to build properly
Richard Levitte [Tue, 13 Feb 2018 19:48:48 +0000 (20:48 +0100)]
VMS: modify crypto/bn/asm/ia64.S to build properly

On VMS, 'abort' is really 'decc$abort'

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

6 years agoVMS: add the possibility to use Itanium assembler with 'ias'
Richard Levitte [Tue, 13 Feb 2018 19:47:34 +0000 (20:47 +0100)]
VMS: add the possibility to use Itanium assembler with 'ias'

This does require the use of a port of 'ias' for VMS.

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

6 years agoHarmonize the make variables across all known platforms families
Richard Levitte [Tue, 13 Feb 2018 19:32:42 +0000 (20:32 +0100)]
Harmonize the make variables across all known platforms families

The make variables LIB_CFLAGS, DSO_CFLAGS and so on were used in
addition to CFLAGS and so on.  This works without problem on Unix and
Windows, where options with different purposes (such as -D and -I) can
appear anywhere on the command line and get accumulated as they come.
This is not necessarely so on VMS.  For example, macros must all be
collected and given through one /DEFINE, and the same goes for
inclusion directories (/INCLUDE).

So, to harmonize all platforms, we repurpose make variables starting
with LIB_, DSO_ and BIN_ to be all encompassing variables that
collects the corresponding values from CFLAGS, CPPFLAGS, DEFINES,
INCLUDES and so on together with possible config target values
specific for libraries DSOs and programs, and use them instead of the
general ones everywhere.

This will, for example, allow VMS to use the exact same generators for
generated files that go through cpp as all other platforms, something
that has been impossible to do safely before now.

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

6 years agod2i_X509.pod: clarify usage of the 'pp' function parameter
Dr. Matthias St. Pierre [Wed, 14 Feb 2018 11:21:26 +0000 (12:21 +0100)]
d2i_X509.pod: clarify usage of the 'pp' function parameter

The 'pp' function parameters of d2i_TYPE() and i2d_TYPE() are referenced
in the DESCRIPTION section as 'in' resp. 'out'. This commit renames the
references to 'ppin' resp. 'ppout' and adds an explaining sentence.

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

6 years agoIgnore an s_client psk in TLSv1.3 if not TLSv1.3 suitable
Matt Caswell [Tue, 30 Jan 2018 15:41:56 +0000 (15:41 +0000)]
Ignore an s_client psk in TLSv1.3 if not TLSv1.3 suitable

The s_client psk_use_session_cb callback has a comment stating that we
should ignore a key that isn't suitable for TLSv1.3. However we were
actually causing the connection to fail. Changing the return value fixes
the issue.

Also related to this is that the early_data extension was not marked as
TLSv1.3 only which it should be.

Fixes #5202

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

6 years agoMake sure we check the return value of extract_min_max()
Matt Caswell [Mon, 12 Feb 2018 17:22:17 +0000 (17:22 +0000)]
Make sure we check the return value of extract_min_max()

Commit 42d7d7dd6 turned this function from returning void to
returning an int error code. This instance of calling it was
missed.

Found by Coverity.

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

6 years agoFix a memory leak in an error path
Matt Caswell [Mon, 12 Feb 2018 16:58:33 +0000 (16:58 +0000)]
Fix a memory leak in an error path

Found by Coverity.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/5336)

6 years agoBuild files: parametrize cpp
Richard Levitte [Tue, 13 Feb 2018 19:04:35 +0000 (20:04 +0100)]
Build files: parametrize cpp

Instead of having the knowledge of the exact flags to run the C
preprocessor only and have it output on standard output in the deeper
recesses of the build file template, make it a config parameter, or
rely on build CPP in value ('$(CC) -E' on Unix).

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

6 years agoVMS: simplify config targets
Richard Levitte [Wed, 14 Feb 2018 09:34:12 +0000 (10:34 +0100)]
VMS: simplify config targets

All VMS config targets were literally copies of each other, only
differing in what argument the parameter seeking function vms_info()
received (the pointer size).

This could be hugely simplified by letting vms_info() detect what
pointer size was desired from the desired config target name instead.

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

6 years agoAvoid fragile aliasing of SHA224/384 update/final
Viktor Dukhovni [Wed, 14 Feb 2018 03:43:15 +0000 (22:43 -0500)]
Avoid fragile aliasing of SHA224/384 update/final

This is purported to save a few cycles, but makes the code less
obvious and more brittle, and in fact breaks on platforms where for
ABI continuity reasons there is a SHA2 implementation in libc, and
so EVP needs to call those to avoid conflicts.

A sufficiently good optimizer could simply generate the same entry
points for:

        foo(...) { ... }
    and
        bar(...) { return foo(...); }

but, even without that, the different is negligible, with the
"winner" varying from run to run (openssl speed -evp sha384):

    Old:
    type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes 16384 bytes
    sha384           28864.28k   117362.62k   266469.21k   483258.03k   635144.87k 649123.16k

    New:
    type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes 16384 bytes
    sha384           30055.18k   120725.98k   272057.26k   482847.40k   634585.09k 650308.27k

Reviewed-by: Rich Salz <rsalz@openssl.org>
6 years agoUse both getrandom() and /dev/urandom by default on Linux.
Kurt Roeckx [Fri, 9 Feb 2018 23:30:29 +0000 (00:30 +0100)]
Use both getrandom() and /dev/urandom by default on Linux.

getrandom() is now used on Linux by default when using Linux >= 3.17
and glibc >= 2.25

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

6 years agoVMS: for testutil, make sure to use BIO_f_linebuffer
Richard Levitte [Tue, 13 Feb 2018 18:10:22 +0000 (19:10 +0100)]
VMS: for testutil, make sure to use BIO_f_linebuffer

Without that, output comes one character per line.  It's the same
issue as has been observed before, this happens when using write()
on a record oriented stream (possibly unbuffered too).

This also uncovered a bug in BIO_f_linebuffer, where this would cause
an error:

    BIO_write(bio, "1\n", 1);

I.e. there's a \n just after the part of the string that we currently
ask to get written.

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

6 years agoConfigure: if a file is generated, never assume it's in the source dir
Richard Levitte [Tue, 13 Feb 2018 18:46:10 +0000 (19:46 +0100)]
Configure: if a file is generated, never assume it's in the source dir

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

6 years agos390x assembly pack: implement OPENSSL_rdtsc as STCKF
Patrick Steuer [Wed, 7 Feb 2018 17:49:29 +0000 (18:49 +0100)]
s390x assembly pack: implement OPENSSL_rdtsc as STCKF

.. if avalable. STCK has an artificial delay to ensure uniqueness
which can result in a performance penalty if used heavily
concurrently.

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

6 years agoGenerate copyright year properly
Rich Salz [Tue, 13 Feb 2018 18:09:02 +0000 (13:09 -0500)]
Generate copyright year properly

Output copyright year depends on any input file(s) and the script.
This is not perfect, but better than what we had.
Also run 'make update'

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

6 years agoOPENSSL_cleanup: cleanup secure memory
Dr. Matthias St. Pierre [Mon, 12 Feb 2018 01:37:27 +0000 (02:37 +0100)]
OPENSSL_cleanup: cleanup secure memory

If the global DRBGs are allocated on the secure heap, then calling
CRYPTO_secure_malloc_done() inside main() will have no effect, unless
OPENSSL_cleanup() has been called explicitely before that, because
otherwise the DRBGs will still be allocated. So it is better to cleanup
the secure heap automatically at the end of OPENSSL_cleanup().

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

6 years agoDRBG: make the derivation function the default for ctr_drbg
Dr. Matthias St. Pierre [Thu, 8 Feb 2018 22:04:16 +0000 (23:04 +0100)]
DRBG: make the derivation function the default for ctr_drbg

The NIST standard presents two alternative ways for seeding the
CTR DRBG, depending on whether a derivation function is used or not.
In Section 10.2.1 of NIST SP800-90Ar1 the following is assessed:

  The use of the derivation function is optional if either an
  approved RBG or an entropy source provides full entropy output
  when entropy input is requested by the DRBG mechanism.
  Otherwise, the derivation function shall be used.

Since the OpenSSL DRBG supports being reseeded from low entropy random
sources (using RAND_POOL), the use of a derivation function is mandatory.
For that reason we change the default and replace the opt-in flag
RAND_DRBG_FLAG_CTR_USE_DF with an opt-out flag RAND_DRBG_FLAG_CTR_NO_DF.
This change simplifies the RAND_DRBG_new() calls.

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

6 years agoDRBG: unify initialization and cleanup code
Dr. Matthias St. Pierre [Thu, 8 Feb 2018 21:46:23 +0000 (22:46 +0100)]
DRBG: unify initialization and cleanup code

The functions drbg_setup() and drbg_cleanup() used to duplicate a lot of
code from RAND_DRBG_new() and RAND_DRBG_free(). This duplication has been
removed, which simplifies drbg_setup() and makes drbg_cleanup() obsolete.

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

6 years agoDRBG: add locking api
Dr. Matthias St. Pierre [Thu, 8 Feb 2018 15:40:32 +0000 (16:40 +0100)]
DRBG: add locking api

This commit adds three new accessors to the internal DRBG lock

   int RAND_DRBG_lock(RAND_DRBG *drbg)
   int RAND_DRBG_unlock(RAND_DRBG *drbg)
   int RAND_DRBG_enable_locking(RAND_DRBG *drbg)

The three shared DRBGs are intended to be used concurrently, so they
have locking enabled by default. It is the callers responsibility to
guard access to the shared DRBGs by calls to RAND_DRBG_lock() and
RAND_DRBG_unlock().

All other DRBG instances don't have locking enabled by default, because
they are intendended to be used by a single thread. If it is desired,
locking can be enabled by using RAND_DRBG_enable_locking().

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

6 years agoPrepare for 1.1.1-pre2-dev
Matt Caswell [Tue, 13 Feb 2018 13:49:49 +0000 (13:49 +0000)]
Prepare for 1.1.1-pre2-dev

Reviewed-by: Richard Levitte <levitte@openssl.org>
6 years agoPrepare for 1.1.1-pre1 release OpenSSL_1_1_1-pre1
Matt Caswell [Tue, 13 Feb 2018 13:48:07 +0000 (13:48 +0000)]
Prepare for 1.1.1-pre1 release

Reviewed-by: Richard Levitte <levitte@openssl.org>
6 years agoUpdate copyright year
Matt Caswell [Tue, 13 Feb 2018 12:51:29 +0000 (12:51 +0000)]
Update copyright year

Reviewed-by: Richard Levitte <levitte@openssl.org>
6 years agoOpenSSL 1.1.1 is now in pre release
Matt Caswell [Tue, 13 Feb 2018 10:17:18 +0000 (10:17 +0000)]
OpenSSL 1.1.1 is now in pre release

Reviewed-by: Richard Levitte <levitte@openssl.org>
6 years agoUpdate last release letter for CHANGES and NEWS
Matt Caswell [Tue, 13 Feb 2018 10:09:34 +0000 (10:09 +0000)]
Update last release letter for CHANGES and NEWS

Reviewed-by: Richard Levitte <levitte@openssl.org>
6 years agoFix whitespace issues in CHANGES and NEWS
Dr. Matthias St. Pierre [Tue, 13 Feb 2018 01:04:50 +0000 (02:04 +0100)]
Fix whitespace issues in CHANGES and NEWS

Removed mixed tabs (converted tabs to eight spaces)

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

6 years agoDocument new random generator in NEWS and CHANGES
Dr. Matthias St. Pierre [Tue, 13 Feb 2018 01:02:22 +0000 (02:02 +0100)]
Document new random generator in NEWS and CHANGES

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