summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2018-01-23 12:23:23 +0000
committerMatt Caswell <matt@openssl.org>2018-01-24 18:02:37 +0000
commit97ea1e7f42eea97b117af08b3c1d29f6443850ab (patch)
treea0100b95025d6da5f9fb4c3b1293ff92322b3780 /test
parentd0debc0a1cea232d3131b941dba435dc001f3cd3 (diff)
Updates following review of SSL_stateless() code
Reviewed-by: Ben Kaduk <kaduk@mit.edu> (Merged from https://github.com/openssl/openssl/pull/4435)
Diffstat (limited to 'test')
-rw-r--r--test/sslapitest.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/test/sslapitest.c b/test/sslapitest.c
index 82f61bceab..a338578fcc 100644
--- a/test/sslapitest.c
+++ b/test/sslapitest.c
@@ -2561,8 +2561,8 @@ static int generate_cookie_callback(SSL *ssl, unsigned char *cookie,
* Not suitable as a real cookie generation function but good enough for
* testing!
*/
- memcpy(cookie, cookie_magic_value, sizeof(cookie_magic_value));
- *cookie_len = sizeof(cookie_magic_value);
+ memcpy(cookie, cookie_magic_value, sizeof(cookie_magic_value) - 1);
+ *cookie_len = sizeof(cookie_magic_value) - 1;
return 1;
}
@@ -2570,7 +2570,7 @@ static int generate_cookie_callback(SSL *ssl, unsigned char *cookie,
static int verify_cookie_callback(SSL *ssl, const unsigned char *cookie,
unsigned int cookie_len)
{
- if (cookie_len == sizeof(cookie_magic_value)
+ if (cookie_len == sizeof(cookie_magic_value) - 1
&& memcmp(cookie, cookie_magic_value, cookie_len) == 0)
return 1;
@@ -2601,7 +2601,7 @@ static int test_stateless(void)
|| !TEST_false(create_ssl_connection(serverssl, clientssl,
SSL_ERROR_WANT_READ))
/* This should fail because there is no cookie */
- || !TEST_int_le(SSL_stateless(serverssl), 0))
+ || !TEST_false(SSL_stateless(serverssl)))
goto end;
/* Abandon the connection from this client */
@@ -2618,12 +2618,12 @@ static int test_stateless(void)
|| !TEST_false(create_ssl_connection(serverssl, clientssl,
SSL_ERROR_WANT_READ))
/* This should fail because there is no cookie */
- || !TEST_int_le(SSL_stateless(serverssl), 0)
+ || !TEST_false(SSL_stateless(serverssl))
/* Send the second ClientHello */
|| !TEST_false(create_ssl_connection(serverssl, clientssl,
SSL_ERROR_WANT_READ))
/* This should succeed because a cookie is now present */
- || !TEST_int_gt(SSL_stateless(serverssl), 0)
+ || !TEST_true(SSL_stateless(serverssl))
/* Complete the connection */
|| !TEST_true(create_ssl_connection(serverssl, clientssl,
SSL_ERROR_NONE)))