Skip to content

Commit be73e93

Browse files
committed
cert_parse_pre: bring order in switch closer to RFC 6487, 4.8
ok claudio
1 parent 0400daa commit be73e93

File tree

1 file changed

+29
-29
lines changed

1 file changed

+29
-29
lines changed

usr.sbin/rpki-client/cert.c

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: cert.c,v 1.159 2025/06/04 09:18:28 claudio Exp $ */
1+
/* $OpenBSD: cert.c,v 1.160 2025/06/19 05:20:37 tb Exp $ */
22
/*
33
* Copyright (c) 2022 Theo Buehler <[email protected]>
44
* Copyright (c) 2021 Job Snijders <[email protected]>
@@ -881,6 +881,34 @@ cert_parse_pre(const char *fn, const unsigned char *der, size_t len)
881881
assert(obj != NULL);
882882

883883
switch (nid = OBJ_obj2nid(obj)) {
884+
case NID_basic_constraints:
885+
if (bc++ > 0)
886+
goto dup;
887+
break;
888+
case NID_subject_key_identifier:
889+
if (ski++ > 0)
890+
goto dup;
891+
break;
892+
case NID_authority_key_identifier:
893+
if (aki++ > 0)
894+
goto dup;
895+
break;
896+
case NID_key_usage:
897+
if (ku++ > 0)
898+
goto dup;
899+
break;
900+
case NID_ext_key_usage:
901+
if (eku++ > 0)
902+
goto dup;
903+
break;
904+
case NID_crl_distribution_points:
905+
if (crldp++ > 0)
906+
goto dup;
907+
break;
908+
case NID_info_access:
909+
if (aia++ > 0)
910+
goto dup;
911+
break;
884912
case NID_sbgp_ipAddrBlock:
885913
if (ip++ > 0)
886914
goto dup;
@@ -909,34 +937,6 @@ cert_parse_pre(const char *fn, const unsigned char *der, size_t len)
909937
if (!certificate_policies(fn, cert, ext))
910938
goto out;
911939
break;
912-
case NID_crl_distribution_points:
913-
if (crldp++ > 0)
914-
goto dup;
915-
break;
916-
case NID_info_access:
917-
if (aia++ > 0)
918-
goto dup;
919-
break;
920-
case NID_authority_key_identifier:
921-
if (aki++ > 0)
922-
goto dup;
923-
break;
924-
case NID_subject_key_identifier:
925-
if (ski++ > 0)
926-
goto dup;
927-
break;
928-
case NID_ext_key_usage:
929-
if (eku++ > 0)
930-
goto dup;
931-
break;
932-
case NID_basic_constraints:
933-
if (bc++ > 0)
934-
goto dup;
935-
break;
936-
case NID_key_usage:
937-
if (ku++ > 0)
938-
goto dup;
939-
break;
940940
default:
941941
/* unexpected extensions warrant investigation */
942942
{

0 commit comments

Comments
 (0)