oweals/openssl.git
9 years agoFix spurious bntest failures.
Emilia Kasper [Mon, 31 Aug 2015 11:57:44 +0000 (13:57 +0200)]
Fix spurious bntest failures.

BN_bntest_rand generates a single-word zero BIGNUM with quite a large probability.

A zero BIGNUM in turn will end up having a NULL |d|-buffer, which we shouldn't dereference without checking.

Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoRemove the "times" directory.
Rich Salz [Fri, 28 Aug 2015 21:49:30 +0000 (17:49 -0400)]
Remove the "times" directory.

Reviewed-by: Tim Hudson <tjh@openssl.org>
9 years agoFix 4c42ebd; forgot to inutil util/libeay.num
Rich Salz [Fri, 28 Aug 2015 19:53:41 +0000 (15:53 -0400)]
Fix 4c42ebd; forgot to inutil util/libeay.num

Reviewed-by: Tim Hudson <tjh@openssl.org>
9 years agoGH354: Memory leak fixes
Alessandro Ghedini [Fri, 28 Aug 2015 03:07:07 +0000 (23:07 -0400)]
GH354: Memory leak fixes

Fix more potential leaks in X509_verify_cert()
Fix memory leak in ClientHello test
Fix memory leak in gost2814789 test
Fix potential memory leak in PKCS7_verify()
Fix potential memory leaks in X509_add1_reject_object()
Refactor to use "goto err" in cleanup.

Signed-off-by: Rich Salz <rsalz@akamai.com>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
9 years agoGH367: Fix dsa keygen for too-short seed
Ismo Puustinen [Sat, 8 Aug 2015 02:14:47 +0000 (22:14 -0400)]
GH367: Fix dsa keygen for too-short seed

If the seed value for dsa key generation is too short (< qsize),
return an error. Also update the documentation.

Signed-off-by: Rich Salz <rsalz@akamai.com>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
9 years agoFix memory over-read
Rich Salz [Thu, 27 Aug 2015 21:17:26 +0000 (17:17 -0400)]
Fix memory over-read

Fix from David Baggett via tweet.

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoVarious doc fixes.
Rich Salz [Thu, 27 Aug 2015 16:28:08 +0000 (12:28 -0400)]
Various doc fixes.

Make all mention of digest algorithm use "any supported algorithm"

RT2071, some new manpages from Victor B. Wagner <vitus@cryptocom.ru>:
    X509_LOOKUP_hash_dir.pod
    X509_check_ca.pod
    X509_check_issued.pod

RT 1600:
    Remove references to non-existant objects(3)
    Add RETURN VALUES to BIO_do_accept page.

RT1818:
    RSA_sign Can return values other than 0 on failure.

RT3634:
    Fix AES CBC aliases (Steffen Nurpmeso <sdaoden@yandex.com>)

RT3678:
    Some clarifications to BIO_new_pair
    (Devchandra L Meetei <dlmeetei@gmail.com>)

RT3787:
    Fix some EVP_ function return values
    (Laetitia Baudoin <lbaudoin@google.com>)

Reviewed-by: Tim Hudson <tjh@openssl.org>
9 years agoGH350: -help text few s_client and s_server flags
Hubert Kario [Fri, 31 Jul 2015 16:32:39 +0000 (18:32 +0200)]
GH350: -help text few s_client and s_server flags

add -help description of sigalgs, client_sigalgs, curves
and named_curve

Signed-off-by: Rich Salz <rsalz@akamai.com>
Reviewed-by: Tim Hudson <tjh@openssl.org>
9 years agoFixed problem with multiple load-unload of comp zlib
David Brodski [Tue, 13 May 2014 16:06:27 +0000 (18:06 +0200)]
Fixed problem with multiple load-unload of comp zlib

Signed-off-by: Rich Salz <rsalz@akamai.com>
Reviewed-by: Tim Hudson <tjh@openssl.org>
9 years agoGH correct organizationalUnitName
Viktor Dukhovni [Thu, 24 Apr 2014 01:58:30 +0000 (21:58 -0400)]
GH correct organizationalUnitName

Signed-off-by: Rich Salz <rsalz@akamai.com>
Reviewed-by: Tim Hudson <tjh@openssl.org>
9 years agoClean up reset of read/write sequences
Matt Caswell [Wed, 26 Aug 2015 15:22:45 +0000 (16:22 +0100)]
Clean up reset of read/write sequences

Use sizeof instead of an explicit size, and use the functions for the
purpose.

Reviewed-by: Rich Salz <rsalz@openssl.org>
9 years agoPACKET: add methods for reading length-prefixed TLS vectors.
Emilia Kasper [Tue, 18 Aug 2015 10:29:36 +0000 (12:29 +0200)]
PACKET: add methods for reading length-prefixed TLS vectors.

Rewrite ssl3_get_client_hello to use the new methods.

Reviewed-by: Matt Caswell <matt@openssl.org>
9 years agoFix SSLv2-compatible ClientHello processing.
Emilia Kasper [Tue, 18 Aug 2015 17:01:51 +0000 (19:01 +0200)]
Fix SSLv2-compatible ClientHello processing.

If the client challenge is less than 32 bytes, it is padded with leading - not trailing - zero bytes.

Reviewed-by: Matt Caswell <matt@openssl.org>
9 years agoPACKET: constify where possible
Emilia Kasper [Tue, 18 Aug 2015 12:55:53 +0000 (14:55 +0200)]
PACKET: constify where possible

The PACKET should hold a 'const unsigned char*' underneath as well
but the legacy code passes the record buffer around as 'unsigned char*'
(to callbacks, too) so that's a bigger refactor.

Reviewed-by: Matt Caswell <matt@openssl.org>
9 years agoGH371: Print debug info for ALPN extension
Alessandro Ghedini [Wed, 19 Aug 2015 15:12:31 +0000 (17:12 +0200)]
GH371: Print debug info for ALPN extension

Also known as RT 4106
Signed-off-by: Rich Salz <rsalz@akamai.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
9 years agoRemove _locked memory functions.
Rich Salz [Wed, 26 Aug 2015 04:25:11 +0000 (00:25 -0400)]
Remove _locked memory functions.

Undocumented, unused, unnecessary (replaced by secure arena).

Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoBN_bin2bn handle leading zero's
Rich Salz [Mon, 10 Aug 2015 16:45:25 +0000 (12:45 -0400)]
BN_bin2bn handle leading zero's

If a binary sequence is all zero's, call BN_zero.

Reviewed-by: Matt Caswell <matt@openssl.org>
9 years agoAdd NewSessionTicket test suite
Matt Caswell [Thu, 13 Aug 2015 14:17:14 +0000 (15:17 +0100)]
Add NewSessionTicket test suite

Add a set of tests for checking that NewSessionTicket messages are
behaving as expected.

Reviewed-by: Tim Hudson <tjh@openssl.org>
9 years agoFix TLSProxy end of test detection
Matt Caswell [Thu, 13 Aug 2015 15:58:20 +0000 (16:58 +0100)]
Fix TLSProxy end of test detection

Previously TLSProxy would detect a successful handshake once it saw the
server Finished message. This causes problems with abbreviated handshakes,
or if the client fails to process a message from the last server flight.

This change additionally sends some application data and finishes when the
client sends a CloseNotify.

Reviewed-by: Tim Hudson <tjh@openssl.org>
9 years agoFix DTLS session ticket renewal
Matt Caswell [Thu, 13 Aug 2015 09:06:30 +0000 (10:06 +0100)]
Fix DTLS session ticket renewal

A DTLS client will abort a handshake if the server attempts to renew the
session ticket. This is caused by a state machine discrepancy between DTLS
and TLS discovered during the state machine rewrite work.

The bug can be demonstrated as follows:

Start a DTLS s_server instance:
openssl s_server -dtls

Start a client and obtain a session but no ticket:
openssl s_client -dtls -sess_out session.pem -no_ticket

Now start a client reusing the session, but allow a ticket:
openssl s_client -dtls -sess_in session.pem

The client will abort the handshake.

Reviewed-by: Tim Hudson <tjh@openssl.org>
9 years agoIgnore generated *.S ARM assembly files
Chris Watts [Mon, 24 Aug 2015 22:56:31 +0000 (15:56 -0700)]
Ignore generated *.S ARM assembly files

Signed-off-by: Rich Salz <rsalz@akamai.com>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
9 years agoRT4019: Duplicate -hmac flag in dgst.pod
Markus Rinne [Mon, 24 Aug 2015 20:20:13 +0000 (16:20 -0400)]
RT4019: Duplicate -hmac flag in dgst.pod

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
9 years agoGH372: Remove duplicate flags
Rich Salz [Mon, 24 Aug 2015 19:25:14 +0000 (15:25 -0400)]
GH372: Remove duplicate flags

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
9 years agoSmall cleanup of crypto.pod
Rich Salz [Mon, 24 Aug 2015 21:54:54 +0000 (17:54 -0400)]
Small cleanup of crypto.pod

Came up on the mailing list, from Ken Goldman.

Reviewed-by: Tim Hudson <tjh@openssl.org>
9 years agoGH337: Need backslash before leading #
Peter Mosmans [Mon, 24 Aug 2015 19:13:48 +0000 (15:13 -0400)]
GH337: Need backslash before leading #

Signed-off-by: Rich Salz <rsalz@akamai.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoRT4015: Add missing date to CHANGES
janpopan [Mon, 24 Aug 2015 19:21:27 +0000 (15:21 -0400)]
RT4015: Add missing date to CHANGES

Signed-off-by: Rich Salz <rsalz@akamai.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoMore test cases.
Dr. Stephen Henson [Mon, 24 Aug 2015 14:04:47 +0000 (15:04 +0100)]
More test cases.

Add DSA tests.

Add tests to verify signatures against public keys. This will also check
that a public key is read in correctly.

Reviewed-by: Ben Laurie <ben@openssl.org>
9 years agoAdd DSA digest length checks.
Dr. Stephen Henson [Thu, 30 Apr 2015 13:16:07 +0000 (14:16 +0100)]
Add DSA digest length checks.

Reviewed-by: Ben Laurie <ben@openssl.org>
9 years agoFix L<> content in manpages
Rich Salz [Mon, 17 Aug 2015 19:21:33 +0000 (15:21 -0400)]
Fix L<> content in manpages

L<foo|foo> is sub-optimal  If the xref is the same as the title,
which is what we do, then you only need L<foo>.  This fixes all
1457 occurrences in 349 files.  Approximately.  (And pod used to
need both.)

Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoAdd new types to indent.pro
Richard Levitte [Mon, 17 Aug 2015 16:10:16 +0000 (18:10 +0200)]
Add new types to indent.pro

Reviewed-by: Rich Salz <rsalz@openssl.org>
9 years agoAdd new GOST OIDs
Dmitry Belyavsky [Mon, 17 Aug 2015 10:22:52 +0000 (11:22 +0100)]
Add new GOST OIDs

Add new OIDs for latest GOST updates

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
9 years agoRestore previous behaviour of only running one algorithm when -evp alg is used.
Tim Hudson [Mon, 17 Aug 2015 12:20:06 +0000 (22:20 +1000)]
Restore previous behaviour of only running one algorithm when -evp alg is used.

Submitted by: Eric Young <eay@pobox.com>
Reviewed-by: Ben Laurie <ben@openssl.org>
9 years agorestore usage of -elapsed that was disabled in the ifdef reorg
Tim Hudson [Mon, 17 Aug 2015 12:16:39 +0000 (22:16 +1000)]
restore usage of -elapsed that was disabled in the ifdef reorg

Reviewed-by: Ben Laurie <ben@openssl.org>
9 years agoGH345: Remove stderr output
Rich Salz [Mon, 17 Aug 2015 01:08:25 +0000 (21:08 -0400)]
GH345: Remove stderr output

Reviewed-by: Tim Hudson <tjh@openssl.org>
9 years agoMove FAQ to the web.
Rich Salz [Sun, 16 Aug 2015 22:38:24 +0000 (18:38 -0400)]
Move FAQ to the web.

Best hope of keeping current.

Reviewed-by: Tim Hudson <tjh@openssl.org>
9 years agoPACKETise CertificateRequest
Matt Caswell [Tue, 4 Aug 2015 21:12:53 +0000 (22:12 +0100)]
PACKETise CertificateRequest

Process CertificateRequest messages using the PACKET API

Reviewed-by: Emilia Käsper <emilia@openssl.org>
9 years agoPACKETise ClientKeyExchange processing
Matt Caswell [Mon, 3 Aug 2015 11:57:51 +0000 (12:57 +0100)]
PACKETise ClientKeyExchange processing

Use the new PACKET code to process the CKE message

Reviewed-by: Stephen Henson <steve@openssl.org>
9 years agoPACKETise NewSessionTicket
Matt Caswell [Wed, 5 Aug 2015 13:50:24 +0000 (14:50 +0100)]
PACKETise NewSessionTicket

Process NewSessionTicket messages using the new PACKET API

Reviewed-by: Emilia Käsper <emilia@openssl.org>
9 years agoFix session tickets
Matt Caswell [Thu, 13 Aug 2015 09:04:23 +0000 (10:04 +0100)]
Fix session tickets

Commit 9ceb2426b0 (PACKETise ClientHello) broke session tickets by failing
to detect the session ticket extension in an incoming ClientHello. This
commit fixes the bug.

Reviewed-by: Emilia Käsper <emilia@openssl.org>
9 years agoadd CCM docs
Dr. Stephen Henson [Mon, 10 Aug 2015 18:17:50 +0000 (19:17 +0100)]
add CCM docs

Reviewed-by: Tim Hudson <tjh@openssl.org>
9 years agoAdd CCM ciphersuites from RFC6655 and RFC7251
Dr. Stephen Henson [Fri, 31 Jul 2015 15:53:45 +0000 (16:53 +0100)]
Add CCM ciphersuites from RFC6655 and RFC7251

Reviewed-by: Tim Hudson <tjh@openssl.org>
9 years agoccm8 support
Dr. Stephen Henson [Fri, 31 Jul 2015 15:59:45 +0000 (16:59 +0100)]
ccm8 support

Reviewed-by: Tim Hudson <tjh@openssl.org>
9 years agoCCM support.
Dr. Stephen Henson [Fri, 31 Jul 2015 15:54:35 +0000 (16:54 +0100)]
CCM support.

Reviewed-by: Tim Hudson <tjh@openssl.org>
9 years agoUpdate docs.
Dr. Stephen Henson [Wed, 17 Jun 2015 00:13:40 +0000 (01:13 +0100)]
Update docs.

Clarify and update documention for extra chain certificates.

PR#3878.

Reviewed-by: Rich Salz <rsalz@openssl.org>
9 years agoDocumentation for SSL_check_chain()
Dr. Stephen Henson [Thu, 23 Jul 2015 15:38:58 +0000 (16:38 +0100)]
Documentation for SSL_check_chain()

Reviewed-by: Matt Caswell <matt@openssl.org>
9 years agofor test_sslvertol, add a value to display SSL version < 3 in debug
Richard Levitte [Thu, 13 Aug 2015 17:15:45 +0000 (19:15 +0200)]
for test_sslvertol, add a value to display SSL version < 3 in debug

Reviewed-by: Matt Caswell <matt@openssl.org>
9 years agoFixups in libssl test harness
Richard Levitte [Thu, 13 Aug 2015 17:14:34 +0000 (19:14 +0200)]
Fixups in libssl test harness

- select an actual file handle for devnull
- do not declare $msgdata twice
- SKE records sometimes seem to come without sig
- in SKE parsing, use and use $pub_key_len when parsing $pub_key

Reviewed-by: Matt Caswell <matt@openssl.org>
9 years agoUse -I to add to @INC, and use -w to produce warnings
Richard Levitte [Thu, 13 Aug 2015 17:13:16 +0000 (19:13 +0200)]
Use -I to add to @INC, and use -w to produce warnings

Reviewed-by: Matt Caswell <matt@openssl.org>
9 years agoFix FAQ formatting for new website.
Rich Salz [Thu, 13 Aug 2015 15:22:10 +0000 (11:22 -0400)]
Fix FAQ formatting for new website.

Reviewed-by: Matt Caswell <matt@openssl.org>
9 years agoPACKETise Certificate Status message
Matt Caswell [Wed, 5 Aug 2015 14:52:26 +0000 (15:52 +0100)]
PACKETise Certificate Status message

Process the Certificate Status message using the PACKET API

Reviewed-by: Emilia Käsper <emilia@openssl.org>
9 years agoEnhance PACKET readability
Matt Caswell [Mon, 3 Aug 2015 16:20:47 +0000 (17:20 +0100)]
Enhance PACKET readability

Enhance the PACKET code readability, and fix a stale comment. Thanks
to Ben Kaduk (bkaduk@akamai.com) for pointing this out.

Reviewed-by: Emilia Käsper <emilia@openssl.org>
9 years agoAdd missing return check for PACKET_buf_init
Matt Caswell [Mon, 3 Aug 2015 16:20:07 +0000 (17:20 +0100)]
Add missing return check for PACKET_buf_init

The new ClientHello PACKET code is missing a return value check.

Reviewed-by: Emilia Käsper <emilia@openssl.org>
9 years agoGH364: Free memory on an error path
Ismo Puustinen [Sat, 8 Aug 2015 02:11:28 +0000 (22:11 -0400)]
GH364: Free memory on an error path

Part of RT 3997
Per Ben, just jump to common exit code.

Signed-off-by: Rich Salz <rsalz@akamai.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoPACKETise Server Certificate processing
Matt Caswell [Tue, 4 Aug 2015 19:10:06 +0000 (20:10 +0100)]
PACKETise Server Certificate processing

Use the PACKET API to process an incoming server Certificate message.

Reviewed-by: Emilia Käsper <emilia@openssl.org>
9 years agoReturn error for unsupported modes.
Dr. Stephen Henson [Sat, 1 Aug 2015 14:38:11 +0000 (15:38 +0100)]
Return error for unsupported modes.

PR#3974
PR#3975

Reviewed-by: Matt Caswell <matt@openssl.org>
9 years agoFix memory leak if setup fails.
Dr. Stephen Henson [Sat, 1 Aug 2015 14:37:44 +0000 (15:37 +0100)]
Fix memory leak if setup fails.

Reviewed-by: Matt Caswell <matt@openssl.org>
9 years agoErr isn't always malloc failure.
Dr. Stephen Henson [Sat, 1 Aug 2015 14:37:01 +0000 (15:37 +0100)]
Err isn't always malloc failure.

Reviewed-by: Matt Caswell <matt@openssl.org>
9 years agoRemove Gost94 signature algorithm.
Rich Salz [Tue, 4 Aug 2015 16:32:40 +0000 (12:32 -0400)]
Remove Gost94 signature algorithm.

This was obsolete in 2001.  This is not the same as Gost94 digest.
Thanks to Dmitry Belyavsky <beldmit@gmail.com> for review and advice.

Reviewed-by: Matt Caswell <matt@openssl.org>
9 years agoFix "make test" seg fault with SCTP enabled
Matt Caswell [Tue, 11 Aug 2015 18:38:39 +0000 (19:38 +0100)]
Fix "make test" seg fault with SCTP enabled

When config'd with "sctp" running "make test" causes a seg fault. This is
actually due to the way ssltest works - it dives under the covers and frees
up BIOs manually and so some BIOs are NULL when the SCTP code does not
expect it. The simplest fix is just to add some sanity checks to make sure
the BIOs aren't NULL before we use them.

This problem occurs in master and 1.0.2. The fix has also been applied to
1.0.1 to keep the code in sync.

Reviewed-by: Tim Hudson <tjh@openssl.org>
9 years agoFix missing return value checks in SCTP
Matt Caswell [Tue, 11 Aug 2015 18:36:43 +0000 (19:36 +0100)]
Fix missing return value checks in SCTP

There are some missing return value checks in the SCTP code. In master this
was causing a compilation failure when config'd with
"--strict-warnings sctp".

Reviewed-by: Tim Hudson <tjh@openssl.org>
9 years agomake update
Matt Caswell [Tue, 11 Aug 2015 10:41:51 +0000 (11:41 +0100)]
make update

Run a "make update" for the OSSLTest Engine changes

Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoUse dynamic engine for libssl test harness
Richard Levitte [Mon, 10 Aug 2015 09:46:27 +0000 (10:46 +0100)]
Use dynamic engine for libssl test harness

Use a dynamic engine for ossltest engine so that we can build it without
subsequently deploying it during install. We do not want people accidentally
using this engine.

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
9 years agoAdd a test for 0 p value in anon DH SKE
Matt Caswell [Fri, 7 Aug 2015 13:40:00 +0000 (14:40 +0100)]
Add a test for 0 p value in anon DH SKE

When using an anon DH ciphersuite a client should reject a 0 value for p.

Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoExtend TLSProxy capabilities
Matt Caswell [Fri, 7 Aug 2015 13:38:21 +0000 (14:38 +0100)]
Extend TLSProxy capabilities

Add ServerHello parsing to TLSProxy.
Also add some (very) limited ServerKeyExchange parsing.
Add the capability to set client and server cipher lists
Fix a bug with fragment lengths

Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoAdd some libssl tests
Matt Caswell [Tue, 16 Jun 2015 12:12:37 +0000 (13:12 +0100)]
Add some libssl tests

Two tests are added: one is a simple version tolerance test; the second is
a test to ensure that OpenSSL operates correctly in the case of a zero
length extensions block. The latter was broken inadvertently (now fixed)
and it would have been helpful to have a test case for it.

Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoAdd a libssl test harness
Matt Caswell [Tue, 16 Jun 2015 12:06:41 +0000 (13:06 +0100)]
Add a libssl test harness

This commit provides a set of perl modules that support the testing of
libssl. The test harness operates as a man-in-the-middle proxy between
s_server and s_client. Both s_server and s_client must be started using the
"-testmode" option which loads the new OSSLTEST engine.

The test harness enables scripts to be written that can examine the packets
sent during a handshake, as well as (potentially) modifying them so that
otherwise illegal handshake messages can be sent.

Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoAdd OSSLTest Engine
Matt Caswell [Tue, 16 Jun 2015 11:59:37 +0000 (12:59 +0100)]
Add OSSLTest Engine

This engine is for testing purposes only. It provides crippled crypto
implementations and therefore must not be used in any instance where
security is required.

This will be used by the forthcoming libssl test harness which will operate
as a man-in-the-middle proxy. The test harness will be able to modify
TLS packets and read their contents. By using this test engine packets are
not encrypted and MAC codes always verify.

Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoCheck for 0 modulus in BN_MONT_CTX_set
Matt Caswell [Mon, 10 Aug 2015 11:00:29 +0000 (12:00 +0100)]
Check for 0 modulus in BN_MONT_CTX_set

The function BN_MONT_CTX_set was assuming that the modulus was non-zero
and therefore that |mod->top| > 0. In an error situation that may not be
the case and could cause a seg fault.

This is a follow on from CVE-2015-1794.

Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoFix seg fault with 0 p val in SKE
Guy Leaver (guleaver) [Fri, 7 Aug 2015 14:45:21 +0000 (15:45 +0100)]
Fix seg fault with 0 p val in SKE

If a client receives a ServerKeyExchange for an anon DH ciphersuite with the
value of p set to 0 then a seg fault can occur. This commits adds a test to
reject p, g and pub key parameters that have a 0 value (in accordance with
RFC 5246)

The security vulnerability only affects master and 1.0.2, but the fix is
additionally applied to 1.0.1 for additional confidence.

CVE-2015-1794

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
9 years agoNormalise make errors output
Matt Caswell [Fri, 7 Aug 2015 14:42:37 +0000 (15:42 +0100)]
Normalise make errors output

make errors wants things in a different order to the way things are
currently defined in the header files. The easiest fix is to just let it
reorder it.

Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoGH365: Missing #ifdef rename.
Rich Salz [Thu, 6 Aug 2015 16:22:31 +0000 (12:22 -0400)]
GH365: Missing #ifdef rename.

Reviewed-by: Matt Caswell <matt@openssl.org>
9 years agoRT3999: Remove sub-component version strings
Rich Salz [Fri, 7 Aug 2015 21:09:30 +0000 (17:09 -0400)]
RT3999: Remove sub-component version strings

Especially since after the #ifdef cleanups this is not useful.

Reviewed-by: Matt Caswell <matt@openssl.org>
9 years agoFix build break.
Rich Salz [Mon, 10 Aug 2015 15:37:48 +0000 (11:37 -0400)]
Fix build break.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
9 years agoFind the right indent on *BSD.
Ben Laurie [Sun, 9 Aug 2015 09:47:03 +0000 (10:47 +0100)]
Find the right indent on *BSD.

Reviewed-by: Tim Hudson <tjh@openssl.org>
9 years agoGH357: Update ocsp.c
bluelineXY [Tue, 4 Aug 2015 11:23:00 +0000 (13:23 +0200)]
GH357: Update ocsp.c

Add Host Header in OCSP query if no host header is set via -header

Signed-off-by: Rich Salz <rsalz@akamai.com>
Reviewed-by: Ben Laurie <ben@openssl.org>
9 years agoRT3998: fix X509_check_host.pod release to 1.0.2
David Woodhouse [Sat, 8 Aug 2015 02:18:26 +0000 (22:18 -0400)]
RT3998: fix X509_check_host.pod release to 1.0.2

Signed-off-by: Rich Salz <rsalz@akamai.com>
Reviewed-by: Ben Laurie <ben@openssl.org>
9 years agoFix clang uninitialized variable warning.
Adam Eijdenberg [Tue, 4 Aug 2015 23:29:07 +0000 (16:29 -0700)]
Fix clang uninitialized variable warning.

We could just initialize it, but to be consistent with the rest of the file
it seemed to make more sense to just drop.

Reviewed-by: Ben Laurie <ben@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
9 years agoRevert "Fix uninitalised warning."
Matt Caswell [Thu, 6 Aug 2015 21:44:29 +0000 (22:44 +0100)]
Revert "Fix uninitalised warning."

This reverts commit 704563f04a8401781b359906c1f88a30e12af69c.

Reverting in favour of the next commit which removes the underlying cause
of the warning.

Reviewed-by: Ben Laurie <ben@openssl.org>
9 years agoFix uninitalised warning.
Ben Laurie [Thu, 6 Aug 2015 20:32:58 +0000 (21:32 +0100)]
Fix uninitalised warning.

Reviewed-by: Rich Salz <rsalz@openssl.org>
9 years agoRT3990: Fix #include path.
Anton Blanchard [Thu, 6 Aug 2015 01:48:35 +0000 (21:48 -0400)]
RT3990: Fix #include path.

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
9 years agoChange error reason to match previous behaviour.
Adam Eijdenberg [Tue, 4 Aug 2015 22:15:38 +0000 (15:15 -0700)]
Change error reason to match previous behaviour.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
9 years agoFix unhandled error condition in sslv2 client hello parsing.
Adam Eijdenberg [Tue, 4 Aug 2015 21:59:47 +0000 (14:59 -0700)]
Fix unhandled error condition in sslv2 client hello parsing.

--strict-warnings started showing warnings for this today...

Surely an error should be raised if these reads fail?

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
9 years agoFix SRTP s_client/s_server options
Matt Caswell [Tue, 4 Aug 2015 18:18:02 +0000 (19:18 +0100)]
Fix SRTP s_client/s_server options

The -use_srtp s_client/s_server option is supposed to take a colon
separated string as an argument. In master this was incorrectly set to
expect a filename.

Reviewed-by: Rich Salz <rsalz@openssl.org>
9 years agoPACKETise NextProto
Matt Caswell [Tue, 4 Aug 2015 12:52:03 +0000 (13:52 +0100)]
PACKETise NextProto

Change NextProto message processing to use the PACKET API.

Reviewed-by: Stephen Henson <steve@openssl.org>
9 years agoPACKETise CertificateVerify processing
Matt Caswell [Mon, 3 Aug 2015 15:56:41 +0000 (16:56 +0100)]
PACKETise CertificateVerify processing

Modify CertificateVerify processing to use the new PACKET API.

Reviewed-by: Stephen Henson <steve@openssl.org>
9 years agoPACKETise ClientCertificate processing
Matt Caswell [Tue, 4 Aug 2015 10:44:52 +0000 (11:44 +0100)]
PACKETise ClientCertificate processing

Use the PACKET API for processing ClientCertificate messages

Reviewed-by: Tim Hudson <tjh@openssl.org>
9 years agoFix a bug in the new PACKET implementation
Matt Caswell [Tue, 4 Aug 2015 12:03:20 +0000 (13:03 +0100)]
Fix a bug in the new PACKET implementation

Some of the PACKET functions were returning incorrect data. An unfortunate
choice of test data in the unit test was masking the failure.

Reviewed-by: Tim Hudson <tjh@openssl.org>
9 years agoFix warning when compiling with no-ec2m
Matt Caswell [Thu, 9 Jul 2015 15:37:54 +0000 (16:37 +0100)]
Fix warning when compiling with no-ec2m

EC_KEY_set_public_key_affine_coordinates was using some variables that only
apply if OPENSSL_NO_EC2M is not defined.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
9 years agoFix make errors for the CCS changes
Matt Caswell [Thu, 30 Jul 2015 10:14:44 +0000 (11:14 +0100)]
Fix make errors for the CCS changes

The move of CCS into the state machine was causing make errors to fail. This
fixes it.

Reviewed-by: Tim Hudson <tjh@openssl.org>
9 years agoFix ssl3_read_bytes handshake fragment bug
Matt Caswell [Tue, 30 Jun 2015 10:30:44 +0000 (11:30 +0100)]
Fix ssl3_read_bytes handshake fragment bug

The move of CCS into the state machine introduced a bug in ssl3_read_bytes.
The value of |recvd_type| was not being set if we are satisfying the request
from handshake fragment storage. This can occur, for example, with
renegotiation and causes the handshake to fail.

Reviewed-by: Tim Hudson <tjh@openssl.org>
9 years agoMove DTLS CCS processing into the state machine
Matt Caswell [Tue, 2 Jun 2015 10:33:07 +0000 (11:33 +0100)]
Move DTLS CCS processing into the state machine

Continuing on from the previous commit this moves the processing of DTLS
CCS messages out of the record layer and into the state machine.

Reviewed-by: Tim Hudson <tjh@openssl.org>
9 years agoMove TLS CCS processing into the state machine
Matt Caswell [Mon, 11 May 2015 08:35:41 +0000 (09:35 +0100)]
Move TLS CCS processing into the state machine

The handling of incoming CCS records is a little strange. Since CCS is not
a handshake message it is handled differently to normal handshake messages.
Unfortunately whilst technically it is not a handhshake message the reality
is that it must be processed in accordance with the state of the handshake.
Currently CCS records are processed entirely within the record layer. In
order to ensure that it is handled in accordance with the handshake state
a flag is used to indicate that it is an acceptable time to receive a CCS.

Previously this flag did not exist (see CVE-2014-0224), but the flag should
only really be considered a workaround for the problem that CCS is not
visible to the state machine.

Outgoing CCS messages are already handled within the state machine.

This patch makes CCS visible to the TLS state machine. A separate commit
will handle DTLS.

Reviewed-by: Tim Hudson <tjh@openssl.org>
9 years agoPACKETise ClientHello processing
Matt Caswell [Thu, 16 Apr 2015 09:06:25 +0000 (10:06 +0100)]
PACKETise ClientHello processing

Uses the new PACKET code to process the incoming ClientHello including all
extensions etc.

Reviewed-by: Tim Hudson <tjh@openssl.org>
9 years agoPACKET unit tests
Matt Caswell [Fri, 17 Apr 2015 15:10:23 +0000 (16:10 +0100)]
PACKET unit tests

Add some unit tests for the new PACKET API

Reviewed-by: Tim Hudson <tjh@openssl.org>
9 years agoAdd initial packet parsing code
Matt Caswell [Tue, 14 Apr 2015 16:01:29 +0000 (17:01 +0100)]
Add initial packet parsing code

Provide more robust (inline) functions to replace n2s, n2l, etc. These
functions do the same thing as the previous macros, but also keep track
of the amount of data remaining and return an error if we try to read more
data than we've got.

Reviewed-by: Tim Hudson <tjh@openssl.org>
9 years agoFix refactoring breakage.
Ben Laurie [Sun, 2 Aug 2015 15:04:27 +0000 (16:04 +0100)]
Fix refactoring breakage.

Reviewed-by: Rich Salz <rsalz@openssl.org>
9 years agodon't reset return value to 0
Dr. Stephen Henson [Sun, 2 Aug 2015 13:28:50 +0000 (14:28 +0100)]
don't reset return value to 0

Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoAdd -Wconditional-uninitialized to clang strict warnings.
Ben Laurie [Sun, 2 Aug 2015 01:45:44 +0000 (02:45 +0100)]
Add -Wconditional-uninitialized to clang strict warnings.

Reviewed-by: Rich Salz <rsalz@openssl.org>
9 years agoBuild with --strict-warnings on FreeBSD.
Ben Laurie [Sun, 2 Aug 2015 01:21:46 +0000 (02:21 +0100)]
Build with --strict-warnings on FreeBSD.

Reviewed-by: Rich Salz <rsalz@openssl.org>
9 years agoMake BSD make happy with subdirectories.
Ben Laurie [Sat, 1 Aug 2015 14:55:19 +0000 (15:55 +0100)]
Make BSD make happy with subdirectories.

Reviewed-by: Richard Levitte