Commit graph

6179 commits

Author SHA1 Message Date
Dr. Stephen Henson
6c88c71b4e 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>
2016-02-19 14:03:07 +00:00
Andy Polyakov
b393a4ad38 evp/e_des3.c: address compiler warning.
In backporting from master one modification was mistreated.

RT#4210

Reviewed-by: Matt Caswell <matt@openssl.org>
2016-02-19 13:34:42 +01:00
Dr. Stephen Henson
43be582e9b typo
Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit f6fb7f1856)
2016-02-18 14:00:23 +00:00
Dr. Stephen Henson
866b282d1b Switch to FIPS implementation for CMAC.
Reviewed-by: Tim Hudson <tjh@openssl.org>
2016-02-16 22:52:59 +00:00
Andy Polyakov
24e6a0dba4 evp/e_des[3].c: address compiler warnings, fix formatting.
RT#4210

(1.0.2-specific adaptation of 7687f52550)

Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-02-13 10:46:26 +01:00
Andy Polyakov
6533a0b8d1 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 5e4bbeb49f)
2016-02-12 22:00:13 +01:00
Andy Polyakov
10c639a8a5 perlasm/x86_64-xlate.pl: pass pure constants verbatim.
RT#3885

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit fd7dc201d3)
2016-02-11 21:26:44 +01:00
Dr. Stephen Henson
402fb1896b if no comparison function set make sk_sort no op
Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 0ca2e82ab1)
2016-02-06 18:49:56 +00:00
Viktor Dukhovni
a3baa17105 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>
2016-02-05 10:54:11 -05:00
Kurt Roeckx
093d20a8cb Restore xmm7 from the correct address on win64
Reviewed-by: Richard Levitte <levitte@openssl.org>

RT: #4288, MR: #1831
(cherry picked from commit df057ea6c8)
2016-02-04 15:42:50 +01:00
Daniel Kahn Gillmor
a38a159bfc RT4129: BUF_new_mem_buf should take const void *
Signed-off-by: Rich Salz <rsalz@akamai.com>
Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
(cherry picked from commit 8ab31975ba)
2016-02-01 08:43:27 -05:00
Rich Salz
e0fde613ac GH102: Add volatile to CRYPTO_memcmp
Can't hurt and seems to prevent problems from some over-aggressive
(LTO?) compilers.

Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit 98ab57644f)
2016-01-30 14:41:23 -05:00
Matt Caswell
1e9446bf5c Add have_precompute_mult tests
Add tests for have_precompute_mult for the optimised curves (nistp224,
nistp256 and nistp521) if present

Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit 8ce4e7e605)
2016-01-29 13:07:12 +00:00
Matt Caswell
e94f52e0c7 Fix bug in nistp224/256/521 where have_precompute_mult always returns 0
During precomputation if the group given is well known then we memcpy a
well known precomputation. However we go the wrong label in the code and
don't store the data properly. Consequently if we call have_precompute_mult
the data isn't there and we return 0.

RT#3600

Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit 615614c886)
2016-01-29 13:07:10 +00:00
Matt Caswell
83ab6e55a1 Add missing return value checks
The function DH_check_pub_key() was missing some return value checks in
some calls to BN functions.

RT#4278

Reviewed-by: Andy Polyakov <appro@openssl.org>
(cherry picked from commit f5a12207ec)
2016-01-29 11:58:45 +00:00
Matt Caswell
7107798ae6 Correct value of DH_CHECK_PUBKEY_INVALID
A new return value for DH_check_pub_key was recently added:
DH_CHECK_PUBKEY_INVALID. As this is a flag which can be ORed with other
return values it should have been set to the value 4 not 3.

RT#4278

Reviewed-by: Andy Polyakov <appro@openssl.org>
(cherry picked from commit cb389fe804)
2016-01-29 11:58:45 +00:00
Richard Levitte
da7947e8c6 Correct number of arguments in BIO_get_conn_int_port macro
Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 41a28cb294)
2016-01-28 18:20:55 +01:00
Matt Caswell
22d192f106 Prepare for 1.0.2g-dev
Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-01-28 13:58:24 +00:00
Matt Caswell
95605f3ae1 Prepare for 1.0.2f release
Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-01-28 13:57:22 +00:00
Matt Caswell
75374adf8a Add a test for small subgroup attacks on DH/DHE
Following on from the previous commit, add a test to ensure that
DH_compute_key correctly fails if passed a bad y such that:

y^q (mod p) != 1

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
2016-01-28 13:49:56 +00:00
Matt Caswell
878e2c5b13 Prevent small subgroup attacks on DH/DHE
Historically OpenSSL only ever generated DH parameters based on "safe"
primes. More recently (in version 1.0.2) support was provided for
generating X9.42 style parameter files such as those required for RFC
5114 support. The primes used in such files may not be "safe". Where an
application is using DH configured with parameters based on primes that
are not "safe" then an attacker could use this fact to find a peer's
private DH exponent. This attack requires that the attacker complete
multiple handshakes in which the peer uses the same DH exponent.

A simple mitigation is to ensure that y^q (mod p) == 1

CVE-2016-0701 (fix part 1 of 2)

Issue reported by Antonio Sanso.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
2016-01-28 13:49:56 +00:00
Billy Brumley
2b80d00e3a RT3863 ECC: Add missing NULL check. Set a flag
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(cherry picked from commit dd67493c34)
2016-01-21 14:14:33 +00:00
Viktor Dukhovni
4d6fe78f65 Empty SNI names are not valid
While empty inputs to SSL_set1_host() clear the reference identifier
list.

(cherry-picked from 1.1.0-dev)

Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-01-17 16:58:48 -05:00
Zi Lin
15debc128a NGX-2040 - fix wildcard match on punycode/IDNA DNS names
- bugfix: should not treat '--' as invalid domain substring.
    - '-' should not be the first letter of a domain

Signed-off-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-01-15 14:48:17 -05:00
Mouse
8788fb97a8 Root cause discovered and fixed, this fix became unnecessary
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-01-13 01:23:34 +01:00
Mouse
ad81ca9061 Fixed crash (SIGSEGV) when freeing of ex_data stumbles upon a NULL-pointer.
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-01-13 01:23:34 +01:00
Viktor Dukhovni
a3d74afcae Fix X509_STORE_CTX_cleanup()
Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
2016-01-02 11:14:05 -05:00
David Benjamin
1c7de36f62 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 679d87515d)
2015-12-22 11:49:57 +01:00
Dr. Stephen Henson
6656ba7152 Don't check RSA_FLAG_SIGN_VER.
Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-12-20 19:27:03 +00:00
Richard Levitte
17592f323a BIO_s_datagram() ctrl doesn't support SEEK/TELL, so don't pretend it does
Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-12-19 22:07:42 +01:00
Richard Levitte
6d97060ee0 Correct or add comments indicating what controls belong to what
Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-12-19 22:07:42 +01:00
Richard Levitte
2a60fccdd9 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>
2015-12-19 22:07:42 +01:00
Matt Caswell
dd045d17e7 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>
2015-12-19 14:43:43 +00:00
Richard Levitte
93a17f79b9 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>
2015-12-18 13:39:34 +01:00
Emilia Kasper
44e4f5b04b Fix a ** 0 mod 1 = 0 for real this time.
Commit 2b0180c37f 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 d911097d7c)
2015-12-14 17:57:49 +01:00
Andy Polyakov
e780ed0336 x86_64 assembly pack: tune clang version detection even further.
RT#4171

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
(cherry picked from commit b974943234)
2015-12-13 22:19:32 +01:00
Andy Polyakov
3cd33c42e3 ec/ecp_nistz256_table.c: fix potential misalignment problem with Sun C.
Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-12-10 20:13:28 +01:00
Richard Levitte
c44844d928 Cleanup the EVP_MD_CTX before exit rather than after
Reviewed-by: Matt Caswell <matt@openssl.org>
2015-12-08 01:04:55 +01:00
Matt Caswell
8a27243c7b Prepare for 1.0.2f-dev
Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-12-03 14:45:41 +00:00
Matt Caswell
bfe07df40c Prepare for 1.0.2e release
Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-12-03 14:44:31 +00:00
Dr. Stephen Henson
c394a48894 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: Richard Levitte <levitte@openssl.org>
2015-12-03 14:32:05 +00:00
Andy Polyakov
d73cc256c8 bn/asm/x86_64-mont5.pl: fix carry propagating bug (CVE-2015-3193).
Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit e7c078db57908cbf16074c68034977565ffaf107)
2015-12-03 14:32:05 +00:00
Dr. Stephen Henson
cc598f321f 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>
2015-12-03 14:32:05 +00:00
Richard Levitte
fb4f46763f Add cleanup of *.s
Reviewed-by: Matt Caswell <matt@openssl.org>
2015-12-03 15:20:10 +01:00
Andy Polyakov
babe434c99 perlasm/ppc-xlate.pl: comply with ABIs that specify vrsave as reserved.
RT#4162

Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit b5516cfbd6)
2015-12-03 13:31:36 +01:00
Andy Polyakov
15c62b0dfd crypto/sparcv9cap.c: add SIGILL-free feature detection for Solaris.
Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 2238e0e45d)
2015-12-02 10:56:27 +01:00
Andy Polyakov
301a6dcd45 x86_64 assembly pack: tune clang version detection.
RT#4142

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

Resolved conflicts:
	crypto/bn/asm/x86_64-mont.pl
	crypto/bn/asm/x86_64-mont5.pl

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
2015-11-30 13:37:39 +01:00
Kurt Roeckx
ed02493567 Use both sun and __sun
Reviewed-by: Andy Polyakov <appro@openssl.org>
2015-11-24 23:44:05 +01:00
Marcus Meissner
296f7bd1ac 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 434b58457c)
2015-11-24 22:05:10 +01:00
Dr. Stephen Henson
943c4ca62b Fix uninitialised p error.
Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 63eb10a07e)
2015-11-24 16:55:34 +00:00