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

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

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


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

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


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

7 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 <>
7 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 <>
7 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 <>
7 years agomake update
Matt Caswell [Wed, 15 Oct 2014 12:48:52 +0000 (13:48 +0100)]
make update

Reviewed-by: Stephen Henson <>
7 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 <>
7 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 <>
7 years agoFix no-ssl3 configuration option
Geoff Thorpe [Wed, 15 Oct 2014 07:25:50 +0000 (03:25 -0400)]
Fix no-ssl3 configuration option


Reviewed-by: Emilia Kasper <>
Reviewed-by: Rich Salz <>
7 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.


Reviewed-by: Rich Salz <>
Reviewed-by: Matt Caswell <>
(cherry picked from commit 90e53055939db40cf0fac1ad0c59630280aeee86)

7 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 <>
7 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 <>
7 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 <>
7 years agoSupport TLS_FALLBACK_SCSV.
Bodo Moeller [Wed, 15 Oct 2014 02:18:29 +0000 (04:18 +0200)]

Reviewed-by: Stephen Henson <>
7 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 <>
7 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 <>
(cherry picked from commit fdc35a9d3e8cf4cfd9330d5df9883f42cf5648ad)

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


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


7 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

(cherry picked from commit adb46dbc6dd7347750df2468c93e8c34bcb93a4b)

Reviewed-by: Rich Salz <>
7 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 <>,
as well as code from BoringSSL and OpenSSL.

Reviewed-by: Kurt Roeckx <>

7 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 <>
Reviewed-by: Matt Caswell <>
(cherry picked from commit b5ff559ff90124c6fd53bbb49dae5edb4e821e0a)

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

7 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 <>
Reviewed-by: Andy Polyakov <>
(cherry picked from commit 6a14fe7576e7a14a46ba14df8be8fe478536b4fb)

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

7 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


Reviewed-by: Tim Hudson <>
(cherry picked from commit 5d33b70ef5a4768fdfb77a73f9817c4570613039)

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


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

7 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

Reviewed-by: Richard Levitte <>
Reviewed-by: Dr Stephen Henson <>
(cherry picked from commit f511b25a7370c775dc9fd6198dbacd1706cf242b)


7 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

(cherry picked from commit 7753a3a68431aa81b82beea4c3f5374b41454679)


Reviewed-by: Rich Salz <>
(cherry picked from commit a90b1e32d2f697d1aa39b49038469e2ea40d5e7b)

7 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.



Reviewed-by: Emilia Käsper <>
7 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).



7 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 <>
7 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 <>
7 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 <>
7 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.


Reviewed-by: Dr. Stephen Henson <>
Reviewed-by: Kurt Roeckx <>
Reviewed-by: Tim Hudson <>
7 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


Reviewed-by: Dr. Stephen Henson <>
7 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


Reviewed-by: Emilia Käsper <>
Reviewed-by: Bodo Möller <>
7 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 <>
Reviewed-by: Emilia Käsper <>
7 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

Reviewed-by: Emilia Käsper <>
7 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

Reviewed-by: Matt Caswell <>
Reviewed-by: Emilia Käsper <>
7 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 <>
Reviewed-by: Emilia Käsper <>
7 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

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 <>
7 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 <>
7 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

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 <>
Reviewed-by: Emilia Käsper <>
7 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 <>
7 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 <>
7 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).


7 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".


Reviewed-by: Rich Salz <>
(cherry picked from commit cba11f57ce161fd301a72194827327128191de7e)

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

7 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 <>
Reviewed-by: Rich Salz <>
(cherry picked from commit c8d133e4b6f1ed1b7ad3c1a6d2c62f460e26c050)

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

Reviewed-by: Matt Caswell <>
(cherry picked from commit 197400c3f0d617d71ad8167b52fb73046d334320)

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

Reviewed-by: Stephen Henson <>
Reviewed-by: Matt Caswell <>
(cherry picked from commit d48e78f0cf22aaddb563f4bcfccf25b1a45ac8a4)

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

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

(cherry picked from commit ca2015a617842fed3d36ed4dcbbf8d5e27bc5216)

7 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.

(cherry picked from commit c8d710dc5f83d69d802f941a4cc5895eb5fe3d65)

7 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.

(cherry picked from commit 58a2aaeade8bdecd0f9f0df41927f7cff3012547)

7 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.

(cherry picked from commit 1c3e9a7c67ccdc5e770829fe951e5832e600d377)

7 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.


(cherry picked from commit 77747e2d9a5573b1dbc15e247ce18c03374c760c)

7 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

(cherry picked from commit 8b5dd340919e511137696792279f595a70ae2762)

7 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 <>


(cherry picked from commit 66816c53bea0ecddb9448da7ea9a51a334496127)

7 years agoPrevent infinite loop loading config files.
David Lloyd [Mon, 7 Jul 2014 12:11:48 +0000 (13:11 +0100)]
Prevent infinite loop loading config files.

(cherry picked from commit 9d23f422a32cb333a5e803199ae230706b1bf9f5)

7 years agoFix ECC SSLv2 exclusion on OpenSSL 0.9.8.
Dr. Stephen Henson [Mon, 7 Jul 2014 12:00:07 +0000 (13:00 +0100)]
Fix ECC SSLv2 exclusion on OpenSSL 0.9.8.

7 years agoUpdate ticket callback docs.
Dr. Stephen Henson [Thu, 3 Jul 2014 13:50:08 +0000 (14:50 +0100)]
Update ticket callback docs.
(cherry picked from commit a23a6e85d8dcd5733a343754f434201f3c9aa6f0)

7 years agoFixes for newer versions of pod2man
Matt Caswell [Sat, 5 Jul 2014 23:00:46 +0000 (00:00 +0100)]
Fixes for newer versions of pod2man

7 years agoFixed error in pod files with latest versions of pod2man
Matt Caswell [Sat, 5 Jul 2014 21:31:05 +0000 (22:31 +0100)]
Fixed error in pod files with latest versions of pod2man

(cherry picked from commit 07255f0a76d9d349d915e14f969b9ff2ee0d1953)

7 years agoReturn smaller of ret and f.
Alan Hryngle [Sat, 5 Jul 2014 21:24:03 +0000 (22:24 +0100)]
Return smaller of ret and f.

(cherry picked from commit fdea4fff8fb058be928980600b24cf4c62ef3630)

7 years agoDon't limit message sizes in ssl3_get_cert_verify.
Dr. Stephen Henson [Sat, 5 Jul 2014 12:19:12 +0000 (13:19 +0100)]
Don't limit message sizes in ssl3_get_cert_verify.

PR#319 (reoponed version).
(cherry picked from commit 7f6e9578648728478e84246fd3e64026b8b6a48e)



7 years agoMore doc fixes.
Dr. Stephen Henson [Thu, 3 Jul 2014 20:31:51 +0000 (21:31 +0100)]
More doc fixes.

7 years agoMore bugfixes from the doc-fix merge; errors found by DrH, thanks.
Rich Salz [Thu, 3 Jul 2014 20:17:54 +0000 (16:17 -0400)]
More bugfixes from the doc-fix merge; errors found by DrH, thanks.

7 years agoFix errors with last cherry-pick; SSL_CONF_* and s_client
Rich Salz [Thu, 3 Jul 2014 18:31:04 +0000 (14:31 -0400)]
Fix errors with last cherry-pick; SSL_CONF_* and s_client
-verify_return_error aren't in this release.

7 years agoMerge branch 'rsalz-docfixes'
Rich Salz [Thu, 3 Jul 2014 16:35:40 +0000 (12:35 -0400)]
Merge branch 'rsalz-docfixes'
(cherry picked from commit b5071dc2f67d7667ab3cbbe50a30342f999b896a)



7 years agoClose 3170, remove reference to Ariel Glenn's old 0.9.8 doc
Rich Salz [Thu, 3 Jul 2014 04:07:04 +0000 (00:07 -0400)]
Close 3170, remove reference to Ariel Glenn's old 0.9.8 doc
(cherry picked from commit f1112985e847286033ac573e70bdee752d26f46f)

7 years agoFix doc typo.
Matt Smart [Wed, 2 Jul 2014 02:43:42 +0000 (03:43 +0100)]
Fix doc typo.

ERR_get_error(3) references the non-existent
ERR_get_last_error_line_data instead of the one that does exist,

(cherry picked from commit 5cc99c6cf5e908df6b00b04af7f08e99c0698c7b)

7 years agoutil/ fix perl warning
Geoff Thorpe [Fri, 25 Apr 2014 05:20:16 +0000 (01:20 -0400)]
util/ fix perl warning

Gets rid of this;

defined(@array) is deprecated at ../util/ line 792.
        (Maybe you should just omit the defined()?)
defined(@array) is deprecated at ../util/ line 800.
        (Maybe you should just omit the defined()?)

Signed-off-by: Geoff Thorpe <>
(cherry picked from commit 647f360e2e86818cee1f2d0429e071d14814e0b5)

7 years agoASN1 sanity check.
Dr. Stephen Henson [Tue, 1 Jul 2014 23:57:57 +0000 (00:57 +0100)]
ASN1 sanity check.

Primitive encodings shouldn't use indefinite length constructed

PR#2438 (partial).
(cherry picked from commit 398e99fe5e06edb11f55a39ce0883d9aa633ffa9)

7 years agoFix memory leak.
Dr. Stephen Henson [Sun, 29 Jun 2014 12:53:06 +0000 (13:53 +0100)]
Fix memory leak.

(cherry picked from commit 59899c4d1b4b6ee4066a540bad2b62cb22ac3d91)

7 years agoTypo.
Ken Ballou [Sun, 29 Jun 2014 12:38:55 +0000 (13:38 +0100)]

(cherry picked from commit 76ed5a42ea68dd08bba44e4003b7e638e5d8a4a3)

7 years agoShow errors on CSR verification failure.
Dr. Stephen Henson [Sun, 29 Jun 2014 12:31:57 +0000 (13:31 +0100)]
Show errors on CSR verification failure.

If CSR verify fails in ca utility print out error messages.
Otherwise some errors give misleading output: for example
if the key size exceeds the library limit.

(cherry picked from commit a30bdb55d1361b9926eef8127debfc2e1bb8c484)

7 years agoTypo.
Dr. Stephen Henson [Sat, 28 Jun 2014 11:42:04 +0000 (12:42 +0100)]

(cherry picked from commit 7c206db9280865ae4af352dbc14e9019a6c4795d)

7 years agoDon't disable state strings with no-ssl2
Dr. Stephen Henson [Fri, 27 Jun 2014 23:54:32 +0000 (00:54 +0100)]
Don't disable state strings with no-ssl2

Some state strings were erronously not compiled when no-ssl2
was set.

(cherry picked from commit 0518a3e19e18cfc441cab261b28441b8c8bd77bf)

7 years agoFix typo in ideatest.c
Andreas Westfeld [Fri, 27 Jun 2014 23:04:56 +0000 (00:04 +0100)]
Fix typo in ideatest.c
(cherry picked from commit d1d4382dcb3fdcad4758ef7e7dd7b61dbf5abbfe)

7 years agoRemove redundant check.
Ken Ballou [Fri, 27 Jun 2014 22:17:47 +0000 (23:17 +0100)]
Remove redundant check.

(cherry picked from commit fd331c0bb9b557903dd2ce88398570a3327b5ef0)

7 years agoHandle IPv6 addresses in OCSP_parse_url.
Tom Greenslade [Fri, 27 Jun 2014 16:30:59 +0000 (17:30 +0100)]
Handle IPv6 addresses in OCSP_parse_url.

(cherry picked from commit b36f35cda964544a15d53d3fdfec9b2bab8cacb1)

7 years agoDon't advertise ECC ciphersuits in SSLv2 compatible client hello.
Tomas Mraz [Fri, 27 Jun 2014 15:49:22 +0000 (16:49 +0100)]
Don't advertise ECC ciphersuits in SSLv2 compatible client hello.

(cherry picked from commit 0436369fccd128cb7f6a8538d5fed1c876c437af)

7 years agoClarify docs.
Jeffrey Walton [Fri, 27 Jun 2014 15:33:06 +0000 (16:33 +0100)]
Clarify docs.

Document that the certificate passed to SSL_CTX_add_extra_chain_cert()
should not be freed by the application.


Add restrictions section present in other branches.

(cherry picked from commit 86cac6d3b25342ff17a2b6564f7592fd7c6829e8)

7 years agoMemory leak and NULL dereference fixes.
Dr. Stephen Henson [Fri, 27 Jun 2014 02:21:10 +0000 (03:21 +0100)]
Memory leak and NULL dereference fixes.

(cherry picked from commit d2aea038297e0c64ca66e6844cbb37377365885e)



7 years agoRemove ancient obsolete files under pkcs7.
Dr. Stephen Henson [Thu, 26 Jun 2014 11:36:44 +0000 (12:36 +0100)]
Remove ancient obsolete files under pkcs7.
(cherry picked from commit 7be6b27aaf5ed77f13c93dc89a2c27a42082db3f)

7 years agoMake sure BN_sqr can never return a negative value.
Huzaifa Sidhpurwala [Thu, 26 Jun 2014 22:45:58 +0000 (23:45 +0100)]
Make sure BN_sqr can never return a negative value.

(cherry picked from commit e14e764c0d5d469da63d0819c6ffc0e1e9e7f0bb)

7 years ago Fix off-by-one errors in ssl_cipher_get_evp()
Miod Vallat [Thu, 12 Jun 2014 20:25:07 +0000 (21:25 +0100)]
Fix off-by-one errors in ssl_cipher_get_evp()

    In the ssl_cipher_get_evp() function, fix off-by-one errors in index validation before accessing arrays.

    Bug discovered and fixed by Miod Vallat from the OpenBSD team.


7 years agoRevert " Fix off-by-one errors in ssl_cipher_get_evp()"
Matt Caswell [Sun, 22 Jun 2014 22:24:52 +0000 (23:24 +0100)]
Revert "    Fix off-by-one errors in ssl_cipher_get_evp()"

This reverts commit def1490717c091c6ef669da9fc5ea4c8b2a4d776.

Incorrect attribution

7 years agoAccept CCS after sending finished.
Dr. Stephen Henson [Sat, 14 Jun 2014 21:24:08 +0000 (22:24 +0100)]
Accept CCS after sending finished.

Allow CCS after finished has been sent by client: at this point
keys have been correctly set up so it is OK to accept CCS from
server. Without this renegotiation can sometimes fail.

(cherry picked from commit 99cd6a91fcb0931feaebbb4832681d40a66fad41)

7 years ago Fix off-by-one errors in ssl_cipher_get_evp()
Kurt Cancemi [Thu, 12 Jun 2014 20:25:07 +0000 (21:25 +0100)]
Fix off-by-one errors in ssl_cipher_get_evp()

    In the ssl_cipher_get_evp() function, fix off-by-one errors in index validation before accessing arrays.


7 years agoAllow the maximum value.
Ben Laurie [Mon, 19 May 2014 17:21:39 +0000 (18:21 +0100)]
Allow the maximum value.
(Backported as a result of PR#3377 reported by Rainer Jung <>)

7 years agoFix null pointer errors.
Dr. Stephen Henson [Tue, 10 Jun 2014 13:47:29 +0000 (14:47 +0100)]
Fix null pointer errors.

(cherry picked from commit 7a9d59c148b773f59a41f8697eeecf369a0974c2)