]> git.ipfire.org Git - thirdparty/openssl.git/log
thirdparty/openssl.git
9 years agoPrepare for 0.9.8zf-dev OpenSSL_0_9_8-pre-reformat
Matt Caswell [Thu, 15 Jan 2015 15:08:48 +0000 (15:08 +0000)] 
Prepare for 0.9.8zf-dev

Reviewed-by: Stephen Henson <steve@openssl.org>
9 years agoPrepare for 0.9.8ze release OpenSSL_0_9_8ze
Matt Caswell [Thu, 15 Jan 2015 15:05:59 +0000 (15:05 +0000)] 
Prepare for 0.9.8ze release

Reviewed-by: Stephen Henson <steve@openssl.org>
9 years agomake update
Matt Caswell [Thu, 15 Jan 2015 15:05:59 +0000 (15:05 +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 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)

Conflicts:
e_os.h

9 years agoAvoid Windows 8 Getversion deprecated errors.
Dr. Stephen Henson [Tue, 25 Feb 2014 12:11:22 +0000 (12:11 +0000)] 
Avoid Windows 8 Getversion deprecated errors.

Windows 8 SDKs complain that GetVersion() is deprecated.

We only use GetVersion like this:

(GetVersion() < 0x80000000)

which checks if the Windows version is NT based. Use a macro check_winnt()
which uses GetVersion() on older SDK versions and true otherwise.
(cherry picked from commit a4cc3c8041104896d51ae12ef7b678c31808ce52)

Conflicts:
apps/apps.c
crypto/bio/bss_log.c

Backported by Matt Caswell <matt@openssl.org>
Reviewed-by: Tim Hudson <tjh@openss.org>
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)

Conflicts:
.gitignore

9 years agoPrepare for 0.9.8ze-dev
Matt Caswell [Thu, 8 Jan 2015 14:36:15 +0000 (14:36 +0000)] 
Prepare for 0.9.8ze-dev

Reviewed-by: Stephen Henson <steve@openssl.org>
9 years agoPrepare for 0.9.8zd release OpenSSL_0_9_8zd
Matt Caswell [Thu, 8 Jan 2015 14:33:47 +0000 (14:33 +0000)] 
Prepare for 0.9.8zd release

Reviewed-by: Stephen Henson <steve@openssl.org>
9 years agomake update
Matt Caswell [Thu, 8 Jan 2015 14:33:47 +0000 (14:33 +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:37:28 +0000 (13:37 +0000)] 
CHANGES and NEWS updates for release

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Steve Henson <steve@openssl.org>
9 years agoFix typo.
Dr. Stephen Henson [Tue, 6 Jan 2015 14:28:34 +0000 (14:28 +0000)] 
Fix typo.

Fix typo in ssl3_get_cert_verify: we can only skip certificate verify
message if certificate is absent.

NB: OpenSSL 0.9.8 is NOT vulnerable to CVE-2015-0205 as it doesn't
support DH certificates and this typo prohibits skipping of
certificate verify message for sign only certificates anyway.

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>
Conflicts:
ssl/s3_pkt.c

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>
(cherry picked from commit e793809ba50c1e90ab592fb640a856168e50f3de)

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)

Conflicts:
CHANGES

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 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
ssl/d1_srvr.c
ssl/s3_srvr.c

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
ssl/s3_clnt.c

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 208a6012be3077d83df4475f32dd1b1446f3a02e)

Conflicts:
crypto/dsa/dsa_vrf.c

9 years agoUpdate ordinals.
Dr. Stephen Henson [Mon, 5 Jan 2015 15:35:55 +0000 (15:35 +0000)] 
Update ordinals.

Reviewed-by: Emilia Käsper <emilia@openssl.org>
9 years agoAdd ASN1_TYPE_cmp and X509_ALGOR_cmp.
Dr. Stephen Henson [Sun, 14 Dec 2014 23:14:15 +0000 (23:14 +0000)] 
Add ASN1_TYPE_cmp and X509_ALGOR_cmp.

(these are needed for certificate fingerprint fixes)
Reviewed-by: Emilia Käsper <emilia@openssl.org>
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>
(cherry picked from commit 86edf13b1c97526c0cf63c37342aaa01f5442688)

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 agoRevert "RT3425: constant-time evp_enc"
Emilia Kasper [Wed, 17 Dec 2014 13:52:13 +0000 (14:52 +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 1bb01b1b5f27a7de33e7a67946b8c001b54e09e9.

Reviewed-by: Andy Polyakov <appro@openssl.org>
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 agomd32_common.h: address compiler warning in HOST_c2l.
Andy Polyakov [Wed, 29 Oct 2014 09:48:39 +0000 (10:48 +0100)] 
md32_common.h: address compiler warning in HOST_c2l.

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

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:27 +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:33:03 +0000 (22:33 +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 agoFix warning
Kurt Roeckx [Tue, 21 Oct 2014 19:32:50 +0000 (21:32 +0200)] 
Fix warning

Reviewed-by: Emilia Käsper <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:23:54 +0000 (15:23 +1000)] 
no-ssl2 with no-ssl3 does not mean drop the ssl lib

Reviewed-by: Geoff Thorpe <geoff@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>
(cherry picked from commit e2e5326e5b068411999f62b4ba67835d64764ca5)

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>
(cherry picked from commit 8202802fadf7f70c656b92f3697da39c9c4271d7)

Conflicts:
crypto/evp/evp_enc.c

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)

Conflicts:
e_os.h

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 agoDon't try 1**0 test with FIPS.
Dr. Stephen Henson [Thu, 16 Oct 2014 03:18:50 +0000 (04:18 +0100)] 
Don't try 1**0 test with FIPS.

The 1**0 test will fail for FIPS capable builds because it uses the
old BIGNUM code in the 1.2 FIPS module which can't be fixed.
Reviewed-by: Emilia Käsper <emilia@openssl.org>
9 years agoPrepare for 0.9.8zd-dev
Matt Caswell [Wed, 15 Oct 2014 12:49:42 +0000 (13:49 +0100)] 
Prepare for 0.9.8zd-dev

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

Reviewed-by: Stephen Henson <steve@openssl.org>
9 years agomake update
Matt Caswell [Wed, 15 Oct 2014 12:48:52 +0000 (13:48 +0100)] 
make update

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

Reviewed-by: Dr Stephen Henson <steve@openssl.org>
9 years agoUpdates to CHANGES file
Matt Caswell [Wed, 15 Oct 2014 09:52:00 +0000 (10:52 +0100)] 
Updates 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>
(cherry picked from commit 90e53055939db40cf0fac1ad0c59630280aeee86)

9 years agoFix SSL_R naming inconsistency.
Bodo Moeller [Wed, 15 Oct 2014 12:39:17 +0000 (14:39 +0200)] 
Fix SSL_R naming inconsistency.

Reviewed-by: Tim Hudson <tjh@openssl.org>
9 years agoAdd TLS_FALLBACK_SCSV documentation, and move s_client -fallback_scsv
Bodo Moeller [Wed, 15 Oct 2014 09:15:58 +0000 (11:15 +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:26:29 +0000 (04:26 +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:18:29 +0000 (04:18 +0200)] 
Support TLS_FALLBACK_SCSV.

Reviewed-by: Stephen Henson <steve@openssl.org>
9 years agoAdd additional DigestInfo checks.
Dr. Stephen Henson [Mon, 29 Sep 2014 11:16:13 +0000 (12:16 +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>
9 years agoAdd missing tests
Emilia Kasper [Thu, 25 Sep 2014 11:39:21 +0000 (13:39 +0200)] 
Add missing tests

Accidentally omitted from commit 455b65dfab0de51c9f67b3c909311770f2b3f801

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

9 years agoRT3425: constant-time evp_enc
Emilia Kasper [Fri, 5 Sep 2014 12:47:33 +0000 (14:47 +0200)] 
RT3425: constant-time evp_enc

Do the final padding check in EVP_DecryptFinal_ex in constant time to
avoid a timing leak from padding failure.

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

Conflicts:
crypto/evp/Makefile
crypto/evp/evp_enc.c

9 years agoRT3067: simplify patch
Emilia Kasper [Thu, 4 Sep 2014 11:04:42 +0000 (13:04 +0200)] 
RT3067: simplify patch

(Original commit adb46dbc6dd7347750df2468c93e8c34bcb93a4b)

Use the new constant-time methods consistently in s3_srvr.c

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

Conflicts:
ssl/Makefile

9 years agoThis change alters the processing of invalid, RSA pre-master secrets so
Adam Langley [Wed, 24 Apr 2013 18:45:44 +0000 (14:45 -0400)] 
This change alters the processing of invalid, RSA pre-master secrets so
that bad encryptions are treated like random session keys in constant
time.

(cherry picked from commit adb46dbc6dd7347750df2468c93e8c34bcb93a4b)

Reviewed-by: Rich Salz <rsalz@openssl.org>
9 years agoRT3066: rewrite RSA padding checks to be slightly more constant time.
Emilia Kasper [Thu, 28 Aug 2014 17:43:49 +0000 (19:43 +0200)] 
RT3066: rewrite RSA padding checks to be slightly more constant time.

Also tweak s3_cbc.c to use new constant-time methods.
Also fix memory leaks from internal errors in RSA_padding_check_PKCS1_OAEP_mgf1

This patch is based on the original RT submission by Adam Langley <agl@chromium.org>,
as well as code from BoringSSL and OpenSSL.

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
Conflicts:
crypto/rsa/rsa_oaep.c

9 years agoFixed error introduced in commit f2be92b94dad3c6cbdf79d99a324804094cf1617
Tim Hudson [Sun, 21 Sep 2014 11:54:31 +0000 (21:54 +1000)] 
Fixed error introduced in commit f2be92b94dad3c6cbdf79d99a324804094cf1617
that fixed PR#3450 where an existing cast masked an issue when i was changed
from int to long in that commit

Picked up on z/linux (s390) where sizeof(int)!=sizeof(long)

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

9 years agoEnsure that x**0 mod 1 = 0.
Adam Langley [Tue, 23 Apr 2013 16:13:51 +0000 (12:13 -0400)] 
Ensure that x**0 mod 1 = 0.

(cherry picked from commit 2b0180c37fa6ffc48ee40caa831ca398b828e680)

Reviewed-by: Ben Laurie <ben@openssl.org>
9 years agoFollowup on RT3334 fix: make sure that a directory that's the empty
Richard Levitte [Thu, 14 Aug 2014 23:24:34 +0000 (01:24 +0200)] 
Followup on RT3334 fix: make sure that a directory that's the empty
string returns 0 with errno = ENOENT.

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

9 years agoRT3334: Fix crypto/LPdir_win.c
Phil Mesnier [Thu, 14 Aug 2014 17:35:07 +0000 (19:35 +0200)] 
RT3334: Fix crypto/LPdir_win.c

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Andy Polyakov <appro@openssl.org>
(cherry picked from commit 6a14fe7576e7a14a46ba14df8be8fe478536b4fb)

9 years agoMake the inline const-time functions static.
Emilia Kasper [Thu, 28 Aug 2014 17:45:55 +0000 (19:45 +0200)] 
Make the inline const-time functions static.

"inline" without static is not correct as the compiler may choose to ignore it
and will then either emit an external definition, or expect one.

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

9 years agoFixed double inclusion of string.h
Matt Caswell [Fri, 29 Aug 2014 20:25:42 +0000 (21:25 +0100)] 
Fixed double inclusion of string.h

PR2693

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

9 years agoConstant-time utilities
Emilia Kasper [Thu, 28 Aug 2014 13:33:34 +0000 (15:33 +0200)] 
Constant-time utilities

Pull constant-time methods out to a separate header, add tests.

Reviewed-by: Bodo Moeller <bodo@openssl.org>
(cherry picked from commit 73729e4cf3961e36b5534d270c11ff7cd811aa43)

Conflicts:
ssl/Makefile
test/Makefile

9 years agoRT3060: Limit the number of empty records.
Adam Langley [Tue, 19 Aug 2014 15:57:53 +0000 (17:57 +0200)] 
RT3060: Limit the number of empty records.

Limit the number of empty records that will be processed consecutively
in order to prevent ssl3_get_record from never returning.

Reported by "oftc_must_be_destroyed" and George Kadianakis.

Reviewed-by: Bodo Moeller <bodo@openssl.org>
(cherry picked from commit 3aac17a82fbaf2bc23ee62f24611e5883d3e7b97)

9 years agodefine inline for Visual Studio
Emilia Kasper [Tue, 19 Aug 2014 11:18:07 +0000 (13:18 +0200)] 
define inline for Visual Studio

In Visual Studio, inline is available in C++ only, however __inline is available for C, see
http://msdn.microsoft.com/en-us/library/z8y1yy88.aspx

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Dr Stephen Henson <steve@openssl.org>
(cherry picked from commit f511b25a7370c775dc9fd6198dbacd1706cf242b)

Conflicts:
e_os.h

9 years agoAdd volatile qualifications to two blocks of inline asm to stop GCC from
Adam Langley [Mon, 3 Jun 2013 19:45:11 +0000 (15:45 -0400)] 
Add volatile qualifications to two blocks of inline asm to stop GCC from
eliminating them as dead code.

Both volatile and "memory" are used because of some concern that the compiler
may still cache values across the asm block without it, and because this was
such a painful debugging session that I wanted to ensure that it's never
repeated.

(cherry picked from commit 7753a3a68431aa81b82beea4c3f5374b41454679)

Conflicts:
crypto/bn/asm/x86_64-gcc.c

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

9 years agoFixed out-of-bounds read errors in ssl3_get_key_exchange.
Matt Caswell [Sat, 26 Jul 2014 22:47:40 +0000 (23:47 +0100)] 
Fixed out-of-bounds read errors in ssl3_get_key_exchange.

PR#3450

Conflicts:
ssl/s3_clnt.c

Reviewed-by: Emilia Käsper <emilia@openssl.org>
9 years agoFurther improve/fix ec_GFp_simple_points_make_affine (ecp_smpl.c) and
Bodo Moeller [Wed, 13 Aug 2014 15:37:19 +0000 (17:37 +0200)] 
Further improve/fix ec_GFp_simple_points_make_affine (ecp_smpl.c) and
group_order_tests (ectest.c).  Also fix the EC_POINTs_mul documentation (ec.h).

Reviewed-by: emilia@openssl.org
Conflicts:
crypto/ec/ectest.c

Conflicts:
crypto/ec/ec.h

9 years agoPrepare for 0.9.8zc-dev
Matt Caswell [Wed, 6 Aug 2014 21:29:40 +0000 (22:29 +0100)] 
Prepare for 0.9.8zc-dev

Reviewed-by: Stephen Henson <steve@openssl.org>
9 years agoPrepare for 0.9.8zb release OpenSSL_0_9_8zb
Matt Caswell [Wed, 6 Aug 2014 21:29:20 +0000 (22:29 +0100)] 
Prepare for 0.9.8zb release

Reviewed-by: Stephen Henson <steve@openssl.org>
9 years agoUpdates to CHANGES and NEWS
Matt Caswell [Wed, 6 Aug 2014 20:28:59 +0000 (21:28 +0100)] 
Updates to CHANGES and NEWS

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
9 years agoFix OID handling:
Emilia Kasper [Wed, 2 Jul 2014 17:02:33 +0000 (19:02 +0200)] 
Fix OID handling:

- Upon parsing, reject OIDs with invalid base-128 encoding.
- Always NUL-terminate the destination buffer in OBJ_obj2txt printing function.

CVE-2014-3508

Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
9 years agoFix DTLS anonymous EC(DH) denial of service
Emilia Käsper [Thu, 24 Jul 2014 20:15:29 +0000 (22:15 +0200)] 
Fix DTLS anonymous EC(DH) denial of service

CVE-2014-3510

Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
9 years agoFix protocol downgrade bug in case of fragmented packets
David Benjamin [Wed, 23 Jul 2014 20:32:21 +0000 (22:32 +0200)] 
Fix protocol downgrade bug in case of fragmented packets

CVE-2014-3511

Reviewed-by: Emilia Käsper <emilia@openssl.org>
Reviewed-by: Bodo Möller <bodo@openssl.org>
9 years agoRemove some duplicate DTLS code.
Adam Langley [Fri, 6 Jun 2014 21:47:07 +0000 (14:47 -0700)] 
Remove some duplicate DTLS code.

In |dtls1_process_out_of_seq_message|, we know that
|frag_len| <= |msg_hdr->msg_len| so the later tests for |frag_len <
msg_hdr->msg_len| can be more clearly written as |frag_len !=
msg_hdr->msg_len|, since that's the only remaining case.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
9 years agoApplying same fix as in dtls1_process_out_of_seq_message. A truncated DTLS fragment...
Matt Caswell [Thu, 24 Jul 2014 22:54:28 +0000 (23:54 +0100)] 
Applying same fix as in dtls1_process_out_of_seq_message. A truncated DTLS fragment would cause *ok to be clear, but the return value would still be the number of bytes read.

Problem identified by Emilia Käsper, based on previous issue/patch by Adam
Langley.

Reviewed-by: Emilia Käsper <emilia@openssl.org>
9 years agoFix return code for truncated DTLS fragment.
Adam Langley [Fri, 6 Jun 2014 21:44:20 +0000 (14:44 -0700)] 
Fix return code for truncated DTLS fragment.

Previously, a truncated DTLS fragment in
|dtls1_process_out_of_seq_message| would cause *ok to be cleared, but
the return value would still be the number of bytes read. This would
cause |dtls1_get_message| not to consider it an error and it would
continue processing as normal until the calling function noticed that
*ok was zero.

I can't see an exploit here because |dtls1_get_message| uses
|s->init_num| as the length, which will always be zero from what I can
see.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
9 years agoFix memory leak from zero-length DTLS fragments.
Adam Langley [Fri, 6 Jun 2014 21:30:33 +0000 (14:30 -0700)] 
Fix memory leak from zero-length DTLS fragments.

The |pqueue_insert| function can fail if one attempts to insert a
duplicate sequence number. When handling a fragment of an out of
sequence message, |dtls1_process_out_of_seq_message| would not call
|dtls1_reassemble_fragment| if the fragment's length was zero. It would
then allocate a fresh fragment and attempt to insert it, but ignore the
return value, leaking the fragment.

This allows an attacker to exhaust the memory of a DTLS peer.

Fixes CVE-2014-3507

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
9 years agoFix DTLS handshake message size checks.
Matt Caswell [Fri, 6 Jun 2014 21:25:52 +0000 (14:25 -0700)] 
Fix DTLS handshake message size checks.

In |dtls1_reassemble_fragment|, the value of
|msg_hdr->frag_off+frag_len| was being checked against the maximum
handshake message size, but then |msg_len| bytes were allocated for the
fragment buffer. This means that so long as the fragment was within the
allowed size, the pending handshake message could consume 16MB + 2MB
(for the reassembly bitmap). Approx 10 outstanding handshake messages
are allowed, meaning that an attacker could consume ~180MB per DTLS
connection.

In the non-fragmented path (in |dtls1_process_out_of_seq_message|), no
check was applied.

Fixes CVE-2014-3506

Wholly based on patch by Adam Langley with one minor amendment.

Reviewed-by: Emilia Käsper <emilia@openssl.org>
9 years agoAdded comment for the frag->reassembly == NULL case as per feedback from Emilia
Matt Caswell [Thu, 24 Jul 2014 22:33:34 +0000 (23:33 +0100)] 
Added comment for the frag->reassembly == NULL case as per feedback from Emilia

Reviewed-by: Emilia Käsper <emilia@openssl.org>
9 years agoAvoid double free when processing DTLS packets.
Adam Langley [Fri, 6 Jun 2014 21:19:21 +0000 (14:19 -0700)] 
Avoid double free when processing DTLS packets.

The |item| variable, in both of these cases, may contain a pointer to a
|pitem| structure within |s->d1->buffered_messages|. It was being freed
in the error case while still being in |buffered_messages|. When the
error later caused the |SSL*| to be destroyed, the item would be double
freed.

Thanks to Wah-Teh Chang for spotting that the fix in 1632ef74 was
inconsistent with the other error paths (but correct).

Fixes CVE-2014-3505

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
9 years agofix warn_unused_result warnings
Dr. Stephen Henson [Wed, 6 Aug 2014 20:51:00 +0000 (21:51 +0100)] 
fix warn_unused_result warnings

Reviewed-by: Tim Hudson <tjh@openssl.org>
9 years agoFix warnings about ignored return values.
Dr. Stephen Henson [Thu, 17 Mar 2011 14:43:13 +0000 (14:43 +0000)] 
Fix warnings about ignored return values.
(cherry picked from commit 27131fe8f7418bf22b1e3000ea6a5d7b1ec8ebd4)
Reviewed-by: Matt Caswell <matt@openssl.org>
9 years agoSimplify and fix ec_GFp_simple_points_make_affine
Bodo Moeller [Fri, 1 Aug 2014 15:18:14 +0000 (17:18 +0200)] 
Simplify and fix ec_GFp_simple_points_make_affine
(which didn't always handle value 0 correctly).

Reviewed-by: emilia@openssl.org
Conflicts:
CHANGES
crypto/ec/ectest.c

9 years ago"EC_POINT_invert" was checking "dbl" function pointer instead of "invert".
Billy Brumley [Mon, 21 Jul 2014 21:08:23 +0000 (22:08 +0100)] 
"EC_POINT_invert" was checking "dbl" function pointer instead of "invert".

PR#2569

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

9 years agoRemove old unused and unmaintained demonstration code.
Tim Hudson [Mon, 21 Jul 2014 19:26:17 +0000 (05:26 +1000)] 
Remove old unused and unmaintained demonstration code.

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

9 years agoMinor documentation update removing "really" and a
Tim Hudson [Mon, 21 Jul 2014 10:03:50 +0000 (20:03 +1000)] 
Minor documentation update removing "really" and a
statement of opinion rather than a fact.

Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit c8d133e4b6f1ed1b7ad3c1a6d2c62f460e26c050)

9 years agoFix documentation for RSA_set_method(3)
Dr. Stephen Henson [Sat, 19 Jul 2014 13:20:05 +0000 (14:20 +0100)] 
Fix documentation for RSA_set_method(3)

PR#1675
Reviewed-by: Matt Caswell <matt@openssl.org>
(cherry picked from commit 197400c3f0d617d71ad8167b52fb73046d334320)

9 years agoFix typo, add reference.
Jeffrey Walton [Thu, 17 Jul 2014 10:25:02 +0000 (11:25 +0100)] 
Fix typo, add reference.

PR#3456
Reviewed-by: Stephen Henson <steve@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(cherry picked from commit d48e78f0cf22aaddb563f4bcfccf25b1a45ac8a4)

9 years agoAdd Matt Caswell's fingerprint, and general update on the fingerprints file to bring...
Matt Caswell [Tue, 15 Jul 2014 21:47:29 +0000 (22:47 +0100)] 
Add Matt Caswell's fingerprint, and general update on the fingerprints file to bring it up to date

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

9 years agoClarify -Verify and PSK.
Dr. Stephen Henson [Tue, 15 Jul 2014 19:22:39 +0000 (20:22 +0100)] 
Clarify -Verify and PSK.

PR#3452
(cherry picked from commit ca2015a617842fed3d36ed4dcbbf8d5e27bc5216)

9 years agoFix DTLS certificate requesting code.
Dr. Stephen Henson [Tue, 15 Jul 2014 17:21:59 +0000 (18:21 +0100)] 
Fix DTLS certificate requesting code.

Use same logic when determining when to expect a client
certificate for both TLS and DTLS.

PR#3452
(cherry picked from commit c8d710dc5f83d69d802f941a4cc5895eb5fe3d65)

9 years agoDon't allow -www etc options with DTLS.
Dr. Stephen Henson [Tue, 15 Jul 2014 11:22:49 +0000 (12:22 +0100)] 
Don't allow -www etc options with DTLS.

The options which emulate a web server don't make sense when doing DTLS.
Exit with an error if an attempt is made to use them.

PR#3453
(cherry picked from commit 58a2aaeade8bdecd0f9f0df41927f7cff3012547)

9 years agoUse case insensitive compare for servername.
Dr. Stephen Henson [Mon, 14 Jul 2014 22:59:13 +0000 (23:59 +0100)] 
Use case insensitive compare for servername.

PR#3445
(cherry picked from commit 1c3e9a7c67ccdc5e770829fe951e5832e600d377)

9 years agoFixed valgrind complaint due to BN_consttime_swap reading uninitialised data.
Matt Caswell [Thu, 10 Jul 2014 22:47:31 +0000 (23:47 +0100)] 
Fixed valgrind complaint due to BN_consttime_swap reading uninitialised data.
This is actually ok for this function, but initialised to zero anyway if
PURIFY defined.

This does have the impact of masking any *real* unitialised data reads in bn though.

Patch based on approach suggested by Rich Salz.

PR#3415

(cherry picked from commit 77747e2d9a5573b1dbc15e247ce18c03374c760c)

9 years ago* crypto/ui/ui_lib.c: misplaced brace in switch statement.
Richard Levitte [Sun, 13 Jul 2014 17:11:29 +0000 (19:11 +0200)] 
* crypto/ui/ui_lib.c: misplaced brace in switch statement.
  Detected by dcruette@qualitesys.com

(cherry picked from commit 8b5dd340919e511137696792279f595a70ae2762)

9 years agoFix memory leak in BIO_free if there is no destroy function.
Matt Caswell [Wed, 9 Jul 2014 22:29:17 +0000 (23:29 +0100)] 
Fix memory leak in BIO_free if there is no destroy function.
Based on an original patch by Neitrino Photonov <neitrinoph@gmail.com>

PR#3439

(cherry picked from commit 66816c53bea0ecddb9448da7ea9a51a334496127)