From a904e98b78b55e7a6213356225e45a04fdc457e1 Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Mon, 18 Mar 2013 13:13:24 +0100 Subject: Refine looking up of attributes in arrays There was a class of bugs for looking up invalid or empty attributes in the internal PKCS#11 attribute arrays. * Refine what p11_attrs_find_valid() treats as valid * Rename p11_attrs_is_empty() to p11_attrs_terminator() for clarity --- tools/tests/test-extract.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'tools/tests') diff --git a/tools/tests/test-extract.c b/tools/tests/test-extract.c index c7382cd..29ee986 100644 --- a/tools/tests/test-extract.c +++ b/tools/tests/test-extract.c @@ -218,7 +218,8 @@ static CK_ATTRIBUTE extension_eku_invalid[] = { static void test_info_simple_certificate (CuTest *tc) { - CK_ATTRIBUTE *value; + void *value; + size_t length; CK_RV rv; setup (tc); @@ -237,9 +238,9 @@ test_info_simple_certificate (CuTest *tc) CuAssertIntEquals (tc, CKO_CERTIFICATE, test.ex.klass); CuAssertPtrNotNull (tc, test.ex.attrs); - value = p11_attrs_find_valid (test.ex.attrs, CKA_VALUE); + value = p11_attrs_find_value (test.ex.attrs, CKA_VALUE, &length); CuAssertPtrNotNull (tc, value); - CuAssertTrue (tc, memcmp (value->pValue, test_cacert3_ca_der, value->ulValueLen) == 0); + CuAssertTrue (tc, memcmp (value, test_cacert3_ca_der, length) == 0); CuAssertPtrNotNull (tc, test.ex.cert_der); CuAssertTrue (tc, memcmp (test.ex.cert_der, test_cacert3_ca_der, test.ex.cert_len) == 0); CuAssertPtrNotNull (tc, test.ex.cert_asn); -- cgit v1.1