From 3c488e141c422575ee81b7b73c80795290158c96 Mon Sep 17 00:00:00 2001 From: tb <> Date: Sat, 30 Jul 2022 17:50:17 +0000 Subject: Untangle two logic chains in x509_asid.c into something more readable. ok jsing --- src/lib/libcrypto/x509/x509_asid.c | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/lib/libcrypto/x509/x509_asid.c b/src/lib/libcrypto/x509/x509_asid.c index 37c38d9b68..6c73018b8d 100644 --- a/src/lib/libcrypto/x509/x509_asid.c +++ b/src/lib/libcrypto/x509/x509_asid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x509_asid.c,v 1.34 2022/05/12 20:00:06 tb Exp $ */ +/* $OpenBSD: x509_asid.c,v 1.35 2022/07/30 17:50:17 tb Exp $ */ /* * Contributed to the OpenSSL Project by the American Registry for * Internet Numbers ("ARIN"). @@ -753,9 +753,13 @@ ASIdentifierChoice_canonize(ASIdentifierChoice *choice) int X509v3_asid_canonize(ASIdentifiers *asid) { - return (asid == NULL || - (ASIdentifierChoice_canonize(asid->asnum) && - ASIdentifierChoice_canonize(asid->rdi))); + if (asid == NULL) + return 1; + + if (!ASIdentifierChoice_canonize(asid->asnum)) + return 0; + + return ASIdentifierChoice_canonize(asid->rdi); } /* @@ -900,11 +904,20 @@ const X509V3_EXT_METHOD v3_asid = { int X509v3_asid_inherits(ASIdentifiers *asid) { - return (asid != NULL && - ((asid->asnum != NULL && - asid->asnum->type == ASIdentifierChoice_inherit) || - (asid->rdi != NULL && - asid->rdi->type == ASIdentifierChoice_inherit))); + if (asid == NULL) + return 0; + + if (asid->asnum != NULL) { + if (asid->asnum->type == ASIdentifierChoice_inherit) + return 1; + } + + if (asid->rdi != NULL) { + if (asid->rdi->type == ASIdentifierChoice_inherit) + return 1; + } + + return 0; } /* -- cgit v1.2.3-55-g6feb