oweals/openssl.git
6 years agoMake BN_num_bits_word constant-time.
David Benjamin [Tue, 23 Jan 2018 18:46:53 +0000 (13:46 -0500)]
Make BN_num_bits_word constant-time.

(This patch was written by Andy Polyakov. I only wrote the commit
message. Mistakes in the analysis are my fault.)

BN_num_bits, by way of BN_num_bits_word, currently leaks the
most-significant word of its argument via branching and memory access
pattern.

BN_num_bits is called on RSA prime factors in various places. These have
public bit lengths, but all bits beyond the high bit are secret. This
fully resolves those cases.

There are a few places where BN_num_bits is called on an input where the
bit length is also secret. This does *not* fully resolve those cases as
we still only look at the top word. Today, that is guaranteed to be
non-zero, but only because of the long-standing bn_correct_top timing
leak. Once that is fixed, a constant-time BN_num_bits on such inputs
must count bits on each word.

Instead, those cases should not call BN_num_bits at all. In particular,
BN_mod_exp_mont_consttime uses the exponent bit width to pick windows,
but it should be using the maximum bit width. The next patch will fix
this.

Thanks to Dinghao Wu, Danfeng Zhang, Shuai Wang, Pei Wang, and Xiao Liu
for reporting this issue.

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

6 years agoAdd OPENSSL_VERSION_AT_LEAST
Michael Richardson [Thu, 1 Feb 2018 18:22:48 +0000 (13:22 -0500)]
Add OPENSSL_VERSION_AT_LEAST

added macro to create version number
use the macro to build OPENSSL_VERSION_AT_LEAST(maj,min,fix) so that
customers of libssl (such as ruby-openssl) do not need to be so aware of
openssl version numbers.
includes updates to ssl(7) and OPENSSL_VERSION_NUMBER(3) man page

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

6 years agoShorten output by a line
Rich Salz [Thu, 1 Feb 2018 18:18:32 +0000 (13:18 -0500)]
Shorten output by a line

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

6 years agoVMS: MMS wants a space before the target / dependecies separator
Richard Levitte [Thu, 1 Feb 2018 09:35:59 +0000 (10:35 +0100)]
VMS: MMS wants a space before the target / dependecies separator

So as not to be mixed up with a device specification...

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

6 years agoFix some minor code nits
Todd Short [Wed, 31 Jan 2018 21:36:27 +0000 (16:36 -0500)]
Fix some minor code nits

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

6 years agoFix doc nits
Todd Short [Wed, 31 Jan 2018 21:34:20 +0000 (16:34 -0500)]
Fix doc nits

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

6 years agoFree pha_dgst in SSL_clear()
Todd Short [Wed, 31 Jan 2018 21:20:52 +0000 (16:20 -0500)]
Free pha_dgst in SSL_clear()

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

6 years agoAdd TLSv1.3 post-handshake authentication (PHA)
Todd Short [Mon, 18 Dec 2017 21:52:28 +0000 (16:52 -0500)]
Add TLSv1.3 post-handshake authentication (PHA)

Add SSL_verify_client_post_handshake() for servers to initiate PHA

Add SSL_force_post_handshake_auth() for clients that don't have certificates
initially configured, but use a certificate callback.

Update SSL_CTX_set_verify()/SSL_set_verify() mode:

* Add SSL_VERIFY_POST_HANDSHAKE to postpone client authentication until after
the initial handshake.

* Update SSL_VERIFY_CLIENT_ONCE now only sends out one CertRequest regardless
of when the certificate authentication takes place; either initial handshake,
re-negotiation, or post-handshake authentication.

Add 'RequestPostHandshake' and 'RequirePostHandshake' SSL_CONF options that
add the SSL_VERIFY_POST_HANDSHAKE to the 'Request' and 'Require' options

Add support to s_client:
* Enabled automatically when cert is configured
* Can be forced enabled via -force_pha

Add support to s_server:
* Use 'c' to invoke PHA in s_server
* Remove some dead code

Update documentation

Update unit tests:
* Illegal use of PHA extension
* TLSv1.3 certificate tests

DTLS and TLS behave ever-so-slightly differently. So, when DTLS1.3 is
implemented, it's PHA support state machine may need to be different.
Add a TODO and a #error

Update handshake context to deal with PHA.

The handshake context for TLSv1.3 post-handshake auth is up through the
ClientFinish message, plus the CertificateRequest message. Subsequent
Certificate, CertificateVerify, and Finish messages are based on this
handshake context (not the Certificate message per se, but it's included
after the hash). KeyUpdate, NewSessionTicket, and prior Certificate
Request messages are not included in post-handshake authentication.

After the ClientFinished message is processed, save off the digest state
for future post-handshake authentication. When post-handshake auth occurs,
copy over the saved handshake context into the "main" handshake digest.
This effectively discards the any KeyUpdate or NewSessionTicket messages
and any prior post-handshake authentication.

This, of course, assumes that the ID-22 did not mean to include any
previous post-handshake authentication into the new handshake transcript.
This is implied by section 4.4.1 that lists messages only up to the
first ClientFinished.

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

6 years agoRemove bad comments
Todd Short [Fri, 19 Jan 2018 15:43:19 +0000 (10:43 -0500)]
Remove bad comments

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

6 years agoFix some instances of the wrong alert type being sent
Matt Caswell [Wed, 31 Jan 2018 09:53:51 +0000 (09:53 +0000)]
Fix some instances of the wrong alert type being sent

In a few places we sent an internal_error alert instead of a decode_error.

Fixes #5213
Fixes #5214

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

6 years agoocsp.c doesn't free the whole output chain, maybe causing a memory leak
Richard Levitte [Wed, 31 Jan 2018 21:08:12 +0000 (22:08 +0100)]
ocsp.c doesn't free the whole output chain, maybe causing a memory leak

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

6 years agoMake sure that apps/openssl prefixes its output with '# ' during tests
Richard Levitte [Sun, 28 Jan 2018 08:49:46 +0000 (09:49 +0100)]
Make sure that apps/openssl prefixes its output with '# ' during tests

The reason to do this is that some output might start with an 'ok',
which TAP catches and takes for TAP output.  The TAP compatible way is
to make all output it shouldn't catch look like comments.

We do this by setting the environment variable HARNESS_OSSL_PREFIX
during tests.  When that is set, apps/openssl uses BIO_f_linebuffer
and sets its prefix to the content of that environment variable.

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

6 years agoAdd an apps internal BIO filter for prefixing output lines
Richard Levitte [Tue, 30 Jan 2018 21:03:27 +0000 (22:03 +0100)]
Add an apps internal BIO filter for prefixing output lines

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

6 years agoAdd missing \n in some testutil output
Richard Levitte [Wed, 31 Jan 2018 20:49:27 +0000 (21:49 +0100)]
Add missing \n in some testutil output

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

6 years agoMake test/uitest depend on the private apps support library
Richard Levitte [Wed, 31 Jan 2018 13:18:54 +0000 (14:18 +0100)]
Make test/uitest depend on the private apps support library

This avoids having to enumerate specific modules in apps, or to have
to include them in libtestutil.a.

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

6 years agoApps: divide the modules in direct command modules, support library and init
Richard Levitte [Wed, 31 Jan 2018 13:15:52 +0000 (14:15 +0100)]
Apps: divide the modules in direct command modules, support library and init

Most modules are direct implementations of openssl application
sub-commands, but some constitute a support library, which can be used
by more than one program (and is, incidently, by test/uitest).

For practical purposes, we place the support library modules in a
private, static library.

Finally, there are some modules that don't have direct references in
the rest of the apps code, but are still crucial.  See them as some
kind of extra crt0 or similar for your platform.

Inspiration from David von Oheimb

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

6 years agoapps: Don't include progs.h in apps.h
Richard Levitte [Wed, 31 Jan 2018 10:13:10 +0000 (11:13 +0100)]
apps: Don't include progs.h in apps.h

Everything in apps includes apps.h, because that one declares apps
internal library routines.  However, progs.h doesn't declare library
routines, but rather the main commands and their options, and there's
no reason why the library modules should include it.

So, remove the inclusion of progs.h from apps.h and add that inclusion
in all command source files.

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

6 years agotest/asn1_time_test.c: fix pre-C90 warning.
Andy Polyakov [Tue, 23 Jan 2018 19:33:36 +0000 (20:33 +0100)]
test/asn1_time_test.c: fix pre-C90 warning.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
6 years agopoly1305/poly1305_ieee754.c: add support for MIPS.
Andy Polyakov [Mon, 29 Jan 2018 22:44:33 +0000 (23:44 +0100)]
poly1305/poly1305_ieee754.c: add support for MIPS.

Reviewed-by: Rich Salz <rsalz@openssl.org>
6 years agoRestore clearing of init_lock after free
Benjamin Kaduk [Fri, 26 Jan 2018 15:32:40 +0000 (09:32 -0600)]
Restore clearing of init_lock after free

The behavior of resetting the init_lock value to NULL after
freeing it during OPENSSL_cleanup() was added as part of the
global lock commits that were just reverted, but there is desire
to retain this behavior for clarity.

It is unclear that the library would actually remain usable in
any form after OPENSSL_cleanup(), since the required re-initialization
occurs under a CRYPTO_ONCE check that cannot be reset at cleanup time.
That said, a NULL dereference is probably more friendly behavior
in these treacherous waters than using freed memory would be.

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/5089)

6 years agoRevert the crypto "global lock" implementation
Benjamin Kaduk [Tue, 16 Jan 2018 15:49:54 +0000 (09:49 -0600)]
Revert the crypto "global lock" implementation

Conceptually, this is a squashed version of:

    Revert "Address feedback"

    This reverts commit 75551e07bd2339dfea06ef1d31d69929e13a4495.

and

    Revert "Add CRYPTO_thread_glock_new"

    This reverts commit ed6b2c7938ec6f07b15745d4183afc276e74c6dd.

But there were some intervening commits that made neither revert apply
cleanly, so instead do it all as one shot.

The crypto global locks were an attempt to cope with the awkward
POSIX semantics for pthread_atfork(); its documentation (the "RATIONALE"
section) indicates that the expected usage is to have the prefork handler
lock all "global" locks, and the parent and child handlers release those
locks, to ensure that forking happens with a consistent (lock) state.
However, the set of functions available in the child process is limited
to async-signal-safe functions, and pthread_mutex_unlock() is not on
the list of async-signal-safe functions!  The only synchronization
primitives that are async-signal-safe are the semaphore primitives,
which are not really appropriate for general-purpose usage.

However, the state consistency problem that the global locks were
attempting to solve is not actually a serious problem, particularly for
OpenSSL.  That is, we can consider four cases of forking application
that might use OpenSSL:

(1) Single-threaded, does not call into OpenSSL in the child (e.g.,
the child calls exec() immediately)

For this class of process, no locking is needed at all, since there is
only ever a single thread of execution and the only reentrancy is due to
signal handlers (which are themselves limited to async-signal-safe
operation and should not be doing much work at all).

(2) Single-threaded, calls into OpenSSL after fork()

The application must ensure that it does not fork() with an unexpected
lock held (that is, one that would get unlocked in the parent but
accidentally remain locked in the child and cause deadlock).  Since
OpenSSL does not expose any of its internal locks to the application
and the application is single-threaded, the OpenSSL internal locks
will be unlocked for the fork(), and the state will be consistent.
(OpenSSL will need to reseed its PRNG in the child, but that is
an orthogonal issue.)  If the application makes use of locks from
libcrypto, proper handling for those locks is the responsibility of
the application, as for any other locking primitive that is available
for application programming.

(3) Multi-threaded, does not call into OpenSSL after fork()

As for (1), the OpenSSL state is only relevant in the parent, so
no particular fork()-related handling is needed.  The internal locks
are relevant, but there is no interaction with the child to consider.

(4) Multi-threaded, calls into OpenSSL after fork()

This is the case where the pthread_atfork() hooks to ensure that all
global locks are in a known state across fork() would come into play,
per the above discussion.  However, these "calls into OpenSSL after
fork()" are still subject to the restriction to async-signal-safe
functions.  Since OpenSSL uses all sorts of locking and libc functions
that are not on the list of safe functions (e.g., malloc()), this
case is not currently usable and is unlikely to ever be usable,
independently of the locking situation.  So, there is no need to
go through contortions to attempt to support this case in the one small
area of locking interaction with fork().

In light of the above analysis (thanks @davidben and @achernya), go
back to the simpler implementation that does not need to distinguish
"library-global" locks or to have complicated atfork handling for locks.

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/5089)

6 years agoRemove "dummy" BIO create and destroy functions
Richard Levitte [Wed, 31 Jan 2018 14:24:24 +0000 (15:24 +0100)]
Remove "dummy" BIO create and destroy functions

They aren't needed if all they do is set bio->init = 1 and zero other
fields that are already zeroed

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

6 years agoBIO: at the end of BIO_new, declare the BIO inited if no create method present
Richard Levitte [Wed, 31 Jan 2018 10:17:32 +0000 (11:17 +0100)]
BIO: at the end of BIO_new, declare the BIO inited if no create method present

Without this, every BIO implementation is forced to have a create
method, just to set bio->init = 1.

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

6 years agocrypto/rand/rand_lib.c: fix undefined reference to `clock_gettime'
Dr. Matthias St. Pierre [Tue, 30 Jan 2018 22:53:57 +0000 (23:53 +0100)]
crypto/rand/rand_lib.c: fix undefined reference to `clock_gettime'

Some older glibc versions require the `-lrt` linker option for
resolving the reference to `clock_gettime'. Since it is not desired
to add new library dependencies in version 1.1.1, the call to
clock_gettime() is replaced by a call to gettimeofday() for the
moment. It will be added back in version 1.2.

Signed-off-by: Dr. Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/5199)

6 years agoConfigure: Fix configdata.pm shorthand for --dump, should be -d
Peter Meerwald-Stadler [Wed, 31 Jan 2018 00:16:51 +0000 (10:16 +1000)]
Configure: Fix configdata.pm shorthand for --dump, should be -d
INSTALL: Mention 'aria' algorithm for no-<alg>

Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Ben Kaduk <kaduk@mit.edu>
(Merged from https://github.com/openssl/openssl/pull/5215)

6 years agoFix small typo (parenthesis missing)
Richard Levitte [Tue, 30 Jan 2018 18:13:11 +0000 (19:13 +0100)]
Fix small typo (parenthesis missing)

Fixes #5207 (another PR)

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

6 years agoConfigure: when checking user input, check both %user and %useradd
Richard Levitte [Tue, 30 Jan 2018 16:21:12 +0000 (17:21 +0100)]
Configure: when checking user input, check both %user and %useradd

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

6 years agoConfigure: add configure command line C flags after the configured C flags
Richard Levitte [Tue, 30 Jan 2018 16:16:13 +0000 (17:16 +0100)]
Configure: add configure command line C flags after the configured C flags

Fixes #5203

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

6 years agoMove decisions about whether to accept reneg into the state machine
Matt Caswell [Mon, 29 Jan 2018 14:19:52 +0000 (14:19 +0000)]
Move decisions about whether to accept reneg into the state machine

If a server receives an unexpected ClientHello then we may or may not
accept it. Make sure all such decisions are made in the state machine
and not in the record layer. This also removes a disparity between the
TLS and the DTLS code. The TLS code was making this decision in the
record layer, while the DTLS code was making it later.

Finally it also solves a problem where a warning alert was being sent
during tls_setup_handshake() and the function was returning a failure
return code. This is problematic because it can be called from a
transition function - which we only allow fatal errors to occur in.

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

6 years agoAdd a 'reconfigure' make target
Richard Levitte [Mon, 29 Jan 2018 22:17:43 +0000 (23:17 +0100)]
Add a 'reconfigure' make target

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

6 years agoRestore perl variables for ENGINESDIR and OPENSSLDIR
Richard Levitte [Mon, 29 Jan 2018 21:49:50 +0000 (22:49 +0100)]
Restore perl variables for ENGINESDIR and OPENSSLDIR

For proper escaping, we need the direct perl variable values, not a
make variable reference.

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

6 years agoFix typo in Windows makefile template: quotify, not quotiry
Richard Levitte [Mon, 29 Jan 2018 20:54:52 +0000 (21:54 +0100)]
Fix typo in Windows makefile template: quotify, not quotiry

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

6 years agoTo make it less surprising and confusing, leave a message on configdata.pm
Richard Levitte [Mon, 29 Jan 2018 17:33:32 +0000 (18:33 +0100)]
To make it less surprising and confusing, leave a message on configdata.pm

This message will ONLY be visible in OpenSSL 1.1.1, it will not show
in 1.1.1a or any other release or update.

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

6 years agoMake Travis and Appveyor display the configuration data dump
Richard Levitte [Mon, 29 Jan 2018 17:22:33 +0000 (18:22 +0100)]
Make Travis and Appveyor display the configuration data dump

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

6 years agoDocument the use of configdata.pm as a script
Richard Levitte [Mon, 29 Jan 2018 17:19:36 +0000 (18:19 +0100)]
Document the use of configdata.pm as a script

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

6 years agoMove the display of disabled features to configdata.pm as well.
Richard Levitte [Mon, 29 Jan 2018 16:33:58 +0000 (17:33 +0100)]
Move the display of disabled features to configdata.pm as well.

The additional possibility is:

perl configdata.pm --options            Display the features, both
                                        enabled and disabled, and
                                        display defined macro and
                                        skipped directories where
                                        applicable.

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

6 years agoHave the build files use the executable configdata.pm
Richard Levitte [Mon, 29 Jan 2018 07:20:26 +0000 (08:20 +0100)]
Have the build files use the executable configdata.pm

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

6 years agoMake configdata.pm runnable and move all display of information there
Richard Levitte [Mon, 29 Jan 2018 05:19:17 +0000 (06:19 +0100)]
Make configdata.pm runnable and move all display of information there

The "make variable" information displayed by Configure was selective
and incomplete, and possibly undesirable (too verbose).

Instead, we make configdata.pm and have the user run it to get the
information they desire, and also make it possible to have it perform
a reconfiguration.

Possibilities so far:

perl configdata.pm --dump               Displays everything (i.e. the
                                        combined output from
                                        --command-line, --environment,
                                        --make-variables and
                                        --build-parameters.
perl configdata.pm --command-line       Displays the config command
                                        line.
perl configdata.pm --envirnoment        Displays the recorded
                                        environment variables.
perl configdata.pm --make-variables     Displays the configured "make
                                        variables".
perl configdata.pm --build-parameters   Displays the build file and
                                        the template files to create
                                        it.
perl configdata.pm --reconfigure        Re-runs the configuration with
                                        the recorded environment
                                        variables.

--verbose can be used to have --reconfigure be a bit more verbose.

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

6 years agoDon't define OPENSSL_NO_ERR for the command line
Richard Levitte [Mon, 29 Jan 2018 09:22:51 +0000 (10:22 +0100)]
Don't define OPENSSL_NO_ERR for the command line

It's already in opensslconf.h, which is included where this is relevant.

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

6 years agoRemove $no_sse2, as it's just a 'copy' of $disabled{sse2}
Richard Levitte [Mon, 29 Jan 2018 09:21:46 +0000 (10:21 +0100)]
Remove $no_sse2, as it's just a 'copy' of $disabled{sse2}

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

6 years agoFix recent typo. -DL_ENDIAN / -DB_ENDIAN, not -DL_DEBIAN / -DB_DEBIAN
Richard Levitte [Mon, 29 Jan 2018 11:42:35 +0000 (12:42 +0100)]
Fix recent typo.  -DL_ENDIAN / -DB_ENDIAN, not -DL_DEBIAN / -DB_DEBIAN

Thank you Beat Bolli for notifying us

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

6 years agoDon't break testing when runnins as root
Richard Levitte [Mon, 29 Jan 2018 05:14:53 +0000 (06:14 +0100)]
Don't break testing when runnins as root

The rehash test broke the test if run by root.  Instead, just skip the
check that requires non-root to be worth it.

Fixes #4387

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

6 years agoAdd RAND_DRBG_bytes
Kurt Roeckx [Fri, 17 Nov 2017 14:00:35 +0000 (15:00 +0100)]
Add RAND_DRBG_bytes

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/4752)

6 years agoCreate troubleshooting subsection in INSTALL file
nickthetait [Sun, 28 Jan 2018 19:15:23 +0000 (20:15 +0100)]
Create troubleshooting subsection in INSTALL file

Fixes: #5130

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

6 years agoGet rid of a warning about unused results
Richard Levitte [Sat, 27 Jan 2018 14:00:16 +0000 (15:00 +0100)]
Get rid of a warning about unused results

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

6 years agoTreat C++ flags more like C flags, and only if C++ compiler specified
Richard Levitte [Sat, 27 Jan 2018 13:56:06 +0000 (14:56 +0100)]
Treat C++ flags more like C flags, and only if C++ compiler specified

C++ flags got the same config target value as C flags, but then
nothing else happened while C flags get all kinds of stuff added to
them (especially when --strict-warnings is used).

Now, C++ flags get the exact same treatment as C flags.  However, this
only happens when a C++ compiler is specified, to avoid confusing
messages about added C++ flags.

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

6 years agoFix WinCE config target
Richard Levitte [Sun, 28 Jan 2018 12:26:01 +0000 (13:26 +0100)]
Fix WinCE config target

vc_wince_info()->{defines} was left around, when it should be
vc_wince_info()->{cppflags}

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

6 years agoVMS config.com: better handling of arguments
Richard Levitte [Sun, 28 Jan 2018 09:22:03 +0000 (10:22 +0100)]
VMS config.com: better handling of arguments

Most of all, this change preserves casing a bit better

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

6 years agoUpdate copyright year in mkerr.pl
Steve Linsell [Sun, 28 Jan 2018 11:01:04 +0000 (12:01 +0100)]
Update copyright year in mkerr.pl

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

6 years agoAdd a note on Configure variable processing in NEWS and CHANGES
Richard Levitte [Sat, 27 Jan 2018 15:53:07 +0000 (16:53 +0100)]
Add a note on Configure variable processing in NEWS and CHANGES

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

6 years agoMake sure all our config targets inherit a BASE template
Richard Levitte [Sat, 27 Jan 2018 12:06:39 +0000 (13:06 +0100)]
Make sure all our config targets inherit a BASE template

There were a small number that inherited no BASE, the now inherit
BASE_unix.

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

6 years agoWe need Unixly defaults for config targets that don't inherit a BASE
Richard Levitte [Sat, 27 Jan 2018 12:01:44 +0000 (13:01 +0100)]
We need Unixly defaults for config targets that don't inherit a BASE

Ideally, each config target should inherit a base to get their
platform specific defaults.  Unfortunately, that is currently not the
case, so we duplicate the Unixly defaults from the BASE_unix template
into the DEFAULT template.

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

6 years agoStop having Unix defaults in Configure (partial)
Richard Levitte [Sat, 27 Jan 2018 11:13:35 +0000 (12:13 +0100)]
Stop having Unix defaults in Configure (partial)

Default values belong in the DEFAULT config target template, in
Configurations/00-base-templates.conf.

This isn't a complete move, but takes care of the most blatant
examples.

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

6 years agoProcessing GNU-style "make variables" - implementation
Richard Levitte [Fri, 26 Jan 2018 18:56:44 +0000 (19:56 +0100)]
Processing GNU-style "make variables" - implementation

Support the following "make variables":

AR              (GNU compatible)
ARFLAGS         (GNU Compatible)
AS              (GNU Compatible)
ASFLAGS         (GNU Compatible)
CC              (GNU Compatible)
CFLAGS          (GNU Compatible)
CXX             (GNU Compatible)
CXXFLAGS        (GNU Compatible)
CPP             (GNU Compatible)
CPPFLAGS        (GNU Compatible)
CPPDEFINES      List of CPP macro definitions.  Alternative for -D
CPPINCLUDES     List of CPP inclusion directories.  Alternative for -I
HASHBANGPERL    Perl invocation to be inserted after '#!' in public
                perl scripts.
LDFLAGS         (GNU Compatible)
LDLIBS          (GNU Compatible)
RANLIB          Program to generate library archive index
RC              Program to manipulate Windows resources
RCFLAGS         Flags for $(RC)
RM              (GNU Compatible)

Setting one of these overrides the corresponding data from our config
targets.  However, flags given directly on the configuration command
line are additional, and are therefore added to the flags coming from
one of the variables above or the config target.

Fixes #2420

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

6 years agoProcessing GNU-style "make variables" - separate CPP flags from C flags
Richard Levitte [Tue, 23 Jan 2018 12:54:55 +0000 (13:54 +0100)]
Processing GNU-style "make variables" - separate CPP flags from C flags

C preprocessor flags get separated from C flags, which has the
advantage that we don't get loads of macro definitions and inclusion
directory specs when linking shared libraries, DSOs and programs.

This is a step to add support for "make variables" when configuring.

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

6 years agoFix some style nits in commit eee8a40
Bernd Edlinger [Fri, 26 Jan 2018 18:15:28 +0000 (19:15 +0100)]
Fix some style nits in commit eee8a40

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

6 years agoCatch some more old sigalg names in comments
Benjamin Kaduk [Fri, 26 Jan 2018 15:23:57 +0000 (09:23 -0600)]
Catch some more old sigalg names in comments

Make the sigalg name in comments reflect one that actually exists
in the draft standard.

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

6 years agoFix ssl-trace with TLS 1.3 draft-23 PSS sigalgs
Benjamin Kaduk [Fri, 26 Jan 2018 15:21:08 +0000 (09:21 -0600)]
Fix ssl-trace with TLS 1.3 draft-23 PSS sigalgs

The latest TLS 1.3 draft split the RSA-PSS signature schemes into
two versions that indicate the OID of the RSA key being used.
This forced us to rename the preprocessor defines for the sigalg
values, and the ssl-trace code was not adopted to match, since
it was not enabled int the default build.

Belatedly update the ssl_sigalg_tbl in the trace code to match.

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

6 years agoFix uninitialized read in sigalg parsing code
Benjamin Kaduk [Fri, 26 Jan 2018 01:30:54 +0000 (19:30 -0600)]
Fix uninitialized read in sigalg parsing code

The check for a duplicate value was reading one entry past
where it was supposed to, getting an uninitialized value.

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

6 years agoAdd TLSProxy tests for signature_algorithms_cert
Benjamin Kaduk [Wed, 24 Jan 2018 20:45:08 +0000 (14:45 -0600)]
Add TLSProxy tests for signature_algorithms_cert

We don't need to send this extension in normal operation since
we are our own X.509 library, but add some test cases that force
the extension to be sent and exercise our code to process the extension.

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

6 years agoAdd support for the TLS 1.3 signature_algorithms_cert extension
Benjamin Kaduk [Thu, 11 Jan 2018 17:47:12 +0000 (11:47 -0600)]
Add support for the TLS 1.3 signature_algorithms_cert extension

The new extension is like signature_algorithms, but only for the
signature *on* the certificate we will present to the peer (the
old signature_algorithms extension is still used for signatures that
we *generate*, i.e., those over TLS data structures).

We do not need to generate this extension, since we are the same
implementation as our X.509 stack and can handle the same types
of signatures, but we need to be prepared to receive it, and use the received
information when selecting what certificate to present.

There is a lot of interplay between signature_algorithms_cert and
signature_algorithms, since both affect what certificate we can
use, and thus the resulting signature algorithm used for TLS messages.
So, apply signature_algorithms_cert (if present) as a filter on what
certificates we can consider when choosing a certificate+sigalg
pair.

As part of this addition, we also remove the fallback code that let
keys of type EVP_PKEY_RSA be used to generate RSA-PSS signatures -- the
new rsa_pss_pss_* and rsa_pss_rsae_* signature schemes have pulled
the key type into what is covered by the signature algorithm, so
we should not apply this sort of compatibility workaround.

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

6 years agoUpdate documentation for SSL_set1_sigalgs()
Benjamin Kaduk [Thu, 18 Jan 2018 05:21:19 +0000 (23:21 -0600)]
Update documentation for SSL_set1_sigalgs()

These functions can now take both "sig+hash" strings and
algorithm-specific identifiers like "rsa_pss_pss_sha256" that
indicate a particular entry from the TLS signature algorithm
registry.

Also clarify that only the "_list" form allows for the new-style names
(the non-"list" interfaces take sig and hasn NIDs, which cannot
access all of the new-style schemes).

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

6 years agoPropagate TLS 1.3 sigalgs through tls1_set_sigalgs()
Benjamin Kaduk [Wed, 17 Jan 2018 17:55:29 +0000 (11:55 -0600)]
Propagate TLS 1.3 sigalgs through tls1_set_sigalgs()

Our historical SSL{,_CTX}_set_sigalgs() APIs take an array of
NID pairs (hash and signature), and our parser for manually
specifying unified sigalgs (that do not necessarily correspond
to an actual signature+hash pair) was transiting via (the implementation
of) this historical API.  The TLS 1.3 draft-23 has introduced
signature schemes that have identical signature type and hash type,
differing only in the (RSA) public key OID, which prevents
the rsa_pss_pss_* schemes from being properly identified and
sent on the wire.

To fix the issue, parse sigalg strings directly into SIGALG_LOOKUP
objects, and pass around an array of uint16 wire protocol values
instead of NID pairs.  The old interface is retained for API
compatibility but will become less and less useful with time.

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

6 years agoAdd TLS 1.3 draft-23 PSS signature algorithms
Benjamin Kaduk [Thu, 11 Jan 2018 19:39:30 +0000 (13:39 -0600)]
Add TLS 1.3 draft-23 PSS signature algorithms

We now have a split in the signature algorithms codepoint space for
whether the certificate's key is for rsaEncryption or a PSS-specific
key, which should let us get rid of some special-casing that we
previously needed to try to coax rsaEncryption keys into performing PSS.
(This will be done in a subsequent commit.)

Send the new PSS-with-PSS-specific key first in our list, so that
we prefer the new technology to the old one.

We need to update the expected certificate type in one test,
since the "RSA-PSS+SHA256" form now corresponds to a public key
of type rsaEncryption, so we should expect the server certificate
type to be just "RSA".  If we want to get a server certificate
type of "RSA-PSS", we need to use a new signature algorithm
that cannot be represented as signature+hash, so add a test for that
as well.

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

6 years agoRenumber TLSEXT_TYPE_key_share for draft-23
Benjamin Kaduk [Thu, 11 Jan 2018 16:55:05 +0000 (10:55 -0600)]
Renumber TLSEXT_TYPE_key_share for draft-23

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

6 years agoBump TLS1_3_VERSION_DRAFT for draft-23
Benjamin Kaduk [Thu, 11 Jan 2018 16:49:33 +0000 (10:49 -0600)]
Bump TLS1_3_VERSION_DRAFT for draft-23

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

6 years agoMake the s_server command listen on IPv6 only when requested
Bernd Edlinger [Tue, 23 Jan 2018 16:43:45 +0000 (17:43 +0100)]
Make the s_server command listen on IPv6 only when requested

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

6 years agoFix setting of IPV6_V6ONLY on Windows
Bernd Edlinger [Thu, 25 Jan 2018 14:16:18 +0000 (15:16 +0100)]
Fix setting of IPV6_V6ONLY on Windows

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

6 years agoFix signature of min/max proto getter
Christian Heimes [Sun, 21 Jan 2018 09:37:59 +0000 (10:37 +0100)]
Fix signature of min/max proto getter

The getters for min and max proto version wrongly passed NULL instead of
0 as third argument to SSL_ctrl() and SSL_CTX_ctrl(). The third argument
is not used, but the error results in a compiler warning:

warning: passing argument 3 of ‘SSL_CTX_ctrl’ makes integer from pointer without a cast [-Wint-conversion]
int v = SSL_CTX_get_max_proto_version(self->ctx);

See https://github.com/openssl/openssl/pull/4364

Signed-off-by: Christian Heimes <christian@python.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Ben Kaduk <kaduk@mit.edu>
(Merged from https://github.com/openssl/openssl/pull/5128)

6 years agoFix SSL_CTX_get_{min,max}_proto_version integer conversion warning
Steffan Karger [Wed, 17 Jan 2018 16:06:41 +0000 (17:06 +0100)]
Fix SSL_CTX_get_{min,max}_proto_version integer conversion warning

When using the SSL_CTX_get_min_min_version macro while compiling with
-Wall, my compiler rightfully complains about this construction:

warning: passing argument 3 of ‘SSL_CTX_ctrl’ makes integer from
pointer without a cast [-Wint-conversion]

These macro's should use 0, instead of NULL, for the third argument,
like most other SSL_CTX_ctrl 'get' wrappers do.

CLA: trivial
Signed-off-by: Steffan Karger <steffan.karger@fox-it.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Ben Kaduk <kaduk@mit.edu>
(Merged from https://github.com/openssl/openssl/pull/5099)

6 years agoAdded "B" tag to all variables.
David Cooper [Wed, 24 Jan 2018 17:27:19 +0000 (12:27 -0500)]
Added "B" tag to all variables.

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

6 years agoAdd documentation for the OCSP_basic_sign() and OCSP_basic_sign_ctx() functions.
David Cooper [Wed, 24 Jan 2018 16:47:23 +0000 (11:47 -0500)]
Add documentation for the OCSP_basic_sign() and OCSP_basic_sign_ctx() functions.

Correct error return value in OCSP_basic_sign().

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

6 years agoMake editorial changes suggested by Matt Caswell and fixed Travis failures.
David Cooper [Tue, 23 Jan 2018 19:22:17 +0000 (14:22 -0500)]
Make editorial changes suggested by Matt Caswell and fixed Travis failures.

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

6 years agoMake editorial changes suggested by Rich Salz and add the -rsigopt option to the...
David Cooper [Tue, 12 Dec 2017 21:01:22 +0000 (16:01 -0500)]
Make editorial changes suggested by Rich Salz and add the -rsigopt option to the man page for the ocsp command.

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

6 years agoAdd -rsigopt option to ocsp command
David Cooper [Fri, 18 Aug 2017 13:27:19 +0000 (09:27 -0400)]
Add -rsigopt option to ocsp command

Add a -rsigopt option to the ocsp command that allows signature parameters to be provided for the signing of OCSP responses. The parameters that may be provided to -rsigopt are the same as may be provided to -sigopt in the ca, req, and x509 commands.

This PR also defines a OCSP_basic_sign_ctx() function, which functions in the same way as OCSP_basic_sign(), except that it accepts a EVP_MD_CTX rather than a key and digest. The OCSP_basic_sign_ctx() function is used to implement the -rsigopt option in the ocsp command.

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

6 years agoFix error-path memory leak in asn_mime.c
Todd Short [Mon, 22 Jan 2018 19:30:24 +0000 (14:30 -0500)]
Fix error-path memory leak in asn_mime.c

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

6 years agoUpdates following review of SSL_stateless() code
Matt Caswell [Tue, 23 Jan 2018 12:23:23 +0000 (12:23 +0000)]
Updates following review of SSL_stateless() code

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

6 years agoAdd a timestamp to the cookie
Matt Caswell [Wed, 17 Jan 2018 14:29:22 +0000 (14:29 +0000)]
Add a timestamp to the cookie

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

6 years agoAdd the ability for s_server to operate statelessly
Matt Caswell [Fri, 29 Dec 2017 17:37:04 +0000 (17:37 +0000)]
Add the ability for s_server to operate statelessly

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

6 years agoDon't send unexpected_message if we receive CCS while stateless
Matt Caswell [Fri, 29 Dec 2017 17:36:28 +0000 (17:36 +0000)]
Don't send unexpected_message if we receive CCS while stateless

Probably this is the CCS between the first and second ClientHellos. It
should be ignored.

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

6 years agoAdd documentation for SSL_stateless()
Matt Caswell [Thu, 28 Sep 2017 14:05:58 +0000 (15:05 +0100)]
Add documentation for SSL_stateless()

Fixes #4283

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

6 years agoFix the cookie/key_share extensions for use with SSL_stateless()
Matt Caswell [Thu, 28 Sep 2017 12:25:23 +0000 (13:25 +0100)]
Fix the cookie/key_share extensions for use with SSL_stateless()

Fixes some bugs identified during testing.

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

6 years agoFix the SSL_stateless() return code
Matt Caswell [Thu, 28 Sep 2017 12:24:58 +0000 (13:24 +0100)]
Fix the SSL_stateless() return code

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

6 years agoFix interaction between SSL_stateless() and SSL_clear()
Matt Caswell [Thu, 28 Sep 2017 12:23:49 +0000 (13:23 +0100)]
Fix interaction between SSL_stateless() and SSL_clear()

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

6 years agoAdd some tests for the SSL_stateless() capability
Matt Caswell [Wed, 27 Sep 2017 08:46:38 +0000 (09:46 +0100)]
Add some tests for the SSL_stateless() capability

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

6 years agoFix logic around when to send an HRR based on cookies
Matt Caswell [Wed, 13 Sep 2017 13:50:49 +0000 (14:50 +0100)]
Fix logic around when to send an HRR based on cookies

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

6 years agoAdd the SSL_stateless() function
Matt Caswell [Wed, 13 Sep 2017 12:48:48 +0000 (13:48 +0100)]
Add the SSL_stateless() function

This enables sending and receiving of the TLSv1.3 cookie on the server side
as appropriate.

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

6 years agoEnable the cookie callbacks to work even in TLS in the apps
Matt Caswell [Tue, 12 Sep 2017 15:19:09 +0000 (16:19 +0100)]
Enable the cookie callbacks to work even in TLS in the apps

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

6 years agoAdd support for sending TLSv1.3 cookies
Matt Caswell [Mon, 11 Sep 2017 14:43:56 +0000 (15:43 +0100)]
Add support for sending TLSv1.3 cookies

This just adds the various extension functions. More changes will be
required to actually use them.

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

6 years agoSmall cleanup of some build.info files
Richard Levitte [Tue, 23 Jan 2018 18:16:29 +0000 (19:16 +0100)]
Small cleanup of some build.info files

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

6 years agoConfigure: ensure that a DEPEND generates the correct inclusion directory
Richard Levitte [Tue, 23 Jan 2018 18:13:48 +0000 (19:13 +0100)]
Configure: ensure that a DEPEND generates the correct inclusion directory

We incorrectly assumed that explicit dependencies meant that the
source directory would be added for inclusion.  However, if the
dependent file is generated, it's stored in the build directory, and
that should be used for inclusion rather than the source directory.

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

6 years agoConfigure: let INCLUDEs set on binaries "trickle down" to the objects
Richard Levitte [Tue, 23 Jan 2018 18:07:14 +0000 (19:07 +0100)]
Configure: let INCLUDEs set on binaries "trickle down" to the objects

This ensures that only one set of includes is associated with each
object file, reagardless of where it's used.

For example, if apps/build.info has this:

    SOURCE[openssl]=foo.c
    INCLUDE[openssl]=.. ../include

and test/build.info has this:

    SOURCE[footest]=../apps/foo.c
    INCLUDE[footest]=../include

The inclusion directories used for apps/foo.o would differ depending
on which program's dependencies get generated first in the build file.

With this change, all those INCLUDEs get combined into one set of
inclusion directories tied to the object file.

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

6 years agoSHA512/224 and SHA512/256
Pauli [Wed, 17 Jan 2018 03:20:22 +0000 (13:20 +1000)]
SHA512/224 and SHA512/256

Support added for these two digests, available only via the EVP interface.

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

6 years agoHave EVP_PKEY_asn1_find_str() work more like EVP_PKEY_asn1_find()
Richard Levitte [Mon, 22 Jan 2018 18:03:37 +0000 (19:03 +0100)]
Have EVP_PKEY_asn1_find_str() work more like EVP_PKEY_asn1_find()

EVP_PKEY_asn1_find_str() would search through standard asn1 methods
first, then those added by the application, which EVP_PKEY_asn1_find()
worked the other way around.  Also, EVP_PKEY_asn1_find_str() didn't
handle aliases.

This change brings EVP_PKEY_asn1_find_str() closer to EVP_PKEY_asn1_find().

Fixes #5086

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

6 years agoRevert "EVP_PKEY_asn1_add0(): Check that this method isn't already registered"
Richard Levitte [Mon, 22 Jan 2018 17:24:55 +0000 (18:24 +0100)]
Revert "EVP_PKEY_asn1_add0(): Check that this method isn't already registered"

This reverts commit d85722d31ac9ff0dc54c06cdc8d125acf56ca27a.

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

6 years agoFix no-ec --strict-warnings builds
Benjamin Kaduk [Tue, 23 Jan 2018 13:31:36 +0000 (07:31 -0600)]
Fix no-ec --strict-warnings builds

The 'loop' variable is only used if EC is available.

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

6 years agoImprove some BN documentation.
Rich Salz [Mon, 22 Jan 2018 19:41:09 +0000 (14:41 -0500)]
Improve some BN documentation.

Thanks to Nicolas Schodet for pointing this out.

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

6 years agoDon't add $(EX_LIBS) to libssl.pc's Libs.private
Richard Levitte [Mon, 22 Jan 2018 15:53:23 +0000 (16:53 +0100)]
Don't add $(EX_LIBS) to libssl.pc's Libs.private

Since libssl requires libcrypto and libcrypto.pc already has
Libs.private set exactly the same, there's no reason to repeat it in
libssl.pc.

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

6 years agoAdd anything specifying a threads library to ex_libs
Richard Levitte [Mon, 22 Jan 2018 15:50:54 +0000 (16:50 +0100)]
Add anything specifying a threads library to ex_libs

Even -pthread gets treated that way.  The reason to do this is so it
ends up in 'Libs.private' in libcrypto.pc.

Fixes #3884

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

6 years agoWhen building shared libraries, only ln -s when simple and full name differ
Richard Levitte [Mon, 22 Jan 2018 21:02:36 +0000 (22:02 +0100)]
When building shared libraries, only ln -s when simple and full name differ

Fixes #5143

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