mirror of
https://github.com/openssl/openssl.git
synced 2025-01-24 13:55:42 +08:00
Use the built in boolean type for CompressionExpected
Don't create a custom boolean type for parsing CompressionExpected. Use the existing one instead. Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2814)
This commit is contained in:
parent
439db0c97b
commit
b6611753a6
@ -34,7 +34,7 @@ typedef struct handshake_result {
|
|||||||
ssl_servername_t servername;
|
ssl_servername_t servername;
|
||||||
/* Session ticket status */
|
/* Session ticket status */
|
||||||
ssl_session_ticket_t session_ticket;
|
ssl_session_ticket_t session_ticket;
|
||||||
ssl_compression_t compression;
|
int compression;
|
||||||
/* Was this called on the second context? */
|
/* Was this called on the second context? */
|
||||||
int session_ticket_do_not_call;
|
int session_ticket_do_not_call;
|
||||||
char *client_npn_negotiated;
|
char *client_npn_negotiated;
|
||||||
|
@ -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)
|
static int check_compression(HANDSHAKE_RESULT *result, SSL_TEST_CTX *test_ctx)
|
||||||
{
|
{
|
||||||
if (result->compression != test_ctx->compression_expected) {
|
if (result->compression != test_ctx->compression_expected) {
|
||||||
fprintf(stderr, "Client CompressionExpected mismatch, expected %s, got %s\n.",
|
fprintf(stderr, "Client CompressionExpected mismatch, expected %d, got %d\n.",
|
||||||
ssl_compression_name(test_ctx->compression_expected),
|
test_ctx->compression_expected,
|
||||||
ssl_compression_name(result->compression));
|
result->compression);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -288,26 +288,7 @@ const char *ssl_session_ticket_name(ssl_session_ticket_t server)
|
|||||||
|
|
||||||
/* CompressionExpected */
|
/* CompressionExpected */
|
||||||
|
|
||||||
static const test_enum ssl_compression[] = {
|
IMPLEMENT_SSL_TEST_BOOL_OPTION(SSL_TEST_CTX, test, compression_expected)
|
||||||
{"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);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Method */
|
/* Method */
|
||||||
|
|
||||||
@ -564,7 +545,7 @@ static const ssl_test_ctx_option ssl_test_ctx_options[] = {
|
|||||||
{ "ExpectedProtocol", &parse_protocol },
|
{ "ExpectedProtocol", &parse_protocol },
|
||||||
{ "ExpectedServerName", &parse_expected_servername },
|
{ "ExpectedServerName", &parse_expected_servername },
|
||||||
{ "SessionTicketExpected", &parse_session_ticket },
|
{ "SessionTicketExpected", &parse_session_ticket },
|
||||||
{ "CompressionExpected", &parse_compression },
|
{ "CompressionExpected", &parse_test_compression_expected },
|
||||||
{ "Method", &parse_test_method },
|
{ "Method", &parse_test_method },
|
||||||
{ "ExpectedNPNProtocol", &parse_test_expected_npn_protocol },
|
{ "ExpectedNPNProtocol", &parse_test_expected_npn_protocol },
|
||||||
{ "ExpectedALPNProtocol", &parse_test_expected_alpn_protocol },
|
{ "ExpectedALPNProtocol", &parse_test_expected_alpn_protocol },
|
||||||
|
@ -168,7 +168,7 @@ typedef struct {
|
|||||||
*/
|
*/
|
||||||
ssl_servername_t expected_servername;
|
ssl_servername_t expected_servername;
|
||||||
ssl_session_ticket_t session_ticket_expected;
|
ssl_session_ticket_t session_ticket_expected;
|
||||||
ssl_compression_t compression_expected;
|
int compression_expected;
|
||||||
/* The expected NPN/ALPN protocol to negotiate. */
|
/* The expected NPN/ALPN protocol to negotiate. */
|
||||||
char *expected_npn_protocol;
|
char *expected_npn_protocol;
|
||||||
char *expected_alpn_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
|
const char *ssl_servername_callback_name(ssl_servername_callback_t
|
||||||
servername_callback);
|
servername_callback);
|
||||||
const char *ssl_session_ticket_name(ssl_session_ticket_t server);
|
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_test_method_name(ssl_test_method_t method);
|
||||||
const char *ssl_handshake_mode_name(ssl_handshake_mode_t mode);
|
const char *ssl_handshake_mode_name(ssl_handshake_mode_t mode);
|
||||||
const char *ssl_ct_validation_name(ssl_ct_validation_t mode);
|
const char *ssl_ct_validation_name(ssl_ct_validation_t mode);
|
||||||
|
@ -174,9 +174,9 @@ static int SSL_TEST_CTX_equal(SSL_TEST_CTX *ctx, SSL_TEST_CTX *ctx2)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (ctx->compression_expected != ctx2->compression_expected) {
|
if (ctx->compression_expected != ctx2->compression_expected) {
|
||||||
fprintf(stderr, "ComrpessionExpected mismatch: %s vs %s.\n",
|
fprintf(stderr, "ComrpessionExpected mismatch: %d vs %d.\n",
|
||||||
ssl_compression_name(ctx->compression_expected),
|
ctx->compression_expected,
|
||||||
ssl_compression_name(ctx2->compression_expected));
|
ctx2->compression_expected);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (!strings_equal("ExpectedNPNProtocol", ctx->expected_npn_protocol,
|
if (!strings_equal("ExpectedNPNProtocol", ctx->expected_npn_protocol,
|
||||||
|
Loading…
Reference in New Issue
Block a user