diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2017-01-13 15:20:42 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2017-01-20 01:16:31 +0000 |
commit | ee5b6a42be3c0ca18145ace8793135fbb4768248 (patch) | |
tree | d079b139c1c015df4ccf7f9dda092c2fda0d1487 /test/ssl_test_ctx.c | |
parent | 424baabdf5af540bda4a69122d274b071d804390 (diff) |
Add options to check TLS signing hashes
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2235)
Diffstat (limited to 'test/ssl_test_ctx.c')
-rw-r--r-- | test/ssl_test_ctx.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/ssl_test_ctx.c b/test/ssl_test_ctx.c index f8d5ecda14..242602d88e 100644 --- a/test/ssl_test_ctx.c +++ b/test/ssl_test_ctx.c @@ -480,6 +480,39 @@ __owur static int parse_expected_client_cert_type(SSL_TEST_CTX *test_ctx, value); } +/*************************/ +/* Expected signing hash */ +/*************************/ + +__owur static int parse_expected_sign_hash(int *ptype, const char *value) +{ + int nid; + + if (value == NULL) + return 0; + nid = OBJ_sn2nid(value); + if (nid == NID_undef) + nid = OBJ_ln2nid(value); + if (nid == NID_undef) + return 0; + *ptype = nid; + return 1; +} + +__owur static int parse_expected_server_sign_hash(SSL_TEST_CTX *test_ctx, + const char *value) +{ + return parse_expected_sign_hash(&test_ctx->expected_server_sign_hash, + value); +} + +__owur static int parse_expected_client_sign_hash(SSL_TEST_CTX *test_ctx, + const char *value) +{ + return parse_expected_sign_hash(&test_ctx->expected_server_sign_hash, + value); +} + /*************************************************************/ /* Known test options and their corresponding parse methods. */ /*************************************************************/ @@ -506,7 +539,9 @@ static const ssl_test_ctx_option ssl_test_ctx_options[] = { { "MaxFragmentSize", &parse_test_max_fragment_size }, { "ExpectedTmpKeyType", &parse_expected_tmp_key_type }, { "ExpectedServerCertType", &parse_expected_server_cert_type }, + { "ExpectedServerSignHash", &parse_expected_server_sign_hash }, { "ExpectedClientCertType", &parse_expected_client_cert_type }, + { "ExpectedClientSignHash", &parse_expected_client_sign_hash }, }; /* Nested client options. */ |