openssl.git
7 years agoConstify certificate and CRL time routines.
Dr. Stephen Henson [Fri, 19 Aug 2016 11:39:57 +0000 (12:39 +0100)]
Constify certificate and CRL time routines.

Update certificate and CRL time routines to match new standard.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoAdd -dane_ee_no_namechecks s_client(1) option
Viktor Dukhovni [Fri, 19 Aug 2016 15:59:47 +0000 (11:59 -0400)]
Add -dane_ee_no_namechecks s_client(1) option

The DANE API supports a DANE_FLAG_NO_DANE_EE_NAMECHECKS option, but
there was no way to exercise/enable it via s_client.  This commit
addresses that gap.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoSet certificate times in one function.
Dr. Stephen Henson [Fri, 19 Aug 2016 15:21:21 +0000 (16:21 +0100)]
Set certificate times in one function.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoAvoid duplicated code.
Dr. Stephen Henson [Fri, 19 Aug 2016 15:12:31 +0000 (16:12 +0100)]
Avoid duplicated code.

The certificate and CRL time setting functions used similar code,
combine into a single utility function.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoRT3940: For now, just document the issue.
Rich Salz [Sat, 13 Aug 2016 14:47:50 +0000 (10:47 -0400)]
RT3940: For now, just document the issue.

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoMEMPACKET is typedef'd in ssltestlib.h, don't do so again in ssltestlib.c
Richard Levitte [Fri, 19 Aug 2016 15:14:26 +0000 (17:14 +0200)]
MEMPACKET is typedef'd in ssltestlib.h, don't do so again in ssltestlib.c

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoAllow to run all speed test when async_jobs active
FdaSilvaYY [Thu, 18 Aug 2016 06:44:43 +0000 (08:44 +0200)]
Allow to run all speed test when async_jobs active

... without any interruption.

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

7 years agomake update
Dr. Stephen Henson [Fri, 19 Aug 2016 11:59:55 +0000 (12:59 +0100)]
make update

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoConvert PKCS12* functions to use const getters
Matt Caswell [Sat, 13 Aug 2016 11:07:42 +0000 (12:07 +0100)]
Convert PKCS12* functions to use const getters

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Stephen Henson <steve@openssl.org>
7 years agoUpdate function error code
Matt Caswell [Fri, 19 Aug 2016 12:50:01 +0000 (13:50 +0100)]
Update function error code

A function error code needed updating due to merge issues.

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoFix some clang warnings
Matt Caswell [Tue, 19 Jul 2016 10:34:21 +0000 (11:34 +0100)]
Fix some clang warnings

Clang was complaining about some unused functions. Moving the stack
declaration to the header seems to sort it. Also the certstatus variable
in dtlstest needed to be declared static.

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoFix DTLS replay protection
Matt Caswell [Fri, 1 Jul 2016 14:20:33 +0000 (15:20 +0100)]
Fix DTLS replay protection

The DTLS implementation provides some protection against replay attacks
in accordance with RFC6347 section 4.1.2.6.

A sliding "window" of valid record sequence numbers is maintained with
the "right" hand edge of the window set to the highest sequence number we
have received so far. Records that arrive that are off the "left" hand
edge of the window are rejected. Records within the window are checked
against a list of records received so far. If we already received it then
we also reject the new record.

If we have not already received the record, or the sequence number is off
the right hand edge of the window then we verify the MAC of the record.
If MAC verification fails then we discard the record. Otherwise we mark
the record as received. If the sequence number was off the right hand edge
of the window, then we slide the window along so that the right hand edge
is in line with the newly received sequence number.

Records may arrive for future epochs, i.e. a record from after a CCS being
sent, can arrive before the CCS does if the packets get re-ordered. As we
have not yet received the CCS we are not yet in a position to decrypt or
validate the MAC of those records. OpenSSL places those records on an
unprocessed records queue. It additionally updates the window immediately,
even though we have not yet verified the MAC. This will only occur if
currently in a handshake/renegotiation.

This could be exploited by an attacker by sending a record for the next
epoch (which does not have to decrypt or have a valid MAC), with a very
large sequence number. This means the right hand edge of the window is
moved very far to the right, and all subsequent legitimate packets are
dropped causing a denial of service.

A similar effect can be achieved during the initial handshake. In this
case there is no MAC key negotiated yet. Therefore an attacker can send a
message for the current epoch with a very large sequence number. The code
will process the record as normal. If the hanshake message sequence number
(as opposed to the record sequence number that we have been talking about
so far) is in the future then the injected message is bufferred to be
handled later, but the window is still updated. Therefore all subsequent
legitimate handshake records are dropped. This aspect is not considered a
security issue because there are many ways for an attacker to disrupt the
initial handshake and prevent it from completing successfully (e.g.
injection of a handshake message will cause the Finished MAC to fail and
the handshake to be aborted). This issue comes about as a result of trying
to do replay protection, but having no integrity mechanism in place yet.
Does it even make sense to have replay protection in epoch 0? That
issue isn't addressed here though.

This addressed an OCAP Audit issue.

CVE-2016-2181

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoAdd DTLS replay protection test
Matt Caswell [Tue, 5 Jul 2016 08:50:55 +0000 (09:50 +0100)]
Add DTLS replay protection test

Injects a record from epoch 1 during epoch 0 handshake, with a record
sequence number in the future, to test that the record replay protection
feature works as expected. This is described more fully in the next commit.

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoFix DTLS unprocessed records bug
Matt Caswell [Tue, 5 Jul 2016 08:51:08 +0000 (09:51 +0100)]
Fix DTLS unprocessed records bug

During a DTLS handshake we may get records destined for the next epoch
arrive before we have processed the CCS. In that case we can't decrypt or
verify the record yet, so we buffer it for later use. When we do receive
the CCS we work through the queue of unprocessed records and process them.

Unfortunately the act of processing wipes out any existing packet data
that we were still working through. This includes any records from the new
epoch that were in the same packet as the CCS. We should only process the
buffered records if we've not got any data left.

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoAdd a DTLS unprocesed records test
Matt Caswell [Mon, 4 Jul 2016 13:59:06 +0000 (14:59 +0100)]
Add a DTLS unprocesed records test

Add a test to inject a record from the next epoch during the handshake and
make sure it doesn't get processed immediately.

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoSplit create_ssl_connection()
Matt Caswell [Mon, 4 Jul 2016 13:55:50 +0000 (14:55 +0100)]
Split create_ssl_connection()

Split the create_ssl_connection() helper function into two steps: one to
create the SSL objects, and one to actually create the connection. This
provides the ability to make changes to the SSL object before the
connection is actually made.

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoAdd a DTLS packet mem BIO
Matt Caswell [Mon, 4 Jul 2016 13:53:28 +0000 (14:53 +0100)]
Add a DTLS packet mem BIO

This adds a BIO similar to a normal mem BIO but with datagram awareness.
It also has the capability to inject additional packets at arbitrary
locations into the BIO, for testing purposes.

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoAdd a (D)TLS dumper BIO
Matt Caswell [Mon, 4 Jul 2016 13:51:56 +0000 (14:51 +0100)]
Add a (D)TLS dumper BIO

Dump out the records passed over the BIO. Only works for DTLS at the
moment but could easily be extended to TLS.

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoAdd more details on how to add a new SSL test
Emilia Kasper [Fri, 19 Aug 2016 12:19:32 +0000 (14:19 +0200)]
Add more details on how to add a new SSL test

Reviewed-by: Stephen Henson <steve@openssl.org>
7 years agomake update
Dr. Stephen Henson [Thu, 18 Aug 2016 14:26:47 +0000 (15:26 +0100)]
make update

Reviewed-by: Matt Caswell <matt@openssl.org>
7 years agoAdd X509_get0_serialNumber() and constify OCSP_cert_to_id()
Dr. Stephen Henson [Thu, 18 Aug 2016 14:16:31 +0000 (15:16 +0100)]
Add X509_get0_serialNumber() and constify OCSP_cert_to_id()

Reviewed-by: Matt Caswell <matt@openssl.org>
7 years agoconstify X509_REQ_get0_signature()
Dr. Stephen Henson [Thu, 18 Aug 2016 14:13:00 +0000 (15:13 +0100)]
constify X509_REQ_get0_signature()

Reviewed-by: Matt Caswell <matt@openssl.org>
7 years agoconstify i2o_ECPublicKey
Dr. Stephen Henson [Thu, 18 Aug 2016 12:59:32 +0000 (13:59 +0100)]
constify i2o_ECPublicKey

Reviewed-by: Matt Caswell <matt@openssl.org>
7 years agoSort %disabled in Configure
Benjamin Kaduk [Thu, 18 Aug 2016 20:47:04 +0000 (15:47 -0500)]
Sort %disabled in Configure

@disablables is sorted, but these were just added at the end of
%disabled in commits c2e27310 and 22e3dcb7.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
7 years agoFix missing dane_tlsa_rrdata option error message
Viktor Dukhovni [Thu, 18 Aug 2016 20:57:55 +0000 (16:57 -0400)]
Fix missing dane_tlsa_rrdata option error message

The error message said "dane_tlsa_rrset" instead of "dane_tlsa_rrdata".

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoConstify i2a*
Dr. Stephen Henson [Thu, 18 Aug 2016 15:48:33 +0000 (16:48 +0100)]
Constify i2a*

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoSimplify indentation of DECLARE_ and IMPLEMENT_ lines
Richard Levitte [Thu, 18 Aug 2016 11:24:27 +0000 (13:24 +0200)]
Simplify indentation of DECLARE_ and IMPLEMENT_ lines

There's no reason we should enumerate every type of IMPLEMENT_ and
DECLARE_ line (and forget the ones we add a little now and then).
They all start with the same first word, let's just take'm all.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoIndent ssl/
Emilia Kasper [Fri, 5 Aug 2016 17:03:17 +0000 (19:03 +0200)]
Indent ssl/

Run util/openssl-format-source on ssl/

Some comments and hand-formatted tables were fixed up
manually by disabling auto-formatting.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoConvert X509_REVOKED* functions to use const getters
Matt Caswell [Mon, 15 Aug 2016 11:41:25 +0000 (12:41 +0100)]
Convert X509_REVOKED* functions to use const getters

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Stephen Henson <steve@openssl.org>
7 years agoTest that the peers send at most one fatal alert
Emilia Kasper [Fri, 12 Aug 2016 12:29:24 +0000 (14:29 +0200)]
Test that the peers send at most one fatal alert

Duplicate alerts have happened, see
70c22888c1648fe8652e77107f3c74bf2212de36

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoPort multi-buffer tests
Emilia Kasper [Tue, 16 Aug 2016 13:11:08 +0000 (15:11 +0200)]
Port multi-buffer tests

Make maximum fragment length configurable and add various fragmentation
tests, in addition to the existing multi-buffer tests.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoFix some doc nits.
Rich Salz [Wed, 17 Aug 2016 20:38:08 +0000 (16:38 -0400)]
Fix some doc nits.

Reviewed-by: Matt Caswell <matt@openssl.org>
7 years agoDon't try to init dasync internally
Richard Levitte [Wed, 17 Aug 2016 13:06:23 +0000 (15:06 +0200)]
Don't try to init dasync internally

Since dasync isn't installed, and is only ever used as a dynamic
engine, there's no reason to consider it for initialization when
building static engines.

Reviewed-by: Ben Laurie <ben@openssl.org>
7 years agomake update
Dr. Stephen Henson [Wed, 17 Aug 2016 16:29:18 +0000 (17:29 +0100)]
make update

Reviewed-by: Matt Caswell <matt@openssl.org>
7 years agoConstify X509_SIG.
Dr. Stephen Henson [Wed, 17 Aug 2016 16:27:05 +0000 (17:27 +0100)]
Constify X509_SIG.

Constify X509_SIG_get0() and order arguments to mactch new standard.

Add X509_SIG_get0_mutable() to support modification or initialisation
of an X509_SIG structure.

Reviewed-by: Matt Caswell <matt@openssl.org>
7 years agoSmall nits and cleanups
FdaSilvaYY [Sun, 7 Aug 2016 10:04:26 +0000 (12:04 +0200)]
Small nits and cleanups

using util/openssl-format-source on s_derver, s_client, ca.c, speed.c only...

Fix/merge some #ifndef

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
7 years agoConstify char* input parameters in apps code
FdaSilvaYY [Thu, 4 Aug 2016 21:52:22 +0000 (23:52 +0200)]
Constify char* input parameters in apps code

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
7 years agoSimplify and add help about OPT_PVK* options
FdaSilvaYY [Thu, 4 Aug 2016 22:19:36 +0000 (00:19 +0200)]
Simplify and add help about OPT_PVK* options

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
7 years agoImprove error message
FdaSilvaYY [Wed, 3 Aug 2016 22:23:39 +0000 (00:23 +0200)]
Improve error message

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
7 years agoRelocalise some globals variables
FdaSilvaYY [Wed, 3 Aug 2016 20:49:25 +0000 (22:49 +0200)]
Relocalise some globals variables

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
7 years agoConstify ssl_cert_type()
Dr. Stephen Henson [Wed, 17 Aug 2016 14:49:36 +0000 (15:49 +0100)]
Constify ssl_cert_type()

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoConstify X509_certificate_type()
Dr. Stephen Henson [Wed, 17 Aug 2016 13:58:56 +0000 (14:58 +0100)]
Constify X509_certificate_type()

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoConstify X509_get0_signature()
Dr. Stephen Henson [Wed, 17 Aug 2016 13:10:52 +0000 (14:10 +0100)]
Constify X509_get0_signature()

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoConvert X509* functions to use const getters
Dr. Stephen Henson [Wed, 17 Aug 2016 12:50:48 +0000 (13:50 +0100)]
Convert X509* functions to use const getters

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoConvert X509_CRL* functions to use const getters
Matt Caswell [Sat, 13 Aug 2016 13:44:07 +0000 (14:44 +0100)]
Convert X509_CRL* functions to use const getters

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Stephen Henson <steve@openssl.org>
7 years agoMake X509_NAME_get0_der() conform to OpenSSL style
Matt Caswell [Mon, 15 Aug 2016 09:07:30 +0000 (10:07 +0100)]
Make X509_NAME_get0_der() conform to OpenSSL style

Put the main object first in the params list.

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Stephen Henson <steve@openssl.org>
7 years agoCorrupt signature in place.
Dr. Stephen Henson [Wed, 17 Aug 2016 11:34:22 +0000 (12:34 +0100)]
Corrupt signature in place.

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoConvert OCSP* functions to use const getters
Matt Caswell [Fri, 12 Aug 2016 20:37:55 +0000 (21:37 +0100)]
Convert OCSP* functions to use const getters

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Stephen Henson <steve@openssl.org>
7 years agoConstify private key decode.
Dr. Stephen Henson [Tue, 16 Aug 2016 23:21:55 +0000 (00:21 +0100)]
Constify private key decode.

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoconstify X509_ALGOR_get0()
Dr. Stephen Henson [Tue, 16 Aug 2016 19:18:04 +0000 (20:18 +0100)]
constify X509_ALGOR_get0()

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoConstify ASN1_item_unpack().
Dr. Stephen Henson [Tue, 16 Aug 2016 19:14:02 +0000 (20:14 +0100)]
Constify ASN1_item_unpack().

Reviewed-by: Richard Levitte <levitte@openssl.org>
7 years agoAdd missing session id and tlsext_status accessors
Remi Gacogne [Sat, 6 Aug 2016 10:54:29 +0000 (12:54 +0200)]
Add missing session id and tlsext_status accessors

 * SSL_SESSION_set1_id()
 * SSL_SESSION_get0_id_context()
 * SSL_CTX_get_tlsext_status_cb()
 * SSL_CTX_get_tlsext_status_arg()

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
7 years agodasync is an internal testing engine, so don't install it
Richard Levitte [Wed, 17 Aug 2016 08:45:03 +0000 (10:45 +0200)]
dasync is an internal testing engine, so don't install it

Unfortunately, it means that the VMS IVP gets a bit crippled.  This
will be fixed later on.

Reviewed-by: Matt Caswell <matt@openssl.org>
7 years agoVMS: no ENDIF on one line IF statements, in config.com
Richard Levitte [Wed, 17 Aug 2016 08:39:11 +0000 (10:39 +0200)]
VMS: no ENDIF on one line IF statements, in config.com

Correct small error from last config.com change

Reviewed-by: Matt Caswell <matt@openssl.org>
7 years agoConvert SSL_SESSION* functions to use const getters
Matt Caswell [Sat, 13 Aug 2016 13:29:41 +0000 (14:29 +0100)]
Convert SSL_SESSION* functions to use const getters

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Stephen Henson <steve@openssl.org>
7 years agoConvert PKCS8* functions to use const getters
Matt Caswell [Sat, 13 Aug 2016 12:40:05 +0000 (13:40 +0100)]
Convert PKCS8* functions to use const getters

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Stephen Henson <steve@openssl.org>
7 years agoConvert TS_STATUS_INFO* functions to use const getters
Matt Caswell [Sat, 13 Aug 2016 13:32:17 +0000 (14:32 +0100)]
Convert TS_STATUS_INFO* functions to use const getters

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Stephen Henson <steve@openssl.org>
7 years agotwo typo fixes
FdaSilvaYY [Thu, 11 Aug 2016 22:29:27 +0000 (00:29 +0200)]
two typo fixes

Reviewed-by: Emilia Käsper <emilia@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1461)

7 years agoFix compilation when using MASM on x86
Gergely Nagy [Tue, 16 Aug 2016 12:46:13 +0000 (14:46 +0200)]
Fix compilation when using MASM on x86

The generated asm code from x86cpuid.pl contains CMOVE instructions
which are only available on i686 and later CPUs.

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

7 years agoProvide compat macros for SSL_CTX_set_ecdh_auto() and SSL_set_ecdh_auto()
Matt Caswell [Tue, 16 Aug 2016 12:28:14 +0000 (13:28 +0100)]
Provide compat macros for SSL_CTX_set_ecdh_auto() and SSL_set_ecdh_auto()

These functions are no longer relevant to 1.1.0 (we always have auto ecdh
on) - but no reason to break old code that tries to call it. The macros will
only return a dummy "success" result if the app was trying to enable ecdh.
Disabling can't be done in quite this way any more.

Fixes Github Issue #1437

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
7 years agoEnsure we unpad in constant time for read pipelining
Matt Caswell [Tue, 16 Aug 2016 13:07:29 +0000 (14:07 +0100)]
Ensure we unpad in constant time for read pipelining

The read pipelining code broke constant time unpadding. See GitHub
issue #1438

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoCorrupt signature earlier.
Dr. Stephen Henson [Tue, 16 Aug 2016 14:19:55 +0000 (15:19 +0100)]
Corrupt signature earlier.

If -badsig is selected corrupt the signature before printing out
any details so the output reflects the modified signature.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agomake update
Dr. Stephen Henson [Tue, 16 Aug 2016 14:08:06 +0000 (15:08 +0100)]
make update

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoAdd ASN1_STRING_get0_data(), deprecate ASN1_STRING_data().
Dr. Stephen Henson [Tue, 16 Aug 2016 13:06:48 +0000 (14:06 +0100)]
Add ASN1_STRING_get0_data(), deprecate ASN1_STRING_data().

Deprecate the function ASN1_STRING_data() and replace with a new function
ASN1_STRING_get0_data() which returns a constant pointer. Update library
to use new function.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoRemove duplicate ordinals
Richard Levitte [Tue, 16 Aug 2016 12:08:54 +0000 (14:08 +0200)]
Remove duplicate ordinals

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoARMv8 assembly pack: add Samsung Mongoose results.
Andy Polyakov [Sun, 14 Aug 2016 20:37:58 +0000 (22:37 +0200)]
ARMv8 assembly pack: add Samsung Mongoose results.

Reviewed-by: Tim Hudson <tjh@openssl.org>
7 years agoConfigure: recognize -static as link option and disable incompatible options.
Andy Polyakov [Sun, 14 Aug 2016 15:24:10 +0000 (17:24 +0200)]
Configure: recognize -static as link option and disable incompatible options.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agotest/ssl_test.tmpl: make it work with elderly perl.
Andy Polyakov [Fri, 12 Aug 2016 14:25:33 +0000 (16:25 +0200)]
test/ssl_test.tmpl: make it work with elderly perl.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoFix satsub64be() to unconditionally use 64-bit integers
David Woodhouse [Fri, 5 Aug 2016 09:58:52 +0000 (10:58 +0100)]
Fix satsub64be() to unconditionally use 64-bit integers

Now we support (u)int64_t this can be very much simpler.

Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
7 years agoSSL tests: send some application data
Emilia Kasper [Thu, 11 Aug 2016 18:51:57 +0000 (20:51 +0200)]
SSL tests: send some application data

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoAdd a "config" for verbosity and use it with Travis
Richard Levitte [Mon, 15 Aug 2016 16:46:39 +0000 (18:46 +0200)]
Add a "config" for verbosity and use it with Travis

Modify VMS config.com to match

Reviewed-by: Emilia Käsper <emilia@openssl.org>
7 years agoMake "make" less verbose in Travis, except for the build only case
Richard Levitte [Mon, 15 Aug 2016 16:45:22 +0000 (18:45 +0200)]
Make "make" less verbose in Travis, except for the build only case

Reviewed-by: Emilia Käsper <emilia@openssl.org>
7 years agoLimit reads in do_b2i_bio()
Dr. Stephen Henson [Mon, 15 Aug 2016 15:52:21 +0000 (16:52 +0100)]
Limit reads in do_b2i_bio()

Apply a limit to the maximum blob length which can be read in do_d2i_bio()
to avoid excessive allocation.

Thanks to Shi Lei for reporting this.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoCheck for errors in a2d_ASN1_OBJECT()
Dr. Stephen Henson [Fri, 5 Aug 2016 13:33:03 +0000 (14:33 +0100)]
Check for errors in a2d_ASN1_OBJECT()

Check for error return in BN_div_word().

Reviewed-by: Tim Hudson <tjh@openssl.org>
7 years agoCheck for errors in BN_bn2dec()
Dr. Stephen Henson [Fri, 5 Aug 2016 13:26:03 +0000 (14:26 +0100)]
Check for errors in BN_bn2dec()

If an oversize BIGNUM is presented to BN_bn2dec() it can cause
BN_div_word() to fail and not reduce the value of 't' resulting
in OOB writes to the bn_data buffer and eventually crashing.

Fix by checking return value of BN_div_word() and checking writes
don't overflow buffer.

Thanks to Shi Lei for reporting this bug.

CVE-2016-2182

Reviewed-by: Tim Hudson <tjh@openssl.org>
7 years agoAvoid truncating the pointer on x32 platform.
Tomas Mraz [Mon, 15 Aug 2016 10:02:06 +0000 (12:02 +0200)]
Avoid truncating the pointer on x32 platform.

The 64 bit pointer must not be cast to 32bit unsigned long on
x32 platform.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
7 years agoAdd a comment for the added cast with explanation.
Tomas Mraz [Wed, 10 Aug 2016 13:21:32 +0000 (15:21 +0200)]
Add a comment for the added cast with explanation.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
7 years agoFix af_alg engine failure on 32 bit architectures.
Tomas Mraz [Tue, 9 Aug 2016 10:50:13 +0000 (12:50 +0200)]
Fix af_alg engine failure on 32 bit architectures.

Add extra cast to unsigned long to avoid sign extension when
converting pointer to 64 bit data.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
7 years agoRemove a stray unneeded line in 70-test_sslrecords.t
Matt Caswell [Thu, 4 Aug 2016 10:31:57 +0000 (11:31 +0100)]
Remove a stray unneeded line in 70-test_sslrecords.t

Reviewed-by: Tim Hudson <tjh@openssl.org>
7 years agoAddress feedback on SSLv2 ClientHello processing
Matt Caswell [Wed, 3 Aug 2016 12:03:25 +0000 (13:03 +0100)]
Address feedback on SSLv2 ClientHello processing

Reviewed-by: Tim Hudson <tjh@openssl.org>
7 years agoAdd some SSLv2 ClientHello tests
Matt Caswell [Tue, 2 Aug 2016 16:24:54 +0000 (17:24 +0100)]
Add some SSLv2 ClientHello tests

Test that we handle a TLS ClientHello in an SSLv2 record correctly.

Reviewed-by: Tim Hudson <tjh@openssl.org>
7 years agoSend an alert if we get a non-initial record with the wrong version
Matt Caswell [Tue, 2 Aug 2016 16:43:32 +0000 (17:43 +0100)]
Send an alert if we get a non-initial record with the wrong version

If we receive a non-initial record but the version number isn't right then
we should send an alert.

Reviewed-by: Tim Hudson <tjh@openssl.org>
7 years agoAddress feedback on SSLv2 ClientHello processing
Matt Caswell [Mon, 1 Aug 2016 16:15:13 +0000 (17:15 +0100)]
Address feedback on SSLv2 ClientHello processing

Feedback on the previous SSLv2 ClientHello processing fix was that it
breaks layering by reading init_num in the record layer. It also does not
detect if there was a previous non-fatal warning.

This is an alternative approach that directly tracks in the record layer
whether this is the first record.

GitHub Issue #1298

Reviewed-by: Tim Hudson <tjh@openssl.org>
7 years agoReplaces CT_POLICY_EVAL_CTX_set0 entries with new setters in libcrypto.num
Rob Percival [Mon, 15 Aug 2016 15:46:22 +0000 (16:46 +0100)]
Replaces CT_POLICY_EVAL_CTX_set0 entries with new setters in libcrypto.num

Reviewed-by: Emilia Käsper <emilia@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1408)

7 years agoMake CT_POLICY_EVAL_CTX_set1_{cert,issuer} into boolean functions
Rob Percival [Mon, 15 Aug 2016 13:47:02 +0000 (14:47 +0100)]
Make CT_POLICY_EVAL_CTX_set1_{cert,issuer} into boolean functions

They may fail if they cannot increment the reference count of the
certificate they are storing a pointer for. They should return 0 if this
occurs.

Reviewed-by: Emilia Käsper <emilia@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1408)

7 years agoImproves CTLOG_STORE setters
Rob Percival [Fri, 5 Aug 2016 13:17:31 +0000 (14:17 +0100)]
Improves CTLOG_STORE setters

Changes them to have clearer ownership semantics, as suggested in
https://github.com/openssl/openssl/pull/1372#discussion_r73232196.

Reviewed-by: Emilia Käsper <emilia@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1408)

7 years agoSkip the SRP tests in 80-test_ssl_old.t if no TLS versions is enabled
Richard Levitte [Mon, 15 Aug 2016 13:58:16 +0000 (15:58 +0200)]
Skip the SRP tests in 80-test_ssl_old.t if no TLS versions is enabled

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoFix no-ec
Dr. Stephen Henson [Mon, 15 Aug 2016 13:07:33 +0000 (14:07 +0100)]
Fix no-ec

Fix no-ec builds by having separate functions to create keys based on
an existing EVP_PKEY and a curve id.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoNever return -1 from BN_exp
Jakub Zelenka [Sun, 14 Aug 2016 19:52:13 +0000 (20:52 +0100)]
Never return -1 from BN_exp

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

7 years agoupdate CHANGES
Dr. Stephen Henson [Sat, 13 Aug 2016 12:49:17 +0000 (13:49 +0100)]
update CHANGES

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoadd documentation
Dr. Stephen Henson [Fri, 12 Aug 2016 16:27:11 +0000 (17:27 +0100)]
add documentation

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoPrint out names of other temp key algorithms.
Dr. Stephen Henson [Thu, 11 Aug 2016 15:37:00 +0000 (16:37 +0100)]
Print out names of other temp key algorithms.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoRemove old EC based X25519 code.
Dr. Stephen Henson [Thu, 11 Aug 2016 14:49:07 +0000 (15:49 +0100)]
Remove old EC based X25519 code.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoModify TLS support for new X25519 API.
Dr. Stephen Henson [Thu, 11 Aug 2016 14:41:49 +0000 (15:41 +0100)]
Modify TLS support for new X25519 API.

When handling ECDH check to see if the curve is "custom" (X25519 is
currently the only curve of this type) and instead of setting a curve
NID just allocate a key of appropriate type.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoAdd encoded points to other EC curves too.
Dr. Stephen Henson [Thu, 11 Aug 2016 14:38:37 +0000 (15:38 +0100)]
Add encoded points to other EC curves too.

Add encoded point ctrl support for other curves: this makes it possible
to handle X25519 and other EC curve point encoding in a similar way
for TLS.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agomake update
Dr. Stephen Henson [Thu, 11 Aug 2016 14:49:57 +0000 (15:49 +0100)]
make update

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoAdd point ctrls to X25519
Dr. Stephen Henson [Wed, 10 Aug 2016 21:30:43 +0000 (22:30 +0100)]
Add point ctrls to X25519

Add ctrl operations to set or retrieve encoded point in
EVP_PKEY structures containing X25519 keys.

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoUpdate X25519 key format in evptests.txt
Dr. Stephen Henson [Wed, 10 Aug 2016 15:04:51 +0000 (16:04 +0100)]
Update X25519 key format in evptests.txt

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoAdd X25519 methods to internal tables
Dr. Stephen Henson [Tue, 9 Aug 2016 20:58:55 +0000 (21:58 +0100)]
Add X25519 methods to internal tables

Reviewed-by: Rich Salz <rsalz@openssl.org>
7 years agoadd to build.info
Dr. Stephen Henson [Tue, 9 Aug 2016 19:25:12 +0000 (20:25 +0100)]
add to build.info

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