summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2016-11-02 10:44:15 +0000
committerMatt Caswell <matt@openssl.org>2016-11-02 16:51:58 +0000
commit3f99bfed678b09110fda82bc6896fd45eb0b376c (patch)
tree77618af22ba50195d36970876eb077e9549e3775 /test
parent0f6c9d73cb1e1027c67d993a669719e351c25cfc (diff)
Add a read_ahead test
This test checks that read_ahead works correctly when dealing with large records. Reviewed-by: Richard Levitte <levitte@openssl.org> (cherry picked from commit 7856332e8c14fd1da1811a9d0afde243dd0f4669)
Diffstat (limited to 'test')
-rw-r--r--test/sslapitest.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/test/sslapitest.c b/test/sslapitest.c
index 495bf26ed2..90326d9f9d 100644
--- a/test/sslapitest.c
+++ b/test/sslapitest.c
@@ -33,7 +33,7 @@ static X509 *ocspcert = NULL;
#define NUM_EXTRA_CERTS 40
static int execute_test_large_message(const SSL_METHOD *smeth,
- const SSL_METHOD *cmeth)
+ const SSL_METHOD *cmeth, int read_ahead)
{
SSL_CTX *cctx = NULL, *sctx = NULL;
SSL *clientssl = NULL, *serverssl = NULL;
@@ -61,6 +61,14 @@ static int execute_test_large_message(const SSL_METHOD *smeth,
goto end;
}
+ if(read_ahead) {
+ /*
+ * Test that read_ahead works correctly when dealing with large
+ * records
+ */
+ SSL_CTX_set_read_ahead(cctx, 1);
+ }
+
/*
* We assume the supplied certificate is big enough so that if we add
* NUM_EXTRA_CERTS it will make the overall message large enough. The
@@ -107,14 +115,25 @@ static int execute_test_large_message(const SSL_METHOD *smeth,
static int test_large_message_tls(void)
{
- return execute_test_large_message(TLS_server_method(), TLS_client_method());
+ return execute_test_large_message(TLS_server_method(), TLS_client_method(),
+ 0);
+}
+
+static int test_large_message_tls_read_ahead(void)
+{
+ return execute_test_large_message(TLS_server_method(), TLS_client_method(),
+ 1);
}
#ifndef OPENSSL_NO_DTLS
static int test_large_message_dtls(void)
{
+ /*
+ * read_ahead is not relevant to DTLS because DTLS always acts as if
+ * read_ahead is set.
+ */
return execute_test_large_message(DTLS_server_method(),
- DTLS_client_method());
+ DTLS_client_method(), 0);
}
#endif
@@ -867,6 +886,7 @@ int main(int argc, char *argv[])
CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
ADD_TEST(test_large_message_tls);
+ ADD_TEST(test_large_message_tls_read_ahead);
#ifndef OPENSSL_NO_DTLS
ADD_TEST(test_large_message_dtls);
#endif