oweals/openssl.git
8 years agoDon't shift serial number into sign bit
Dr. Stephen Henson [Fri, 4 Mar 2016 18:04:46 +0000 (18:04 +0000)]
Don't shift serial number into sign bit

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

8 years agoSanity check PVK file fields.
Dr. Stephen Henson [Thu, 3 Mar 2016 23:37:36 +0000 (23:37 +0000)]
Sanity check PVK file fields.

PVK files with abnormally large length or salt fields can cause an
integer overflow which can result in an OOB read and heap corruption.
However this is an rarely used format and private key files do not
normally come from untrusted sources the security implications not
significant.

Fix by limiting PVK length field to 100K and salt to 10K: these should be
more than enough to cover any files encountered in practice.

Issue reported by Guido Vranken.

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

8 years agoPrepare for 1.0.1t-dev
Matt Caswell [Tue, 1 Mar 2016 13:42:02 +0000 (13:42 +0000)]
Prepare for 1.0.1t-dev

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoPrepare for 1.0.1s release OpenSSL_1_0_1s
Matt Caswell [Tue, 1 Mar 2016 13:40:46 +0000 (13:40 +0000)]
Prepare for 1.0.1s release

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agomake update
Matt Caswell [Tue, 1 Mar 2016 13:40:45 +0000 (13:40 +0000)]
make update

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoEnsure mk1mf.pl is aware of no-weak-ssl-ciphers option
Matt Caswell [Tue, 1 Mar 2016 12:08:33 +0000 (12:08 +0000)]
Ensure mk1mf.pl is aware of no-weak-ssl-ciphers option

Update mk1mf.pl to properly handle no-weak-ssl-ciphers

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoUpdate CHANGES and NEWS for new release
Matt Caswell [Tue, 1 Mar 2016 11:00:48 +0000 (11:00 +0000)]
Update CHANGES and NEWS for new release

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoperlasm/x86_64-xlate.pl: handle inter-bank movd.
Andy Polyakov [Thu, 11 Sep 2014 22:06:00 +0000 (00:06 +0200)]
perlasm/x86_64-xlate.pl: handle inter-bank movd.

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

8 years agocrypto/bn/x86_64-mont5.pl: constant-time gather procedure.
Andy Polyakov [Tue, 26 Jan 2016 15:25:02 +0000 (16:25 +0100)]
crypto/bn/x86_64-mont5.pl: constant-time gather procedure.

[Backport from master]

CVE-2016-0702

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agobn/bn_exp.c: constant-time MOD_EXP_CTIME_COPY_FROM_PREBUF.
Andy Polyakov [Tue, 26 Jan 2016 10:34:41 +0000 (11:34 +0100)]
bn/bn_exp.c: constant-time MOD_EXP_CTIME_COPY_FROM_PREBUF.

Performance penalty varies from platform to platform, and even
key length. For rsa2048 sign it was observed to reach almost 10%.

CVE-2016-0702

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoDisable EXPORT and LOW SSLv3+ ciphers by default
Viktor Dukhovni [Fri, 19 Feb 2016 18:05:11 +0000 (13:05 -0500)]
Disable EXPORT and LOW SSLv3+ ciphers by default

Reviewed-by: Emilia Käsper <emilia@openssl.org>
8 years agoBring SSL method documentation up to date
Viktor Dukhovni [Thu, 18 Feb 2016 04:22:59 +0000 (23:22 -0500)]
Bring SSL method documentation up to date

Reviewed-by: Emilia Käsper <emilia@openssl.org>
8 years agoDisable SSLv2 default build, default negotiation and weak ciphers.
Viktor Dukhovni [Thu, 18 Feb 2016 02:37:15 +0000 (21:37 -0500)]
Disable SSLv2 default build, default negotiation and weak ciphers.

SSLv2 is by default disabled at build-time.  Builds that are not
configured with "enable-ssl2" will not support SSLv2.  Even if
"enable-ssl2" is used, users who want to negotiate SSLv2 via the
version-flexible SSLv23_method() will need to explicitly call either
of:

    SSL_CTX_clear_options(ctx, SSL_OP_NO_SSLv2);
or
    SSL_clear_options(ssl, SSL_OP_NO_SSLv2);

as appropriate.  Even if either of those is used, or the application
explicitly uses the version-specific SSLv2_method() or its client
or server variants, SSLv2 ciphers vulnerable to exhaustive search
key recovery have been removed.  Specifically, the SSLv2 40-bit
EXPORT ciphers, and SSLv2 56-bit DES are no longer available.

Mitigation for CVE-2016-0800

Reviewed-by: Emilia Käsper <emilia@openssl.org>
8 years agoFix BN_hex2bn/BN_dec2bn NULL ptr/heap corruption
Matt Caswell [Mon, 22 Feb 2016 10:27:18 +0000 (10:27 +0000)]
Fix BN_hex2bn/BN_dec2bn NULL ptr/heap corruption

In the BN_hex2bn function the number of hex digits is calculated using
an int value |i|. Later |bn_expand| is called with a value of |i * 4|.
For large values of |i| this can result in |bn_expand| not allocating any
memory because |i * 4| is negative. This leaves ret->d as NULL leading
to a subsequent NULL ptr deref. For very large values of |i|, the
calculation |i * 4| could be a positive value smaller than |i|. In this
case memory is allocated to ret->d, but it is insufficiently sized
leading to heap corruption. A similar issue exists in BN_dec2bn.

This could have security consequences if BN_hex2bn/BN_dec2bn is ever
called by user applications with very large untrusted hex/dec data. This is
anticipated to be a rare occurrence.

All OpenSSL internal usage of this function uses data that is not expected
to be untrusted, e.g. config file data or application command line
arguments. If user developed applications generate config file data based
on untrusted data then it is possible that this could also lead to security
consequences. This is also anticipated to be a rare.

Issue reported by Guido Vranken.

CVE-2016-0797

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

8 years agoRevert "Don't check RSA_FLAG_SIGN_VER."
Kurt Roeckx [Sat, 27 Feb 2016 12:38:01 +0000 (13:38 +0100)]
Revert "Don't check RSA_FLAG_SIGN_VER."

This reverts commit 23a58779f53a9060c823d00d76b3070cad61d9a3.

This broke existing engines that didn't properly implement the sign and verify
functions.

Reviewed-by: Richard Levitte <levitte@openssl.org>
MR: #2077

8 years agoFix memory issues in BIO_*printf functions
Matt Caswell [Thu, 25 Feb 2016 13:09:46 +0000 (13:09 +0000)]
Fix memory issues in BIO_*printf functions

The internal |fmtstr| function used in processing a "%s" format string
in the BIO_*printf functions could overflow while calculating the length
of a string and cause an OOB read when printing very long strings.

Additionally the internal |doapr_outch| function can attempt to write to
an OOB memory location (at an offset from the NULL pointer) in the event of
a memory allocation failure. In 1.0.2 and below this could be caused where
the size of a buffer to be allocated is greater than INT_MAX. E.g. this
could be in processing a very long "%s" format string. Memory leaks can also
occur.

These issues will only occur on certain platforms where sizeof(size_t) >
sizeof(int). E.g. many 64 bit systems. The first issue may mask the second
issue dependent on compiler behaviour.

These problems could enable attacks where large amounts of untrusted data
is passed to the BIO_*printf functions. If applications use these functions
in this way then they could be vulnerable. OpenSSL itself uses these
functions when printing out human-readable dumps of ASN.1 data. Therefore
applications that print this data could be vulnerable if the data is from
untrusted sources. OpenSSL command line applications could also be
vulnerable where they print out ASN.1 data, or if untrusted data is passed
as command line arguments.

Libssl is not considered directly vulnerable. Additionally certificates etc
received via remote connections via libssl are also unlikely to be able to
trigger these issues because of message size limits enforced within libssl.

CVE-2016-0799

Issue reported by Guido Vranken.

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

8 years agoCVE-2016-0798: avoid memory leak in SRP
Emilia Kasper [Wed, 24 Feb 2016 11:59:59 +0000 (12:59 +0100)]
CVE-2016-0798: avoid memory leak in SRP

The SRP user database lookup method SRP_VBASE_get_by_user had confusing
memory management semantics; the returned pointer was sometimes newly
allocated, and sometimes owned by the callee. The calling code has no
way of distinguishing these two cases.

Specifically, SRP servers that configure a secret seed to hide valid
login information are vulnerable to a memory leak: an attacker
connecting with an invalid username can cause a memory leak of around
300 bytes per connection.

Servers that do not configure SRP, or configure SRP but do not configure
a seed are not vulnerable.

In Apache, the seed directive is known as SSLSRPUnknownUserSeed.

To mitigate the memory leak, the seed handling in SRP_VBASE_get_by_user
is now disabled even if the user has configured a seed.

Applications are advised to migrate to SRP_VBASE_get1_by_user. However,
note that OpenSSL makes no strong guarantees about the
indistinguishability of valid and invalid logins. In particular,
computations are currently not carried out in constant time.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoGH714: missing field initialisation
FdaSilvaYY [Fri, 19 Feb 2016 22:28:52 +0000 (23:28 +0100)]
GH714: missing field initialisation

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
(cherry picked from commit 04f2a0b50d219aafcef2fa718d91462b587aa23d)

8 years agoFix double free in DSA private key parsing.
Dr. Stephen Henson [Thu, 18 Feb 2016 12:47:23 +0000 (12:47 +0000)]
Fix double free in DSA private key parsing.

Fix double free bug when parsing malformed DSA private keys.

Thanks to Adam Langley (Google/BoringSSL) for discovering this bug using
libFuzzer.

CVE-2016-0705

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

8 years agomodes/ctr128.c: pay attention to ecount_buf alignment in CRYPTO_ctr128_encrypt.
Andy Polyakov [Fri, 12 Feb 2016 13:07:27 +0000 (14:07 +0100)]
modes/ctr128.c: pay attention to ecount_buf alignment in CRYPTO_ctr128_encrypt.

It's never problem if CRYPTO_ctr128_encrypt is called from EVP, because
buffer in question is always aligned within EVP_CIPHER_CTX structure.

RT#4218

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

8 years agoutil/mk1mf.pl: use LINK_CMD instead of LINK variable.
Andy Polyakov [Wed, 3 Feb 2016 17:21:00 +0000 (18:21 +0100)]
util/mk1mf.pl: use LINK_CMD instead of LINK variable.

Trouble is that LINK variable assignment in make-file interferes with
LINK environment variable, which can be used to modify Microsoft's
LINK.EXE behaviour.

RT#4289

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

Resolved conflicts:
util/pl/VC-32.pl

(cherry picked from commit 0fffd522426c7fc022894c8dd079dc2625c04096)

8 years agoms/uplink-x86.pl: make it work.
Andy Polyakov [Tue, 9 Feb 2016 10:53:11 +0000 (11:53 +0100)]
ms/uplink-x86.pl: make it work.

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

8 years agoFix CHANGES entry about DSA_generate_parameters_ex
Kurt Roeckx [Wed, 27 Jan 2016 19:31:57 +0000 (20:31 +0100)]
Fix CHANGES entry about DSA_generate_parameters_ex

Reviewed-by: Viktor Dukhovni <openssl-users@dukhovni.org>
(cherry picked from commit 2b0c11a620c3a3431410c5d56799286f60f60d8d)

8 years agoCorrect number of arguments in BIO_get_conn_int_port macro
Richard Levitte [Thu, 28 Jan 2016 16:55:11 +0000 (17:55 +0100)]
Correct number of arguments in BIO_get_conn_int_port macro

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

8 years agoPrepare for 1.0.1s-dev
Matt Caswell [Thu, 28 Jan 2016 14:22:09 +0000 (14:22 +0000)]
Prepare for 1.0.1s-dev

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoPrepare for 1.0.1r release OpenSSL_1_0_1r
Matt Caswell [Thu, 28 Jan 2016 14:21:21 +0000 (14:21 +0000)]
Prepare for 1.0.1r release

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoTARFILE wasn't correctly set
Richard Levitte [Thu, 28 Jan 2016 14:18:50 +0000 (15:18 +0100)]
TARFILE wasn't correctly set

This solves an earlier cherry-pick mistake.

Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoFurther updates to CHANGES and NEWS
Matt Caswell [Thu, 28 Jan 2016 12:28:53 +0000 (12:28 +0000)]
Further updates to CHANGES and NEWS

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoUpdate CHANGES and NEWS ready for release
Matt Caswell [Wed, 27 Jan 2016 13:55:05 +0000 (13:55 +0000)]
Update CHANGES and NEWS ready for release

Update CHANGES and NEWS with details of the issues fixed in the forthcoming
release.

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoBetter SSLv2 cipher-suite enforcement
Viktor Dukhovni [Thu, 31 Dec 2015 03:44:51 +0000 (22:44 -0500)]
Better SSLv2 cipher-suite enforcement

Based on patch by: Nimrod Aviram <nimrod.aviram@gmail.com>

CVE-2015-3197

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoAlways generate DH keys for ephemeral DH cipher suites
Matt Caswell [Thu, 17 Dec 2015 02:57:20 +0000 (02:57 +0000)]
Always generate DH keys for ephemeral DH cipher suites

Modified version of the commit ffaef3f15 in the master branch by Stephen
Henson. This makes the SSL_OP_SINGLE_DH_USE option a no-op and always
generates a new DH key for every handshake regardless.

This is a follow on from CVE-2016-0701. This branch is not impacted by
that CVE because it does not support X9.42 style parameters. It is still
possible to generate parameters based on primes that are not "safe",
although by default OpenSSL does not do this. The documentation does
sign post that using such parameters is unsafe if the private DH key is
reused. However to avoid accidental problems or future attacks this commit
has been backported to this branch.

Issue reported by Antonio Sanso

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
8 years agoFix BSD -rpath parameter
Richard Levitte [Tue, 19 Jan 2016 19:35:41 +0000 (20:35 +0100)]
Fix BSD -rpath parameter

For BSD systems, Configure adds a shared_ldflags including a reference
to the Makefile variable LIBRPATH, but since it must be passed down to
Makefile.shared, care must be taken so the value of LIBRPATH doesn't
get expanded too early, or it ends up giving an empty string.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
(cherry picked from commit c64879d3f3cc4c7f1c436a9fe3bd109847a23629)

8 years agoValidate ClientHello session_id field length and send alert on failure
Alessandro Ghedini [Wed, 13 Jan 2016 12:49:24 +0000 (12:49 +0000)]
Validate ClientHello session_id field length and send alert on failure

RT#4080

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoUpdate license year range to 2016
Prayag Verma [Mon, 18 Jan 2016 03:19:09 +0000 (08:49 +0530)]
Update license year range to 2016

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit 02f70372470b4dd3b21443bb615292175f5d2c88)

8 years agoEmpty SNI names are not valid
Viktor Dukhovni [Sat, 16 Jan 2016 17:57:24 +0000 (12:57 -0500)]
Empty SNI names are not valid

Reviewed-by: Rich Salz <rsalz@openssl.org>
8 years agoTo avoid possible time_t overflow use X509_time_adj_ex()
Dr. Stephen Henson [Thu, 14 Jan 2016 00:25:25 +0000 (00:25 +0000)]
To avoid possible time_t overflow use X509_time_adj_ex()

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
(cherry picked from commit 9aa00b187a65b1f30789d6274ec31ea86efe7973)

Conflicts:
apps/x509.c

8 years agoChange minimum DH size from 768 to 1024
Kurt Roeckx [Sun, 10 Jan 2016 12:55:08 +0000 (13:55 +0100)]
Change minimum DH size from 768 to 1024

Reviewed-by: Viktor Dukhovni <openssl-users@dukhovni.org>
8 years agoFile is about s_time, not s_client
Kurt Roeckx [Sat, 2 Jan 2016 19:42:27 +0000 (20:42 +0100)]
File is about s_time, not s_client

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

8 years agoFix X509_STORE_CTX_cleanup()
Viktor Dukhovni [Fri, 1 Jan 2016 05:51:12 +0000 (00:51 -0500)]
Fix X509_STORE_CTX_cleanup()

Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
8 years agoRT4202: Update rt URL's.
Rich Salz [Mon, 28 Dec 2015 19:58:23 +0000 (14:58 -0500)]
RT4202: Update rt URL's.

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

8 years agoAdd some documentation for the OCSP callback functions
Matt Caswell [Mon, 30 Nov 2015 16:04:51 +0000 (16:04 +0000)]
Add some documentation for the OCSP callback functions

Describe the usage of the OCSP callback functions on both the client and
the server side.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
(cherry picked from commit c52c3b5e11253afabaa62739a8ee1c4c4bddcd53)

8 years agoEnsure we don't call the OCSP callback if resuming a session
Matt Caswell [Mon, 30 Nov 2015 13:29:41 +0000 (13:29 +0000)]
Ensure we don't call the OCSP callback if resuming a session

It makes no sense to call the OCSP status callback if we are resuming a
session because no certificates will be sent.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
(cherry picked from commit 0ac6239955965f58f9dddb4229e8cd58e0dba20d)

8 years agoFix error when server does not send CertificateStatus message
Matt Caswell [Thu, 5 Nov 2015 14:52:27 +0000 (14:52 +0000)]
Fix error when server does not send CertificateStatus message

If a server sends the status_request extension then it may choose
to send the CertificateStatus message. However this is optional.
We were treating it as mandatory and the connection was failing.

Thanks to BoringSSL for reporting this issue.

RT#4120

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
(cherry picked from commit 905943af3b43116b64ae815db1a6b9c2f15e0356)

8 years agoFix memory leak in DSA redo case.
David Benjamin [Thu, 17 Dec 2015 19:11:11 +0000 (20:11 +0100)]
Fix memory leak in DSA redo case.

Found by clang scan-build.

Signed-off-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Richard Levitte <levitte@openssl.org>
RT: #4184, MR: #1496
(cherry picked from commit 679d87515d23ca31491effdc264edc81c695a72a)

8 years agoDon't check RSA_FLAG_SIGN_VER.
Dr. Stephen Henson [Sun, 20 Dec 2015 18:18:43 +0000 (18:18 +0000)]
Don't check RSA_FLAG_SIGN_VER.

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

8 years agoBIO_s_datagram() ctrl doesn't support SEEK/TELL, so don't pretend it does
Richard Levitte [Mon, 2 Nov 2015 15:43:28 +0000 (16:43 +0100)]
BIO_s_datagram() ctrl doesn't support SEEK/TELL, so don't pretend it does

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

8 years agoCorrect or add comments indicating what controls belong to what
Richard Levitte [Sun, 1 Nov 2015 14:56:21 +0000 (15:56 +0100)]
Correct or add comments indicating what controls belong to what

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

8 years agoDocument how BIO_get_conn_ip and BIO_get_conn_int_port actually work
Richard Levitte [Sun, 1 Nov 2015 14:45:49 +0000 (15:45 +0100)]
Document how BIO_get_conn_ip and BIO_get_conn_int_port actually work

No dummy arguments.

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

8 years agoHave BIO_get_conn_int_port use BIO_ctrl instead BIO_int_ctrl
Richard Levitte [Sun, 1 Nov 2015 14:42:04 +0000 (15:42 +0100)]
Have BIO_get_conn_int_port use BIO_ctrl instead BIO_int_ctrl

BIO_int_ctrl isn't made for the purpose BIO_get_conn_int_port used it
for.

This also changes BIO_C_GET_CONNECT to actually return the port
instead of assigning it to a pointer that was never returned back to
the caller.

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

8 years agoFix more URLs mangled by reformat
Matt Caswell [Sat, 19 Dec 2015 14:42:06 +0000 (14:42 +0000)]
Fix more URLs mangled by reformat

Fix some more URLs mangled by indent in the reformat. These ones don't exist
in master so we have a separate commit. Based on a patch supplied by Arnaud
Lacombe <al@aerilon.ca>

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoFix URLs mangled by reformat
Matt Caswell [Sat, 19 Dec 2015 14:38:17 +0000 (14:38 +0000)]
Fix URLs mangled by reformat

Some URLs in the source code ended up getting mangled by indent. This fixes
it. Based on a patch supplied by Arnaud Lacombe <al@aerilon.ca>

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoRemove the "eay" c-file-style indicators
Richard Levitte [Fri, 18 Dec 2015 12:13:31 +0000 (13:13 +0100)]
Remove the "eay" c-file-style indicators

Since we don't use the eay style any more, there's no point tryint to
tell emacs to use it.

Reviewed-by: Ben Laurie <ben@openssl.org>
8 years agoProvide better "make depend" warning.
Rich Salz [Thu, 10 Dec 2015 17:31:01 +0000 (12:31 -0500)]
Provide better "make depend" warning.

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

8 years agoFix a ** 0 mod 1 = 0 for real this time.
Emilia Kasper [Mon, 14 Dec 2015 15:38:15 +0000 (16:38 +0100)]
Fix a ** 0 mod 1 = 0 for real this time.

Commit 2b0180c37fa6ffc48ee40caa831ca398b828e680 attempted to do this but
only hit one of many BN_mod_exp codepaths. Fix remaining variants and add
a test for each method.

Thanks to Hanno Boeck for reporting this issue.

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

8 years agoFix tarball production to keep test/bctest and util/pod2mantest
Richard Levitte [Mon, 14 Dec 2015 02:53:06 +0000 (03:53 +0100)]
Fix tarball production to keep test/bctest and util/pod2mantest

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

8 years agoEnsure |rwstate| is set correctly on BIO_flush
Matt Caswell [Wed, 4 Nov 2015 11:20:50 +0000 (11:20 +0000)]
Ensure |rwstate| is set correctly on BIO_flush

A BIO_flush call in the DTLS code was not correctly setting the |rwstate|
variable to SSL_WRITING. This means that SSL_get_error() will not return
SSL_ERROR_WANT_WRITE in the event of an IO retry.

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

8 years agoFix DTLS handshake fragment retries
Matt Caswell [Tue, 3 Nov 2015 14:45:07 +0000 (14:45 +0000)]
Fix DTLS handshake fragment retries

If using DTLS and NBIO then if a second or subsequent handshake message
fragment hits a retry, then the retry attempt uses the wrong fragment
offset value. This commit restores the fragment offset from the last
attempt.

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

8 years agoDon't use applink for static builds.
Dr Stephen Henson [Tue, 8 Dec 2015 19:10:48 +0000 (19:10 +0000)]
Don't use applink for static builds.

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

8 years agoRefer to website for acknowledgements.
Rich Salz [Tue, 8 Dec 2015 21:07:09 +0000 (16:07 -0500)]
Refer to website for acknowledgements.

Reviewed-by: Steve Marquess <marquess@openssl.com>
(cherry picked from commit ab29c82a55f3583a490733dd521ea6c486e8e2fb)

8 years agoNot all 'find's know -xtype, use -type instead
Richard Levitte [Tue, 8 Dec 2015 14:34:52 +0000 (15:34 +0100)]
Not all 'find's know -xtype, use -type instead

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

8 years agoAdapt the OS X build to use the OS X tar
Richard Levitte [Tue, 8 Dec 2015 11:43:05 +0000 (12:43 +0100)]
Adapt the OS X build to use the OS X tar

As part of this, move release creation to a script to be called from
.travis.yml.  That makes it much easier to test outside of travis.

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

8 years agoMake it possible to affect the way dists are made
Richard Levitte [Tue, 8 Dec 2015 11:42:27 +0000 (12:42 +0100)]
Make it possible to affect the way dists are made

Introducing DISTTARVARS to propagate changed variables down to the
tar-making target.

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

8 years agoCleanup the EVP_MD_CTX before exit rather than after
Richard Levitte [Tue, 8 Dec 2015 00:01:13 +0000 (01:01 +0100)]
Cleanup the EVP_MD_CTX before exit rather than after

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

8 years agoChange tar owner and group to just 0
Richard Levitte [Mon, 7 Dec 2015 15:50:15 +0000 (16:50 +0100)]
Change tar owner and group to just 0

It seems like some tar versions don't like the name:id form for
--owner and --group.  The closest known anonymous user being 0 (root),
that seems to be the most appropriate user/group to assign ownership
to.  It matters very little when unpacking either way.

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

8 years agoDo not add symlinks in the source release
Richard Levitte [Mon, 7 Dec 2015 14:56:27 +0000 (15:56 +0100)]
Do not add symlinks in the source release

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

8 years agoIn travis, build from a "source release" rather than from the build tree
Richard Levitte [Mon, 7 Dec 2015 14:47:43 +0000 (15:47 +0100)]
In travis, build from a "source release" rather than from the build tree

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

8 years agoSmall changes to creating dists
Richard Levitte [Mon, 7 Dec 2015 14:45:50 +0000 (15:45 +0100)]
Small changes to creating dists

Make TARFILE include ../ instead of having that hard coded all over the place.
When transforming file names in TAR_COMMAND, use $(NAME) instead of openssl-$(VERSION)

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

8 years agoPrepare for 1.0.1r-dev
Matt Caswell [Thu, 3 Dec 2015 14:51:13 +0000 (14:51 +0000)]
Prepare for 1.0.1r-dev

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoPrepare for 1.0.1q release OpenSSL_1_0_1q
Matt Caswell [Thu, 3 Dec 2015 14:50:26 +0000 (14:50 +0000)]
Prepare for 1.0.1q release

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agomake update
Matt Caswell [Thu, 3 Dec 2015 14:50:26 +0000 (14:50 +0000)]
make update

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoUpdate CHANGES and NEWS
Matt Caswell [Tue, 1 Dec 2015 14:39:47 +0000 (14:39 +0000)]
Update CHANGES and NEWS

Update the CHANGES and NEWS files for the new release.

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoAdd PSS parameter check.
Dr. Stephen Henson [Fri, 2 Oct 2015 12:10:29 +0000 (13:10 +0100)]
Add PSS parameter check.

Avoid seg fault by checking mgf1 parameter is not NULL. This can be
triggered during certificate verification so could be a DoS attack
against a client or a server enabling client authentication.

Thanks to Loïc Jonas Etienne (Qnective AG) for discovering this bug.

CVE-2015-3194

Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agoFix leak with ASN.1 combine.
Dr. Stephen Henson [Tue, 10 Nov 2015 19:03:07 +0000 (19:03 +0000)]
Fix leak with ASN.1 combine.

When parsing a combined structure pass a flag to the decode routine
so on error a pointer to the parent structure is not zeroed as
this will leak any additional components in the parent.

This can leak memory in any application parsing PKCS#7 or CMS structures.

CVE-2015-3195.

Thanks to Adam Langley (Google/BoringSSL) for discovering this bug using
libFuzzer.

PR#4131

Reviewed-by: Richard Levitte <levitte@openssl.org>
8 years agoe_os.h: limit _MSC_VER trickery to older compilers.
Andy Polyakov [Thu, 3 Dec 2015 11:29:49 +0000 (12:29 +0100)]
e_os.h: limit _MSC_VER trickery to older compilers.

PR: #3390, backport from 1.0.2.

Reviewed-by: Matt Caswell <matt@openssl.org>
8 years agotypo
Dr. Stephen Henson [Wed, 2 Dec 2015 21:49:37 +0000 (21:49 +0000)]
typo

Reviewed-by: Andy Polyakov <appro@openssl.org>
8 years ago_BSD_SOURCE is deprecated, use _DEFAULT_SOURCE instead
Richard Levitte [Wed, 2 Dec 2015 17:18:03 +0000 (18:18 +0100)]
_BSD_SOURCE is deprecated, use _DEFAULT_SOURCE instead

The feature_test_macros(7) manual tells us that _BSD_SOURCE is
deprecated since glibc 2.20 and that the compiler will warn about it
being used, unless _DEFAULT_SOURCE is defined as well.

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

8 years agoReturn errors even if the cookie validation has succeeded
Matt Caswell [Mon, 30 Nov 2015 10:38:54 +0000 (10:38 +0000)]
Return errors even if the cookie validation has succeeded

In the DTLS ClientHello processing the return value is stored in |ret| which
by default is -1. We wish to return 1 on success or 2 on success *and* we
have validated the DTLS cookie. Previously on successful validation of the
cookie we were setting |ret| to 2. Unfortunately if we later encounter an
error then we can end up returning a successful (positive) return code from
the function because we already set |ret| to a positive value.

This does not appear to have a security consequence because the handshake
just fails at a later point.

Reviewed-by: Andy Polyakov <appro@openssl.org>
9 years agoUse both sun and __sun
Kurt Roeckx [Tue, 24 Nov 2015 22:21:06 +0000 (23:21 +0100)]
Use both sun and __sun

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

9 years agomark openssl configuration as loaded at end of OPENSSL_config
Marcus Meissner [Tue, 24 Nov 2015 21:03:58 +0000 (22:03 +0100)]
mark openssl configuration as loaded at end of OPENSSL_config

Signed-off-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Rich Salz <rsalz@akamai.com>
GH: #466
(cherry picked from commit 434b58457c8cca4d09f77a1774d6d2c446604bae)

9 years agossl3_free(): Return if it wasn't created
Pascal Cuoq [Sun, 22 Nov 2015 23:13:15 +0000 (00:13 +0100)]
ssl3_free(): Return if it wasn't created

If somewhere in SSL_new() there is a memory allocation failure, ssl3_free() can
get called with s->s3 still being NULL.

Patch also provided by Willy Tarreau <wtarreau@haproxy.com>

Signed-off-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Viktor Dukhovni <openssl-users@dukhovni.org>
(cherry picked from commit 3e7bd2ce0b16f8611298175d6dc7cb35ee06ea6d)

9 years agoSet reference count earlier
Kurt Roeckx [Tue, 24 Nov 2015 20:53:40 +0000 (21:53 +0100)]
Set reference count earlier

Backport of 0e04674e964b905e67e3d215bcf888932c92765f

Reviewed-by: Steve Henson <steve@openssl.org>
RT #4047, #4110, MR #1356

9 years agoFix uninitialised p error.
Dr. Stephen Henson [Tue, 24 Nov 2015 16:37:52 +0000 (16:37 +0000)]
Fix uninitialised p error.

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

9 years agoLimit depth of ASN1 parse printing.
Dr. Stephen Henson [Thu, 3 Sep 2015 13:27:19 +0000 (14:27 +0100)]
Limit depth of ASN1 parse printing.

Thanks to Guido Vranken <guidovranken@gmail.com> for reporting this issue.

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

Conflicts:
crypto/asn1/asn1_par.c

9 years agoUse defined(__sun) instead of defined(sun)
Kurt Roeckx [Sun, 22 Nov 2015 09:31:35 +0000 (10:31 +0100)]
Use defined(__sun) instead of defined(sun)

Strict ISO confirming C compilers only define __sun

Reviewed-by: Viktor Dukhovni <openssl-users@dukhovni.org>
RT #4144, MR #1353

(cherry picked from commit 3d32218812e87221344f2985512e42e4aaa88745)

9 years agoAdd initial AppVeyor configuration
Alessandro Ghedini [Wed, 28 Oct 2015 20:11:37 +0000 (21:11 +0100)]
Add initial AppVeyor configuration

Original patch by Frank Morgner.

Signed-off-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Rich Salz <rsalz@akamai.com>
GH: #456
(cherry picked from commit 68db80e2d1accdd4c4a6b4763559c6cfe9663820)

9 years agoEnsure all EVP calls have their returns checked where appropriate
Matt Caswell [Fri, 6 Nov 2015 16:31:21 +0000 (16:31 +0000)]
Ensure all EVP calls have their returns checked where appropriate

There are lots of calls to EVP functions from within libssl There were
various places where we should probably check the return value but don't.
This adds these checks.

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

Conflicts:
ssl/s3_enc.c
ssl/s3_srvr.c

9 years agoFix release in README.
Rich Salz [Wed, 18 Nov 2015 21:58:40 +0000 (16:58 -0500)]
Fix release in README.

Reviewed-by: Steve Marquess <marquess@openssl.com>
9 years agoRT32671: wrong multiple errs TS_check_status_info
Graeme Perrow [Fri, 13 Nov 2015 21:56:18 +0000 (16:56 -0500)]
RT32671: wrong multiple errs TS_check_status_info

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

9 years agoStop DTLS servers asking for unsafe legacy renegotiation
Matt Caswell [Tue, 10 Nov 2015 15:17:42 +0000 (15:17 +0000)]
Stop DTLS servers asking for unsafe legacy renegotiation

If a DTLS client that does not support secure renegotiation connects to an
OpenSSL DTLS server then, by default, renegotiation is disabled. If a
server application attempts to initiate a renegotiation then OpenSSL is
supposed to prevent this. However due to a discrepancy between the TLS and
DTLS code, the server sends a HelloRequest anyway in DTLS.

This is not a security concern because the handshake will still fail later
in the process when the client responds with a ClientHello.

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

9 years agoOnly call ssl3_init_finished_mac once for DTLS
Matt Caswell [Tue, 3 Nov 2015 15:49:08 +0000 (15:49 +0000)]
Only call ssl3_init_finished_mac once for DTLS

In DTLS if an IO retry occurs during writing of a fragmented ClientHello
then we can end up reseting the finish mac variables on the retry, which
causes a handshake failure. We should only reset on the first attempt not
on retries.

Thanks to BoringSSL for reporting this issue.

RT#4119

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

9 years agoFix missing malloc return value checks
Matt Caswell [Wed, 4 Nov 2015 15:51:02 +0000 (15:51 +0000)]
Fix missing malloc return value checks

During work on a larger change in master a number of locations were
identified where return value checks were missing. This backports the
relevant fixes.

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

Conflicts:
crypto/cms/cms_sd.c

9 years agoMake the match for previous cflags a bit more strict
Richard Levitte [Mon, 9 Nov 2015 08:50:56 +0000 (09:50 +0100)]
Make the match for previous cflags a bit more strict

./Configure [target] --strict-warnings -Wno-pedantic-ms-format
would not add '-pedantic' because it matches '-Wno-pedantic-ms-format',
which was added first.

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

9 years agoMinor EVP_SignInit_ex doc fix
Matt Caswell [Mon, 2 Nov 2015 15:37:45 +0000 (15:37 +0000)]
Minor EVP_SignInit_ex doc fix

EVP_SignInit_ex was missing from the NAME section of its man page so
typing "man EVP_SignInit_ex" failed to load the page.

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

9 years agoClarify the preferred way of creating patch files
Matt Caswell [Sun, 1 Nov 2015 14:41:29 +0000 (14:41 +0000)]
Clarify the preferred way of creating patch files

Clarify that git format-patch output is preferred for creating patch files.

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

9 years agoSome README and CONTRIBUTING cleanups.
Rich Salz [Sun, 1 Nov 2015 13:41:05 +0000 (08:41 -0500)]
Some README and CONTRIBUTING cleanups.

Close GH Issue 69
Close GH PR 457/RT4113
Some other updates

By Rich Salz, Alessandro Ghedini, Steve Marquess, Collin Anderson

(manual cherry-pick of a2aaf8be7e3c22a61ef89f273aa85f482b955336 and
b06935f439af7150d3ae566922353c3f210e63ed)

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
9 years agoBN_GF2m_mod_inv(): check bn_wexpand return value
Pascal Cuoq [Mon, 12 Oct 2015 10:19:19 +0000 (12:19 +0200)]
BN_GF2m_mod_inv(): check bn_wexpand return value

Signed-off-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Rich Salz <rsalz@akamai.com>
MR #1276, RT #4107

(cherry picked from commit 94b3664a528258df5ebcaae213d19bf6568cc47d)

9 years agoRemove useless code
Alessandro Ghedini [Thu, 8 Oct 2015 20:00:27 +0000 (22:00 +0200)]
Remove useless code

RT#4081

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit 070c23325af4526c9a8532a60d63522c58d5554b)

9 years agoCheck memory allocation
Alessandro Ghedini [Thu, 8 Oct 2015 12:50:27 +0000 (14:50 +0200)]
Check memory allocation

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit 8cf9d71a3a43d9b98a8a278d47dc08088a954a7b)

9 years agoFix references to various RFCs
Alessandro Ghedini [Thu, 8 Oct 2015 12:41:09 +0000 (14:41 +0200)]
Fix references to various RFCs

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit 3240e7cf5f651d9d94814b4d494fbe294e463b72)

9 years agoFix typos
Alessandro Ghedini [Thu, 8 Oct 2015 12:40:42 +0000 (14:40 +0200)]
Fix typos

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit d900a015b5a89ea2018e6122dd2738925e4d68ab)