Richard Levitte [Mon, 9 May 2016 19:52:11 +0000 (21:52 +0200)]
Add NULL check in i2d_PrivateKey()
Originally submitted by Kurt Cancemi <kurt@x64architecture.com>
Closes RT#4533
Reviewed-by: Matt Caswell <matt@openssl.org>
(cherry picked from commit
59a56c4cf02bbf1efeda6c2a5893d5079db78ff3)
David Benjamin [Sun, 6 Mar 2016 00:49:20 +0000 (19:49 -0500)]
Don't send signature algorithms when client_version is below TLS 1.2.
Per RFC 5246,
Note: this extension is not meaningful for TLS versions prior to 1.2.
Clients MUST NOT offer it if they are offering prior versions.
However, even if clients do offer it, the rules specified in [TLSEXT]
require servers to ignore extensions they do not understand.
Although second sentence would suggest that there would be no interop
problems in always offering the extension, WebRTC has reported issues
with Bouncy Castle on < TLS 1.2 ClientHellos that still include
signature_algorithms. See also
https://bugs.chromium.org/p/webrtc/issues/detail?id=4223
RT#4390
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Stephen Henson <steve@openssl.org>
(cherry picked from commit
f7aa318552c4ef62d902c480b59bd7c4513c0009)
Conflicts:
ssl/ssl_locl.h
Matt Caswell [Mon, 9 May 2016 14:04:11 +0000 (15:04 +0100)]
Fix BIO_eof() for BIO pairs
BIO_eof() was always returning true when using a BIO pair. It should only
be true if the peer BIO is empty and has been shutdown.
RT#1215
Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit
3105d695358d86c0f2a404b2b74a1870b941ce5e)
Dr. Stephen Henson [Sun, 8 May 2016 23:06:02 +0000 (00:06 +0100)]
Only call FIPS_update, FIPS_final in FIPS mode.
RT#3826
Reviewed-by: Tim Hudson <tjh@openssl.org>
Dr. Stephen Henson [Fri, 6 May 2016 02:46:09 +0000 (03:46 +0100)]
Constify PKCS12_newpass()
PR#4449
Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit
049f5bbce3eebdf4ec2030042eb2ae64bb67aedb)
Conflicts:
doc/crypto/PKCS12_newpass.pod
Dr. Stephen Henson [Thu, 5 May 2016 14:37:23 +0000 (15:37 +0100)]
Tidy up PKCS12_newpass() fix memory leaks.
PR#4466
Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit
d800d0f45b7618c30692c01d4dbf96042468b932)
Conflicts:
crypto/pkcs12/p12_npas.c
Dr. Stephen Henson [Fri, 6 May 2016 18:27:49 +0000 (19:27 +0100)]
Only set CMS parameter when encrypting
Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit
708cf5ded249f871fcd5e3de27d9281b1f37ae71)
Dr. Stephen Henson [Thu, 5 May 2016 21:17:05 +0000 (22:17 +0100)]
Use default ASN.1 for SEED.
The default ASN.1 handling can be used for SEED. This also makes
CMS work with SEED.
PR#4504
Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit
c0aa8c274843c5b8a70d70fc05d71fa3dfd510db)
Dr. Stephen Henson [Mon, 21 Mar 2016 15:48:51 +0000 (15:48 +0000)]
Always try to set ASN.1 parameters for CMS.
Try to set the ASN.1 parameters for CMS encryption even if the IV
length is zero as the underlying cipher should still set the type.
This will correctly result in errors if an attempt is made to use
an unsupported cipher type.
Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit
3fd60dc42288591737a35a90368d72dbd00fdef8)
Conflicts:
crypto/cms/cms_enc.c
Richard Levitte [Wed, 4 May 2016 12:44:10 +0000 (14:44 +0200)]
Check return of PEM_write_* functions and report possible errors
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1025)
(cherry picked from commit
c73aa309049c4f04ec81f0f1cf552eab8456a16e)
Dr. Stephen Henson [Wed, 4 May 2016 15:09:06 +0000 (16:09 +0100)]
Fix name length limit check.
The name length limit check in x509_name_ex_d2i() includes
the containing structure as well as the actual X509_NAME. This will
cause large CRLs to be rejected.
Fix by limiting the length passed to ASN1_item_ex_d2i() which will
then return an error if the passed X509_NAME exceeds the length.
RT#4531
Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit
4e0d184ac1dde845ba9574872e2ae5c903c81dff)
Dr. Stephen Henson [Tue, 3 May 2016 14:05:31 +0000 (15:05 +0100)]
Fix double free in d2i_PrivateKey().
RT#4527
Reviewed-by: Matt Caswell <matt@openssl.org>
(cherry picked from commit
3340e8bb186f689df5720352f65a9c0c42b6046b)
Dr. Stephen Henson [Tue, 3 May 2016 14:21:41 +0000 (15:21 +0100)]
add documentation
Reviewed-by: Matt Caswell <matt@openssl.org>
(cherry picked from commit
b1b3e14fbeb373a288ba20402600e071e6f402f8)
Matt Caswell [Tue, 3 May 2016 13:47:32 +0000 (14:47 +0100)]
Prepare for 1.0.2i-dev
Reviewed-by: Rich Salz <rsalz@openssl.org>
Matt Caswell [Tue, 3 May 2016 13:46:41 +0000 (14:46 +0100)]
Prepare for 1.0.2h release
Reviewed-by: Rich Salz <rsalz@openssl.org>
Matt Caswell [Tue, 3 May 2016 13:46:41 +0000 (14:46 +0100)]
make update
Reviewed-by: Rich Salz <rsalz@openssl.org>
Matt Caswell [Tue, 3 May 2016 08:37:23 +0000 (09:37 +0100)]
Update CHANGES and NEWS for the new release
Reviewed-by: Richard Levitte <levitte@openssl.org>
Dr. Stephen Henson [Fri, 15 Apr 2016 01:37:09 +0000 (02:37 +0100)]
Fix ASN1_INTEGER handling.
Only treat an ASN1_ANY type as an integer if it has the V_ASN1_INTEGER
tag: V_ASN1_NEG_INTEGER is an internal only value which is never used
for on the wire encoding.
Thanks to David Benjamin <davidben@google.com> for reporting this bug.
This was found using libFuzzer.
RT#4364 (part)CVE-2016-2108.
Reviewed-by: Emilia Käsper <emilia@openssl.org>
Kurt Roeckx [Sat, 16 Apr 2016 21:08:56 +0000 (23:08 +0200)]
Check that we have enough padding characters.
Reviewed-by: Emilia Käsper <emilia@openssl.org>
CVE-2016-2107
MR: #2572
Matt Caswell [Tue, 3 May 2016 11:45:45 +0000 (12:45 +0100)]
Remove some documentation for functions not in 1.0.x
A few functions in the recently added EVP_EncodeInit docs don't apply to
the 1.0.x branches.
Reviewed-by: Richard Levitte <levitte@openssl.org>
Matt Caswell [Mon, 25 Apr 2016 10:54:30 +0000 (11:54 +0100)]
Add documentation for EVP_EncodeInit() and similar functions
Reviewed-by: Richard Levitte <levitte@openssl.org>
Matt Caswell [Mon, 25 Apr 2016 08:06:29 +0000 (09:06 +0100)]
Ensure EVP_EncodeUpdate handles an output length that is too long
With the EVP_EncodeUpdate function it is the caller's responsibility to
determine how big the output buffer should be. The function writes the
amount actually used to |*outl|. However this could go negative with a
sufficiently large value for |inl|. We add a check for this error
condition.
Reviewed-by: Richard Levitte <levitte@openssl.org>
Matt Caswell [Fri, 4 Mar 2016 10:17:17 +0000 (10:17 +0000)]
Avoid overflow in EVP_EncodeUpdate
An overflow can occur in the EVP_EncodeUpdate function which is used for
Base64 encoding of binary data. If an attacker is able to supply very large
amounts of input data then a length check can overflow resulting in a heap
corruption. Due to the very large amounts of data involved this will most
likely result in a crash.
Internally to OpenSSL the EVP_EncodeUpdate function is primarly used by the
PEM_write_bio* family of functions. These are mainly used within the
OpenSSL command line applications, so any application which processes
data from an untrusted source and outputs it as a PEM file should be
considered vulnerable to this issue.
User applications that call these APIs directly with large amounts of
untrusted data may also be vulnerable.
Issue reported by Guido Vranken.
CVE-2016-2105
Reviewed-by: Richard Levitte <levitte@openssl.org>
Matt Caswell [Thu, 28 Apr 2016 09:46:55 +0000 (10:46 +0100)]
Prevent EBCDIC overread for very long strings
ASN1 Strings that are over 1024 bytes can cause an overread in
applications using the X509_NAME_oneline() function on EBCDIC systems.
This could result in arbitrary stack data being returned in the buffer.
Issue reported by Guido Vranken.
CVE-2016-2176
Reviewed-by: Andy Polyakov <appro@openssl.org>
Matt Caswell [Thu, 3 Mar 2016 23:36:23 +0000 (23:36 +0000)]
Fix encrypt overflow
An overflow can occur in the EVP_EncryptUpdate function. If an attacker is
able to supply very large amounts of input data after a previous call to
EVP_EncryptUpdate with a partial block then a length check can overflow
resulting in a heap corruption.
Following an analysis of all OpenSSL internal usage of the
EVP_EncryptUpdate function all usage is one of two forms.
The first form is like this:
EVP_EncryptInit()
EVP_EncryptUpdate()
i.e. where the EVP_EncryptUpdate() call is known to be the first called
function after an EVP_EncryptInit(), and therefore that specific call
must be safe.
The second form is where the length passed to EVP_EncryptUpdate() can be
seen from the code to be some small value and therefore there is no
possibility of an overflow.
Since all instances are one of these two forms, I believe that there can
be no overflows in internal code due to this problem.
It should be noted that EVP_DecryptUpdate() can call EVP_EncryptUpdate()
in certain code paths. Also EVP_CipherUpdate() is a synonym for
EVP_EncryptUpdate(). Therefore I have checked all instances of these
calls too, and came to the same conclusion, i.e. there are no instances
in internal usage where an overflow could occur.
This could still represent a security issue for end user code that calls
this function directly.
CVE-2016-2106
Issue reported by Guido Vranken.
Reviewed-by: Tim Hudson <tjh@openssl.org>
(cherry picked from commit
3f3582139fbb259a1c3cbb0a25236500a409bf26)
Dr. Stephen Henson [Mon, 2 May 2016 16:33:50 +0000 (17:33 +0100)]
Fix i2d_X509_AUX: pp can be NULL.
Reported by David Benjamin
Reviewed-by: Emilia Käsper <emilia@openssl.org>
(cherry picked from commit
05aef4bbdbc18e7b9490512cdee41e8a608bcc0e)
TJ Saunders [Fri, 29 Apr 2016 14:40:28 +0000 (07:40 -0700)]
Remove confusing comment.
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
TJ Saunders [Wed, 23 Mar 2016 18:55:53 +0000 (11:55 -0700)]
Issue #719:
If no serverinfo extension is found in some cases, do not abort the handshake,
but simply omit/skip that extension.
Check for already-registered serverinfo callbacks during serverinfo
registration.
Update SSL_CTX_use_serverinfo() documentation to mention the need to reload the
same serverinfo per certificate, for servers with multiple server certificates.
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
Dr. Stephen Henson [Wed, 27 Apr 2016 19:27:41 +0000 (20:27 +0100)]
Don't free ret->data if malloc fails.
Issue reported by Guido Vranken.
Reviewed-by: Matt Caswell <matt@openssl.org>
Dr. Stephen Henson [Thu, 28 Apr 2016 18:45:44 +0000 (19:45 +0100)]
Add checks to X509_NAME_oneline()
Sanity check field lengths and sums to avoid potential overflows and reject
excessively large X509_NAME structures.
Issue reported by Guido Vranken.
Reviewed-by: Matt Caswell <matt@openssl.org>
(cherry picked from commit
77076dc944f76e821e4eae3a6563b853ce00c0ed)
Conflicts:
crypto/x509/x509_err.c
crypto/x509/x509_obj.c
Dr. Stephen Henson [Thu, 28 Apr 2016 12:09:27 +0000 (13:09 +0100)]
Sanity check buffer length.
Reject zero length buffers passed to X509_NAME_onelne().
Issue reported by Guido Vranken.
Reviewed-by: Matt Caswell <matt@openssl.org>
(cherry picked from commit
b33d1141b6dcce947708b984c5e9e91dad3d675d)
Dr. Stephen Henson [Thu, 28 Apr 2016 11:55:29 +0000 (12:55 +0100)]
Add size limit to X509_NAME structure.
This adds an explicit limit to the size of an X509_NAME structure. Some
part of OpenSSL (e.g. TLS) already effectively limit the size due to
restrictions on certificate size.
Reviewed-by: Matt Caswell <matt@openssl.org>
(cherry picked from commit
295f3a24919157e2f9021d0b1709353710ad63db)
Dr. Stephen Henson [Sat, 23 Apr 2016 12:33:05 +0000 (13:33 +0100)]
Reject inappropriate private key encryption ciphers.
The traditional private key encryption algorithm doesn't function
properly if the IV length of the cipher is zero. These ciphers
(e.g. ECB mode) are not suitable for private key encryption
anyway.
Reviewed-by: Emilia Käsper <emilia@openssl.org>
(cherry picked from commit
d78df5dfd650e6de159a19a033513481064644f5)
Matt Caswell [Mon, 25 Apr 2016 15:05:55 +0000 (16:05 +0100)]
Ensure we check i2d_X509 return val
The i2d_X509() function can return a negative value on error. Therefore
we should make sure we check it.
Issue reported by Yuan Jochen Kang.
Reviewed-by: Emilia Käsper <emilia@openssl.org>
(cherry picked from commit
446ba8de9af9aa4fa3debc7c76a38f4efed47a62)
Matt Caswell [Mon, 25 Apr 2016 16:45:11 +0000 (17:45 +0100)]
Fix a signed/unsigned warning
This causes a compilation failure when using --strict-warnings in 1.0.2
and 1.0.1
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Rich Salz [Mon, 25 Apr 2016 12:56:54 +0000 (08:56 -0400)]
Fix NULL deref in apps/pkcs7
Thanks to Brian Carpenter for finding and reporting this.
Reviewed-by: Emilia Käsper <emilia@openssl.org>
(cherry picked from commit
79356a83b78a2d936dcd022847465d9ebf6c67b1)
Andy Polyakov [Fri, 15 Apr 2016 14:39:22 +0000 (16:39 +0200)]
s390x assembly pack: cache capability query results.
IBM argues that in certain scenarios capability query is really
expensive. At the same time it's asserted that query results can
be safely cached, because disabling CPACF is incompatible with
reboot-free operation.
Reviewed-by: Tim Hudson <tjh@openssl.org>
(cherry picked from commit
670ad0fbf6ebcf113e278d8174081a7e2d2fa44c)
Viktor Dukhovni [Wed, 20 Apr 2016 02:23:24 +0000 (22:23 -0400)]
Fix buffer overrun in ASN1_parse().
Backport of commits:
79c7f74d6cefd5d32fa20e69195ad3de834ce065
bdcd660e33710079b495cf5cc6a1aaa5d2dcd317
from master.
Reviewed-by: Matt Caswell <matt@openssl.org>
Dr. Stephen Henson [Mon, 11 Apr 2016 12:57:20 +0000 (13:57 +0100)]
Harden ASN.1 BIO handling of large amounts of data.
If the ASN.1 BIO is presented with a large length field read it in
chunks of increasing size checking for EOF on each read. This prevents
small files allocating excessive amounts of data.
CVE-2016-2109
Thanks to Brian Carpenter for reporting this issue.
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
(cherry picked from commit
c62981390d6cf9e3d612c489b8b77c2913b25807)
Andy Polyakov [Thu, 31 Mar 2016 16:47:17 +0000 (18:47 +0200)]
PPC assembly pack: remove branch hints.
As it turns out branch hints grew as kind of a misconception. In
addition their interpretation by GNU assembler is affected by
assembler flags and can end up with opposite meaning on different
processors. As we have to loose quite a lot on misinterprerations,
especially on newer processors, we just omit them altogether.
Reviewed-by: Tim Hudson <tjh@openssl.org>
(cherry picked from commit
20b88bb160865b0c2998056fe841b1cbacd6d4c7)
David Benjamin [Mon, 14 Mar 2016 19:03:07 +0000 (15:03 -0400)]
Fix memory leak on invalid CertificateRequest.
Free up parsed X509_NAME structure if the CertificateRequest message
contains excess data.
The security impact is considered insignificant. This is a client side
only leak and a large number of connections to malicious servers would
be needed to have a significant impact.
This was found by libFuzzer.
Reviewed-by: Emilia Käsper <emilia@openssl.org>
Reviewed-by: Stephen Henson <steve@openssl.org>
Todd Short [Sat, 5 Mar 2016 13:47:55 +0000 (08:47 -0500)]
Fix ALPN
* Perform ALPN after the SNI callback; the SSL_CTX may change due to
that processing
* Add flags to indicate that we actually sent ALPN, to properly error
out if unexpectedly received.
* document ALPN functions
* unit tests
Backport of commit
817cd0d52f0462039d1fe60462150be7f59d2002
Reviewed-by: Emilia Käsper <emilia@openssl.org>
Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
Dr. Stephen Henson [Sat, 26 Mar 2016 15:00:53 +0000 (15:00 +0000)]
Fix FIPS SSLv2 test
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Matt Caswell [Thu, 17 Mar 2016 12:55:02 +0000 (12:55 +0000)]
Fix the no-comp option for Windows
no-comp on Windows was not actually suppressing compilation of the code,
although it was suppressing its use.
Reviewed-by: Richard Levitte <levitte@openssl.org>
Matt Caswell [Tue, 15 Mar 2016 11:51:48 +0000 (11:51 +0000)]
Add a check for a failed malloc
Ensure we check for a NULL return from OPENSSL_malloc
Issue reported by Guido Vranken.
Reviewed-by: Richard Levitte <levitte@openssl.org>
Matt Caswell [Tue, 15 Mar 2016 11:38:56 +0000 (11:38 +0000)]
Ensure that memory allocated for the ticket is freed
If a call to EVP_DecryptUpdate fails then a memory leak could occur.
Ensure that the memory is freed appropriately.
Issue reported by Guido Vranken.
Reviewed-by: Richard Levitte <levitte@openssl.org>
Matt Caswell [Mon, 14 Mar 2016 17:06:19 +0000 (17:06 +0000)]
Fix a potential double free in EVP_DigestInit_ex
There is a potential double free in EVP_DigestInit_ex. This is believed
to be reached only as a result of programmer error - but we should fix it
anyway.
Issue reported by Guido Vranken.
Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit
ffe9150b1508a0ffc9e724f975691f24eb045c05)
Kurt Roeckx [Wed, 9 Mar 2016 17:10:52 +0000 (18:10 +0100)]
Add no-ssl2-method
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
MR: #2341
Richard Levitte [Wed, 9 Mar 2016 10:36:32 +0000 (11:36 +0100)]
Touch the correct variables for the system; shlib_wrap.sh on Solaris
If there is cause to think LD_LIBRARY_PATH_32 and LD_PRELOAD_32 are
appropriate variables to touch, do so. Otherwise, touch the usual
LD_LIBRARY_PATH and LD_PRELOAD. This covers for older installations
that don't have a mix of 32-bit and 64-bit libs.
Reviewed-by: Andy Polyakov <appro@openssl.org>
(cherry picked from commit
a772e9d01a81dae132cb03107292b3ecc725e5af)
Richard Levitte [Sun, 6 Mar 2016 21:36:57 +0000 (22:36 +0100)]
Recognise 32-bit Solaris in util/shlib_wrap.sh
Submitted by Erik Forsberg <erik@efca.com>
Reviewed-by: Andy Polyakov <appro@openssl.org>
(cherry picked from commit
86e75432835ec3ef7700a7103f9847e3c3d4350d)
Viktor Dukhovni [Tue, 8 Mar 2016 20:33:02 +0000 (15:33 -0500)]
expose SSLv2 method prototypes
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
Viktor Dukhovni [Mon, 7 Mar 2016 21:10:38 +0000 (21:10 +0000)]
Retain SSLv2 methods as functions that return NULL
This improves ABI compatibility when symbol resolution is not lazy.
Reviewed-by: Richard Levitte <levitte@openssl.org>
Kurt Roeckx [Sun, 10 Jan 2016 12:23:43 +0000 (13:23 +0100)]
Remove LOW from the default
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
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>
Andy Polyakov [Fri, 4 Mar 2016 10:39:11 +0000 (11:39 +0100)]
bn/asm/x86[_64]-mont*.pl: complement alloca with page-walking.
Some OSes, *cough*-dows, insist on stack being "wired" to
physical memory in strictly sequential manner, i.e. if stack
allocation spans two pages, then reference to farmost one can
be punishable by SEGV. But page walking can do good even on
other OSes, because it guarantees that villain thread hits
the guard page before it can make damage to innocent one...
Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit
adc4f1fc25b2cac90076f1e1695b05b7aeeae501)
Andy Polyakov [Fri, 4 Mar 2016 10:32:26 +0000 (11:32 +0100)]
perlasm/x86_64-xlate.pl: handle binary constants early.
Not all assemblers of "gas" flavour handle binary constants, e.g.
seasoned MacOS Xcode doesn't, so give them a hand.
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
(cherry picked from commit
6e42e3ff9cde43830555549fdafa2a8b37b9485b)
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)
Eric S. Raymond [Mon, 29 Feb 2016 19:54:47 +0000 (14:54 -0500)]
RT4358: Extra ] in doc/ocsp.pod
Reviewed-by: Richard Levitte <levitte@openssl.org>
Matt Caswell [Tue, 1 Mar 2016 13:37:56 +0000 (13:37 +0000)]
Prepare for 1.0.2h-dev
Reviewed-by: Richard Levitte <levitte@openssl.org>
Matt Caswell [Tue, 1 Mar 2016 13:36:54 +0000 (13:36 +0000)]
Prepare for 1.0.2g release
Reviewed-by: Richard Levitte <levitte@openssl.org>
Matt Caswell [Tue, 1 Mar 2016 13:36:54 +0000 (13:36 +0000)]
make update
Reviewed-by: Richard Levitte <levitte@openssl.org>
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>
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>
Andy Polyakov [Tue, 26 Jan 2016 15:50:10 +0000 (16:50 +0100)]
bn/asm/x86_64-mont5.pl: unify gather procedure in hardly used path
and reorganize/harmonize post-conditions.
Additional hardening following on from CVE-2016-0702
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from master)
Andy Polyakov [Mon, 25 Jan 2016 22:41:01 +0000 (23:41 +0100)]
crypto/bn/x86_64-mont5.pl: constant-time gather procedure.
At the same time remove miniscule bias in final subtraction.
Performance penalty varies from platform to platform, and even with
key length. For rsa2048 sign it was observed to be 4% for Sandy
Bridge and 7% on Broadwell.
CVE-2016-0702
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from master)
Andy Polyakov [Mon, 25 Jan 2016 22:25:40 +0000 (23:25 +0100)]
bn/asm/rsaz-avx2.pl: constant-time gather procedure.
Performance penalty is 2%.
CVE-2016-0702
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from master)
Andy Polyakov [Mon, 25 Jan 2016 22:06:45 +0000 (23:06 +0100)]
bn/asm/rsax-x86_64.pl: constant-time gather procedure.
Performance penalty is 2% on Linux and 5% on Windows.
CVE-2016-0702
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from master)
Andy Polyakov [Mon, 25 Jan 2016 19:38:38 +0000 (20:38 +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>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from master)
Resolved conflicts:
crypto/bn/bn_exp.c
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>
Matt Caswell [Fri, 19 Feb 2016 11:38:25 +0000 (11:38 +0000)]
Add a test for SSLv2 configuration
SSLv2 should be off by default. You can only turn it on if you have called
SSL_CTX_clear_options(SSL_OP_NO_SSLv2) or
SSL_clear_options(SSL_OP_NO_SSLv2). You should not be able to inadvertantly
turn it on again via SSL_CONF without having done that first.
Reviewed-by: Emilia Käsper <emilia@openssl.org>
Viktor Dukhovni [Thu, 18 Feb 2016 04:38:55 +0000 (23:38 -0500)]
Bring SSL method documentation up to date
Reviewed-by: Emilia Käsper <emilia@openssl.org>
Viktor Dukhovni [Thu, 18 Feb 2016 02:07:48 +0000 (21:07 -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>
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>
Kurt Roeckx [Sun, 28 Feb 2016 10:40:12 +0000 (11:40 +0100)]
Fix invalid free
Also removes an extra initializer, the master branch has a extra field.
Reviewed-by: Rich Salz <rsalz@openssl.org>
FdaSilvaYY [Fri, 29 Jan 2016 18:53:28 +0000 (19:53 +0100)]
Fix two possible leaks
Backport of
98637bd
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
FdaSilvaYY [Fri, 29 Jan 2016 18:49:38 +0000 (19:49 +0100)]
Fix possible memory leak on BUF_MEM_grow_clean failure
backport of
3eb70c5ebae6f2b5fd6034ed5af14910c8479688
shorter changes
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
Andy Polyakov [Wed, 24 Feb 2016 19:07:06 +0000 (20:07 +0100)]
modes/asm/ghash-x86_64.pl: refine GNU assembler version detection.
Even though AVX support was added in GAS 2.19 vpclmulqdq was apparently
added in 2.20.
Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit
d3cdab17362b9ab0f1a0525b736c862937a9cd2f)
Kurt Roeckx [Sat, 20 Feb 2016 14:29:45 +0000 (15:29 +0100)]
Revert "Don't check RSA_FLAG_SIGN_VER."
This reverts commit
6656ba7152dfe4bba865e327dd362ea08544aa80.
This broke existing engines that didn't properly implement the sign and verify
functions.
Reviewed-by: Richard Levitte <levitte@openssl.org>
MR: #2077
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>
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>
Andy Polyakov [Wed, 3 Feb 2016 10:26:11 +0000 (11:26 +0100)]
ec/asm/ecp_nistz256-x86_64.pl: get corner case logic right.
RT#4284
Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit
d93753412b455907b4dc09427ccd2382209d9af2)
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>
David Woodhouse [Tue, 23 Feb 2016 14:00:03 +0000 (14:00 +0000)]
RT4175: Fix PKCS7_verify() regression with Authenticode signatures
This is a partial revert of commit
c8491de39 ("GH354: Memory leak fixes"),
which was cherry-picked from commit
55500ea7c in OpenSSL 1.1.
That commit introduced a change in behaviour which is a regression for
software implementing Microsoft Authenticode — which requires a PKCS#7
signature to be validated against explicit external data, even though
it's a non-detached signature with its own embedded data.
The is fixed differently in OpenSSL 1.1 by commit
6b2ebe433 ("Add
PKCS7_NO_DUAL_CONTENT flag"), but that approach isn't viable in the
1.0.2 stable branch, so just comment the offending check back out again.
Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Corinna Vinschen [Sat, 16 Jan 2016 18:36:15 +0000 (19:36 +0100)]
Don't strip object files on Cygwin
Building for the Cygwin distro requires to be able to build debuginfo
files. This in turn requires to build object files without stripping.
The stripping is performed by the next step after building which creates
the debuginfo files.
Signed-off-by: Corinna Vinschen <vinschen@redhat.com>
(cherry picked from commit
42b8f1427a8cdf320e51374a5fbfefc74bec0519)
Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Richard Levitte [Mon, 22 Feb 2016 10:02:03 +0000 (11:02 +0100)]
Recognise Cygwin-x86_64 in config
In response to RT#4326
Reviewed-by: Rich Salz <rsalz@openssl.org>
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>
Andy Polyakov [Fri, 19 Feb 2016 12:40:58 +0000 (13:40 +0100)]
Makefile.shared: limit .dll image base pinning to FIPS builds.
Reviewed-by: Richard Levitte <levitte@openssl.org>
Andy Polyakov [Thu, 18 Feb 2016 13:08:55 +0000 (14:08 +0100)]
evp/e_des3.c: address compiler warning.
In backporting from master one modification was mistreated.
RT#4210
Reviewed-by: Matt Caswell <matt@openssl.org>
Dr. Stephen Henson [Thu, 18 Feb 2016 02:49:14 +0000 (02:49 +0000)]
typo
Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit
f6fb7f1856d443185c23f1a5968c08b4269dd37d)
Dr. Stephen Henson [Tue, 16 Feb 2016 22:17:43 +0000 (22:17 +0000)]
Switch to FIPS implementation for CMAC.
Reviewed-by: Tim Hudson <tjh@openssl.org>
Andy Polyakov [Fri, 12 Feb 2016 13:46:02 +0000 (14:46 +0100)]
evp/e_des[3].c: address compiler warnings, fix formatting.
RT#4210
(1.0.2-specific adaptation of
7687f5255011a5a3ca75e8c5427683d58ae411c0)
Reviewed-by: Richard Levitte <levitte@openssl.org>
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)
Emilia Kasper [Tue, 2 Feb 2016 16:12:45 +0000 (17:12 +0100)]
RT 3854: Update apps/req
Change the default keysize to 2048 bits, and the minimum to 512 bits.
Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit
a76265574398944d686d2d0de9bacca162f555ca)
Andy Polyakov [Wed, 10 Feb 2016 14:11:40 +0000 (15:11 +0100)]
perlasm/x86_64-xlate.pl: pass pure constants verbatim.
RT#3885
Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit
fd7dc201d3b9d43972de6a0e659f7ef6421c99cc)
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
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)
Matt Caswell [Tue, 2 Feb 2016 10:05:43 +0000 (10:05 +0000)]
Handle SSL_shutdown while in init more appropriately #2
Previous commit
f73c737c7 attempted to "fix" a problem with the way
SSL_shutdown() behaved whilst in mid-handshake. The original behaviour had
SSL_shutdown() return immediately having taken no action if called mid-
handshake with a return value of 1 (meaning everything was shutdown
successfully). In fact the shutdown has not been successful.
Commit
f73c737c7 changed that to send a close_notify anyway and then
return. This seems to be causing some problems for some applications so
perhaps a better (much simpler) approach is revert to the previous
behaviour (no attempt at a shutdown), but return -1 (meaning the shutdown
was not successful).
This also fixes a bug where SSL_shutdown always returns 0 when shutdown
*very* early in the handshake (i.e. we are still using SSLv23_method).
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Dr. Stephen Henson [Sat, 6 Feb 2016 17:07:58 +0000 (17:07 +0000)]
if no comparison function set make sk_sort no op
Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit
0ca2e82ab1575f9c4eed259c4d66ca9372a45bf5)
Viktor Dukhovni [Tue, 2 Feb 2016 09:35:27 +0000 (04:35 -0500)]
Fix missing ok=0 with locally blacklisted CAs
Also in X509_verify_cert() avoid using "i" not only as a loop
counter, but also as a trust outcome and as an error ordinal.
Finally, make sure that all "goto end" jumps return an error, with
"end" renamed to "err" accordingly.
[ The 1.1.0 version of X509_verify_cert() is major rewrite,
which addresses these issues in a more systemic way. ]
Reviewed-by: Rich Salz <rsalz@openssl.org>
Kurt Roeckx [Wed, 3 Feb 2016 17:54:02 +0000 (18:54 +0100)]
Restore xmm7 from the correct address on win64
Reviewed-by: Richard Levitte <levitte@openssl.org>
RT: #4288, MR: #1831
(cherry picked from commit
df057ea6c8a20e4babc047689507dfafde59ffd6)