openssl.git
9 years agoPrepare for 1.0.0q release OpenSSL_1_0_0q
Matt Caswell [Thu, 15 Jan 2015 14:56:27 +0000 (14:56 +0000)]
Prepare for 1.0.0q release

Reviewed-by: Stephen Henson <steve@openssl.org>
9 years agomake update
Matt Caswell [Thu, 15 Jan 2015 14:56:27 +0000 (14:56 +0000)]
make update

Reviewed-by: Stephen Henson <steve@openssl.org>
9 years agoUpdates to CHANGES and NEWS
Matt Caswell [Thu, 15 Jan 2015 13:04:01 +0000 (13:04 +0000)]
Updates to CHANGES and NEWS

Reviewed-by: Dr Stephen Henson <steve@openssl.org>
9 years agoFixup installation script for VMS
Richard Levitte [Wed, 14 Jan 2015 18:17:17 +0000 (19:17 +0100)]
Fixup installation script for VMS

Reviewed-by: Matt Caswell <matt@openssl.org>
9 years agoVMS fixups for 1.0.0
Richard Levitte [Tue, 13 Jan 2015 21:13:20 +0000 (22:13 +0100)]
VMS fixups for 1.0.0

Reviewed-by: Matt Caswell <matt@openssl.org>
9 years agoMake output from openssl version -f consistent with previous versions
Matt Caswell [Tue, 13 Jan 2015 10:20:12 +0000 (10:20 +0000)]
Make output from openssl version -f consistent with previous versions

Reviewed-by: Andy Polyakov <appro@openssl.org>
(cherry picked from commit 2d2671790ee12dedd92c97f35b6feb755b8d4374)

9 years agoFix warning where BIO_FLAGS_UPLINK was being redefined.
Matt Caswell [Sat, 10 Jan 2015 23:36:28 +0000 (23:36 +0000)]
Fix warning where BIO_FLAGS_UPLINK was being redefined.
This warning breaks the build in 1.0.0 and 0.9.8

Reviewed-by: Andy Polyakov <appro@openssl.org>
(cherry picked from commit b1ffc6ca1c387efad0772c16dfe426afef45dc4f)

9 years agoAvoid deprecation problems in Visual Studio 13
Matt Caswell [Fri, 9 Jan 2015 14:06:36 +0000 (14:06 +0000)]
Avoid deprecation problems in Visual Studio 13

Reviewed-by: Andy Polyakov <appro@openssl.org>
(cherry picked from commit 86d21d0b9577322ac5da0114c5fac16eb49b4cef)

9 years agoFurther windows specific .gitignore entries
Matt Caswell [Fri, 9 Jan 2015 23:01:20 +0000 (23:01 +0000)]
Further windows specific .gitignore entries

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(cherry picked from commit 41c9cfbc4ee7345547fb98cccb8511f082f0910b)

9 years agoUpdate .gitignore with windows files to be excluded from git
Matt Caswell [Fri, 9 Jan 2015 10:19:10 +0000 (10:19 +0000)]
Update .gitignore with windows files to be excluded from git

Reviewed-by: Tim Hudson <tjh@openssl.org>
Conflicts:
.gitignore

(cherry picked from commit 04f670cf3d8f22e0d197a071d2db536fb7ebd9c7)

9 years agoFix build failure on Windows due to undefined cflags identifier
Matt Caswell [Thu, 8 Jan 2015 19:05:43 +0000 (19:05 +0000)]
Fix build failure on Windows due to undefined cflags identifier

Reviewed-by: Tim Hudson <tjh@openssl.org>
(cherry picked from commit 5c5e7e1a7eb114cf136e1ae4b6a413bc48ba41eb)

9 years agoPrepare for 1.0.0q-dev
Matt Caswell [Thu, 8 Jan 2015 14:23:38 +0000 (14:23 +0000)]
Prepare for 1.0.0q-dev

Reviewed-by: Stephen Henson <steve@openssl.org>
9 years agoPrepare for 1.0.0p release OpenSSL_1_0_0p
Matt Caswell [Thu, 8 Jan 2015 14:21:42 +0000 (14:21 +0000)]
Prepare for 1.0.0p release

Reviewed-by: Stephen Henson <steve@openssl.org>
9 years agomake update
Matt Caswell [Thu, 8 Jan 2015 14:21:42 +0000 (14:21 +0000)]
make update

Reviewed-by: Stephen Henson <steve@openssl.org>
9 years agoCHANGES and NEWS updates for release
Matt Caswell [Thu, 8 Jan 2015 13:31:01 +0000 (13:31 +0000)]
CHANGES and NEWS updates for release

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Steve Henson <steve@openssl.org>
9 years agoA memory leak can occur in dtls1_buffer_record if either of the calls to
Matt Caswell [Wed, 7 Jan 2015 14:18:13 +0000 (14:18 +0000)]
A memory leak can occur in dtls1_buffer_record if either of the calls to
ssl3_setup_buffers or pqueue_insert fail. The former will fail if there is a
malloc failure, whilst the latter will fail if attempting to add a duplicate
record to the queue. This should never happen because duplicate records should
be detected and dropped before any attempt to add them to the queue.
Unfortunately records that arrive that are for the next epoch are not being
recorded correctly, and therefore replays are not being detected.
Additionally, these "should not happen" failures that can occur in
dtls1_buffer_record are not being treated as fatal and therefore an attacker
could exploit this by sending repeated replay records for the next epoch,
eventually causing a DoS through memory exhaustion.

Thanks to Chris Mueller for reporting this issue and providing initial
analysis and a patch. Further analysis and the final patch was performed by
Matt Caswell from the OpenSSL development team.

CVE-2015-0206

Reviewed-by: Dr Stephen Henson <steve@openssl.org>
(cherry picked from commit 652ff0f4796eecd8729b4690f2076d1c7ccb2862)

9 years agoUnauthenticated DH client certificate fix.
Dr. Stephen Henson [Thu, 23 Oct 2014 19:36:17 +0000 (20:36 +0100)]
Unauthenticated DH client certificate fix.

Fix to prevent use of DH client certificates without sending
certificate verify message.

If we've used a client certificate to generate the premaster secret
ssl3_get_client_key_exchange returns 2 and ssl3_get_cert_verify is
never called.

We can only skip the certificate verify message in
ssl3_get_cert_verify if the client didn't send a certificate.

Thanks to Karthikeyan Bhargavan for reporting this issue.
CVE-2015-0205
Reviewed-by: Matt Caswell <matt@openssl.org>
9 years agoFollow on from CVE-2014-3571. This fixes the code that was the original source
Matt Caswell [Sat, 3 Jan 2015 00:54:35 +0000 (00:54 +0000)]
Follow on from CVE-2014-3571. This fixes the code that was the original source
of the crash due to p being NULL. Steve's fix prevents this situation from
occuring - however this is by no means obvious by looking at the code for
dtls1_get_record. This fix just makes things look a bit more sane.

Conflicts:
ssl/d1_pkt.c

Reviewed-by: Dr Stephen Henson <steve@openssl.org>
9 years agoFix crash in dtls1_get_record whilst in the listen state where you get two
Dr. Stephen Henson [Sat, 3 Jan 2015 00:45:13 +0000 (00:45 +0000)]
Fix crash in dtls1_get_record whilst in the listen state where you get two
separate reads performed - one for the header and one for the body of the
handshake record.

CVE-2014-3571

Reviewed-by: Matt Caswell <matt@openssl.org>
9 years agoFix for CVE-2014-3570.
Andy Polyakov [Mon, 5 Jan 2015 13:52:56 +0000 (14:52 +0100)]
Fix for CVE-2014-3570.

Reviewed-by: Emilia Kasper <emilia@openssl.org>
9 years agofix error discrepancy
Dr. Stephen Henson [Wed, 7 Jan 2015 17:36:17 +0000 (17:36 +0000)]
fix error discrepancy

Reviewed-by: Matt Caswell <matt@openssl.org>
(cherry picked from commit 4a4d4158572fd8b3dc641851b8378e791df7972d)

9 years agouse correct credit in CHANGES
Dr. Stephen Henson [Tue, 6 Jan 2015 21:12:15 +0000 (21:12 +0000)]
use correct credit in CHANGES

Reviewed-by: Matt Caswell <matt@openssl.org>
(cherry picked from commit 4138e3882556c762d77eb827b8be98507cde48df)

9 years agouse correct function name
Dr. Stephen Henson [Tue, 6 Jan 2015 20:55:38 +0000 (20:55 +0000)]
use correct function name

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(cherry picked from commit cb62ab4b17818fe66d2fed0a7fe71969131c811b)

9 years agoRemove blank line from start of cflags character array in buildinf.h
Matt Caswell [Tue, 6 Jan 2015 15:32:01 +0000 (15:32 +0000)]
Remove blank line from start of cflags character array in buildinf.h

Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit b691154e18c0367643696db3cf73debe9ddfa9ae)

9 years agoOnly allow ephemeral RSA keys in export ciphersuites.
Dr. Stephen Henson [Thu, 23 Oct 2014 16:09:57 +0000 (17:09 +0100)]
Only allow ephemeral RSA keys in export ciphersuites.

OpenSSL clients would tolerate temporary RSA keys in non-export
ciphersuites. It also had an option SSL_OP_EPHEMERAL_RSA which
enabled this server side. Remove both options as they are a
protocol violation.

Thanks to Karthikeyan Bhargavan for reporting this issue.
(CVE-2015-0204)
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(cherry picked from commit 4b4c1fcc88aec8c9e001b0a0077d3cd4de1ed0e6)

Conflicts:
CHANGES
doc/ssl/SSL_CTX_set_options.pod

9 years agoECDH downgrade bug fix.
Dr. Stephen Henson [Fri, 24 Oct 2014 11:30:33 +0000 (12:30 +0100)]
ECDH downgrade bug fix.

Fix bug where an OpenSSL client would accept a handshake using an
ephemeral ECDH ciphersuites with the server key exchange message omitted.

Thanks to Karthikeyan Bhargavan for reporting this issue.

CVE-2014-3572
Reviewed-by: Matt Caswell <matt@openssl.org>
(cherry picked from commit b15f8769644b00ef7283521593360b7b2135cb63)

Conflicts:
CHANGES

9 years agoupdate ordinals
Dr. Stephen Henson [Mon, 5 Jan 2015 16:50:31 +0000 (16:50 +0000)]
update ordinals

Reviewed-by: Emilia Käsper <emilia@openssl.org>
9 years agoFix various certificate fingerprint issues.
Dr. Stephen Henson [Sat, 20 Dec 2014 15:09:50 +0000 (15:09 +0000)]
Fix various certificate fingerprint issues.

By using non-DER or invalid encodings outside the signed portion of a
certificate the fingerprint can be changed without breaking the signature.
Although no details of the signed portion of the certificate can be changed
this can cause problems with some applications: e.g. those using the
certificate fingerprint for blacklists.

1. Reject signatures with non zero unused bits.

If the BIT STRING containing the signature has non zero unused bits reject
the signature. All current signature algorithms require zero unused bits.

2. Check certificate algorithm consistency.

Check the AlgorithmIdentifier inside TBS matches the one in the
certificate signature. NB: this will result in signature failure
errors for some broken certificates.

3. Check DSA/ECDSA signatures use DER.

Reencode DSA/ECDSA signatures and compare with the original received
signature. Return an error if there is a mismatch.

This will reject various cases including garbage after signature
(thanks to Antti Karjalainen and Tuomo Untinen from the Codenomicon CROSS
program for discovering this case) and use of BER or invalid ASN.1 INTEGERs
(negative or with leading zeroes).

CVE-2014-8275
Reviewed-by: Emilia Käsper <emilia@openssl.org>
(cherry picked from commit 684400ce192dac51df3d3e92b61830a6ef90be3e)

Conflicts:
CHANGES
crypto/dsa/dsa_asn1.c

9 years agoConstify ASN1_TYPE_cmp add X509_ALGOR_cmp.
Dr. Stephen Henson [Sun, 14 Dec 2014 23:14:15 +0000 (23:14 +0000)]
Constify ASN1_TYPE_cmp add X509_ALGOR_cmp.

Reviewed-by: Emilia Käsper <emilia@openssl.org>
(cherry picked from commit 4c52816d35681c0533c25fdd3abb4b7c6962302d)

Conflicts:
crypto/asn1/x_algor.c
crypto/x509/x509.h

9 years agoReject invalid constructed encodings.
Dr. Stephen Henson [Wed, 17 Dec 2014 14:34:36 +0000 (14:34 +0000)]
Reject invalid constructed encodings.

According to X6.90 null, object identifier, boolean, integer and enumerated
types can only have primitive encodings: return an error if any of
these are received with a constructed encoding.
Reviewed-by: Emilia Käsper <emilia@openssl.org>
(cherry picked from commit f5e4b6b5b566320a8d774f9475540f7d0e6a704d)

Conflicts:
crypto/asn1/asn1_err.c

9 years agoFix a problem if CFLAGS is too long cversion.c fails to compile when config
Matt Caswell [Fri, 19 Dec 2014 10:55:54 +0000 (10:55 +0000)]
Fix a problem if CFLAGS is too long cversion.c fails to compile when config
is run with --strict-warnings.

Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit 488f16e31b8f5ec2513410929325d0830d76762d)

9 years agoReturn error when a bit string indicates an invalid amount of bits left
Kurt Roeckx [Mon, 15 Dec 2014 16:15:16 +0000 (17:15 +0100)]
Return error when a bit string indicates an invalid amount of bits left

Reviewed-by: Matt Caswell <matt@openssl.org>
9 years agoRevert "RT3425: constant-time evp_enc"
Emilia Kasper [Wed, 17 Dec 2014 13:51:07 +0000 (14:51 +0100)]
Revert "RT3425: constant-time evp_enc"

Causes more problems than it fixes: even though error codes
are not part of the stable API, several users rely on the
specific error code, and the change breaks them. Conversely,
we don't have any concrete use-cases for constant-time behaviour here.

This reverts commit b55ff319f880adc874b8c95957adf2003117d42b.

Reviewed-by: Andy Polyakov <appro@openssl.org>
9 years agoPremaster secret handling fixes
Adam Langley [Tue, 16 Dec 2014 13:03:47 +0000 (14:03 +0100)]
Premaster secret handling fixes

From BoringSSL
- Send an alert when the client key exchange isn't correctly formatted.
- Reject overly short RSA ciphertexts to avoid a (benign) out-of-bounds memory access.

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
(cherry picked from commit 4aecfd4d9f366c849c9627ab666d1b1addc024e6)

9 years agoAdd OPENSSL_NO_ECDH guards
Matt Caswell [Tue, 18 Nov 2014 15:56:50 +0000 (15:56 +0000)]
Add OPENSSL_NO_ECDH guards

Reviewed-by: Emilia Käsper <emilia@openssl.org>
(cherry picked from commit 7f9edfd23a9b9cd0827cc381e8fbd8cd0c9e5035)

9 years agoRemove extraneous white space, and add some braces
Matt Caswell [Mon, 15 Dec 2014 20:48:33 +0000 (20:48 +0000)]
Remove extraneous white space, and add some braces

Reviewed-by: Emilia Käsper <emilia@openssl.org>
(cherry picked from commit 55e530265a7ea8f264717a4e37338cc04eca2007)

9 years agoDTLS fixes for signed/unsigned issues
Matt Caswell [Fri, 12 Dec 2014 15:32:24 +0000 (15:32 +0000)]
DTLS fixes for signed/unsigned issues

Reviewed-by: Emilia Käsper <emilia@openssl.org>
(cherry picked from commit 1904d21123849a65dafde1705e6dd5b7c2f420eb)

9 years agoCheckout return value of dtls1_output_cert_chain
Matt Caswell [Wed, 3 Dec 2014 11:15:40 +0000 (11:15 +0000)]
Checkout return value of dtls1_output_cert_chain

Reviewed-by: Tim Hudson <tjh@openssl.org>
(cherry picked from commit 9beb948c0dae6056caddf46a9aa099e18905d184)

9 years agoCheck return value of ssl3_output_cert_chain
Matt Caswell [Tue, 18 Mar 2014 14:19:22 +0000 (14:19 +0000)]
Check return value of ssl3_output_cert_chain

Based on commit 66f96fe2d519147097c118d4bf60704c69ed0635 by Steve Henson

Reviewed-by: Tim Hudson <tjh@openssl.org>
(cherry picked from commit ce5ddefc4394a0ae6c79efaffe08cf47ac659ea0)

9 years agoFix memory leak in s2_srvr.c if BUF_MEM_grow fails
Matt Caswell [Fri, 12 Dec 2014 11:05:21 +0000 (11:05 +0000)]
Fix memory leak in s2_srvr.c if BUF_MEM_grow fails

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
(cherry picked from commit d04a1e0b5beb3329cdf8c4ec35b9113cbc41d2f2)

9 years agoFixed memory leak if BUF_MEM_grow fails
Matt Caswell [Fri, 12 Dec 2014 11:03:00 +0000 (11:03 +0000)]
Fixed memory leak if BUF_MEM_grow fails

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
(cherry picked from commit bb1ddd3d9a0d01656b90693a214b911995a5fe8c)

9 years agoFix use of NULL memory pointer in X509_VERIFY_PARAM_new in the event of a
Matt Caswell [Thu, 4 Dec 2014 10:18:40 +0000 (10:18 +0000)]
Fix use of NULL memory pointer in X509_VERIFY_PARAM_new in the event of a
malloc failure.

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
(cherry picked from commit c6a84ff3516d8ecd92d866b6f0ae0d63df6d9c53)

9 years agoFixed memory leak in the event of a failure of BUF_MEM_grow
Matt Caswell [Thu, 4 Dec 2014 09:56:16 +0000 (09:56 +0000)]
Fixed memory leak in the event of a failure of BUF_MEM_grow

Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit 41bf25013032da0eeb111ce3c8fc0946c0e61c41)

9 years agoFix memory leak in SSL_new if errors occur.
Matt Caswell [Thu, 4 Dec 2014 09:46:44 +0000 (09:46 +0000)]
Fix memory leak in SSL_new if errors occur.

Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit 76e6509085ea96df0ca542568ee2596343711307)

9 years agoRemove incorrect code inadvertently introduced through commit 59669b6ab.
Matt Caswell [Thu, 4 Dec 2014 09:22:50 +0000 (09:22 +0000)]
Remove incorrect code inadvertently introduced through commit 59669b6ab.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Conflicts:
ssl/d1_lib.c

9 years agoRemove "#if 0" code
Matt Caswell [Wed, 3 Dec 2014 09:21:09 +0000 (09:21 +0000)]
Remove "#if 0" code

Reviewed-by: Tim Hudson <tjh@openssl.org>
(cherry picked from commit 4bb8eb9ce4f794fecf020a15b54e8505fced0edf)

9 years agoOnly use the fallback mtu after 2 unsuccessful retransmissions if it is less
Matt Caswell [Tue, 2 Dec 2014 11:16:35 +0000 (11:16 +0000)]
Only use the fallback mtu after 2 unsuccessful retransmissions if it is less
than the mtu we are already using

Reviewed-by: Tim Hudson <tjh@openssl.org>
(cherry picked from commit 047f21593eebbc617a410a208ded01e65ca11028)

9 years agoUpdates to s_client and s_server to remove the constant 28 (for IPv4 header
Matt Caswell [Mon, 1 Dec 2014 23:57:44 +0000 (23:57 +0000)]
Updates to s_client and s_server to remove the constant 28 (for IPv4 header
and UDP header) when setting an mtu. This constant is not always correct (e.g.
if using IPv6). Use the new DTLS_CTRL functions instead.

Reviewed-by: Tim Hudson <tjh@openssl.org>
(cherry picked from commit 464ce92026bd0c79186cbefa75470f39607110be)

9 years agoIf we really get a situation where the underlying mtu is less than the minimum
Matt Caswell [Tue, 2 Dec 2014 00:16:55 +0000 (00:16 +0000)]
If we really get a situation where the underlying mtu is less than the minimum
we will support then dtls1_do_write can go into an infinite loop. This commit
fixes that.

Reviewed-by: Tim Hudson <tjh@openssl.org>
(cherry picked from commit d3d9eef31661633f5b003a9e115c1822f79d1870)

9 years agoFix dtls_query_mtu so that it will always either complete with an mtu that is
Matt Caswell [Mon, 1 Dec 2014 22:18:18 +0000 (22:18 +0000)]
Fix dtls_query_mtu so that it will always either complete with an mtu that is
at least the minimum or it will fail.
There were some instances in dtls1_query_mtu where the final mtu can end up
being less than the minimum, i.e. where the user has set an mtu manually. This
shouldn't be allowed. Also remove dtls1_guess_mtu that, despite having
logic for guessing an mtu, was actually only ever used to work out the minimum
mtu to use.

Reviewed-by: Tim Hudson <tjh@openssl.org>
(cherry picked from commit 1620a2e49c777f31f2ce57966ae74006b48ad759)

9 years agoRemove instances in libssl of the constant 28 (for size of IPv4 header + UDP)
Matt Caswell [Mon, 1 Dec 2014 23:58:05 +0000 (23:58 +0000)]
Remove instances in libssl of the constant 28 (for size of IPv4 header + UDP)
and instead use the value provided by the underlying BIO. Also provide some
new DTLS_CTRLs so that the library user can set the mtu without needing to
know this constant. These new DTLS_CTRLs provide the capability to set the
link level mtu to be used (i.e. including this IP/UDP overhead). The previous
DTLS_CTRLs required the library user to subtract this overhead first.

Reviewed-by: Tim Hudson <tjh@openssl.org>
(cherry picked from commit 59669b6abf620d1ed2ef4d1e2df25c998b89b64d)

Conflicts:
ssl/d1_both.c
ssl/ssl.h
ssl/ssl_lib.c

9 years agoThere are a number of instances throughout the code where the constant 28 is
Matt Caswell [Mon, 1 Dec 2014 23:49:47 +0000 (23:49 +0000)]
There are a number of instances throughout the code where the constant 28 is
used with no explanation. Some of this was introduced as part of RT#1929. The
value 28 is the length of the IP header (20 bytes) plus the UDP header (8
bytes). However use of this constant is incorrect because there may be
instances where a different value is needed, e.g. an IPv4 header is 20 bytes
but an IPv6 header is 40. Similarly you may not be using UDP (e.g. SCTP).
This commit introduces a new BIO_CTRL that provides the value to be used for
this mtu "overhead". It will be used by subsequent commits.

Reviewed-by: Tim Hudson <tjh@openssl.org>
(cherry picked from commit 0d3ae34df573f477b6b1aaf614d52dcdfcff5fce)

Conflicts:
crypto/bio/bio.h
crypto/bio/bss_dgram.c

9 years agoThe first call to query the mtu in dtls1_do_write correctly checks that the
Matt Caswell [Mon, 1 Dec 2014 11:41:25 +0000 (11:41 +0000)]
The first call to query the mtu in dtls1_do_write correctly checks that the
mtu that we have received is not less than the minimum. If its less it uses the
minimum instead. The second call to query the mtu does not do that, but
instead uses whatever comes back. We have seen an instance in RT#3592 where we
have got an unreasonably small mtu come back. This commit makes both query
checks consistent.

Reviewed-by: Tim Hudson <tjh@openssl.org>
(cherry picked from commit 6abb0d1f8e702a0daa9c32b8021d01eda0483018)

9 years agoThe SSL_OP_NO_QUERY_MTU option is supposed to stop the mtu from being
Matt Caswell [Mon, 1 Dec 2014 11:13:15 +0000 (11:13 +0000)]
The SSL_OP_NO_QUERY_MTU option is supposed to stop the mtu from being
automatically updated, and we should use the one provided instead.
Unfortunately there are a couple of locations where this is not respected.

Reviewed-by: Tim Hudson <tjh@openssl.org>
(cherry picked from commit 001235778a6e9c645dc0507cad6092d99c9af8f5)

9 years agoVerify that we have a sensible message len and fail if not
Matt Caswell [Mon, 1 Dec 2014 11:10:38 +0000 (11:10 +0000)]
Verify that we have a sensible message len and fail if not
RT#3592 provides an instance where the OPENSSL_assert that this commit
replaces can be hit. I was able to recreate this issue by forcing the
underlying BIO to misbehave and come back with very small mtu values. This
happens the second time around the while loop after we have detected that the
MTU has been exceeded following the call to dtls1_write_bytes.

Reviewed-by: Tim Hudson <tjh@openssl.org>
(cherry picked from commit cf75017bfd60333ff65edf9840001cd2c49870a3)

9 years agoCheck for FindNextFile when defining it rather than FindFirstFile
Richard Levitte [Fri, 28 Nov 2014 22:06:20 +0000 (23:06 +0100)]
Check for FindNextFile when defining it rather than FindFirstFile

Reviewed-by: Matt Caswell <matt@openssl.org>
9 years ago[PR3597] Advance to the next state variant when reusing messages.
Richard Levitte [Fri, 28 Nov 2014 19:40:10 +0000 (20:40 +0100)]
[PR3597] Advance to the next state variant when reusing messages.

Previously, state variant was not advanced, which resulted in state
being stuck in the st1 variant (usually "_A").

This broke certificate callback retry logic when accepting connections
that were using SSLv2 ClientHello (hence reusing the message), because
their state never advanced to SSL3_ST_SR_CLNT_HELLO_C variant required
for the retry code path.

Reported by Yichun Zhang (agentzh).

Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
9 years agoCorrect some layout issues, convert all remaining tabs to appropriate amounts of...
Richard Levitte [Fri, 28 Nov 2014 15:31:10 +0000 (16:31 +0100)]
Correct some layout issues, convert all remaining tabs to appropriate amounts of spaces.

Reviewed-by: Matt Caswell <matt@openssl.org>
(cherry picked from commit 8123d158ab6f0a6a468748c133e33c2063ff36b5)

9 years agoImproves the proxy certificates howto doc.
Alok Menghrajani [Fri, 14 Nov 2014 18:39:41 +0000 (10:39 -0800)]
Improves the proxy certificates howto doc.

The current documentation contains a bunch of spelling and grammar mistakes. I also
found it hard to understand some paragraphs, so here is my attempt to improve its
readability.

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(cherry picked from commit 03b637a730e4a298c360cc143de7564060c06324)

9 years agoFixed warning in ssl2_enc
Matt Caswell [Thu, 27 Nov 2014 20:40:18 +0000 (20:40 +0000)]
Fixed warning in ssl2_enc

Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit 2db95e094d23b41d2305c0a01db66694ea77f936)

9 years agoCheck EVP_Cipher return values for SSL2
Matt Caswell [Tue, 18 Nov 2014 15:03:55 +0000 (15:03 +0000)]
Check EVP_Cipher return values for SSL2

Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit 5fc8bb6ab71b5f7ce2dd67a47494bb5b5c6dc374)

9 years agoAdd checks to the return value of EVP_Cipher to prevent silent encryption failure.
Matt Caswell [Tue, 18 Nov 2014 12:56:26 +0000 (12:56 +0000)]
Add checks to the return value of EVP_Cipher to prevent silent encryption failure.

PR#1767

Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit 244d0955adc027c0f41a3251e55d145bf940f9ce)

9 years agoRemove redundant checks in ssl_cert_dup. This was causing spurious error messages...
Matt Caswell [Thu, 27 Nov 2014 11:06:43 +0000 (11:06 +0000)]
Remove redundant checks in ssl_cert_dup. This was causing spurious error messages when using GOST

PR#3613

Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit fc3968a25ce0c16cab8730ec0d68a59856158029)

9 years agoRemove duplicated code
Matt Caswell [Mon, 17 Nov 2014 14:22:10 +0000 (14:22 +0000)]
Remove duplicated code

Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
9 years agoTidy up ocsp help output
Matt Caswell [Thu, 27 Nov 2014 10:15:47 +0000 (10:15 +0000)]
Tidy up ocsp help output

Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
(cherry picked from commit 5e31a40f47c6bfd09c718d2af42ba8d8fe6bb932)

Conflicts:
apps/ocsp.c

(cherry picked from commit e16458269036f4334525009906d346f68a73b2a4)

9 years agoAdd documentation on -timeout option in the ocsp utility
André Guerreiro [Thu, 27 Nov 2014 10:11:33 +0000 (10:11 +0000)]
Add documentation on -timeout option in the ocsp utility

PR#3612

Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
(cherry picked from commit de87dd46c1283f899a9ecf4ccc72db74f36afbf2)
(cherry picked from commit 4d3df37bc7fd33d0bec5da04d2572caa0cdbab75)

9 years agoFixed memory leak due to incorrect freeing of DTLS reassembly bit mask
Matt Caswell [Tue, 25 Nov 2014 13:36:00 +0000 (13:36 +0000)]
Fixed memory leak due to incorrect freeing of DTLS reassembly bit mask

PR#3608

Reviewed-by: Tim Hudson <tjh@openssl.org>
(cherry picked from commit 8a35dbb6d89a16d792b79b157b3e89443639ec94)

9 years agoCorrected comments in ssl.h about SSLv23_method and friends
Matt Caswell [Tue, 25 Nov 2014 17:23:24 +0000 (17:23 +0000)]
Corrected comments in ssl.h about SSLv23_method and friends

PR#3574

Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
(cherry picked from commit 3a0765882c4b3b67960b7efb203570764dd4ed29)

9 years agoFix cross reference table generator.
Dr. Stephen Henson [Sat, 1 Nov 2014 00:10:56 +0000 (00:10 +0000)]
Fix cross reference table generator.

If the hash or public key algorithm is "undef" the signature type
will receive special handling and shouldn't be included in the
cross reference table.
Reviewed-by: Tim Hudson <tjh@openssl.org>
(cherry picked from commit 55f7fb8848b6e4bec291724a479e1580d6f407d6)

Conflicts:
crypto/objects/obj_xref.h

9 years agoFixes a minor typo in the EVP docs.
Alok Menghrajani [Tue, 11 Nov 2014 22:39:11 +0000 (14:39 -0800)]
Fixes a minor typo in the EVP docs.

Out is the buffer which needs to contain at least inl + cipher_block_size - 1 bytes. Outl
is just an int*.

Reviewed-by: Emilia Käsper <emilia@openssl.org>
(cherry picked from commit 5211e094dec9486a540ac480f345df1a8d2b2862)

9 years agoCorrect timestamp output when clock_precision_digits > 0
Michal Bozon [Wed, 12 Nov 2014 15:59:04 +0000 (15:59 +0000)]
Correct timestamp output when clock_precision_digits > 0

PR#3535

Reviewed-by: Stephen Henson <steve@openssl.org>
9 years agoFix free of garbage pointer. PR#3595
Matt Caswell [Wed, 12 Nov 2014 11:18:09 +0000 (11:18 +0000)]
Fix free of garbage pointer. PR#3595

Reviewed-by: Emilia Käsper <emilia@openssl.org>
(cherry picked from commit e04d426bf98ebb22abf0f15b6f09d333a6e8b2ad)

9 years agoFix warning about negative unsigned intergers
Kurt Roeckx [Mon, 10 Nov 2014 18:03:03 +0000 (19:03 +0100)]
Fix warning about negative unsigned intergers

Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoUse only unsigned arithmetic in constant-time operations
Samuel Neves [Fri, 3 Oct 2014 23:13:36 +0000 (00:13 +0100)]
Use only unsigned arithmetic in constant-time operations

Signed-off-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
9 years agoFix and improve SSL_MODE_SEND_FALLBACK_SCSV documentation.
Bodo Moeller [Tue, 21 Oct 2014 20:41:07 +0000 (22:41 +0200)]
Fix and improve SSL_MODE_SEND_FALLBACK_SCSV documentation.

Reviewed-by: Rich Salz <rsalz@openssl.org>
9 years agoWhen processing ClientHello.cipher_suites, don't ignore cipher suites
Bodo Moeller [Tue, 21 Oct 2014 20:32:44 +0000 (22:32 +0200)]
When processing ClientHello.cipher_suites, don't ignore cipher suites
listed after TLS_FALLBACK_SCSV.

RT: 3575
Reviewed-by: Emilia Kasper <emilia@openssl.org>
9 years agoKeep old method in case of an unsupported protocol
Kurt Roeckx [Tue, 21 Oct 2014 18:45:15 +0000 (20:45 +0200)]
Keep old method in case of an unsupported protocol

When we're configured with no-ssl3 and we receive an SSL v3 Client Hello, we set
the method to NULL.  We didn't used to do that, and it breaks things.  This is a
regression introduced in 62f45cc27d07187b59551e4fad3db4e52ea73f2c.  Keep the old
method since the code is not able to deal with a NULL method at this time.

CVE-2014-3569, PR#3571

Reviewed-by: Emilia Käsper <emilia@openssl.org>
(cherry picked from commit 392fa7a952e97d82eac6958c81ed1e256e6b8ca5)

9 years agono-ssl2 with no-ssl3 does not mean drop the ssl lib
Tim Hudson [Mon, 20 Oct 2014 05:12:17 +0000 (15:12 +1000)]
no-ssl2 with no-ssl3 does not mean drop the ssl lib

Reviewed-by: Geoff Thorpe <geoff@openssl.org>
(cherry picked from commit c882abd52269a59ed8e0510e5febf667428ece85)

9 years agoe_os.h: refine inline override logic (to address warnings in debug build).
Andy Polyakov [Tue, 30 Sep 2014 19:05:33 +0000 (21:05 +0200)]
e_os.h: refine inline override logic (to address warnings in debug build).

Reviewed-by: Dr Stephen Henson <steve@openssl.org>
(cherry picked from commit 55c7a4cf112bf154ed405ee05a6b7924b6b1ba92)

9 years agoe_os.h: allow inline functions to be compiled by legacy compilers.
Andy Polyakov [Wed, 24 Sep 2014 22:32:56 +0000 (00:32 +0200)]
e_os.h: allow inline functions to be compiled by legacy compilers.

Reviewed-by: Matt Caswell <matt@openssl.org>
(cherry picked from commit 40155f408985aff2e9f1b61b7cb04a3e518633a1)

9 years agoRT3547: Add missing static qualifier
Kurt Cancemi [Sun, 28 Sep 2014 19:28:49 +0000 (15:28 -0400)]
RT3547: Add missing static qualifier

Reviewed-by: Ben Laurie <ben@openssl.org>
(cherry picked from commit 87d388c955c14a7c1371f9c7555fb429a406a3d3)

9 years agoPrepare for 1.0.0p-dev
Matt Caswell [Wed, 15 Oct 2014 12:52:37 +0000 (13:52 +0100)]
Prepare for 1.0.0p-dev

Reviewed-by: Stephen Henson <steve@openssl.org>
9 years agoPrepare for 1.0.0o release OpenSSL_1_0_0o
Matt Caswell [Wed, 15 Oct 2014 12:52:08 +0000 (13:52 +0100)]
Prepare for 1.0.0o release

Reviewed-by: Stephen Henson <steve@openssl.org>
9 years agoUpdates to NEWS
Matt Caswell [Wed, 15 Oct 2014 11:29:06 +0000 (12:29 +0100)]
Updates to NEWS

Reviewed-by: Dr Stephen Henson <steve@openssl.org>
9 years agoUpdate to CHANGES file
Matt Caswell [Wed, 15 Oct 2014 09:50:25 +0000 (10:50 +0100)]
Update to CHANGES file

Reviewed-by: Bodo Möller <bodo@openssl.org>
9 years agoFix no-ssl3 configuration option
Geoff Thorpe [Wed, 15 Oct 2014 07:25:50 +0000 (03:25 -0400)]
Fix no-ssl3 configuration option

CVE-2014-3568

Reviewed-by: Emilia Kasper <emilia@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
9 years agoFix for session tickets memory leak.
Dr. Stephen Henson [Wed, 15 Oct 2014 01:01:16 +0000 (02:01 +0100)]
Fix for session tickets memory leak.

CVE-2014-3567

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
9 years agoFix SSL_R naming inconsistency.
Bodo Moeller [Wed, 15 Oct 2014 12:47:17 +0000 (14:47 +0200)]
Fix SSL_R naming inconsistency.

Reviewed-by: Tim Hudson <tjh@openssl.org>
9 years agoAdd constant_time_locl.h to HEADERS,
Tim Hudson [Thu, 25 Sep 2014 06:04:35 +0000 (08:04 +0200)]
Add constant_time_locl.h to HEADERS,
so the Win32 compile picks it up correctly.

Reviewed-by: Richard Levitte <levitte@openssl.org>
9 years agoAdd the constant time test to the VMS build and tests
Richard Levitte [Thu, 25 Sep 2014 04:47:23 +0000 (06:47 +0200)]
Add the constant time test to the VMS build and tests

Reviewed-by: Tim Hudson <tjh@openssl.org>
Conflicts:
test/maketests.com
test/tests.com

9 years agoInclude "constant_time_locl.h" rather than "../constant_time_locl.h".
Richard Levitte [Wed, 24 Sep 2014 20:59:37 +0000 (22:59 +0200)]
Include "constant_time_locl.h" rather than "../constant_time_locl.h".
The different -I compiler parameters will take care of the rest...

Reviewed-by: Tim Hudson <tjh@openssl.org>
Conflicts:
crypto/evp/evp_enc.c

9 years agoSpaces were added in some strings for better readability. However, those spaces do...
Richard Levitte [Mon, 16 Jun 2014 11:24:04 +0000 (13:24 +0200)]
Spaces were added in some strings for better readability. However, those spaces do not belong in file names, so when picking out the individual parts, remove the spaces

Reviewed-by: Tim Hudson <tjh@openssl.org>
9 years agoAdjust VMS build to Unix build. Most of all, make it so the disabled
Richard Levitte [Wed, 6 Aug 2014 02:37:27 +0000 (04:37 +0200)]
Adjust VMS build to Unix build.  Most of all, make it so the disabled
algorithms MD2 and RC5 don't get built.
Also, disable building the test apps in crypto/des and crypto/pkcs7, as
they have no support at all.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Conflicts:
crypto/crypto-lib.com
makevms.com
ssl/ssl-lib.com

9 years agoMake sure test/tests.com exit gracefully, even when openssl.exe wasn't properly built.
Richard Levitte [Wed, 18 Jun 2014 11:41:54 +0000 (13:41 +0200)]
Make sure test/tests.com exit gracefully, even when openssl.exe wasn't properly built.

Reviewed-by: Tim Hudson <tjh@openssl.org>
9 years agoMake sure that disabling the MAYLOSEDATA3 warning is only done when the compiler...
Richard Levitte [Sat, 14 Jun 2014 13:13:44 +0000 (15:13 +0200)]
Make sure that disabling the MAYLOSEDATA3 warning is only done when the compiler supports it. Otherwise, there are warnings about it lacking everywhere, which is quite tedious to read through while trying to check for other warnings.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Conflicts:
ssl/ssl-lib.com

9 years agoAdd TLS_FALLBACK_SCSV documentation, and move s_client -fallback_scsv
Bodo Moeller [Wed, 15 Oct 2014 09:14:34 +0000 (11:14 +0200)]
Add TLS_FALLBACK_SCSV documentation, and move s_client -fallback_scsv
handling out of #ifndef OPENSSL_NO_DTLS1 section.

Reviewed-by: Rich Salz <rsalz@openssl.org>
9 years agoOops -- fix typo in coment added with TLS_FALLBACK_SCSV support.
Bodo Moeller [Wed, 15 Oct 2014 02:25:41 +0000 (04:25 +0200)]
Oops -- fix typo in coment added with TLS_FALLBACK_SCSV support.

Reviewed-by: Steve Henson <steve@openss.org>
9 years agoSupport TLS_FALLBACK_SCSV.
Bodo Moeller [Wed, 15 Oct 2014 02:05:57 +0000 (04:05 +0200)]
Support TLS_FALLBACK_SCSV.

Reviewed-by: Rich Salz <rsalz@openssl.org>
9 years agoRemoved duplicate definition of PKCS7_type_is_encrypted
Matt Caswell [Fri, 3 Oct 2014 22:48:49 +0000 (23:48 +0100)]
Removed duplicate definition of PKCS7_type_is_encrypted

Patch supplied by Matthieu Patou <mat@matws.net>, and modified to also
remove duplicate definition of PKCS7_type_is_digest.

PR#3551

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit e0fdea3e49e7454aa76bd5ecf3a3747641354c68)

9 years agoAdd additional DigestInfo checks.
Dr. Stephen Henson [Thu, 25 Sep 2014 22:28:48 +0000 (23:28 +0100)]
Add additional DigestInfo checks.

Reencode DigestInto in DER and check against the original: this
will reject any improperly encoded DigestInfo structures.

Note: this is a precautionary measure, there is no known attack
which can exploit this.

Thanks to Brian Smith for reporting this issue.
Reviewed-by: Tim Hudson <tjh@openssl.org>