diff options
author | Stef Walter <stef@thewalter.net> | 2013-07-08 16:56:40 +0200 |
---|---|---|
committer | Stef Walter <stef@thewalter.net> | 2013-07-08 17:00:19 +0200 |
commit | 2c4f5ed657976d868c33f0ddf430477ee2bf0191 (patch) | |
tree | 2a278879f974691ae31be0853bb9313fb5d36a7f /trust/tests | |
parent | 03787ae83b1911118a7a689c4817bbce1e74dabd (diff) |
trust: Explicitly specify which formats parser should parse
Diffstat (limited to 'trust/tests')
-rw-r--r-- | trust/tests/test-module.c | 2 | ||||
-rw-r--r-- | trust/tests/test-parser.c | 10 |
2 files changed, 12 insertions, 0 deletions
diff --git a/trust/tests/test-module.c b/trust/tests/test-module.c index f1813a3..33cdd48 100644 --- a/trust/tests/test-module.c +++ b/trust/tests/test-module.c @@ -160,6 +160,7 @@ setup_writable (void *unused) test.cache = p11_asn1_cache_new (); test.parser = p11_parser_new (test.cache); + p11_parser_formats (test.parser, p11_parser_format_persist, NULL); } static void @@ -1108,6 +1109,7 @@ test_create_and_write (void) /* The expected file name */ path = p11_path_build (test.directory, "yay.p11-kit", NULL); + p11_parser_formats (test.parser, p11_parser_format_persist, NULL); ret = p11_parse_file (test.parser, path, 0); assert_num_eq (ret, P11_PARSE_SUCCESS); free (path); diff --git a/trust/tests/test-parser.c b/trust/tests/test-parser.c index c8cac03..09ec71c 100644 --- a/trust/tests/test-parser.c +++ b/trust/tests/test-parser.c @@ -117,6 +117,7 @@ test_parse_der_certificate (void) { CKA_INVALID }, }; + p11_parser_formats (test.parser, p11_parser_format_x509, NULL); ret = p11_parse_file (test.parser, SRCDIR "/files/cacert3.der", P11_PARSE_FLAG_NONE); assert_num_eq (P11_PARSE_SUCCESS, ret); @@ -144,6 +145,7 @@ test_parse_pem_certificate (void) { CKA_INVALID }, }; + p11_parser_formats (test.parser, p11_parser_format_pem, NULL); ret = p11_parse_file (test.parser, SRCDIR "/files/cacert3.pem", P11_PARSE_FLAG_NONE); assert_num_eq (P11_PARSE_SUCCESS, ret); @@ -170,6 +172,7 @@ test_parse_p11_kit_persist (void) { CKA_INVALID }, }; + p11_parser_formats (test.parser, p11_parser_format_persist, NULL); ret = p11_parse_file (test.parser, SRCDIR "/input/verisign-v1.p11-kit", P11_PARSE_FLAG_NONE); assert_num_eq (P11_PARSE_SUCCESS, ret); @@ -222,6 +225,7 @@ test_parse_openssl_trusted (void) int ret; int i; + p11_parser_formats (test.parser, p11_parser_format_pem, NULL); ret = p11_parse_file (test.parser, SRCDIR "/files/cacert3-trusted.pem", P11_PARSE_FLAG_ANCHOR); assert_num_eq (P11_PARSE_SUCCESS, ret); @@ -305,6 +309,7 @@ test_parse_openssl_distrusted (void) * OpenSSL style is to litter the blacklist in with the anchors, * so we parse this as an anchor, but expect it to be blacklisted */ + p11_parser_formats (test.parser, p11_parser_format_pem, NULL); ret = p11_parse_file (test.parser, SRCDIR "/files/distrusted.pem", P11_PARSE_FLAG_ANCHOR); assert_num_eq (P11_PARSE_SUCCESS, ret); @@ -344,6 +349,7 @@ test_parse_anchor (void) CK_ATTRIBUTE *cert; int ret; + p11_parser_formats (test.parser, p11_parser_format_x509, NULL); ret = p11_parse_file (test.parser, SRCDIR "/files/cacert3.der", P11_PARSE_FLAG_ANCHOR); assert_num_eq (P11_PARSE_SUCCESS, ret); @@ -373,6 +379,7 @@ test_parse_thawte (void) { CKA_INVALID }, }; + p11_parser_formats (test.parser, p11_parser_format_pem, NULL); ret = p11_parse_file (test.parser, SRCDIR "/files/thawte.pem", P11_PARSE_FLAG_NONE); assert_num_eq (P11_PARSE_SUCCESS, ret); @@ -393,6 +400,7 @@ test_parse_invalid_file (void) p11_message_quiet (); + p11_parser_formats (test.parser, p11_parser_format_x509, NULL); ret = p11_parse_file (test.parser, "/nonexistant", P11_PARSE_FLAG_NONE); assert_num_eq (P11_PARSE_FAILURE, ret); @@ -407,6 +415,7 @@ test_parse_unrecognized (void) p11_message_quiet (); + p11_parser_formats (test.parser, p11_parser_format_x509, NULL); ret = p11_parse_file (test.parser, SRCDIR "/files/unrecognized-file.txt", P11_PARSE_FLAG_NONE); assert_num_eq (P11_PARSE_UNRECOGNIZED, ret); @@ -423,6 +432,7 @@ test_parse_no_asn1_cache (void) parser = p11_parser_new (NULL); assert_ptr_not_null (parser); + p11_parser_formats (parser, p11_parser_format_x509, NULL); ret = p11_parse_file (parser, SRCDIR "/files/cacert3.der", P11_PARSE_FLAG_NONE); assert_num_eq (P11_PARSE_SUCCESS, ret); |