diff options
author | tb <> | 2024-03-25 01:48:50 +0000 |
---|---|---|
committer | tb <> | 2024-03-25 01:48:50 +0000 |
commit | bd7f79673992e1777668d3a9418cc5ddcfe54290 (patch) | |
tree | d78c1085b8689dc261d253442082595ae5ea7ad1 | |
parent | 21bac5f71fbe0b73178f8c5bd627fdfa570a5822 (diff) | |
download | openbsd-bd7f79673992e1777668d3a9418cc5ddcfe54290.tar.gz openbsd-bd7f79673992e1777668d3a9418cc5ddcfe54290.tar.bz2 openbsd-bd7f79673992e1777668d3a9418cc5ddcfe54290.zip |
Const correct the trust handlers
The certificates no longer need to be modified since we cache the
extensions up front.
ok beck
-rw-r--r-- | src/lib/libcrypto/x509/x509_trs.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/lib/libcrypto/x509/x509_trs.c b/src/lib/libcrypto/x509/x509_trs.c index 1cec0760f2..091340641b 100644 --- a/src/lib/libcrypto/x509/x509_trs.c +++ b/src/lib/libcrypto/x509/x509_trs.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: x509_trs.c,v 1.50 2024/03/25 01:00:02 tb Exp $ */ | 1 | /* $OpenBSD: x509_trs.c,v 1.51 2024/03/25 01:48:50 tb Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 1999. | 3 | * project 1999. |
4 | */ | 4 | */ |
@@ -69,17 +69,16 @@ | |||
69 | #include "x509_local.h" | 69 | #include "x509_local.h" |
70 | 70 | ||
71 | typedef struct x509_trust_st { | 71 | typedef struct x509_trust_st { |
72 | int trust; | 72 | int (*check_trust)(int, const X509 *); |
73 | int (*check_trust)(int, X509 *); | ||
74 | int nid; | 73 | int nid; |
75 | } X509_TRUST; | 74 | } X509_TRUST; |
76 | 75 | ||
77 | static int | 76 | static int |
78 | obj_trust(int id, X509 *x) | 77 | obj_trust(int id, const X509 *x) |
79 | { | 78 | { |
80 | ASN1_OBJECT *obj; | 79 | ASN1_OBJECT *obj; |
81 | int i, nid; | 80 | int i, nid; |
82 | X509_CERT_AUX *aux; | 81 | const X509_CERT_AUX *aux; |
83 | 82 | ||
84 | if ((aux = x->aux) == NULL) | 83 | if ((aux = x->aux) == NULL) |
85 | return X509_TRUST_UNTRUSTED; | 84 | return X509_TRUST_UNTRUSTED; |
@@ -102,7 +101,7 @@ obj_trust(int id, X509 *x) | |||
102 | } | 101 | } |
103 | 102 | ||
104 | static int | 103 | static int |
105 | trust_compat(int nid, X509 *x) | 104 | trust_compat(int nid, const X509 *x) |
106 | { | 105 | { |
107 | /* Extensions already cached in X509_check_trust(). */ | 106 | /* Extensions already cached in X509_check_trust(). */ |
108 | if (x->ex_flags & EXFLAG_SS) | 107 | if (x->ex_flags & EXFLAG_SS) |
@@ -112,7 +111,7 @@ trust_compat(int nid, X509 *x) | |||
112 | } | 111 | } |
113 | 112 | ||
114 | static int | 113 | static int |
115 | trust_1oidany(int nid, X509 *x) | 114 | trust_1oidany(int nid, const X509 *x) |
116 | { | 115 | { |
117 | if (x->aux && (x->aux->trust || x->aux->reject)) | 116 | if (x->aux && (x->aux->trust || x->aux->reject)) |
118 | return obj_trust(nid, x); | 117 | return obj_trust(nid, x); |
@@ -123,7 +122,7 @@ trust_1oidany(int nid, X509 *x) | |||
123 | } | 122 | } |
124 | 123 | ||
125 | static int | 124 | static int |
126 | trust_1oid(int nid, X509 *x) | 125 | trust_1oid(int nid, const X509 *x) |
127 | { | 126 | { |
128 | if (x->aux) | 127 | if (x->aux) |
129 | return obj_trust(nid, x); | 128 | return obj_trust(nid, x); |