diff options
author | Theo Buehler <tb@cvs.openbsd.org> | 2024-03-24 08:03:30 +0000 |
---|---|---|
committer | Theo Buehler <tb@cvs.openbsd.org> | 2024-03-24 08:03:30 +0000 |
commit | ad1c0769d98e973db15cd120d32310679efbc5eb (patch) | |
tree | 3db7bd141cd6c1ec6c82d7b7c9d5b21763b59c7a | |
parent | 847405658a6ffe451bf96be70fa70d4a018948bd (diff) |
Drop redundant NULL checks around two for loops
ok beck
-rw-r--r-- | lib/libcrypto/x509/x509_trs.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/lib/libcrypto/x509/x509_trs.c b/lib/libcrypto/x509/x509_trs.c index 73f24682f65..6fb818a76e1 100644 --- a/lib/libcrypto/x509/x509_trs.c +++ b/lib/libcrypto/x509/x509_trs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x509_trs.c,v 1.46 2024/03/24 01:24:26 tb Exp $ */ +/* $OpenBSD: x509_trs.c,v 1.47 2024/03/24 08:03:29 tb Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 1999. */ @@ -83,22 +83,21 @@ obj_trust(int id, X509 *x) ax = x->aux; if (!ax) return X509_TRUST_UNTRUSTED; - if (ax->reject) { - for (i = 0; i < sk_ASN1_OBJECT_num(ax->reject); i++) { - obj = sk_ASN1_OBJECT_value(ax->reject, i); - nid = OBJ_obj2nid(obj); - if (nid == id || nid == NID_anyExtendedKeyUsage) - return X509_TRUST_REJECTED; - } + + for (i = 0; i < sk_ASN1_OBJECT_num(ax->reject); i++) { + obj = sk_ASN1_OBJECT_value(ax->reject, i); + nid = OBJ_obj2nid(obj); + if (nid == id || nid == NID_anyExtendedKeyUsage) + return X509_TRUST_REJECTED; } - if (ax->trust) { - for (i = 0; i < sk_ASN1_OBJECT_num(ax->trust); i++) { - obj = sk_ASN1_OBJECT_value(ax->trust, i); - nid = OBJ_obj2nid(obj); - if (nid == id || nid == NID_anyExtendedKeyUsage) - return X509_TRUST_TRUSTED; - } + + for (i = 0; i < sk_ASN1_OBJECT_num(ax->trust); i++) { + obj = sk_ASN1_OBJECT_value(ax->trust, i); + nid = OBJ_obj2nid(obj); + if (nid == id || nid == NID_anyExtendedKeyUsage) + return X509_TRUST_TRUSTED; } + return X509_TRUST_UNTRUSTED; } |