diff options
author | Benjamin Kaduk <bkaduk@akamai.com> | 2017-02-13 15:10:54 -0600 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2017-02-23 19:40:27 +0100 |
commit | 8e2236eff8e38109a57347c8ad795040b380c936 (patch) | |
tree | 22f926a2a915e28f23f673d75e342aa829093d65 /test/sslapitest.c | |
parent | 694c9180d7f082b896692048052413fc5dc4e467 (diff) |
Let test handshakes stop on certain errors
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)
Diffstat (limited to 'test/sslapitest.c')
-rw-r--r-- | test/sslapitest.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/test/sslapitest.c b/test/sslapitest.c index 47f008a711..cc852952e7 100644 --- a/test/sslapitest.c +++ b/test/sslapitest.c @@ -338,7 +338,7 @@ static int test_keylog(void) { goto end; } - if (!create_ssl_connection(serverssl, clientssl)) { + if (!create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE)) { printf("Unable to create SSL connection\n"); goto end; } @@ -435,7 +435,7 @@ static int test_keylog_no_master_key(void) { goto end; } - if (!create_ssl_connection(serverssl, clientssl)) { + if (!create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE)) { printf("Unable to create SSL connection\n"); goto end; } @@ -541,7 +541,7 @@ static int execute_test_large_message(const SSL_METHOD *smeth, goto end; } - if (!create_ssl_connection(serverssl, clientssl)) { + if (!create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE)) { printf("Unable to create SSL connection\n"); goto end; } @@ -719,7 +719,7 @@ static int test_tlsext_status_type(void) goto end; } - if (!create_ssl_connection(serverssl, clientssl)) { + if (!create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE)) { printf("Unable to create SSL connection\n"); goto end; } @@ -745,7 +745,7 @@ static int test_tlsext_status_type(void) } /* This should fail because the callback will fail */ - if (create_ssl_connection(serverssl, clientssl)) { + if (create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE)) { printf("Unexpected success creating the connection\n"); goto end; } @@ -799,7 +799,7 @@ static int test_tlsext_status_type(void) BIO_free(certbio); certbio = NULL; - if (!create_ssl_connection(serverssl, clientssl)) { + if (!create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE)) { printf("Unable to create SSL connection\n"); goto end; } @@ -906,7 +906,7 @@ static int execute_test_session(SSL_SESSION_TEST_FIXTURE fix) goto end; } - if (!create_ssl_connection(serverssl1, clientssl1)) { + if (!create_ssl_connection(serverssl1, clientssl1, SSL_ERROR_NONE)) { printf("Unable to create SSL connection\n"); goto end; } @@ -932,7 +932,7 @@ static int execute_test_session(SSL_SESSION_TEST_FIXTURE fix) goto end; } - if (!create_ssl_connection(serverssl2, clientssl2)) { + if (!create_ssl_connection(serverssl2, clientssl2, SSL_ERROR_NONE)) { printf("Unable to create second SSL connection\n"); goto end; } @@ -1015,7 +1015,7 @@ static int execute_test_session(SSL_SESSION_TEST_FIXTURE fix) } /* This should fail because of the mismatched protocol versions */ - if (create_ssl_connection(serverssl3, clientssl3)) { + if (create_ssl_connection(serverssl3, clientssl3, SSL_ERROR_NONE)) { printf("Unable to create third SSL connection\n"); goto end; } @@ -1436,7 +1436,7 @@ static int test_set_sigalgs(int idx) } } - if (curr->connsuccess != create_ssl_connection(serverssl, clientssl)) { + if (curr->connsuccess != create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE)) { printf("Unexpected return value creating SSL connection (%d)\n", idx); goto end; } |