summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortb <>2024-03-25 01:48:50 +0000
committertb <>2024-03-25 01:48:50 +0000
commitbd7f79673992e1777668d3a9418cc5ddcfe54290 (patch)
treed78c1085b8689dc261d253442082595ae5ea7ad1
parent21bac5f71fbe0b73178f8c5bd627fdfa570a5822 (diff)
downloadopenbsd-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.c15
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
71typedef struct x509_trust_st { 71typedef 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
77static int 76static int
78obj_trust(int id, X509 *x) 77obj_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
104static int 103static int
105trust_compat(int nid, X509 *x) 104trust_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
114static int 113static int
115trust_1oidany(int nid, X509 *x) 114trust_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
125static int 124static int
126trust_1oid(int nid, X509 *x) 125trust_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);