summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/handshake_helper.h2
-rw-r--r--test/ssl_test.c6
-rw-r--r--test/ssl_test_ctx.c23
-rw-r--r--test/ssl_test_ctx.h3
-rw-r--r--test/ssl_test_ctx_test.c6
5 files changed, 10 insertions, 30 deletions
diff --git a/test/handshake_helper.h b/test/handshake_helper.h
index a9dd5c94a1..1f079c932b 100644
--- a/test/handshake_helper.h
+++ b/test/handshake_helper.h
@@ -34,7 +34,7 @@ typedef struct handshake_result {
ssl_servername_t servername;
/* Session ticket status */
ssl_session_ticket_t session_ticket;
- ssl_compression_t compression;
+ int compression;
/* Was this called on the second context? */
int session_ticket_do_not_call;
char *client_npn_negotiated;
diff --git a/test/ssl_test.c b/test/ssl_test.c
index f5dfa97090..948eb17d78 100644
--- a/test/ssl_test.c
+++ b/test/ssl_test.c
@@ -149,9 +149,9 @@ static int check_session_ticket(HANDSHAKE_RESULT *result, SSL_TEST_CTX *test_ctx
static int check_compression(HANDSHAKE_RESULT *result, SSL_TEST_CTX *test_ctx)
{
if (result->compression != test_ctx->compression_expected) {
- fprintf(stderr, "Client CompressionExpected mismatch, expected %s, got %s\n.",
- ssl_compression_name(test_ctx->compression_expected),
- ssl_compression_name(result->compression));
+ fprintf(stderr, "Client CompressionExpected mismatch, expected %d, got %d\n.",
+ test_ctx->compression_expected,
+ result->compression);
return 0;
}
return 1;
diff --git a/test/ssl_test_ctx.c b/test/ssl_test_ctx.c
index e746dbd942..d668f51f51 100644
--- a/test/ssl_test_ctx.c
+++ b/test/ssl_test_ctx.c
@@ -288,26 +288,7 @@ const char *ssl_session_ticket_name(ssl_session_ticket_t server)
/* CompressionExpected */
-static const test_enum ssl_compression[] = {
- {"Yes", SSL_TEST_COMPRESSION_YES},
- {"No", SSL_TEST_COMPRESSION_NO},
-};
-
-__owur static int parse_compression(SSL_TEST_CTX *test_ctx, const char *value)
-{
- int ret_value;
- if (!parse_enum(ssl_compression, OSSL_NELEM(ssl_compression),
- &ret_value, value)) {
- return 0;
- }
- test_ctx->compression_expected = ret_value;
- return 1;
-}
-
-const char *ssl_compression_name(ssl_compression_t comp)
-{
- return enum_name(ssl_compression, OSSL_NELEM(ssl_compression), comp);
-}
+IMPLEMENT_SSL_TEST_BOOL_OPTION(SSL_TEST_CTX, test, compression_expected)
/* Method */
@@ -564,7 +545,7 @@ static const ssl_test_ctx_option ssl_test_ctx_options[] = {
{ "ExpectedProtocol", &parse_protocol },
{ "ExpectedServerName", &parse_expected_servername },
{ "SessionTicketExpected", &parse_session_ticket },
- { "CompressionExpected", &parse_compression },
+ { "CompressionExpected", &parse_test_compression_expected },
{ "Method", &parse_test_method },
{ "ExpectedNPNProtocol", &parse_test_expected_npn_protocol },
{ "ExpectedALPNProtocol", &parse_test_expected_alpn_protocol },
diff --git a/test/ssl_test_ctx.h b/test/ssl_test_ctx.h
index 418a4f2ac3..300a557880 100644
--- a/test/ssl_test_ctx.h
+++ b/test/ssl_test_ctx.h
@@ -168,7 +168,7 @@ typedef struct {
*/
ssl_servername_t expected_servername;
ssl_session_ticket_t session_ticket_expected;
- ssl_compression_t compression_expected;
+ int compression_expected;
/* The expected NPN/ALPN protocol to negotiate. */
char *expected_npn_protocol;
char *expected_alpn_protocol;
@@ -198,7 +198,6 @@ const char *ssl_servername_name(ssl_servername_t server);
const char *ssl_servername_callback_name(ssl_servername_callback_t
servername_callback);
const char *ssl_session_ticket_name(ssl_session_ticket_t server);
-const char *ssl_compression_name(ssl_compression_t server);
const char *ssl_test_method_name(ssl_test_method_t method);
const char *ssl_handshake_mode_name(ssl_handshake_mode_t mode);
const char *ssl_ct_validation_name(ssl_ct_validation_t mode);
diff --git a/test/ssl_test_ctx_test.c b/test/ssl_test_ctx_test.c
index 5c1e427e21..54a32c6223 100644
--- a/test/ssl_test_ctx_test.c
+++ b/test/ssl_test_ctx_test.c
@@ -174,9 +174,9 @@ static int SSL_TEST_CTX_equal(SSL_TEST_CTX *ctx, SSL_TEST_CTX *ctx2)
return 0;
}
if (ctx->compression_expected != ctx2->compression_expected) {
- fprintf(stderr, "ComrpessionExpected mismatch: %s vs %s.\n",
- ssl_compression_name(ctx->compression_expected),
- ssl_compression_name(ctx2->compression_expected));
+ fprintf(stderr, "ComrpessionExpected mismatch: %d vs %d.\n",
+ ctx->compression_expected,
+ ctx2->compression_expected);
return 0;
}
if (!strings_equal("ExpectedNPNProtocol", ctx->expected_npn_protocol,