openssl.git
21 months agoPrepare for 1.1.1-pre3-dev
Matt Caswell [Tue, 27 Feb 2018 13:41:51 +0000 (13:41 +0000)]
Prepare for 1.1.1-pre3-dev

Reviewed-by: Richard Levitte <levitte@openssl.org>
21 months agoPrepare for 1.1.1-pre2 release OpenSSL_1_1_1-pre2
Matt Caswell [Tue, 27 Feb 2018 13:40:37 +0000 (13:40 +0000)]
Prepare for 1.1.1-pre2 release

Reviewed-by: Richard Levitte <levitte@openssl.org>
21 months agoUpdate copyright year
Matt Caswell [Tue, 27 Feb 2018 13:37:28 +0000 (13:37 +0000)]
Update copyright year

Reviewed-by: Richard Levitte <levitte@openssl.org>
21 months agoClear some sslapitest global variables after use
Matt Caswell [Mon, 26 Feb 2018 19:34:42 +0000 (19:34 +0000)]
Clear some sslapitest global variables after use

Otherwise we get a use after free if the test order is randomised.

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

21 months agomem_sec.c: relax POSIX requirement.
Andy Polyakov [Sun, 25 Feb 2018 15:56:26 +0000 (16:56 +0100)]
mem_sec.c: relax POSIX requirement.

Even though mlock(2) was standardized in POSIX.1-2001, vendors did
implement it prior that point.

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

21 months agotest/ct_test.c: remove dependency on -lm.
Andy Polyakov [Sun, 25 Feb 2018 15:24:34 +0000 (16:24 +0100)]
test/ct_test.c: remove dependency on -lm.

fabs(3m) is customarily inlined, but it's not, one has to link with -lm.
Since fabs(3m) is the only reference, it makes more sense to avoid it.

Reviewed-by: Rich Salz <rsalz@openssl.org>
21 months agoExport keying material using early exporter master secret
Tatsuhiro Tsujikawa [Sun, 4 Feb 2018 03:20:37 +0000 (12:20 +0900)]
Export keying material using early exporter master secret

This commit adds SSL_export_keying_material_early() which exports
keying material using early exporter master secret.

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

21 months agoMake it possible to give --libdir an absolute path
Richard Levitte [Fri, 23 Feb 2018 11:10:42 +0000 (12:10 +0100)]
Make it possible to give --libdir an absolute path

With this, we introduce the make variable 'libdir', which differs from
'LIBDIR' not only in casing, but also by being the absolute path to
the library installation directory.  This variable is intentionally
compatible with the GNU coding standards.

When --libdir is given an absolute path, it is considered as a value
according to GNU coding standards, and the variables LIBDIR and libdir
will be this:

    LIBDIR=
    libdir=/absolute/path

When --libdir is given a relative path (just the name of the desired
library directory), or not given at all, it is considered as a
"traditional" OpenSSL value, and the variables LIBDIR and libdir will
be this:

    LIBDIR=relativepath
    libdir=$(INSTALLTOP)/$(LIBDIR)

Fixes #5398

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

21 months agoappveyor.yml: omit makedepend step.
Andy Polyakov [Fri, 23 Feb 2018 16:24:41 +0000 (17:24 +0100)]
appveyor.yml: omit makedepend step.

makedepend makes lesser sense in a throw-away build like CI, but
it spares some computational time, because with MSVC it takes
separate per-file compiler invocation.

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

21 months agoec/ecp_nistp{224,256,521}.c: harmonize usage of __uint128_t.
Andy Polyakov [Fri, 23 Feb 2018 12:55:37 +0000 (13:55 +0100)]
ec/ecp_nistp{224,256,521}.c: harmonize usage of __uint128_t.

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

21 months ago{ec/curve25519,poly1305/poly1305}.c: relax pedantic constraint.
Andy Polyakov [Fri, 23 Feb 2018 12:37:06 +0000 (13:37 +0100)]
{ec/curve25519,poly1305/poly1305}.c: relax pedantic constraint.

As it turns out gcc -pedantic doesn't seem to consider __uint128_t
as non-standard, unlike __int128 that is.

Fix even MSVC warnings in curve25519.c.

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

21 months agoec/curve448: portability fixups.
Andy Polyakov [Fri, 23 Feb 2018 12:20:33 +0000 (13:20 +0100)]
ec/curve448: portability fixups.

SPARC condition in __SIZEOF_INT128__==16 is rather performance thing
than portability. Even though compiler advertises int128 capability,
corresponding operations are inefficient, because they are not
directly backed by instruction set.

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

21 months agoec/asm/x25519-x86_64.pl: fix up ADCX/ADOX fallback.
Andy Polyakov [Fri, 23 Feb 2018 10:51:41 +0000 (11:51 +0100)]
ec/asm/x25519-x86_64.pl: fix up ADCX/ADOX fallback.

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

21 months agoRemove OSSLzu, and fix the one place that used it.
Rich Salz [Fri, 23 Feb 2018 21:49:59 +0000 (16:49 -0500)]
Remove OSSLzu, and fix the one place that used it.

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

21 months agoFix some bugs with the cfb1 bitsize handling
Bernd Edlinger [Wed, 21 Feb 2018 14:48:02 +0000 (15:48 +0100)]
Fix some bugs with the cfb1 bitsize handling

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

21 months agoRemove executable bit from test/recipes/03-test_internal_sm4.t
Bernd Edlinger [Thu, 22 Feb 2018 07:30:41 +0000 (08:30 +0100)]
Remove executable bit from test/recipes/03-test_internal_sm4.t

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

21 months agoAdd a note in CHANGES
Richard Levitte [Thu, 22 Feb 2018 04:45:18 +0000 (05:45 +0100)]
Add a note in CHANGES

[extended tests]

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

21 months agoTest the storeutl searching options
Richard Levitte [Mon, 20 Feb 2017 01:49:13 +0000 (02:49 +0100)]
Test the storeutl searching options

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

21 months agoSTORE: Add documentation on search criteria
Richard Levitte [Wed, 5 Jul 2017 17:17:40 +0000 (19:17 +0200)]
STORE: Add documentation on search criteria

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

21 months agoAdapt storeutl to allow search for specific objects
Richard Levitte [Mon, 20 Feb 2017 01:47:56 +0000 (02:47 +0100)]
Adapt storeutl to allow search for specific objects

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

21 months agoSTORE 'file' scheme loader: Add search capibility
Richard Levitte [Mon, 20 Feb 2017 01:39:52 +0000 (02:39 +0100)]
STORE 'file' scheme loader: Add search capibility

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

21 months agoSTORE: Add the possibility to search for specific information
Richard Levitte [Sun, 19 Feb 2017 11:24:19 +0000 (12:24 +0100)]
STORE: Add the possibility to search for specific information

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

21 months agoTest the storeutl expectation options
Richard Levitte [Sat, 11 Feb 2017 03:02:32 +0000 (04:02 +0100)]
Test the storeutl expectation options

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

21 months agoSTORE: Add documentation on expecting specific infos
Richard Levitte [Wed, 5 Jul 2017 14:15:48 +0000 (16:15 +0200)]
STORE: Add documentation on expecting specific infos

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

21 months agoAdapt storeutl to allow looking for a specific info type
Richard Levitte [Sat, 11 Feb 2017 02:20:45 +0000 (03:20 +0100)]
Adapt storeutl to allow looking for a specific info type

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

21 months agoSTORE 'file' scheme loader: Add info type expectation
Richard Levitte [Sat, 11 Feb 2017 01:27:31 +0000 (02:27 +0100)]
STORE 'file' scheme loader: Add info type expectation

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

21 months agoSTORE: Add the possibility to specify an expected info type
Richard Levitte [Sat, 11 Feb 2017 01:33:18 +0000 (02:33 +0100)]
STORE: Add the possibility to specify an expected info type

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

21 months agoSTORE: In preparation for coming work, mark when loading is started
Richard Levitte [Sat, 11 Feb 2017 01:50:50 +0000 (02:50 +0100)]
STORE: In preparation for coming work, mark when loading is started

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

21 months agoRemove unreachable statement.
Pauli [Fri, 23 Feb 2018 00:55:50 +0000 (10:55 +1000)]
Remove unreachable statement.

The return at the end isn't reachable.

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

21 months agoBuild files: when using $(CPP), use the C flags alongside the CPP flags
Richard Levitte [Thu, 22 Feb 2018 15:33:58 +0000 (16:33 +0100)]
Build files: when using $(CPP), use the C flags alongside the CPP flags

The reason for this is that some of the C flags affect built in macros
that we may depend on.

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

21 months agoRemove unused num.pl,segregnam scripts
Rich Salz [Thu, 22 Feb 2018 20:36:27 +0000 (15:36 -0500)]
Remove unused num.pl,segregnam scripts

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

21 months agoinitialise dc variable to satisfy old compilers.
Steve Linsell [Thu, 22 Feb 2018 18:24:13 +0000 (13:24 -0500)]
initialise dc variable to satisfy old compilers.

When compiling with -Wall on a machine with an old compiler it gives a false
positive that the dc variable which is a structure of type DISPLAY_COLUMNS
could be used uninitialised. In fact the dc variable's members will always get
set in the case it is used, otherwise it is left uninitialised.
This fix just causes the dc variable's members to always get initialised to 0
at declaration, so the false positive will not get flagged.

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

21 months agoUpdate EC_POINT_new.pod
Per Sandström [Wed, 14 Feb 2018 13:08:33 +0000 (14:08 +0100)]
Update EC_POINT_new.pod

CLA: trivial
fix typo:
EC_point2buf => EC_POINT_point2buf

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

21 months agoBuild file templates: be less verbose when reconfiguring
Richard Levitte [Fri, 2 Feb 2018 19:33:13 +0000 (20:33 +0100)]
Build file templates: be less verbose when reconfiguring

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

21 months agoReplace the message about configdata.pm as a script
Richard Levitte [Fri, 2 Feb 2018 11:30:50 +0000 (12:30 +0100)]
Replace the message about configdata.pm as a script

The new message is geared toward issue reports

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

21 months agoAdd a comment in configdata.pm regarding script-only variables
Richard Levitte [Fri, 2 Feb 2018 11:30:14 +0000 (12:30 +0100)]
Add a comment in configdata.pm regarding script-only variables

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

21 months agoMake CROSS_COMPILE another supported "make variable" in Configure
Richard Levitte [Fri, 2 Feb 2018 11:27:29 +0000 (12:27 +0100)]
Make CROSS_COMPILE another supported "make variable" in Configure

No more special casing for that one, and this means it gets displayed
by 'perl configdata.pm --make-variables' among all the others.

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

21 months agoUnix Makefile: Rework the assignment of CXX and AS
Richard Levitte [Fri, 2 Feb 2018 11:25:26 +0000 (12:25 +0100)]
Unix Makefile: Rework the assignment of CXX and AS

If the configured value is the empty string, give them a sane default.
Otherwise, give them the configured value prefix with $(CROSS_COMPILE)

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

21 months agoRefactor the ranlib attribute
Richard Levitte [Fri, 2 Feb 2018 11:23:09 +0000 (12:23 +0100)]
Refactor the ranlib attribute

It was inconsistent to see this specific command have
'$(CROSS_COMPILE)' in its value when no other command did.

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

21 months agoHave configdata.pm display information on perl
Richard Levitte [Fri, 2 Feb 2018 11:21:27 +0000 (12:21 +0100)]
Have configdata.pm display information on perl

Specifically, the specific perl that was used to run Configure

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

21 months agoCheck return value of time() when getting additional data for the DRBG
Kurt Roeckx [Sun, 18 Feb 2018 17:39:19 +0000 (18:39 +0100)]
Check return value of time() when getting additional data for the DRBG

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Dr. Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
GH: #5400

21 months agoSwitch the DRBGs from AES-128-CTR to AES-256-CTR
Kurt Roeckx [Sun, 18 Feb 2018 18:16:13 +0000 (19:16 +0100)]
Switch the DRBGs from AES-128-CTR to AES-256-CTR

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

21 months agoUse malloc to avoid alignment problems.
Viktor Dukhovni [Wed, 21 Feb 2018 13:25:49 +0000 (08:25 -0500)]
Use malloc to avoid alignment problems.

Thanks to Norm Green for reporting this issue.

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

21 months agoAdd support for PBKDF2 for enc command
EasySec [Wed, 14 Dec 2016 15:29:06 +0000 (16:29 +0100)]
Add support for PBKDF2 for enc command

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

21 months agodo_body: fix heap-use-after-free.
Pavel Kopyl [Fri, 3 Nov 2017 19:18:35 +0000 (22:18 +0300)]
do_body: fix heap-use-after-free.

The memory pointed to by the 'push' is freed by the
X509_NAME_ENTRY_free() in do_body(). The second time
it is referenced to (indirectly) in certify_cert:X509_REQ_free().

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

21 months agoX509V3_EXT_add_nconf_sk, X509v3_add_ext: fix errors handling
Pavel Kopyl [Tue, 7 Nov 2017 12:28:18 +0000 (15:28 +0300)]
X509V3_EXT_add_nconf_sk, X509v3_add_ext: fix errors handling

X509v3_add_ext: free 'sk' if the memory pointed to by it
was malloc-ed inside this function.
X509V3_EXT_add_nconf_sk: return an error if X509v3_add_ext() fails.
This prevents use of a freed memory in do_body:sk_X509_EXTENSION_num().

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

21 months agoReplaced variable-time GCD with consttime inversion to avoid side-channel attacks...
Samuel Weiser [Wed, 21 Feb 2018 11:56:01 +0000 (11:56 +0000)]
Replaced variable-time GCD with consttime inversion to avoid side-channel attacks on RSA key generation

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

21 months agoSanity check the ticket length before using key name/IV
Matt Caswell [Tue, 20 Feb 2018 10:20:20 +0000 (10:20 +0000)]
Sanity check the ticket length before using key name/IV

This could in theory result in an overread - but due to the over allocation
of the underlying buffer does not represent a security issue.

Thanks to Fedor Indutny for reporting this issue.

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

21 months agoFix no-ec build
Matt Caswell [Tue, 20 Feb 2018 14:53:40 +0000 (14:53 +0000)]
Fix no-ec build

[extended tests]

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

21 months agoFix some undefined behaviour in the Curve448 code
Matt Caswell [Tue, 20 Feb 2018 14:53:06 +0000 (14:53 +0000)]
Fix some undefined behaviour in the Curve448 code

We can't add NULL data into a hash

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

21 months agoRemove a spurious TLSProxy byte in TLSv1.3
Matt Caswell [Wed, 14 Feb 2018 17:29:32 +0000 (17:29 +0000)]
Remove a spurious TLSProxy byte in TLSv1.3

When the proxy re-encrypted a TLSv1.3 record it was adding a spurious
byte onto the end. This commit removes that.

The "extra" byte was intended to be the inner content type of the record.
However, TLSProxy was actually adding the original encrypted data into the
record (which already has the inner content type in it) and then adding
the spurious additional content type byte on the end (and adjusting the
record length accordingly).

It is interesting to look at why this didn't cause a failure:

The receiving peer first attempts to decrypt the data. Because this is
TLSProxy we always use a GCM based ciphersuite with a 16 byte tag. When
we decrypt this it actually gets diverted to the ossltest engine. All this
does is go through the motions of encrypting/decrypting but just passes
back the original data. Crucially it will never fail because of a bad tag!
The receiving party thinks the spurious additional byte is part of the
tag and the ossltest engine ignores it.

This means the data that gets passed back to the record layer still has
an additional spurious byte on it - but because the 16 byte tag has been
removed, this is actually the first byte of the original tag. Again
because we are using ossltest engine we aren't actually creating "real"
tags - we only ever emit 16, 0 bytes for the tag. So the spurious
additional byte always has the value 0. The TLSv1.3 spec says that records
can have additional 0 bytes on the end of them - this is "padding". So the
record layer interprets this 0 byte as padding and strips it off to end up
with the originally transmitted record data - which it can now process
successfully.

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

21 months agoVMS: Fix curve448 internal test program
Richard Levitte [Wed, 21 Feb 2018 09:15:16 +0000 (10:15 +0100)]
VMS: Fix curve448 internal test program

The internals test programs access header files that aren't guarded by
the public __DECC_INCLUDE_PROLOGUE.H and __DECC_INCLUDE_EPILOGUE.H
files, and therefore have no idea what the naming convention is.
Therefore, we need to specify that explicitely in the internals test
programs, since they aren't built with the same naming convention as
the library they belong with.

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

21 months agotest/recipes/80-test_pkcs12.t: handle lack of Win32::API.
Andy Polyakov [Tue, 20 Feb 2018 11:43:35 +0000 (12:43 +0100)]
test/recipes/80-test_pkcs12.t: handle lack of Win32::API.

So far check for availability of Win32::API served as implicit check
for $^O being MSWin32. Reportedly it's not safe assumption, and check
for MSWin32 has to be explicit.

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

21 months agoConfigure: engage x25519 assembly support.
Andy Polyakov [Mon, 19 Feb 2018 14:19:49 +0000 (15:19 +0100)]
Configure: engage x25519 assembly support.

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

21 months agoec/curve25519.c: facilitate assembly implementations.
Andy Polyakov [Mon, 19 Feb 2018 14:17:30 +0000 (15:17 +0100)]
ec/curve25519.c: facilitate assembly implementations.

Currently it's limited to 64-bit platforms only as minimum radix
expected in assembly is 2^51.

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

21 months agoAdd x25519-x86_64.pl module, mod 2^255-19 primitives.
Andy Polyakov [Mon, 19 Feb 2018 14:09:33 +0000 (15:09 +0100)]
Add x25519-x86_64.pl module, mod 2^255-19 primitives.

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

21 months agocrypto/ec/curve25519.c: remove redundant fe[51]_cswap.
Andy Polyakov [Mon, 19 Feb 2018 14:00:59 +0000 (15:00 +0100)]
crypto/ec/curve25519.c: remove redundant fe[51]_cswap.

3 least significant bits of the input scalar are explicitly cleared,
hence swap variable has fixed value [of zero] upon exit from the loop.

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

21 months agoAdd tests for newly added constant time functions
Matt Caswell [Mon, 19 Feb 2018 14:53:01 +0000 (14:53 +0000)]
Add tests for newly added constant time functions

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

21 months agoSome more cleanups of curve448 code
Matt Caswell [Fri, 16 Feb 2018 21:39:19 +0000 (21:39 +0000)]
Some more cleanups of curve448 code

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

21 months agofixup! More style fixes for the curve448 code
Matt Caswell [Fri, 16 Feb 2018 21:39:03 +0000 (21:39 +0000)]
fixup! More style fixes for the curve448 code

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

21 months agofixup! Improve readability of f_impl.c and f_impl.h
Matt Caswell [Fri, 16 Feb 2018 16:54:53 +0000 (16:54 +0000)]
fixup! Improve readability of f_impl.c and f_impl.h

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

21 months agoImprove readability of f_impl.c and f_impl.h
Matt Caswell [Wed, 14 Feb 2018 14:35:01 +0000 (14:35 +0000)]
Improve readability of f_impl.c and f_impl.h

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

21 months agoRemove unrolled loops
Matt Caswell [Wed, 31 Jan 2018 13:37:42 +0000 (13:37 +0000)]
Remove unrolled loops

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

21 months agoYet more style updates to the curve448 code
Matt Caswell [Wed, 7 Feb 2018 17:03:14 +0000 (17:03 +0000)]
Yet more style updates to the curve448 code

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

21 months agoFurther style changes to curve448 code
Matt Caswell [Mon, 12 Feb 2018 13:56:50 +0000 (13:56 +0000)]
Further style changes to curve448 code

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

21 months agoSimplify some code
Matt Caswell [Wed, 7 Feb 2018 13:40:56 +0000 (13:40 +0000)]
Simplify some code

The original curve448 code was templated to allow for a 25519
implementation. We've just imported the 448 stuff - but a remnant of
the original templated approach remained. This just simplifies that.

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

21 months agoRemove some unneccessary use of constant time code in curve448
Matt Caswell [Wed, 7 Feb 2018 12:14:25 +0000 (12:14 +0000)]
Remove some unneccessary use of constant time code in curve448

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

21 months agoFix a travis failure in the curve448 code
Matt Caswell [Wed, 7 Feb 2018 12:08:47 +0000 (12:08 +0000)]
Fix a travis failure in the curve448 code

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

21 months agoRemove the curve448 vector code
Matt Caswell [Mon, 12 Feb 2018 14:38:13 +0000 (14:38 +0000)]
Remove the curve448 vector code

We removed various platform specific optimisation files in an earlier
commit. The vector code was related to that and therefore is no longer
required. It may be resurrected at a later point if we reintroduce the
opimtisations.

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

21 months agoMore style fixes for the curve448 code
Matt Caswell [Wed, 7 Feb 2018 11:47:41 +0000 (11:47 +0000)]
More style fixes for the curve448 code

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

21 months agoRemove a strict aliasing issue with pre-computed curve448 constants
Matt Caswell [Tue, 6 Feb 2018 14:59:14 +0000 (14:59 +0000)]
Remove a strict aliasing issue with pre-computed curve448 constants

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

21 months agoMore style fixes to Curve448 code based on review feedback
Matt Caswell [Mon, 12 Feb 2018 14:27:02 +0000 (14:27 +0000)]
More style fixes to Curve448 code based on review feedback

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

21 months agoSome style fixes
Matt Caswell [Mon, 12 Feb 2018 14:03:36 +0000 (14:03 +0000)]
Some style fixes

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

21 months agoFormatting tweak based on review feedback
Matt Caswell [Thu, 1 Feb 2018 14:29:01 +0000 (14:29 +0000)]
Formatting tweak based on review feedback

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

21 months agoUse NLIMBS where appropriate to simplify the code
Matt Caswell [Thu, 1 Feb 2018 14:23:13 +0000 (14:23 +0000)]
Use NLIMBS where appropriate to simplify the code

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

21 months agoRemove cplusplus guards in internal headers
Matt Caswell [Thu, 1 Feb 2018 14:17:38 +0000 (14:17 +0000)]
Remove cplusplus guards in internal headers

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

21 months 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)

21 months 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)

21 months 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)

21 months 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)

21 months 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)

21 months 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)

21 months 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)

21 months 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)

21 months 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)

21 months 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)

21 months 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)

21 months 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)

21 months 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)

21 months 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)

21 months 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)

21 months 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)

21 months 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)

21 months 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)

21 months 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)

21 months 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)

21 months 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)

21 months 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)

21 months 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)

21 months 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)