aboutsummaryrefslogtreecommitdiffstats
path: root/ssl/heartbeat_test.c
Commit message (Collapse)AuthorAgeFilesLines
* mark all block comments that need format preserving so thatTim Hudson2014-12-301-1/+1
| | | | | | | indent will not alter them when reformatting comments Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
* Add conditional unit testing interface.Dr. Stephen Henson2014-07-241-1/+3
| | | | | | | | | | | Don't call internal functions directly call them through SSL_test_functions(). This also makes unit testing work on Windows and platforms that don't export internal functions from shared libraries. By default unit testing is not enabled: it requires the compile time option "enable-unit-test". Reviewed-by: Geoff Thorpe <geoff@openssl.org>
* Update heartbeat_test #includesMike Bland2014-07-191-1/+2
| | | | | | | | ssl/ssl_locl.h now comes first to ensure that it will compile standalone. test/testutil.h is considered to be in the same directory as the test file, since the test file will be linked into test/ and built there. Reviewed-by: Tim Hudson <tjh@openssl.org>
* Use testutil registry in heartbeat_testMike Bland2014-07-191-22/+13
| | | | Reviewed-by: Tim Hudson <tjh@openssl.org>
* Please Clang's sanitizer.Andy Polyakov2014-07-081-17/+21
| | | | PR: #3424,#3423,#3422
* Create test/testutil.h for unit test helper macrosMike Bland2014-06-101-6/+4
| | | | | | | | 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.
* Don't compile heartbeat test code on Windows (for now).Dr. Stephen Henson2014-05-311-1/+1
|
* Fix heartbeat_test for -DOPENSSL_NO_HEARTBEATSMike Bland2014-05-221-0/+10
| | | | | Replaces the entire test with a trivial implementation when OPENSSL_NO_HEARTBEATS is defined.
* For portability use BUF_strndup instead of strndup.Dr. Stephen Henson2014-05-201-2/+2
|
* Fixup for ancient compilers.Ben Laurie2014-05-191-20/+31
|
* Zero-initialize heartbeat test write bufferMike Bland2014-05-191-2/+6
| | | | | | | | | | | | | | | | | | | | | 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.
* More through error checks in set_upMike Bland2014-05-191-4/+20
| | | | Checks the return values of ssl_init_wbio_buffer() and ssl3_setup_buffers().
* Make it build/run.Ben Laurie2014-05-191-2/+2
|
* Unit/regression test for TLS heartbeats.Mike Bland2014-05-191-0/+424
Regression test against CVE-2014-0160 (Heartbleed). More info: http://mike-bland.com/tags/heartbleed.html