/*
- * Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
#include <openssl/err.h>
#include <time.h>
-#include "../ssl/packet_locl.h"
+#include "internal/packet.h"
#include "testutil.h"
BIO *wbio;
long len;
unsigned char *data;
- PACKET pkt = {0}, pkt2 = {0}, pkt3 = {0};
+ PACKET pkt, pkt2, pkt3;
char *dummytick = "Hello World!";
unsigned int type = 0;
int testresult = 0;
return 1;
#endif
+ memset(&pkt, 0, sizeof(pkt));
+ memset(&pkt2, 0, sizeof(pkt2));
+ memset(&pkt3, 0, sizeof(pkt3));
+
/*
* For each test set up an SSL_CTX and SSL and see what ClientHello gets
* produced when we try to connect
case TEST_SET_SESSION_TICK_DATA_VER_NEG:
#if !defined(OPENSSL_NO_TLS1_3) && defined(OPENSSL_NO_TLS1_2)
/* TLSv1.3 is enabled and TLSv1.2 is disabled so can't do this test */
+ SSL_CTX_free(ctx);
return 1;
#else
/* Testing for session tickets <= TLS1.2; not relevant for 1.3 */
* ClientHello is already going to be quite long. To avoid getting one
* that is too long for this test we use a restricted ciphersuite list
*/
- if (!TEST_true(SSL_CTX_set_cipher_list(ctx, "")))
+ if (!TEST_false(SSL_CTX_set_cipher_list(ctx, "")))
goto end;
+ ERR_clear_error();
/* Fall through */
case TEST_ADD_PADDING:
case TEST_PADDING_NOT_NEEDED:
goto end;
}
- len = BIO_get_mem_data(wbio, (char **)&data);
- if (!TEST_true(PACKET_buf_init(&pkt, data, len))
+ if (!TEST_long_ge(len = BIO_get_mem_data(wbio, (char **)&data), 0)
+ || !TEST_true(PACKET_buf_init(&pkt, data, len))
/* Skip the record header */
|| !PACKET_forward(&pkt, SSL3_RT_HEADER_LENGTH))
goto end;
return testresult;
}
+OPT_TEST_DECLARE_USAGE("sessionfile\n")
+
int setup_tests(void)
{
+ if (!test_skip_common_options()) {
+ TEST_error("Error parsing test options\n");
+ return 0;
+ }
+
if (!TEST_ptr(sessionfile = test_get_argument(0)))
return 0;