summaryrefslogtreecommitdiffstats
path: root/src/tests/x509_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/x509_test.c')
-rw-r--r--src/tests/x509_test.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/tests/x509_test.c b/src/tests/x509_test.c
index 658d5247c..256c3e85e 100644
--- a/src/tests/x509_test.c
+++ b/src/tests/x509_test.c
@@ -674,6 +674,7 @@ static struct x509_chain empty_store = {
/** Root certificate list containing the iPXE self-test root CA */
static struct x509_root test_root = {
+ .refcnt = REF_INIT ( ref_no_free ),
.digest = &x509_test_algorithm,
.count = 1,
.fingerprints = root_crt_fingerprint,
@@ -681,6 +682,7 @@ static struct x509_root test_root = {
/** Root certificate list containing the iPXE self-test intermediate CA */
static struct x509_root intermediate_root = {
+ .refcnt = REF_INIT ( ref_no_free ),
.digest = &x509_test_algorithm,
.count = 1,
.fingerprints = intermediate_crt_fingerprint,
@@ -695,6 +697,7 @@ static uint8_t dummy_fingerprint[] =
/** Certificate store containing a dummy fingerprint */
static struct x509_root dummy_root = {
+ .refcnt = REF_INIT ( ref_no_free ),
.digest = &x509_test_algorithm,
.count = 1,
.fingerprints = dummy_fingerprint,
@@ -943,6 +946,10 @@ static void x509_validate_chain_okx ( struct x509_test_chain *chn, time_t time,
x509_invalidate_chain ( chn->chain );
okx ( x509_validate_chain ( chn->chain, time, store, root ) == 0,
file, line );
+ okx ( x509_is_valid ( chn->certs[0]->cert, root ),
+ file, line );
+ okx ( ! x509_is_valid ( chn->certs[0]->cert, &dummy_root ),
+ file, line );
}
#define x509_validate_chain_ok( chn, time, store, root ) \
x509_validate_chain_okx ( chn, time, store, root, __FILE__, __LINE__ )