summaryrefslogtreecommitdiffstats
path: root/test/sslapitest.c
AgeCommit message (Collapse)Author
2017-04-03Add a test for the problem fixed by the previous commitMatt Caswell
Make sure the server can write normal data after earlier writing early data. Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3091)
2017-04-03Update early data test for an even later arrival of CFMatt Caswell
Commit 9b5c865df introduced a synthetic delay between arrival of EoED and CF. We actually want to delay the arrival of CF even further to demonstrate that we can write early data even when "in init". Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3091)
2017-03-30Provide a test for pause between EoED and CFMatt Caswell
This tests the bug fixed in the previous commit. We introduce a synthetic delay between the server receiving EoED and CF and check that we can still send early data. Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3089)
2017-03-30Add a test for the bug fixed in the previous commitMatt Caswell
We want to make sure that if we if are using SSL_MODE_AUTO_RETRY then if SSL_read_early_data() hits EndOfEarlyData then it doesn't auto retry and end up with normal data. The same issue could occur with read_ahead which is what we use in this test. Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3077)
2017-03-29More typo fixesFdaSilvaYY
Fix some comments too [skip ci] Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3069)
2017-03-16Update end of early data processing for draft-19Matt Caswell
The end of early data is now indicated by a new handshake message rather than an alert. Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2895)
2017-03-02Update early data API for writing to unauthenticated clientsMatt Caswell
Change the early data API so that the server must use SSL_write_early_data() to write to an unauthenticated client. Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2737)
2017-03-02Rename SSL_write_early() to SSL_write_early_data()Matt Caswell
This is for consistency with the rest of the API where all the functions are called *early_data*. Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2737)
2017-03-02Rename SSL_read_early() to SSL_read_early_data()Matt Caswell
This is for consistency with the rest of the API where all the functions are called *early_data*. Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2737)
2017-03-02Add early_data testsMatt Caswell
Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2737)
2017-02-28Fix sslapitest when compiled with no-tls1_2Matt Caswell
Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2788)
2017-02-23Add an sslapitest for early callbackBenjamin Kaduk
Make sure that we can stop handshake processing and resume it later. Also check that the cipher list and compression methods are sane. Unfortunately, we don't have the client-side APIs needed to force a specific (known) session ID to be sent in the ClientHello, so that accessor cannot be tested here. Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2279)
2017-02-23Let test handshakes stop on certain errorsBenjamin Kaduk
Certain callback APIs allow the callback to request async processing by trickling a particular error value up the stack to the application as an error return from the handshake function. In those cases, SSL_want() returns a code specific to the type of async processing needed. The create_ssl_connection() helper function for the tests is very helpful for several things, including creating API tests. However, it does not currently let us test the async processing functionality of these callback interfaces, because the special SSL error codes are treated as generic errors and the helper continues to loop until it reaches its maximum iteration count. Add a new parameter, 'want', that indicates an expected/desired special SSL error code, so that the helper will terminate when either side reports that error, giving control back to the calling function and allowing the test to proceed. Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2279)
2017-02-02Test logging TLSv1.3 secrets.Cory Benfield
Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2287)
2017-01-30Re-enable TLSv1.3 session resumption related tests in sslapitestMatt Caswell
Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2259)
2017-01-25Limit the length of the encrypted premaster key.Cory Benfield
Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2288)
2017-01-23Add tests for the key logging callbacks.Cory Benfield
Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1646)
2017-01-10Fix no-ec following sigalgs refactorMatt Caswell
Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2157)
2017-01-04Don't build OCSP stuff when OCSP is disabledRichard Levitte
Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2173)
2016-12-30Don't run the sigalgs tests over a TLSv1.3 connectionMatt Caswell
We need a new API for TLSv1.3 sig algs Reviewed-by: Tim Hudson <tjh@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2160)
2016-12-30Provide some tests for the sig algs APIMatt Caswell
Reviewed-by: Tim Hudson <tjh@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2160)
2016-12-12Fix a leak in SSL_clear()Matt Caswell
SSL_clear() was resetting numwpipes to 0, but not freeing any allocated memory for existing write buffers. Fixes #2026 Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-12-08Send and Receive a TLSv1.3 format ServerHelloMatt Caswell
There are some minor differences in the format of a ServerHello in TLSv1.3. Perl changes reviewed by Richard Levitte. Non-perl changes reviewed by Rich Salz Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-11-09Add main() test methods to reduce test boilerplate.Emilia Kasper
Simple tests only need to implement register_tests(). Tests that need a custom main() should implement test_main(). This will be wrapped in a main() that performs common setup/teardown (currently crypto-mdebug). Note that for normal development, enable-asan is usually sufficient for detecting leaks, and more versatile. enable-crypto-mdebug is stricter as it will also insist that all static variables be freed. This is useful for debugging library init/deinit; however, it also means that test_main() must free everything it allocates. Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-11-02Add a read_ahead testMatt Caswell
This test checks that read_ahead works correctly when dealing with large records. Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-09-29Fix no-dtlsMatt Caswell
The new large message test in sslapitest needs OPENSSL_NO_DTLS guards Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-09-26Fix some mem leaks in sslapitestMatt Caswell
A mem leak could occur on an error path. Also the mempacket BIO_METHOD needs to be cleaned up, because of the newly added DTLS test. Also fixed a double semi-colon in ssltestlib.c Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-09-26Add a test for large messagesMatt Caswell
Ensure that we send a large message during the test suite. Reviewed-by: Emilia Käsper <emilia@openssl.org>
2016-09-22Add some more OCSP testingMatt Caswell
Test that the OCSP callbacks work as expected. Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-08-25Fix uninit read in sslapitestMatt Caswell
msan detected an uninit read. Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-08-19Split create_ssl_connection()Matt Caswell
Split the create_ssl_connection() helper function into two steps: one to create the SSL objects, and one to actually create the connection. This provides the ability to make changes to the SSL object before the connection is actually made. Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-07-30Fix bogus warningsMatt Caswell
Fix some bogus "may be used uninitialized" warnings on some compilers. Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-07-29Simplify and rename SSL_set_rbio() and SSL_set_wbio()Matt Caswell
SSL_set_rbio() and SSL_set_wbio() are new functions in 1.1.0 and really should be called SSL_set0_rbio() and SSL_set0_wbio(). The old implementation was not consistent with what "set0" means though as there were special cases around what happens if the rbio and wbio are the same. We were only ever taking one reference on the BIO, and checking everywhere whether the rbio and wbio are the same so as not to double free. A better approach is to rename the functions to SSL_set0_rbio() and SSL_set0_wbio(). If an existing BIO is present it is *always* freed regardless of whether the rbio and wbio are the same or not. It is therefore the callers responsibility to ensure that a reference is taken for *each* usage, i.e. one for the rbio and one for the wbio. The legacy function SSL_set_bio() takes both the rbio and wbio in one go and sets them both. We can wrap up the old behaviour in the implementation of that function, i.e. previously if the rbio and wbio are the same in the call to this function then the caller only needed to ensure one reference was passed. This behaviour is retained by internally upping the ref count. This commit was inspired by BoringSSL commit f715c423224. RT#4572 Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-07-29Add some SSL BIO testsMatt Caswell
This adds some simple SSL BIO tests that check for pushing and popping of BIOs into the chain. These tests would have caught the bugs fixed in the previous three commits, if combined with a crypto-mdebug build. Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-07-29Add a test for SSL_set_bio()Matt Caswell
The SSL_set_bio() function has some complicated ownership rules. This adds a test to make sure it all works as expected. Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-07-25Fix no-tls1_2Matt Caswell
Misc fixes impacting no-tls1_2. Also fixes no-dtls1_2. Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-07-19Add more session testsMatt Caswell
Add some more tests for sessions following on from the previous commit to ensure the callbacks are called when appropriate. Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-06-13Update sslapitest to use the test frameworkMatt Caswell
Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-06-13Add some session API testsMatt Caswell
This commit adds some session API tests, and in particular tests the modified behaviour of SSL_set_session() introduced in the last commit. To do this I have factored out some common code from the asynciotest into a new ssltestlib.c file. I've also renamed getsettest to sslapitest as this more closely matches what it now is! Reviewed-by: Rich Salz <rsalz@openssl.org>