oweals/openssl.git
8 years agoRemove overzealous echoing
Richard Levitte [Thu, 3 Mar 2016 16:45:14 +0000 (17:45 +0100)]
Remove overzealous echoing

This construct in a Makefile is a bit overzealous:

@echo FOO
@FOO

Cleaned up.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoAdd KDF support to pkeyutl. Update documentation.
Dr. Stephen Henson [Tue, 1 Mar 2016 16:29:47 +0000 (16:29 +0000)]
Add KDF support to pkeyutl. Update documentation.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoClean up curve25519 build
Emilia Kasper [Thu, 3 Mar 2016 15:36:06 +0000 (16:36 +0100)]
Clean up curve25519 build

- Remove OPENSSL_X25519_X86_64 which never worked, because we don't have
  the assembly.
- Also remove OPENSSL_SMALL (which should have been
  OPENSSL_SMALL_FOOTPRINT) which isn't a priority at the moment.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoupdate NEWS
Dr. Stephen Henson [Thu, 3 Mar 2016 13:35:02 +0000 (13:35 +0000)]
update NEWS

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agofix no-ec build
Dr. Stephen Henson [Thu, 3 Mar 2016 13:27:34 +0000 (13:27 +0000)]
fix no-ec build

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoRefactor ClientHello extension parsing
Emilia Kasper [Tue, 22 Sep 2015 13:20:26 +0000 (15:20 +0200)]
Refactor ClientHello extension parsing

1) Simplify code with better PACKET methods.

2) Make broken SNI parsing explicit. SNI was intended to be extensible
to new name types but RFC 4366 defined the syntax inextensibly, and
OpenSSL has never parsed SNI in a way that would allow adding a new name
type. RFC 6066 fixed the definition but due to broken implementations
being widespread, it appears impossible to ever extend SNI.

3) Annotate resumption behaviour. OpenSSL doesn't currently handle all
extensions correctly upon resumption. Annotate for further clean-up.

4) Send an alert on ALPN protocol mismatch.

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
8 years agomake update
Dr. Stephen Henson [Wed, 2 Mar 2016 21:32:40 +0000 (21:32 +0000)]
make update

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoadd kdf.h to mkdef.pl
Dr. Stephen Henson [Wed, 2 Mar 2016 21:32:30 +0000 (21:32 +0000)]
add kdf.h to mkdef.pl

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoAdd KDF error codes
Dr. Stephen Henson [Wed, 2 Mar 2016 04:11:02 +0000 (04:11 +0000)]
Add KDF error codes

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agomake update
Dr. Stephen Henson [Tue, 1 Mar 2016 22:15:02 +0000 (22:15 +0000)]
make update

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoGeneralise KDF test in evp_test.c
Dr. Stephen Henson [Tue, 1 Mar 2016 18:04:42 +0000 (18:04 +0000)]
Generalise KDF test in evp_test.c

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoConvert PRF tests to use Ctrl
Dr. Stephen Henson [Tue, 1 Mar 2016 16:22:25 +0000 (16:22 +0000)]
Convert PRF tests to use Ctrl

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoAdd Ctrl keyword to KDF test in evp_test
Dr. Stephen Henson [Tue, 1 Mar 2016 15:08:18 +0000 (15:08 +0000)]
Add Ctrl keyword to KDF test in evp_test

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoAdd string ctrl operations to TLS1 PRF, update documentation.
Dr. Stephen Henson [Tue, 1 Mar 2016 14:58:33 +0000 (14:58 +0000)]
Add string ctrl operations to TLS1 PRF, update documentation.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoUse utility functions for HMAC and CMAC.
Dr. Stephen Henson [Tue, 1 Mar 2016 14:56:02 +0000 (14:56 +0000)]
Use utility functions for HMAC and CMAC.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoEVP_PKEY_CTX utility functions.
Dr. Stephen Henson [Tue, 1 Mar 2016 14:47:15 +0000 (14:47 +0000)]
EVP_PKEY_CTX utility functions.

Utility functions to pass a string or hex string to EVP_PKEY_CTX_ctrl().

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agomake errors
Dr. Stephen Henson [Tue, 1 Mar 2016 19:16:21 +0000 (19:16 +0000)]
make errors

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoHandle KDF internally.
Dr. Stephen Henson [Mon, 29 Feb 2016 14:12:11 +0000 (14:12 +0000)]
Handle KDF internally.

Handle KDF in ECDH_compute_key instead of requiring each implementation
support it. This modifies the compute_key method: now it allocates and
populates a buffer containing the shared secret.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoDocument the changes in config settings
Richard Levitte [Sat, 27 Feb 2016 16:14:44 +0000 (17:14 +0100)]
Document the changes in config settings

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoDon't copy from %target to %config so much, see %config as a complement
Richard Levitte [Wed, 2 Mar 2016 09:57:05 +0000 (10:57 +0100)]
Don't copy from %target to %config so much, see %config as a complement

We copied $target{cflags}, $target{defines} and a few more to %config,
just to add to the entries.  Avoid doing so, and let the build templates
deal with combining the two.

There are a few cases where we still fiddle with %target, but that's
acceptable.

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoConfigure - Get rid of the special thread_cflag, replace with thread_scheme
Richard Levitte [Sat, 27 Feb 2016 15:51:34 +0000 (16:51 +0100)]
Configure - Get rid of the special thread_cflag, replace with thread_scheme

The thread_cflag setting filled a double role, as kinda sorta an
indicator of thread scheme, and as cflags.  Some configs also added
lflags and ex_libs for multithreading regardless of if threading would
be enabled or not.

Instead of this, add threading cflags among in the cflag setting,
threading lflags in the lflag setting and so on if and only if threads
are enabled (which they are by default).

Also, for configs where there are no special cflags for threading (the
VMS configs are of that kind), this makes it possible to still clearly
mention what thread scheme is used.

The exact value of thread scheme is currently ignored except when it's
"(unknown)", and thereby only serves as a flag to tell if we know how
to build for multi-threading in a particular config.  Yet, the
currently used values are "(unknown)", "pthreads", "uithreads" (a.k.a
solaris threads) and "winthreads".

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoConfigure - get rid of the special debug_ and release_ settings
Richard Levitte [Wed, 2 Mar 2016 18:13:26 +0000 (19:13 +0100)]
Configure - get rid of the special debug_ and release_ settings

Instead, make the build type ("debug" or "release") available through
$config{build_type} and let the configs themselves figure out what the
usual settings (such as "cflags", "lflags" and so on) should be
accordingly.

The benefit with this is that we can now have debug and release
variants of any setting, not just those Configure supports, and may
also involve other factors (the MSVC flags /MD[d] and /MT[d] involve
both build type and whether threading is enabled or not)

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoMinimize copied config settings
Richard Levitte [Sat, 27 Feb 2016 10:42:13 +0000 (11:42 +0100)]
Minimize copied config settings

$target{lflags} and $target{plib_flag} were copied to %config for no
good reason.

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoConfigure - move the addition of the zlib / libz lib to configs
Richard Levitte [Sat, 27 Feb 2016 10:37:33 +0000 (11:37 +0100)]
Configure - move the addition of the zlib / libz lib to configs

Configure had the Unix centric addition of -lz when linking with zlib
is enabled, which doesn't work on other platforms.  Therefore, we move
it to the BASE_unix config template and add corresponding ones in the
other BASE_* config templates.  The Windows one is probably incomplete,
but that doesn't matter for the moment, as mk1mf does it's own thing
anyway.

This required making the %withargs table global, so perl snippets in
the configs can use it.

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoConfigure - Rename BASE to DEFAULTS and add a few inheritable BASEs
Richard Levitte [Sat, 27 Feb 2016 10:25:33 +0000 (11:25 +0100)]
Configure - Rename BASE to DEFAULTS and add a few inheritable BASEs

These BASE templates are intended to hold values that are common for
all configuration variants for whole families of configurations.

So far, three "families" are identified: Unix, Windows and VMS, mostly
characterised by the build system they currently use.

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoConfigure - Allow CODErefs and ARRAYrefs in configuration setting arrays
Richard Levitte [Sat, 27 Feb 2016 10:08:21 +0000 (11:08 +0100)]
Configure - Allow CODErefs and ARRAYrefs in configuration setting arrays

This provides for more powerful lazy evaluation and buildup of the
setting contents.  For example, something like this becomes possible:

    defines => [ sub { $config{thisorthat} ? "FOO" : () } ]

Any undefined result of such functions (such as 'undef' or the empty
list) will be ignored.

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoEnsure Async is deinited properly
Matt Caswell [Wed, 2 Mar 2016 16:52:43 +0000 (16:52 +0000)]
Ensure Async is deinited properly

The global thread local keys were not being deinited properly in async.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoConvert ASYNC code to use new Thread API
Matt Caswell [Wed, 2 Mar 2016 16:15:52 +0000 (16:15 +0000)]
Convert ASYNC code to use new Thread API

The async code uses thread local variables. We should convert to using
the new Thread API for doing this.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoProvide getters for default_passwd_cb and userdata
Christian Heimes [Wed, 2 Mar 2016 11:53:40 +0000 (12:53 +0100)]
Provide getters for default_passwd_cb and userdata

This patch provides getters for default_passwd_cb and userdata for SSL
and SSL_CTX. The getter functions are required to port Python's ssl module
to OpenSSL 1.1.0.

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agocurve25519: add missing const-qualifier
Emilia Kasper [Wed, 2 Mar 2016 16:23:36 +0000 (17:23 +0100)]
curve25519: add missing const-qualifier

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
8 years agoAdd a shared_target to the VC-common config
Richard Levitte [Wed, 2 Mar 2016 13:10:21 +0000 (14:10 +0100)]
Add a shared_target to the VC-common config

This has no real meaning, except it gives Configure a hint that VC
targets are indeed capable of producing shared objects.

Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoConfigure - make the use of environment variables for overrides consistent
Richard Levitte [Wed, 2 Mar 2016 11:22:15 +0000 (12:22 +0100)]
Configure - make the use of environment variables for overrides consistent

We allow some commands to be overriden, but didn't handle that in a
consistent manner.

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoMake uplink auxiliary source separate from cpuid source
Richard Levitte [Wed, 2 Mar 2016 08:34:26 +0000 (09:34 +0100)]
Make uplink auxiliary source separate from cpuid source

There are cases, for example when configuring no-asm, that the added
uplink source files got in the way of the cpuid ones.  The best way to
solve this is to separate the two.

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoMake k25519Precomp const
Kurt Roeckx [Wed, 2 Mar 2016 12:29:49 +0000 (13:29 +0100)]
Make k25519Precomp const

Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
MR: #2184

8 years agopoly1305/asm/poly1305-*.pl: flip horizontal add and reduction.
Andy Polyakov [Sun, 28 Feb 2016 20:48:43 +0000 (21:48 +0100)]
poly1305/asm/poly1305-*.pl: flip horizontal add and reduction.

Formally only 32-bit AVX2 code path needs this, but I choose to
harmonize all vector code paths.

RT#4346
Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoConsistently use arm_arch.h constants in armcap assembly code.
David Benjamin [Tue, 23 Feb 2016 16:41:55 +0000 (11:41 -0500)]
Consistently use arm_arch.h constants in armcap assembly code.

Most of the assembly uses constants from arm_arch.h, but a few references to
ARMV7_NEON don't. Consistently use the macros everywhere.

Signed-off-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoremove old unused oneline name field
Dr. Stephen Henson [Tue, 1 Mar 2016 21:04:41 +0000 (21:04 +0000)]
remove old unused oneline name field

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agomake errors
Dr. Stephen Henson [Mon, 29 Feb 2016 13:06:45 +0000 (13:06 +0000)]
make errors

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoAdd default operations to EC_METHOD
Dr. Stephen Henson [Sun, 28 Feb 2016 17:48:48 +0000 (17:48 +0000)]
Add default operations to EC_METHOD

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoReplace overrides.
Dr. Stephen Henson [Sun, 28 Feb 2016 17:47:06 +0000 (17:47 +0000)]
Replace overrides.

Instead of overriding a default operation move default operation to a
separate function which is then explicitly included in any EC_METHOD
that uses it.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoCT policy validation
Rob Percival [Mon, 29 Feb 2016 17:33:02 +0000 (17:33 +0000)]
CT policy validation

Specifies a callback that will, in the future, be used by the SSL code to
decide whether to abort a connection on Certificate Transparency grounds.

Reviewed-by: Ben Laurie <ben@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoFix -pkeyopt and fix error check.
Dr. Stephen Henson [Tue, 1 Mar 2016 17:22:51 +0000 (17:22 +0000)]
Fix -pkeyopt and fix error check.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoRT4347: Fix GCC unused-value warnings with HOST_c2l()
David Woodhouse [Thu, 25 Feb 2016 23:19:06 +0000 (23:19 +0000)]
RT4347: Fix GCC unused-value warnings with HOST_c2l()

The HOST_c2l() macro assigns the value to the specified variable, but also
evaluates to the same value. Which we ignore, triggering a warning.

To fix this, just cast it to void like we did in commit 08e553644
("Fix some clang warnings.") for a bunch of other instances.

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoMove macros for reading/writing integers into ct_locl.h
Rob Percival [Mon, 29 Feb 2016 20:26:36 +0000 (20:26 +0000)]
Move macros for reading/writing integers into ct_locl.h

Reviewed-by: Ben Laurie <ben@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoAddresses review comments from richsalz
Rob Percival [Mon, 29 Feb 2016 20:25:08 +0000 (20:25 +0000)]
Addresses review comments from richsalz

Reviewed-by: Ben Laurie <ben@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoFixes potential double free and memory leak in ct_b64.c
Rob Percival [Mon, 22 Feb 2016 14:42:09 +0000 (14:42 +0000)]
Fixes potential double free and memory leak in ct_b64.c

Reviewed-by: Ben Laurie <ben@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoVerify SCT signatures
Rob Percival [Thu, 25 Feb 2016 13:33:48 +0000 (13:33 +0000)]
Verify SCT signatures

Tests included in future commit, which adds CT policy validation.

Reviewed-by: Ben Laurie <ben@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoUpdates to CHANGES and NEWS for 1.0.2 and 1.0.1 release
Matt Caswell [Tue, 1 Mar 2016 11:12:47 +0000 (11:12 +0000)]
Updates to CHANGES and NEWS for 1.0.2 and 1.0.1 release

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agobn/asm/x86_64-mont5.pl: unify gather procedure in hardly used path
Andy Polyakov [Tue, 26 Jan 2016 15:50:10 +0000 (16:50 +0100)]
bn/asm/x86_64-mont5.pl: unify gather procedure in hardly used path
and reorganize/harmonize post-conditions.

Additional hardening following on from CVE-2016-0702

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agocrypto/bn/x86_64-mont5.pl: constant-time gather procedure.
Andy Polyakov [Mon, 25 Jan 2016 22:41:01 +0000 (23:41 +0100)]
crypto/bn/x86_64-mont5.pl: constant-time gather procedure.

At the same time remove miniscule bias in final subtraction.
Performance penalty varies from platform to platform, and even with
key length. For rsa2048 sign it was observed to be 4% for Sandy
Bridge and 7% on Broadwell.

CVE-2016-0702

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agobn/asm/rsaz-avx2.pl: constant-time gather procedure.
Andy Polyakov [Mon, 25 Jan 2016 22:25:40 +0000 (23:25 +0100)]
bn/asm/rsaz-avx2.pl: constant-time gather procedure.

Performance penalty is 2%.

CVE-2016-0702

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agobn/asm/rsax-x86_64.pl: constant-time gather procedure.
Andy Polyakov [Mon, 25 Jan 2016 22:06:45 +0000 (23:06 +0100)]
bn/asm/rsax-x86_64.pl: constant-time gather procedure.

Performance penalty is 2% on Linux and 5% on Windows.

CVE-2016-0702

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agobn/bn_exp.c: constant-time MOD_EXP_CTIME_COPY_FROM_PREBUF.
Andy Polyakov [Mon, 25 Jan 2016 19:38:38 +0000 (20:38 +0100)]
bn/bn_exp.c: constant-time MOD_EXP_CTIME_COPY_FROM_PREBUF.

Performance penalty varies from platform to platform, and even
key length. For rsa2048 sign it was observed to reach almost 10%.

CVE-2016-0702

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoUnified - have configdata.pm depend on a few more things
Richard Levitte [Sun, 28 Feb 2016 00:13:17 +0000 (01:13 +0100)]
Unified - have configdata.pm depend on a few more things

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoGH762: Reuse strdup()
Dmitry-Me [Mon, 29 Feb 2016 08:55:13 +0000 (11:55 +0300)]
GH762: Reuse strdup()

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoGH764: s_server: trace option fall through
J Mohan Rao Arisankala [Mon, 29 Feb 2016 16:53:18 +0000 (22:23 +0530)]
GH764: s_server: trace option fall through

in s_server cmd:
specifying -trace option, falls through and turn-on security_debug

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoGH758: e_dasync_err.h: honor no-filenames option
Viktor Szakats [Sun, 28 Feb 2016 20:35:22 +0000 (21:35 +0100)]
GH758: e_dasync_err.h: honor no-filenames option

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoFix BN_hex2bn/BN_dec2bn NULL ptr/heap corruption
Matt Caswell [Mon, 22 Feb 2016 10:27:18 +0000 (10:27 +0000)]
Fix BN_hex2bn/BN_dec2bn NULL ptr/heap corruption

In the BN_hex2bn function the number of hex digits is calculated using
an int value |i|. Later |bn_expand| is called with a value of |i * 4|.
For large values of |i| this can result in |bn_expand| not allocating any
memory because |i * 4| is negative. This leaves ret->d as NULL leading
to a subsequent NULL ptr deref. For very large values of |i|, the
calculation |i * 4| could be a positive value smaller than |i|. In this
case memory is allocated to ret->d, but it is insufficiently sized
leading to heap corruption. A similar issue exists in BN_dec2bn.

This could have security consequences if BN_hex2bn/BN_dec2bn is ever
called by user applications with very large untrusted hex/dec data. This is
anticipated to be a rare occurrence.

All OpenSSL internal usage of this function uses data that is not expected
to be untrusted, e.g. config file data or application command line
arguments. If user developed applications generate config file data based
on untrusted data then it is possible that this could also lead to security
consequences. This is also anticipated to be a rare.

Issue reported by Guido Vranken.

CVE-2016-0797

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoremove unused variables
Dr. Stephen Henson [Mon, 29 Feb 2016 14:33:44 +0000 (14:33 +0000)]
remove unused variables

Reviewed-by: Emilia Käsper <emilia@openssl.org>
8 years agoFix use before init warnings in asynctest
Matt Caswell [Mon, 29 Feb 2016 13:07:28 +0000 (13:07 +0000)]
Fix use before init warnings in asynctest

If the tests fail early before an ASYNC_WAIT_CTX is created then there
can be a use before init problem in asynctest.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoClarify ASYNC_WAIT_CTX_clear_fd() docs
Matt Caswell [Mon, 29 Feb 2016 12:15:27 +0000 (12:15 +0000)]
Clarify ASYNC_WAIT_CTX_clear_fd() docs

Clarify that the "cleanup" routing does not get called if you invoke
ASYNC_WAIT_CTX_clear_fd() directly.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoRefactor the async wait fd logic
Matt Caswell [Mon, 25 Jan 2016 15:28:57 +0000 (15:28 +0000)]
Refactor the async wait fd logic

Implementation experience has shown that the original plan for async wait
fds was too simplistic. Originally the async logic created a pipe internally
and user/engine code could then get access to it via API calls. It is more
flexible if the engine is able to create its own fd and provide it to the
async code.

Another issue is that there can be a lot of churn in the fd value within
the context of (say) a single SSL connection leading to continually adding
and removing fds from (say) epoll. It is better if we can provide some
stability of the fd value across a whole SSL connection. This is
problematic because an engine has no concept of an SSL connection.

This commit refactors things to introduce an ASYNC_WAIT_CTX which acts as a
proxy for an SSL connection down at the engine layer.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoWorkaround for VisualStudio 2015 bug
Matt Caswell [Tue, 23 Feb 2016 15:27:05 +0000 (15:27 +0000)]
Workaround for VisualStudio 2015 bug

VisualStudio 2015 has a bug where an internal compiler error was occurring.
By reordering the DEFINE_STACK_OF declarations for SSL_CIPHER and SSL_COMP
until after the ssl3.h include everything seems ok again.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoAdd forgotten change of check of disabled-dynamic-engine
Richard Levitte [Sun, 28 Feb 2016 16:03:26 +0000 (17:03 +0100)]
Add forgotten change of check of disabled-dynamic-engine

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoAdd CHANGES entry for X25519
Dr. Stephen Henson [Sun, 28 Feb 2016 22:43:30 +0000 (22:43 +0000)]
Add CHANGES entry for X25519

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agomake update
Dr. Stephen Henson [Sun, 28 Feb 2016 18:00:46 +0000 (18:00 +0000)]
make update

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
8 years agoRemove unused code.
Dr. Stephen Henson [Sun, 21 Feb 2016 16:22:43 +0000 (16:22 +0000)]
Remove unused code.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
8 years agoChange BORINGSSL defines to OPENSSL
Dr. Stephen Henson [Sat, 20 Feb 2016 14:24:06 +0000 (14:24 +0000)]
Change BORINGSSL defines to OPENSSL

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
8 years agoInitial adaptations for Curve25519 code.
Dr. Stephen Henson [Sat, 20 Feb 2016 14:19:28 +0000 (14:19 +0000)]
Initial adaptations for Curve25519 code.

Fix "mixed declarations and code" warnings.
Use OpenSSL headers.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
8 years agoPlace under OpenSSL license.
Emilia Kasper [Wed, 24 Feb 2016 16:18:10 +0000 (16:18 +0000)]
Place under OpenSSL license.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Stephen Henson <steve@openssl.org>
8 years agoAdd X25519 code from BoringSSL.
Dr. Stephen Henson [Sat, 20 Feb 2016 13:56:47 +0000 (13:56 +0000)]
Add X25519 code from BoringSSL.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
8 years agoTLS support for X25519
Dr. Stephen Henson [Thu, 25 Feb 2016 17:46:14 +0000 (17:46 +0000)]
TLS support for X25519

Add X25519 to TLS supported curve list.
Reject attempts to configure keys which cannot be used
for signing.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
8 years agoadd ecdhx25519 option to speed
Dr. Stephen Henson [Fri, 12 Feb 2016 14:11:47 +0000 (14:11 +0000)]
add ecdhx25519 option to speed

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
8 years agoskip inappropriate X25519 tests
Dr. Stephen Henson [Tue, 23 Feb 2016 14:35:33 +0000 (14:35 +0000)]
skip inappropriate X25519 tests

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
8 years agoAdd X25519 test vectors from RFC7748 6.1
Dr. Stephen Henson [Tue, 2 Feb 2016 19:07:18 +0000 (19:07 +0000)]
Add X25519 test vectors from RFC7748 6.1
Check sign/verify blocked with X25519

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
8 years agoAdd X25519 curve to list
Dr. Stephen Henson [Tue, 2 Feb 2016 15:23:00 +0000 (15:23 +0000)]
Add X25519 curve to list

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
8 years agoAdd no signing flag.
Dr. Stephen Henson [Tue, 23 Feb 2016 15:02:34 +0000 (15:02 +0000)]
Add no signing flag.

Add a flag to EC_METHOD for curves which do not support signing.
New function EC_KEY_can_sign() returns 1 is key can be used for signing.
Return an explicit error is an attempt is made to sign with
no signing curves.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
8 years agoAdd new EC_METHOD for X25519.
Dr. Stephen Henson [Tue, 2 Feb 2016 14:50:10 +0000 (14:50 +0000)]
Add new EC_METHOD for X25519.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
8 years agoAdd group_order_bits to EC_METHOD.
Dr. Stephen Henson [Mon, 1 Feb 2016 18:52:41 +0000 (18:52 +0000)]
Add group_order_bits to EC_METHOD.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
8 years agoAdd custom_data field for EC_POINT, EC_KEY.
Dr. Stephen Henson [Mon, 1 Feb 2016 18:22:35 +0000 (18:22 +0000)]
Add custom_data field for EC_POINT, EC_KEY.

In some cases the EC_POINT and EC_KEY BIGNUM components are suboptimal
or inappropriate. Add an "custom_data" field which curves can populate with
a custom structure to suit their needs.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
8 years agoExtract compression form in EC_KEY_oct2key().
Dr. Stephen Henson [Wed, 17 Feb 2016 15:05:27 +0000 (15:05 +0000)]
Extract compression form in EC_KEY_oct2key().

Extract compression form in EC_KEY_oct2key() instead of manually in the
ASN.1 code. For custom curves do not assume the initial octet is the
compression form: it isn't for X25519 et al.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
8 years agoExtended EC_METHOD customisation support.
Dr. Stephen Henson [Mon, 1 Feb 2016 18:15:57 +0000 (18:15 +0000)]
Extended EC_METHOD customisation support.

Add support for optional overrides of various private key operations
in EC_METHOD.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
8 years agoEC_METHOD customisation operations.
Dr. Stephen Henson [Mon, 1 Feb 2016 17:57:01 +0000 (17:57 +0000)]
EC_METHOD customisation operations.

Extend EC_METHOD to permit additional customisation of private key and
ECDH operations.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
8 years agoRename OIDs.
Dr. Stephen Henson [Mon, 22 Feb 2016 14:27:09 +0000 (14:27 +0000)]
Rename OIDs.

Use standard X25519 and X448 names for OIDs. Delete EdDSA OIDs: for now they
wont be used and EdDSA may use a different format.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
8 years agoGH715: Missed some null-check-removals. follow commits 412bafdcf5, and 7c96dbcdab
FdaSilvaYY [Sun, 28 Feb 2016 15:01:41 +0000 (16:01 +0100)]
GH715: Missed some null-check-removals. follow commits 412bafdcf5, and 7c96dbcdab

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoFix mk1mf build
Rich Salz [Sun, 28 Feb 2016 17:24:49 +0000 (12:24 -0500)]
Fix mk1mf build

Removing certs broke the mk1mf build.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoGH715: Missed some null-check-removals.
Rich Salz [Thu, 25 Feb 2016 21:34:27 +0000 (16:34 -0500)]
GH715: Missed some null-check-removals.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoRT4351: Update doc for OPENSSL_cleanse
Jeffrey Walton [Sat, 27 Feb 2016 01:44:35 +0000 (20:44 -0500)]
RT4351: Update doc for OPENSSL_cleanse

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoVMS - don't exit out of a MMS recipe
Richard Levitte [Sun, 28 Feb 2016 08:31:46 +0000 (09:31 +0100)]
VMS - don't exit out of a MMS recipe

Exiting out of a recipe more than necessary leaves an ugly message.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoMake generation of dependency files more efficient when possible
Richard Levitte [Sat, 27 Feb 2016 23:20:50 +0000 (00:20 +0100)]
Make generation of dependency files more efficient when possible

When building with GNU C, clang or VMS C, it's more efficient to
generate dependency file and object file in one call rather than two.
Have the dependency output in a temporary file and compare it with the
previous one if available to see if replacement is waranted, thereby
avoiding unnecessary reconstruction of Makefile / descrip.mms.

Github issue #750

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoRT4354: Add some cross-refs
Jeffrey Walton [Sat, 27 Feb 2016 22:08:50 +0000 (17:08 -0500)]
RT4354: Add some cross-refs

Stack Overflow has a number of questions related to mutual authentication,
the client and its certificate. Those visiting the man pages for functions
like SSL_CTX_use_certificate and SSL_CTX_load_verify_locations don't
receive the benefit of a cross reference to SSL_CTX_set_client_CA_list.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agousing macro inside the case.
J Mohan Rao Arisankala [Sat, 27 Feb 2016 03:35:51 +0000 (09:05 +0530)]
using macro inside the case.

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agofix build with no-srtp
J Mohan Rao Arisankala [Sat, 27 Feb 2016 03:20:07 +0000 (08:50 +0530)]
fix build with no-srtp

- srtp_profiles variable is defined when building with SRTP, keeping
the variable usage also under ifndef OPENSSL_NO_SRTP
- alpn help option was kept under ifndef OPENSSL_NO_SRTP

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoct_test.c doesn't need to include from source top, only testutil.c does
Richard Levitte [Sat, 27 Feb 2016 19:34:47 +0000 (20:34 +0100)]
ct_test.c doesn't need to include from source top, only testutil.c does

The INCLUDE statement can handle setting extra include directories for
individual object files, let's use it.

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agoRemove last remains of old config strings
Richard Levitte [Sat, 27 Feb 2016 20:23:01 +0000 (21:23 +0100)]
Remove last remains of old config strings

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years agomodes/asm/ghash-x86_64.pl: refine GNU assembler version detection.
Andy Polyakov [Wed, 24 Feb 2016 19:07:06 +0000 (20:07 +0100)]
modes/asm/ghash-x86_64.pl: refine GNU assembler version detection.

Even though AVX support was added in GAS 2.19 vpclmulqdq was apparently
added in 2.20.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agochacha/asm/chacha-*.pl: fix typos in tail processing.
Andy Polyakov [Sun, 21 Feb 2016 20:16:36 +0000 (21:16 +0100)]
chacha/asm/chacha-*.pl: fix typos in tail processing.

RT#4323

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoReformat and update EC_KEY_new manual page.
Dr. Stephen Henson [Sat, 27 Feb 2016 13:06:17 +0000 (13:06 +0000)]
Reformat and update EC_KEY_new manual page.

Add some missing parentheses and reformat.

Document EC_KEY_oct2key(), EC_KEY_key2buf(), EC_KEY_oct2priv(),
EC_KEY_priv2oct() and EC_KEY_priv2buf()

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoRT2275: use BIO_sock_nbio()
Rich Salz [Sat, 27 Feb 2016 18:24:28 +0000 (13:24 -0500)]
RT2275: use BIO_sock_nbio()

Now that BIO_sock_nbio is available, use it in the apps.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoRemove some old files.
Rich Salz [Sat, 27 Feb 2016 17:32:42 +0000 (12:32 -0500)]
Remove some old files.

I read the PROBLEMS, and they're outdated; nothing I'd put in the
online FAQ, for example.  Test-builds work without using these files.
Had to remove the rehash.time stuff from Makefile.in

Reviewed-by: Richard Levitte <levitte@openssl.org>