Commit graph

1588 commits

Author SHA1 Message Date
Miod Vallat
d15f2d98ef 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:18:15 +01:00
Matt Caswell
00f5ee445b Revert "Fix off-by-one errors in ssl_cipher_get_evp()"
This reverts commit 3d86077427.

Incorrect attribution.
2014-06-22 23:17:40 +01:00
Matt Caswell
e7911530a9 Fixed Windows compilation failure 2014-06-22 20:18:09 +02:00
Felix Laurie von Massenbach
1b823494de Fix signed/unsigned comparisons.
(cherry picked from commit 50cc4f7b3d)
2014-06-17 18:38:36 +01:00
Richard Levitte
23351c607b Remove unused DANE macros. This should be the last DANE stuff... 2014-06-17 12:38:20 +02:00
Richard Levitte
b9c0dae28e Spaces were added in some strings for better readability. However, those spaces do not belong in file names, so when picking out the individual parts, remove the spaces 2014-06-16 13:25:16 +02:00
Dr. Stephen Henson
90d94ce39e 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
(cherry picked from commit 99cd6a91fcb0931feaebbb4832681d40a66fad41)
2014-06-14 22:31:28 +01:00
Richard Levitte
66a6e2b2b6 Adjust VMS build files to the Unix ones 2014-06-14 16:58:11 +02:00
Richard Levitte
1be1d05184 Make sure that disabling the MAYLOSEDATA3 warning is only done when the
compiler supports it.  Otherwise, there are warnings about it lacking
everywhere, which is quite tedious to read through while trying to check
for other warnings.
2014-06-14 16:58:11 +02:00
Matt Caswell
561ba12463 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:50:58 +01:00
Matt Caswell
7f133c357b Revert "Fixed incorrect return code handling in ssl3_final_finish_mac"
This reverts commit 728bd41a15.

Missing attribution.
2014-06-13 15:50:28 +01:00
Kurt Cancemi
3d86077427 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:12:43 +01:00
Matt Caswell
955bfbc268 Added OPENSSL_assert check as per PR#3377 reported by Rainer Jung <rainer.jung@kippdata.de> 2014-06-12 20:42:33 +01:00
Dr. Stephen Henson
5af09776ce Remove unimplemented functions. 2014-06-12 10:52:49 +01:00
Andy Polyakov
d85a772ec3 Enable multi-block support by default.
(cherry picked from commit 77a27a5066)
2014-06-11 20:41:46 +02:00
Matt Caswell
728bd41a15 Fixed incorrect return code handling in ssl3_final_finish_mac 2014-06-10 23:32:27 +01:00
Mike Bland
2fddc5fc09 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:24:46 +01:00
Dr. Stephen Henson
e3beef1e1b Remove experimental DANE code.
Remove experimental DANE/dnssec code: not ready for use in an
official release yet.
2014-06-10 14:59:10 +01:00
Dr. Stephen Henson
cea5a1d5f2 Fix null pointer errors.
PR#3394
(cherry picked from commit 7a9d59c148)
2014-06-10 14:48:02 +01:00
Dr. Stephen Henson
f472ada006 SRP ciphersuite correction.
SRP ciphersuites do not have no authentication. They have authentication
based on SRP. Add new SRP authentication flag and cipher string.
(cherry picked from commit a86b88acc373ac1fb0ca709a5fb8a8fa74683f67)
2014-06-09 12:09:51 +01:00
Dr. Stephen Henson
05b2210476 Update strength_bits for 3DES.
Fix strength_bits to 112 for 3DES.
(cherry picked from commit 837c203719205ab19b5609b2df7151be8df05687)
2014-06-09 12:09:51 +01:00
Dr. Stephen Henson
a21f350a76 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.
(cherry picked from commit 953c592572e8811b7956cc09fbd8e98037068b58)
2014-06-07 15:27:23 +01:00
Dr. Stephen Henson
eb6508d50c 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:24:50 +01:00
Dr. Stephen Henson
77719aefb8 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:24:46 +01:00
Dr. Stephen Henson
9d2c9dd1e1 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:24:40 +01:00
Dr. Stephen Henson
8942b92c7c 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:24:36 +01:00
Dr. Stephen Henson
e5f706590c Fix CVE-2014-3470
Check session_cert is not NULL before dereferencing it.
(cherry picked from commit 8011cd56e3)
2014-06-05 13:24:30 +01:00
David Benjamin
56b94a38b9 Check there is enough room for extension.
(cherry picked from commit 7d89b3bf42e4b4067371ab33ef7631434e41d1e4)
2014-06-02 18:59:48 +01:00
zhu qun-ying
d52eb82781 Free up s->d1->buffered_app_data.q properly.
PR#3286
(cherry picked from commit 71e95000afb2227fe5cac1c79ae884338bcd8d0b)
2014-06-02 14:40:05 +01:00
Sami Farin
6468866823 Typo: set i to -1 before goto.
PR#3302
(cherry picked from commit 9717f01951f976f76dd40a38d9fc7307057fa4c4)
2014-06-02 13:53:54 +01:00
Matt Caswell
de8a5b523f Added SSLErr call for internal error in dtls1_buffer_record 2014-06-01 21:40:31 +01:00
David Ramos
8de85b0048 Delays the queue insertion until after the ssl3_setup_buffers() call due to use-after-free bug. PR#3362 2014-06-01 21:40:25 +01:00
Dr. Stephen Henson
623a01df49 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
(cherry picked from commit 758415b2259fa45d3fe17d8e53ae1341b7b6e482)

Conflicts:

	ssl/t1_lib.c
2014-06-01 16:50:25 +01:00
David Ramos
856a4585d6 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
(cherry picked from commit 92d81ba622)
2014-06-01 14:27:58 +01:00
Dr. Stephen Henson
87a0cbdf2e Use correct digest when exporting keying material.
PR#3319
(cherry picked from commit 84691390eae86befd33c83721dacedb539ae34e6)
2014-05-30 13:24:36 +01:00
Dr. Stephen Henson
b5bdde9e0e Don't compile heartbeat test code on Windows (for now).
(cherry picked from commit 2c575907d2c8601a18716f718ce309ed4e1f1783)
2014-05-30 13:12:26 +01:00
Mike Bland
8db2ba4b84 Fix heartbeat_test for -DOPENSSL_NO_HEARTBEATS
Replaces the entire test with a trivial implementation when
OPENSSL_NO_HEARTBEATS is defined.
2014-05-22 22:02:46 +01:00
Ben Laurie
5cd1a6fc3e Fix signed/unsigned warning. 2014-05-20 15:14:30 +01:00
Dr. Stephen Henson
81ce94f8dc For portability use BUF_strndup instead of strndup.
(cherry picked from commit dcca7b13e9)
2014-05-20 11:22:33 +01:00
Dr. Stephen Henson
feaa3b380b Adding padding extension to trace code.
(cherry picked from commit 6db14dbc51)
2014-05-20 11:22:15 +01:00
Mike Bland
2312a84ca1 Unit/regression test for TLS heartbeats.
Regression test against CVE-2014-0160 (Heartbleed).

More info: http://mike-bland.com/tags/heartbleed.html

(based on commit 35cb55988b75573105eefd00d27d0138eebe40b1)
2014-05-18 10:23:59 -04:00
Kurt Roeckx
1f5bce2dce Check sk_SSL_CIPHER_num() after assigning sk. 2014-05-12 22:59:11 +01:00
Serguei E. Leontiev
d6e55b4001 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
(cherry picked from commit b0308dddd1cc6a8e1de803ef29ba6da25ee072c2)
2014-05-12 18:41:51 +01:00
Matt Caswell
f710c3f198 Fixed NULL pointer dereference. See PR#3321 2014-05-12 00:39:43 +01:00
Günther Noack
8571902e23 Avoid out-of-bounds write in SSL_get_shared_ciphers
PR: 3317
2014-05-11 23:55:06 +01:00
Matt Caswell
f2ebe2a60e Move length check earlier to ensure we don't go beyond the end of the user's buffer. PR#3320 2014-05-11 11:32:17 +01:00
Tim Hudson
011ee91105 safety check to ensure we dont send out beyond the users buffer 2014-05-11 11:32:17 +01:00
Tim Hudson
afe343c3a7 fix coverity issue 966597 - error line is not always initialised 2014-05-07 23:57:00 +01:00
Matt Caswell
7441e7dbe9 Fixed spelling error in error message. Fix supplied by Marcos Marado 2014-05-01 00:27:02 +01:00
Ben Laurie
a0fe2e72c4 Fix use after free. 2014-04-23 07:30:16 +01:00
Kaspar Brand
5aeb43393b Fix SSL_CTX_get{first,next}_certificate.
Fix typo that stopped SSL_CTX_get_{first,next}_certificate from working.
(cherry picked from commit 9330a85e04)
2014-04-21 16:53:48 +01:00
Steven M. Schweda
6ef9d9bacf VMS build fix #2.
(cherry picked from commit a74bee5fc7)
2014-04-08 17:28:23 +01:00
Steven M. Schweda
40a44a7c3d VMS build fix for older compilers.
(cherry picked from commit 55c9e24875)
2014-04-07 23:15:31 +01:00
Dr. Stephen Henson
7e840163c0 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:25:34 +01:00
Dr. Stephen Henson
6411b83e52 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
(cherry picked from commit cd6bd5ffda)

Conflicts:

	CHANGES
2014-04-05 20:49:09 +01:00
Dr. Stephen Henson
bc5ec653ba Fix memory leak with client auth. 2014-03-27 16:10:50 +00:00
Dr. Stephen Henson
1f44dac24d Add -no_resumption_on_reneg to SSL_CONF. 2014-03-27 15:51:25 +00:00
Dr. Stephen Henson
2dd6976f6d 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.
2014-03-27 14:23:46 +00:00
Emilia Kasper
662239183d Allow duplicate certs in ssl_build_cert_chain 2014-03-25 17:28:04 +00:00
Piotr Sikora
aa10982c49 Retry callback only after ClientHello received.
(cherry picked from commit f04665a653)
2014-03-18 23:58:39 +00:00
Dr. Stephen Henson
44f7e399d3 typo
(cherry picked from commit a029788b0e)
2014-03-10 15:48:12 +00:00
Andy Polyakov
25ebd9e3ce bss_dgram.c,d1_lib.c: make it compile with mingw.
Submitted by: Roumen Petrov
(cherry picked from commit 972b0dc350)
2014-03-06 14:07:16 +01:00
Dr. Stephen Henson
976c58302b 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.
2014-03-01 23:14:08 +00:00
Dr. Stephen Henson
d1201e3195 Fix compilation errors with no-nextprotoneg 2014-02-28 13:35:30 +00:00
Dr. Stephen Henson
73be56a21d Fix for WIN32 builds with KRB5 2014-02-26 15:33:10 +00:00
Andy Polyakov
8d08627c94 ssl/t1_enc.c: check EVP_MD_CTX_copy return value.
PR: 3201
(cherry picked from commit 03da57fe14)
2014-02-25 22:23:49 +01:00
Dr. Stephen Henson
3678161d71 Don't use BN_ULLONG in n2l8 use SCTS_TIMESTAMP. 2014-02-25 15:05:08 +00:00
Dr. Stephen Henson
c3f5d3d93a Only set current certificate to valid values.
When setting the current certificate check that it has a corresponding
private key.
(cherry picked from commit 358d352aa2)
2014-02-23 13:49:21 +00:00
Dr. Stephen Henson
c5ea65b157 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.
(cherry picked from commit 13dc3ce9ab)
2014-02-23 13:49:21 +00:00
Dr. Stephen Henson
58b86e4235 Option to set current cert to server certificate.
(cherry picked from commit daddd9a950)
2014-02-23 13:49:21 +00:00
Ben Laurie
a466be6243 Fix typo. 2014-02-23 11:21:39 +00:00
Andy Polyakov
6b3b6beaa1 ssl/ssl_cert.c: DANE update. 2014-02-21 12:12:25 +01:00
Dr. Stephen Henson
b709f8ef54 fix WIN32 warnings 2014-02-20 22:41:06 +00:00
Rob Stradling
c74ce24cd2 Show the contents of the RFC6962 Signed Certificate Timestamp List Certificate/OCSP Extensions.
Add the RFC6962 OIDs to the objects table.
(backport from master branch)
2014-02-20 21:43:54 +00:00
Dr. Stephen Henson
d69acceca9 Fix error discrepancy with 1.0.1 2014-02-14 17:50:20 +00:00
Andy Polyakov
aff78bb39a ssl/s3_pkt.c: detect RAND_bytes error in multi-block.
(cherry picked from commit 701134320a)
2014-02-14 17:45:33 +01:00
Andy Polyakov
d59d0b7c21 ssl/ssl[3].h: retain binary compatibility. 2014-02-13 17:03:14 +01:00
Dr. Stephen Henson
a2317c3ffd fix error discrepancy 2014-02-09 21:12:12 +00:00
Dr. Stephen Henson
295fd057ce fix error number clash 2014-02-09 19:57:27 +00:00
Ben Laurie
8acf1ff4b4 More cleanup.
(cherry picked from commit 5eda213ebe)
Conflicts:
	apps/s_client.c
	apps/s_server.c
2014-02-09 08:07:04 -08:00
Ben Laurie
8b41df41c2 Make it build.
(cherry picked from commit a6a48e87bc)
Conflicts:
	ssl/s3_clnt.c
	ssl/t1_lib.c
2014-02-09 08:02:40 -08:00
Scott Deboy
c32ebefaa8 Reverting 1.0.2-only changes supporting the prior authz RFC5878-based tests from commit 835d104f46 2014-02-09 07:49:44 -08:00
Scott Deboy
5a32dd8930 Don't break out of the custom extension callback loop - continue instead
The contract for custom extension callbacks has changed - all custom extension callbacks are triggered
2014-02-08 16:19:30 -08:00
Ben Laurie
130ebe34c8 Fix whitespace, new-style comments. 2014-02-08 16:19:30 -08:00
Scott Deboy
7612511b3b Re-add alert variables removed during rebase
Whitespace fixes

(cherry picked from commit e9add063b5)
Conflicts:
	ssl/s3_clnt.c
2014-02-08 16:19:01 -08:00
Scott Deboy
19a28a8aa3 Updating DTCP authorization type to expected value 2014-02-08 16:18:11 -08:00
Scott Deboy
fc213217e8 Update custom TLS extension and supplemental data 'generate' callbacks to support sending an alert.
If multiple TLS extensions are expected but not received, the TLS extension and supplemental data 'generate' callbacks are the only chance for the receive-side to trigger a specific TLS alert during the handshake.

Removed logic which no-op'd TLS extension generate callbacks (as the generate callbacks need to always be called in order to trigger alerts), and updated the serverinfo-specific custom TLS extension callbacks to track which custom TLS extensions were received by the client, where no-ops for 'generate' callbacks are appropriate.

(cherry picked from commit ac20719d99)
Conflicts:
	ssl/t1_lib.c
2014-02-08 16:17:24 -08:00
Trevor Perrin
7198c5af1f Redo deletion of some serverinfo code that supplemental data code mistakenly reinstated. 2014-02-08 16:15:10 -08:00
Scott Deboy
038bec784e Add callbacks supporting generation and retrieval of supplemental data entries, facilitating RFC 5878 (TLS auth extensions)
Removed prior audit proof logic - audit proof support was implemented using the generic TLS extension API
Tests exercising the new supplemental data registration and callback api can be found in ssltest.c.
Implemented changes to s_server and s_client to exercise supplemental data callbacks via the -auth argument, as well as additional flags to exercise supplemental data being sent only during renegotiation.

(cherry picked from commit 36086186a9)
Conflicts:
	Configure
	apps/s_client.c
	apps/s_server.c
	ssl/ssl.h
	ssl/ssl3.h
	ssl/ssltest.c
2014-02-08 16:12:15 -08:00
Dr. Stephen Henson
c41e242e5c Return previous compression methods when setting them.
(cherry picked from commit b45e874d7c)
2014-02-06 13:58:18 +00:00
Andy Polyakov
9578319394 ssl/s3_pkt.c: add multi-block processing [from master]. 2014-02-05 21:43:17 +01:00
Dr. Stephen Henson
3bff195dca Oops, get selection logic right.
(cherry picked from commit 3880579240d476d21f68fd01a391dd325920f479)
2014-02-05 18:57:23 +00:00
Dr. Stephen Henson
e0d4272a58 Return per-certificate chain if extra chain is NULL.
If an application calls the macro SSL_CTX_get_extra_chain_certs
return either the old "shared" extra certificates or those associated
with the current certificate.

This means applications which call SSL_CTX_use_certificate_chain_file
and retrieve the additional chain using SSL_CTX_get_extra_chain_certs
will still work. An application which only wants to check the shared
extra certificates can call the new macro
SSL_CTX_get_extra_chain_certs_only
(cherry picked from commit a51f767645)
2014-02-05 17:06:56 +00:00
Dr. Stephen Henson
e2f06800bc New ctrl to set current certificate.
New ctrl sets current certificate based on certain criteria. Currently
two options: set the first valid certificate as current and set the
next valid certificate as current. Using these an application can
iterate over all certificates in an SSL_CTX or SSL structure.
(cherry picked from commit 0f78819c8c)
2014-02-02 23:12:06 +00:00
Andy Polyakov
9071b36d9a Add AES-NI+SHA256 stitch registrations (from master). 2014-02-02 00:05:02 +01:00
Andy Polyakov
2cc5142fb1 Improve WINCE support.
Submitted by: Pierre Delaage
(cherry picked from commit a006fef78e)

Resolved conflicts:

	crypto/bio/bss_dgram.c
	ssl/d1_lib.c
	util/pl/VC-32.pl
2014-02-01 22:48:56 +01:00
Dr. Stephen Henson
a99540a6de Check i before r[i].
PR#3244
(cherry picked from commit 9614d2c676)
2014-01-28 15:14:47 +00:00
Dr. Stephen Henson
ede90b1121 Support retries in certificate callback
(cherry picked from commit 0ebc965b9c)

Conflicts:

	ssl/s3_srvr.c
	ssl/ssl3.h
2014-01-27 14:41:38 +00:00
Dr. Stephen Henson
9f1979b94a New function to set compression methods so they can be safely freed.
(cherry picked from commit cbb6744827)
2014-01-27 14:32:44 +00:00
Dr. Stephen Henson
c4f01c533b Add new function SSL_CTX_get_ssl_method().
Partial fix for PR#3183.
(cherry picked from commit ba168244a1)
2014-01-16 14:08:42 +00:00