Commit graph

1636 commits

Author SHA1 Message Date
Ben Laurie
e3ba6a5f83 Make depend. 2014-06-30 16:03:29 +01:00
Ben Laurie
161e0a617d More constification. 2014-06-29 22:13:45 +01:00
Ben Laurie
8892ce7714 Constification - mostly originally from Chromium. 2014-06-29 21:05:23 +01:00
Dr. Stephen Henson
44724beead Fix memory leak.
PR#2531
2014-06-29 13:51:30 +01:00
Dr. Stephen Henson
0518a3e19e Don't disable state strings with no-ssl2
Some state strings were erronously not compiled when no-ssl2
was set.

PR#3295
2014-06-28 00:54:32 +01:00
yogesh nagarkar
d183545d45 Fix compilation with -DSSL_DEBUG -DTLS_DEBUG -DKSSL_DEBUG
PR#3141
2014-06-28 00:40:26 +01:00
Ken Ballou
0b33bed969 Remove redundant check.
PR#3174
2014-06-27 23:19:39 +01:00
PK
e633248921 Add SHA256 Camellia ciphersuites from RFC5932
PR#2800
2014-06-27 18:24:05 +01:00
Tomas Mraz
0436369fcc Don't advertise ECC ciphersuits in SSLv2 compatible client hello.
PR#3374
2014-06-27 16:51:26 +01:00
Miod Vallat
2841d6ca9f 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.

PR#3375
2014-06-22 23:14:19 +01:00
Matt Caswell
cf1b08cdd7 Revert "Fix off-by-one errors in ssl_cipher_get_evp()"
This reverts commit abfb989fe0.

Incorrect attribution
2014-06-22 22:35:56 +01:00
Matt Caswell
339da43d6c Fixed Windows compilation failure 2014-06-22 20:16:47 +02:00
Felix Laurie von Massenbach
50cc4f7b3d Fix signed/unsigned comparisons. 2014-06-17 17:41:46 +01:00
Dr. Stephen Henson
3b77f01702 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.

PR#3400
2014-06-14 22:31:28 +01:00
Matt Caswell
687721a7dc Fixed incorrect return code handling in ssl3_final_finish_mac.
Based on an original patch by Joel Sing (OpenBSD) who also originally identified the issue.
2014-06-13 15:36:20 +01:00
Matt Caswell
043fd64689 Revert "Fixed incorrect return code handling in ssl3_final_finish_mac"
This reverts commit 2f1dffa88e.

Missing attribution.
2014-06-13 15:35:20 +01:00
Kurt Cancemi
abfb989fe0 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.

PR#3375
2014-06-12 21:11:00 +01:00
Matt Caswell
d84ba7ea23 Added OPENSSL_assert check as per PR#3377 reported by Rainer Jung <rainer.jung@kippdata.de> 2014-06-12 20:40:54 +01:00
Andy Polyakov
77a27a5066 Enable multi-block support by default. 2014-06-11 20:40:51 +02:00
Matt Caswell
2f1dffa88e Fixed incorrect return code handling in ssl3_final_finish_mac 2014-06-10 23:31:50 +01:00
Mike Bland
3ead9f3798 Create test/testutil.h for unit test helper macros
Defines SETUP_TEST_FIXTURE and EXECUTE_TEST, and updates ssl/heartbeat_test.c
using these macros. SETUP_TEST_FIXTURE makes use of the new TEST_CASE_NAME
macro, defined to use __func__ or __FUNCTION__ on platforms that support those
symbols, or to use the file name and line number otherwise. This should fix
several reported build problems related to lack of C99 support.
2014-06-10 19:20:25 +01:00
Dr. Stephen Henson
7a9d59c148 Fix null pointer errors.
PR#3394
2014-06-10 14:47:29 +01:00
Dr. Stephen Henson
447280ca7b SRP ciphersuite correction.
SRP ciphersuites do not have no authentication. They have authentication
based on SRP. Add new SRP authentication flag and cipher string.
2014-06-09 12:09:52 +01:00
Dr. Stephen Henson
1bea384fd5 Update strength_bits for 3DES.
Fix strength_bits to 112 for 3DES.
2014-06-09 12:09:52 +01:00
Dr. Stephen Henson
fb8d9ddb9d Make tls_session_secret_cb work with CVE-2014-0224 fix.
If application uses tls_session_secret_cb for session resumption
set the CCS_OK flag.
2014-06-07 15:27:23 +01:00
Dr. Stephen Henson
c43a55407d Add official extension value.
Encrypt then MAC now has an official extension value, see:

http://www.ietf.org/id/draft-ietf-tls-encrypt-then-mac-02.txt
2014-06-07 15:27:23 +01:00
Dr. Stephen Henson
5111672b8e Update value to use a free bit. 2014-06-05 13:27:11 +01:00
Dr. Stephen Henson
410e444b71 Fix for CVE-2014-0195
A buffer overrun attack can be triggered by sending invalid DTLS fragments
to an OpenSSL DTLS client or server. This is potentially exploitable to
run arbitrary code on a vulnerable client or server.

Fixed by adding consistency check for DTLS fragments.

Thanks to Jüri Aedla for reporting this issue.
(cherry picked from commit 1632ef7448)
2014-06-05 13:23:05 +01:00
Dr. Stephen Henson
a91be10833 Fix for CVE-2014-0224
Only accept change cipher spec when it is expected instead of at any
time. This prevents premature setting of session keys before the master
secret is determined which an attacker could use as a MITM attack.

Thanks to KIKUCHI Masashi (Lepidum Co. Ltd.) for reporting this issue
and providing the initial fix this patch is based on.
(cherry picked from commit bc8923b1ec)
2014-06-05 13:22:42 +01:00
Dr. Stephen Henson
a7c682fb6f Additional CVE-2014-0224 protection.
Return a fatal error if an attempt is made to use a zero length
master secret.
(cherry picked from commit 006cd7083f)
2014-06-05 13:22:24 +01:00
Dr. Stephen Henson
b4322e1de8 Fix CVE-2014-0221
Unnecessary recursion when receiving a DTLS hello request can be used to
crash a DTLS client. Fixed by handling DTLS hello request without recursion.

Thanks to Imre Rad (Search-Lab Ltd.) for discovering this issue.
(cherry picked from commit d3152655d5)
2014-06-05 13:22:03 +01:00
Dr. Stephen Henson
a5362db460 Fix CVE-2014-3470
Check session_cert is not NULL before dereferencing it.
(cherry picked from commit 8011cd56e3)
2014-06-05 13:21:50 +01:00
David Benjamin
c7f267397e Check there is enough room for extension. 2014-06-02 23:55:56 +01:00
zhu qun-ying
470990fee0 Free up s->d1->buffered_app_data.q properly.
PR#3286
2014-06-02 23:55:55 +01:00
Sami Farin
13b7896022 Typo: set i to -1 before goto.
PR#3302
2014-06-02 14:22:07 +01:00
Matt Caswell
a5510df337 Added SSLErr call for internal error in dtls1_buffer_record 2014-06-01 21:36:25 +01:00
David Ramos
d1e1aeef8f Delays the queue insertion until after the ssl3_setup_buffers() call due to use-after-free bug. PR#3362 2014-06-01 21:36:25 +01:00
Dr. Stephen Henson
01f2f18f3c Option to disable padding extension.
Add TLS padding extension to SSL_OP_ALL so it is used with other
"bugs" options and can be turned off.

This replaces SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG which is an ancient
option referring to SSLv2 and SSLREF.

PR#3336
2014-06-01 18:15:21 +01:00
David Ramos
92d81ba622 Allocate extra space when NETSCAPE_HANG_BUG defined.
Make sure there is an extra 4 bytes for server done message when
NETSCAPE_HANG_BUG is defined.

PR#3361
2014-06-01 14:27:22 +01:00
Dr. Stephen Henson
4fdf91742e Use correct digest when exporting keying material.
PR#3319
2014-05-31 13:43:02 +01:00
Dr. Stephen Henson
7ce79a5bfd Don't compile heartbeat test code on Windows (for now). 2014-05-31 13:43:02 +01:00
Juli Mallett
487dac87e3 Fix cast of boolean where cast of LHS intended.
Closes #74.
2014-05-26 13:16:12 +01:00
Matt Caswell
955376fde3 Fix for non compilation with TLS_DEBUG defined 2014-05-24 23:55:27 +01:00
Martin Kaiser
189ae368d9 Add an NSS output format to sess_id to export to export the session id and the master key in NSS keylog format. PR#3352 2014-05-24 00:02:24 +01:00
Mike Bland
647c70f765 Fix heartbeat_test for -DOPENSSL_NO_HEARTBEATS
Replaces the entire test with a trivial implementation when
OPENSSL_NO_HEARTBEATS is defined.
2014-05-22 15:23:10 -04:00
Dr. Stephen Henson
dcca7b13e9 For portability use BUF_strndup instead of strndup. 2014-05-20 11:18:30 +01:00
Dr. Stephen Henson
6db14dbc51 Adding padding extension to trace code. 2014-05-20 11:09:04 +01:00
Dr. Stephen Henson
deffd89af3 Fix bug in signature algorithm copy. 2014-05-20 11:09:04 +01:00
Ben Laurie
2ec52dc3a1 Fixup for ancient compilers. 2014-05-19 17:39:41 +01:00
Mike Bland
39dd6f4549 Zero-initialize heartbeat test write buffer
The previous calls to memset() were added to tear_down() when I noticed the
test spuriously failing in opt mode, with different results each time. This
appeared to be because the allocator zeros out memory in debug mode, but not
in opt mode. Since the heartbeat functions silently drop the request on error
without modifying the contents of the write buffer, whatever random contents
were in memory before being reallocated to the write buffer used in the test
would cause nondeterministic test failures in the Heartbleed regression cases.
Adding these calls allowed the test to pass in both debug and opt modes.

Ben Laurie notified me offline that the test was aborting in
debug-ben-debug-64-clang mode, configured with GitConfigure and built with
GitMake. Looking into this, I realized the first memset() call was zeroing out
a reference count used by SSL_free() that was checked in
debug-ben-debug-64-clang mode but not in the normal debug mode.

Removing the memset() calls from tear_down() and adding a memset() for the
write buffer in set_up() addresses the issue and allows the test to
successfully execute in debug, opt, and debug-ben-debug-64-clang modes.
2014-05-19 17:39:41 +01:00
Mike Bland
f5ad068b01 More through error checks in set_up
Checks the return values of ssl_init_wbio_buffer() and ssl3_setup_buffers().
2014-05-19 17:39:41 +01:00
Ben Laurie
f41231d62a Make it build/run. 2014-05-19 17:39:41 +01:00
Mike Bland
6af080acaf Unit/regression test for TLS heartbeats.
Regression test against CVE-2014-0160 (Heartbleed).

More info: http://mike-bland.com/tags/heartbleed.html
2014-05-19 17:39:41 +01:00
Kurt Roeckx
4ee356686f Check sk_SSL_CIPHER_num() after assigning sk. 2014-05-12 22:56:13 +01:00
Serguei E. Leontiev
4a56d9a2ed Replace manual ASN1 decoder with ASN1_get_object
Replace manual ASN.1 decoder with ASN1_get object. This
will decode the tag and length properly and check against
it does not exceed the supplied buffer length.

PR#3335
2014-05-12 18:41:52 +01:00
Matt Caswell
7b06ac7593 Fixed NULL pointer dereference. See PR#3321 2014-05-12 00:38:37 +01:00
Günther Noack
308505b838 Avoid out-of-bounds write in SSL_get_shared_ciphers
PR: 3317
2014-05-11 23:52:47 +01:00
Matt Caswell
971a7c5ff7 Move length check earlier to ensure we don't go beyond the end of the user's buffer. PR#3320 2014-05-11 11:27:26 +01:00
Tim Hudson
c388d8b40c safety check to ensure we dont send out beyond the users buffer 2014-05-11 11:21:30 +01:00
Tim Hudson
630f9fc69d fix coverity issue 966597 - error line is not always initialised 2014-05-07 23:54:25 +01:00
Matt Caswell
a141effa7b Fixed spelling error in error message. Fix supplied by Marcos Marado 2014-05-01 00:28:00 +01:00
Geoff Thorpe
79c6c4e828 make depend 2014-04-25 14:31:05 -04:00
Ben Laurie
94d1f4b0f3 Fix use after free. 2014-04-23 07:24:03 +01:00
Kaspar Brand
9330a85e04 Fix SSL_CTX_get{first,next}_certificate.
Fix typo that stopped SSL_CTX_get_{first,next}_certificate from working.
2014-04-21 16:52:28 +01:00
Dr. Stephen Henson
731f431497 Add heartbeat extension bounds check.
A missing bounds check in the handling of the TLS heartbeat extension
can be used to reveal up to 64k of memory to a connected client or
server.

Thanks for Neel Mehta of Google Security for discovering this bug and to
Adam Langley <agl@chromium.org> and Bodo Moeller <bmoeller@acm.org> for
preparing the fix (CVE-2014-0160)
(cherry picked from commit 96db9023b8)
2014-04-07 19:44:38 +01:00
Dr. Stephen Henson
cd6bd5ffda Set TLS padding extension value.
Enable TLS padding extension using official value from:

http://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml
2014-04-05 20:43:54 +01:00
Dr. Stephen Henson
f8dd55bb5b For more than 160 bits of security disable SHA1 HMAC 2014-04-05 13:39:35 +01:00
Dr. Stephen Henson
21e0c1d23a Set security level in cipher string.
Allow setting of security level in cipher string using the
@SECLEVEL=N syntax.
2014-03-28 14:56:43 +00:00
Dr. Stephen Henson
77a926e676 Set security level to zero is ssltest
Since ssltest needs to test low security ciphersuites and keys
set security level to zero so they aren't rejected.
2014-03-28 14:56:43 +00:00
Dr. Stephen Henson
b362ccab5c Security framework.
Security callback: selects which parameters are permitted including
sensible defaults based on bits of security.

The "parameters" which can be selected include: ciphersuites,
curves, key sizes, certificate signature algorithms, supported
signature algorithms, DH parameters, SSL/TLS version, session tickets
and compression.

In some cases prohibiting the use of a parameters will mean they are
not advertised to the peer: for example cipher suites and ECC curves.
In other cases it will abort the handshake: e.g DH parameters or the
peer key size.

Documentation to follow...
2014-03-28 14:56:30 +00:00
Dr. Stephen Henson
66f96fe2d5 Check return value of ssl3_output_cert_chain 2014-03-28 14:49:04 +00:00
Dr. Stephen Henson
8b8e5bed23 Allow return of supported ciphers.
New function ssl_cipher_disabled.

Check for disabled client ciphers using ssl_cipher_disabled.

New function to return only supported ciphers.

New option to ciphers utility to print only supported ciphers.
2014-03-28 14:49:04 +00:00
Dr. Stephen Henson
09599b52d4 Auto DH support.
Add auto DH parameter support. This is roughly equivalent to the
ECDH auto curve selection but for DH. An application can just call

SSL_CTX_set_auto_dh(ctx, 1);

and appropriate DH parameters will be used based on the size of the
server key.

Unlike ECDH there is no way a peer can indicate the range of DH parameters
it supports. Some peers cannot handle DH keys larger that 1024 bits for
example. In this case if you call:

SSL_CTX_set_auto_dh(ctx, 2);

Only 1024 bit DH parameters will be used.

If the server key is 7680 bits or more in size then 8192 bit DH parameters
will be used: these will be *very* slow.

The old export ciphersuites aren't supported but those are very
insecure anyway.
2014-03-28 14:49:04 +00:00
Dr. Stephen Henson
4563da1d7c Fix memory leak with client auth.
(cherry picked from commit bc5ec653ba)
2014-03-27 16:12:59 +00:00
Dr. Stephen Henson
f0ef019da2 Add -no_resumption_on_reneg to SSL_CONF.
(cherry picked from commit 1f44dac24d)
2014-03-27 16:12:40 +00:00
Dr. Stephen Henson
e970f63dc0 Update chain building function.
Don't clear verification errors from the error queue unless
SSL_BUILD_CHAIN_FLAG_CLEAR_ERROR is set.

If errors occur during verification and SSL_BUILD_CHAIN_FLAG_IGNORE_ERROR
is set return 2 so applications can issue warnings.
(cherry picked from commit 2dd6976f6d)
2014-03-27 14:24:40 +00:00
Emilia Kasper
7c5718be27 Allow duplicate certs in ssl_build_cert_chain 2014-03-24 12:33:54 +01:00
Piotr Sikora
f04665a653 Retry callback only after ClientHello received. 2014-03-18 23:55:32 +00:00
Dr. Stephen Henson
a029788b0e typo 2014-03-10 15:47:33 +00:00
Dr. Stephen Henson
d628885e9a Simplify ssl_add_cert_chain logic. 2014-03-10 15:47:33 +00:00
Andy Polyakov
972b0dc350 bss_dgram.c,d1_lib.c: make it compile with mingw.
Submitted by: Roumen Petrov
2014-03-06 14:04:56 +01:00
Dr. Stephen Henson
db7b5e0d76 Add function to free compression methods.
Although the memory allocated by compression methods is fixed and
cannot grow over time it can cause warnings in some leak checking
tools. The function SSL_COMP_free_compression_methods() will free
and zero the list of supported compression methods. This should
*only* be called in a single threaded context when an application
is shutting down to avoid interfering with existing contexts
attempting to look up compression methods.
(cherry picked from commit 976c58302b)
2014-03-01 23:15:25 +00:00
Dr. Stephen Henson
031ea2d14a Fix for WIN32 builds with KRB5
(cherry picked from commit 3eddd1706a30cdf3dc9278692d8ee9038eac8a0d)
2014-02-26 15:33:11 +00:00
Andy Polyakov
03da57fe14 ssl/t1_enc.c: check EVP_MD_CTX_copy return value.
PR: 3201
2014-02-25 22:21:54 +01:00
Dr. Stephen Henson
e0520c65d5 Don't use BN_ULLONG in n2l8 use SCTS_TIMESTAMP.
(cherry picked from commit 3678161d71)
2014-02-25 15:06:51 +00:00
Dr. Stephen Henson
358d352aa2 Only set current certificate to valid values.
When setting the current certificate check that it has a corresponding
private key.
2014-02-23 13:46:52 +00:00
Dr. Stephen Henson
13dc3ce9ab New chain building flags.
New flags to build certificate chains. The can be used to rearrange
the chain so all an application needs to do is add all certificates
in arbitrary order and then build the chain to check and correct them.

Add verify error code when building chain.

Update docs.
2014-02-23 13:36:38 +00:00
Dr. Stephen Henson
daddd9a950 Option to set current cert to server certificate. 2014-02-21 19:44:09 +00:00
Dr. Stephen Henson
47739161c6 fix WIN32 warnings
(cherry picked from commit b709f8ef54)
2014-02-20 22:55:24 +00:00
Dr. Stephen Henson
8764e86339 make depend 2014-02-20 18:48:56 +00:00
Dr. Stephen Henson
ded18639d7 Move CT viewer extension code to crypto/x509v3 2014-02-20 18:48:56 +00:00
Dr. Stephen Henson
4cfeb00be9 make depend 2014-02-19 20:09:08 +00:00
Ben Laurie
e91fb53b38 Make i2r_sctlist static. 2014-02-19 17:57:44 +00:00
Ben Laurie
765e9ba911 Merge branch 'sct-viewer-master' of https://github.com/robstradling/openssl into sct-viewer 2014-02-19 17:17:14 +00:00
Rob Stradling
b263f21246 Move the SCT List extension parser into libssl.
Add the extension parser in the s_client, ocsp and x509 apps.
2014-02-19 13:12:46 +00:00
Dr. Stephen Henson
3c6c139a07 Restore SSL_OP_MSIE_SSLV2_RSA_PADDING
The flag SSL_OP_MSIE_SSLV2_RSA_PADDING hasn't done anything since OpenSSL
0.9.7h but deleting it will break source compatibility with any software
that references it. Restore it but #define to zero.
(cherry picked from commit b17d6b8d1d)
2014-02-16 11:43:46 +00:00
Rob Stradling
dcfe8df148 Show the contents of the RFC6962 Signed Certificate Timestamp List Certificate/OCSP Extensions.
Add the RFC6962 OIDs to the objects table.
2014-02-14 23:24:35 +00:00
Andy Polyakov
701134320a ssl/s3_pkt.c: detect RAND_bytes error in multi-block. 2014-02-14 17:43:31 +01:00
Dr. Stephen Henson
4dce704145 fix error discrepancy
(cherry picked from commit a2317c3ffd)
2014-02-13 14:35:22 +00:00
Dr. Stephen Henson
b45e874d7c Return previous compression methods when setting them. 2014-02-06 13:57:26 +00:00