summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbeck <>2023-04-27 13:26:57 +0000
committerbeck <>2023-04-27 13:26:57 +0000
commit4e5e98b34b1ce8cb8f681aa2a03006c82f8751fb (patch)
tree78f938018c1e47ca95bb350ea8088a5f3cfd21b3 /src
parent7b678b64a90656d9c04739ffc2f8c85b2ea90eb0 (diff)
downloadopenbsd-4e5e98b34b1ce8cb8f681aa2a03006c82f8751fb.tar.gz
openbsd-4e5e98b34b1ce8cb8f681aa2a03006c82f8751fb.tar.bz2
openbsd-4e5e98b34b1ce8cb8f681aa2a03006c82f8751fb.zip
correct test cases to add expected errors.
Diffstat (limited to 'src')
-rw-r--r--src/regress/lib/libcrypto/x509/policy/policy.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/src/regress/lib/libcrypto/x509/policy/policy.c b/src/regress/lib/libcrypto/x509/policy/policy.c
index c2f96599e6..593f43bed1 100644
--- a/src/regress/lib/libcrypto/x509/policy/policy.c
+++ b/src/regress/lib/libcrypto/x509/policy/policy.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: policy.c,v 1.1 2023/04/27 12:23:31 beck Exp $ */ 1/* $OpenBSD: policy.c,v 1.2 2023/04/27 13:26:57 beck Exp $ */
2/* 2/*
3 * Copyright (c) 2020 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2020 Joel Sing <jsing@openbsd.org>
4 * Copyright (c) 2020-2021 Bob Beck <beck@openbsd.org> 4 * Copyright (c) 2020-2021 Bob Beck <beck@openbsd.org>
@@ -309,8 +309,12 @@ struct verify_cert_test verify_cert_tests[] = {
309 .root_file = CERTSDIR "/" "policy_root.pem", 309 .root_file = CERTSDIR "/" "policy_root.pem",
310 .intermediate_file = CERTSDIR "/" "policy_intermediate.pem", 310 .intermediate_file = CERTSDIR "/" "policy_intermediate.pem",
311 .leaf_file = CERTSDIR "/" "policy_leaf.pem", 311 .leaf_file = CERTSDIR "/" "policy_leaf.pem",
312 .policy_oid_to_check = OID2, 312 .policy_oid_to_check = OID3,
313 .want_chains = 0, 313 .want_chains = 0,
314 .want_error = X509_V_ERR_NO_EXPLICIT_POLICY,
315 .want_error_depth = 0,
316 .want_legacy_error = X509_V_ERR_NO_EXPLICIT_POLICY,
317 .want_legacy_error_depth = 0,
314 }, 318 },
315 { 319 {
316 .id = "1 and 2, in 1 and 2", 320 .id = "1 and 2, in 1 and 2",
@@ -338,6 +342,10 @@ struct verify_cert_test verify_cert_tests[] = {
338 .leaf_file = CERTSDIR "/" "policy_leaf.pem", 342 .leaf_file = CERTSDIR "/" "policy_leaf.pem",
339 .policy_oid_to_check = OID1, 343 .policy_oid_to_check = OID1,
340 .want_chains = 0, 344 .want_chains = 0,
345 .want_error = X509_V_ERR_INVALID_POLICY_EXTENSION,
346 .want_error_depth = 0,
347 .want_legacy_error = X509_V_ERR_INVALID_POLICY_EXTENSION,
348 .want_legacy_error_depth = 0,
341 }, 349 },
342 { 350 {
343 .id = "invalid intermediate", 351 .id = "invalid intermediate",
@@ -345,6 +353,10 @@ struct verify_cert_test verify_cert_tests[] = {
345 .intermediate_file = CERTSDIR "/" "policy_intermediate_invalid.pem", 353 .intermediate_file = CERTSDIR "/" "policy_intermediate_invalid.pem",
346 .leaf_file = CERTSDIR "/" "policy_leaf.pem", 354 .leaf_file = CERTSDIR "/" "policy_leaf.pem",
347 .want_chains = 0, 355 .want_chains = 0,
356 .want_error = X509_V_ERR_INVALID_POLICY_EXTENSION,
357 .want_error_depth = 0,
358 .want_legacy_error = X509_V_ERR_INVALID_POLICY_EXTENSION,
359 .want_legacy_error_depth = 0,
348 }, 360 },
349 { 361 {
350 .id = "1 in invalid policy in leaf", 362 .id = "1 in invalid policy in leaf",
@@ -353,6 +365,10 @@ struct verify_cert_test verify_cert_tests[] = {
353 .leaf_file = CERTSDIR "/" "policy_leaf_invalid.pem", 365 .leaf_file = CERTSDIR "/" "policy_leaf_invalid.pem",
354 .policy_oid_to_check = OID1, 366 .policy_oid_to_check = OID1,
355 .want_chains = 0, 367 .want_chains = 0,
368 .want_error = X509_V_ERR_INVALID_POLICY_EXTENSION,
369 .want_error_depth = 0,
370 .want_legacy_error = X509_V_ERR_INVALID_POLICY_EXTENSION,
371 .want_legacy_error_depth = 0,
356 }, 372 },
357 { 373 {
358 .id = "invalid leaf", 374 .id = "invalid leaf",
@@ -360,6 +376,10 @@ struct verify_cert_test verify_cert_tests[] = {
360 .intermediate_file = CERTSDIR "/" "policy_intermediate.pem", 376 .intermediate_file = CERTSDIR "/" "policy_intermediate.pem",
361 .leaf_file = CERTSDIR "/" "policy_leaf_invalid.pem", 377 .leaf_file = CERTSDIR "/" "policy_leaf_invalid.pem",
362 .want_chains = 0, 378 .want_chains = 0,
379 .want_error = X509_V_ERR_INVALID_POLICY_EXTENSION,
380 .want_error_depth = 0,
381 .want_legacy_error = X509_V_ERR_INVALID_POLICY_EXTENSION,
382 .want_legacy_error_depth = 0,
363 }, 383 },
364 // There is a duplicate policy in the leaf policy extension. 384 // There is a duplicate policy in the leaf policy extension.
365 { 385 {
@@ -369,6 +389,10 @@ struct verify_cert_test verify_cert_tests[] = {
369 .leaf_file = CERTSDIR "/" "policy_leaf_duplicate.pem", 389 .leaf_file = CERTSDIR "/" "policy_leaf_duplicate.pem",
370 .policy_oid_to_check = OID1, 390 .policy_oid_to_check = OID1,
371 .want_chains = 0, 391 .want_chains = 0,
392 .want_error = X509_V_ERR_INVALID_POLICY_EXTENSION,
393 .want_error_depth = 0,
394 .want_legacy_error = X509_V_ERR_INVALID_POLICY_EXTENSION,
395 .want_legacy_error_depth = 0,
372 }, 396 },
373 // There is a duplicate policy in the intermediate policy extension. 397 // There is a duplicate policy in the intermediate policy extension.
374 { 398 {
@@ -378,6 +402,10 @@ struct verify_cert_test verify_cert_tests[] = {
378 .leaf_file = CERTSDIR "/" "policy_leaf.pem", 402 .leaf_file = CERTSDIR "/" "policy_leaf.pem",
379 .policy_oid_to_check = OID1, 403 .policy_oid_to_check = OID1,
380 .want_chains = 0, 404 .want_chains = 0,
405 .want_error = X509_V_ERR_INVALID_POLICY_EXTENSION,
406 .want_error_depth = 0,
407 .want_legacy_error = X509_V_ERR_INVALID_POLICY_EXTENSION,
408 .want_legacy_error_depth = 0,
381 }, 409 },
382}; 410};
383 411