static int tr_cmp(const X509_TRUST *const *a, const X509_TRUST *const *b);
static void trtable_free(X509_TRUST *p);
-static int trust_1oidany(X509_TRUST *trust, X509 *x, int flags);
-static int trust_1oid(X509_TRUST *trust, X509 *x, int flags);
-static int trust_compat(X509_TRUST *trust, X509 *x, int flags);
+static int trust_1oidany(X509_TRUST *trust, const X509 *x, int flags);
+static int trust_1oid(X509_TRUST *trust, const X509 *x, int flags);
+static int trust_compat(X509_TRUST *trust, const X509 *x, int flags);
-static int obj_trust(int id, X509 *x, int flags);
-static int (*default_trust)(int id, X509 *x, int flags) = obj_trust;
+static int obj_trust(int id, const X509 *x, int flags);
+static int (*default_trust)(int id, const X509 *x, int flags) = obj_trust;
/*
* WARNING: the following table should be kept in order of trust and without
return (*a)->trust - (*b)->trust;
}
-int (*X509_TRUST_set_default(int (*trust)(int, X509 *, int)))(int, X509 *,
+int (*X509_TRUST_set_default(int (*trust)(int, const X509 *, int)))(int, const X509 *,
int)
{
- int (*oldtrust)(int, X509 *, int);
+ int (*oldtrust)(int, const X509 *, int);
oldtrust = default_trust;
default_trust = trust;
return oldtrust;
}
/* Returns X509_TRUST_TRUSTED, X509_TRUST_REJECTED, or X509_TRUST_UNTRUSTED */
-int X509_check_trust(X509 *x, int id, int flags)
+int X509_check_trust(const X509 *x, int id, int flags)
{
X509_TRUST *pt;
int idx;
return 1;
}
-int X509_TRUST_add(int id, int flags, int (*ck)(X509_TRUST *, X509 *, int),
+int X509_TRUST_add(int id, int flags, int (*ck)(X509_TRUST *, const X509 *, int),
const char *name, int arg1, void *arg2)
{
int idx;
return xp->trust;
}
-static int trust_1oidany(X509_TRUST *trust, X509 *x, int flags)
+static int trust_1oidany(X509_TRUST *trust, const X509 *x, int flags)
{
/*
* Declare the chain verified if the desired trust OID is not rejected in
return obj_trust(trust->arg1, x, flags);
}
-static int trust_1oid(X509_TRUST *trust, X509 *x, int flags)
+static int trust_1oid(X509_TRUST *trust, const X509 *x, int flags)
{
/*
* Declare the chain verified only if the desired trust OID is not
return obj_trust(trust->arg1, x, flags);
}
-static int trust_compat(X509_TRUST *trust, X509 *x, int flags)
+static int trust_compat(X509_TRUST *trust, const X509 *x, int flags)
{
/* Call for side-effect of setting EXFLAG_SS for self-signed-certs */
if (X509_check_purpose(x, -1, 0) != 1)
* If |flags| includes X509_TRUST_OK_ANY_EKU then anyEKU serves as wildcard.
* Return X509_TRUST_UNTRUSTED if no clear decision has been reached here.
*/
-static int obj_trust(int id, X509 *x, int flags)
+static int obj_trust(int id, const X509 *x, int flags)
{
X509_CERT_AUX *ax = x->aux;
int i;
typedef struct x509_trust_st {
int trust;
int flags;
- int (*check_trust)(struct x509_trust_st *, X509 *, int);
+ int (*check_trust)(struct x509_trust_st *, const X509 *, int);
char *name;
int arg1;
void *arg2;
int X509_TRUST_get_count(void);
X509_TRUST *X509_TRUST_get0(int idx);
int X509_TRUST_get_by_id(int id);
-int X509_TRUST_add(int id, int flags, int (*ck)(X509_TRUST *, X509 *, int),
+int X509_TRUST_add(int id, int flags, int (*ck)(X509_TRUST *, const X509 *, int),
const char *name, int arg1, void *arg2);
void X509_TRUST_cleanup(void);
int X509_TRUST_get_flags(const X509_TRUST *xp);
STACK_OF(ASN1_OBJECT) *X509_get0_trust_objects(const X509 *x);
STACK_OF(ASN1_OBJECT) *X509_get0_reject_objects(const X509 *x);
-int (*X509_TRUST_set_default(int (*trust)(int, X509 *, int)))(int, X509 *,
+int (*X509_TRUST_set_default(int (*trust)(int, const X509 *, int)))(int, const X509 *,
int);
-int X509_check_trust(X509 *x, int id, int flags);
+int X509_check_trust(const X509 *x, int id, int flags);
int X509_verify_cert(X509_STORE_CTX *ctx);
int X509_STORE_CTX_verify(X509_STORE_CTX *ctx);