diff options
author | Stef Walter <stefw@gnome.org> | 2012-12-17 16:05:36 +0100 |
---|---|---|
committer | Stef Walter <stefw@gnome.org> | 2013-02-05 14:54:53 +0100 |
commit | 75654253498993ff1638e0e64440c335b54df1db (patch) | |
tree | 79b1dc525ed0f46becbfc1092f11971e0f456f31 /trust/tests | |
parent | c2dcd0b3cb1ccac4eff98044d43d3f8696094644 (diff) |
Add the builtin roots NSS specific object
This tells NSS that this is a source of anchors.
Diffstat (limited to 'trust/tests')
-rw-r--r-- | trust/tests/test-module.c | 27 | ||||
-rw-r--r-- | trust/tests/test-token.c | 6 |
2 files changed, 30 insertions, 3 deletions
diff --git a/trust/tests/test-module.c b/trust/tests/test-module.c index 8bd8e10..64857a7 100644 --- a/trust/tests/test-module.c +++ b/trust/tests/test-module.c @@ -306,6 +306,32 @@ test_find_certificates (CuTest *cu) teardown (cu); } +static void +test_find_builtin (CuTest *cu) +{ + CK_OBJECT_CLASS klass = CKO_NETSCAPE_BUILTIN_ROOT_LIST; + CK_BBOOL vtrue = CK_TRUE; + CK_BBOOL vfalse = CK_FALSE; + + CK_ATTRIBUTE match[] = { + { CKA_CLASS, &klass, sizeof (klass) }, + { CKA_TOKEN, &vtrue, sizeof (vtrue) }, + { CKA_PRIVATE, &vfalse, sizeof (vfalse) }, + { CKA_MODIFIABLE, &vfalse, sizeof (vfalse) }, + { CKA_INVALID, } + }; + + CK_OBJECT_HANDLE objects[16]; + CK_ULONG count; + + setup (cu); + + count = find_objects (cu, match, objects, 16); + CuAssertIntEquals (cu, 1, count); + + teardown (cu); +} + int main (void) { @@ -318,6 +344,7 @@ main (void) /* p11_message_quiet (); */ SUITE_ADD_TEST (suite, test_find_certificates); + SUITE_ADD_TEST (suite, test_find_builtin); CuSuiteRun (suite); CuSuiteSummary (suite, output); diff --git a/trust/tests/test-token.c b/trust/tests/test-token.c index 1d9228a..8a5b34d 100644 --- a/trust/tests/test-token.c +++ b/trust/tests/test-token.c @@ -72,11 +72,11 @@ test_token_load (CuTest *cu) setup (cu); count = p11_token_load (test.token); - CuAssertIntEquals (cu, 4, count); + CuAssertIntEquals (cu, 5, count); - /* A certificate and trust object for each parsed object */ + /* A certificate and trust object for each parsed object + builtin */ objects = p11_token_objects (test.token); - CuAssertIntEquals (cu, count * 2, p11_dict_size (objects)); + CuAssertIntEquals (cu, ((count - 1) * 2) + 1, p11_dict_size (objects)); teardown (cu); } |