64 static void x509v3_cache_extensions(
X509 *x);
66 static int check_ssl_ca(
const X509 *x);
67 static int check_purpose_ssl_client(
const X509_PURPOSE *xp,
const X509 *x,
int ca);
68 static int check_purpose_ssl_server(
const X509_PURPOSE *xp,
const X509 *x,
int ca);
69 static int check_purpose_ns_ssl_server(
const X509_PURPOSE *xp,
const X509 *x,
int ca);
70 static int purpose_smime(
const X509 *x,
int ca);
71 static int check_purpose_smime_sign(
const X509_PURPOSE *xp,
const X509 *x,
int ca);
72 static int check_purpose_smime_encrypt(
const X509_PURPOSE *xp,
const X509 *x,
int ca);
73 static int check_purpose_crl_sign(
const X509_PURPOSE *xp,
const X509 *x,
int ca);
74 static int check_purpose_timestamp_sign(
const X509_PURPOSE *xp,
const X509 *x,
int ca);
94 #define X509_PURPOSE_COUNT (sizeof(xstandard)/sizeof(X509_PURPOSE))
103 return (*a)->purpose - (*b)->purpose;
115 x509v3_cache_extensions(x);
118 if(
id == -1)
return 1;
120 if(idx == -1)
return -1;
143 if(idx < 0)
return NULL;
154 if(!strcmp(xptmp->
sname, sname))
return i;
166 if(!xptable)
return -1;
168 if(idx == -1)
return -1;
174 char *name,
char *sname,
void *
arg)
270 static int nid_cmp(
const int *
a,
const int *
b)
288 static const int supported_nids[] = {
295 #ifndef OPENSSL_NO_RFC3779
311 if (OBJ_bsearch_nid(&ex_nid, supported_nids,
312 sizeof(supported_nids)/
sizeof(
int)))
349 static void setup_crldp(
X509 *x)
357 static void x509v3_cache_extensions(
X509 *x)
363 EXTENDED_KEY_USAGE *extusage;
368 #ifndef OPENSSL_NO_SHA
386 BASIC_CONSTRAINTS_free(bs);
400 PROXY_CERT_INFO_EXTENSION_free(pci);
411 ASN1_BIT_STRING_free(usage);
459 ASN1_BIT_STRING_free(ns);
465 if (!x->
nc && (i != -1))
469 #ifndef OPENSSL_NO_RFC3779
500 #define V1_ROOT (EXFLAG_V1|EXFLAG_SS)
501 #define ku_reject(x, usage) \
502 (((x)->ex_flags & EXFLAG_KUSAGE) && !((x)->ex_kusage & (usage)))
503 #define xku_reject(x, usage) \
504 (((x)->ex_flags & EXFLAG_XKUSAGE) && !((x)->ex_xkusage & (usage)))
505 #define ns_reject(x, usage) \
506 (((x)->ex_flags & EXFLAG_NSCERT) && !((x)->ex_nscert & (usage)))
508 static int check_ca(
const X509 *x)
533 x509v3_cache_extensions(x);
541 static int check_ssl_ca(
const X509 *x)
544 ca_ret = check_ca(x);
545 if(!ca_ret)
return 0;
552 static int check_purpose_ssl_client(
const X509_PURPOSE *xp,
const X509 *x,
int ca)
555 if(ca)
return check_ssl_ca(x);
563 static int check_purpose_ssl_server(
const X509_PURPOSE *xp,
const X509 *x,
int ca)
566 if(ca)
return check_ssl_ca(x);
576 static int check_purpose_ns_ssl_server(
const X509_PURPOSE *xp,
const X509 *x,
int ca)
579 ret = check_purpose_ssl_server(xp, x, ca);
580 if(!ret || ca)
return ret;
587 static int purpose_smime(
const X509 *x,
int ca)
592 ca_ret = check_ca(x);
593 if(!ca_ret)
return 0;
607 static int check_purpose_smime_sign(
const X509_PURPOSE *xp,
const X509 *x,
int ca)
610 ret = purpose_smime(x, ca);
611 if(!ret || ca)
return ret;
616 static int check_purpose_smime_encrypt(
const X509_PURPOSE *xp,
const X509 *x,
int ca)
619 ret = purpose_smime(x, ca);
620 if(!ret || ca)
return ret;
625 static int check_purpose_crl_sign(
const X509_PURPOSE *xp,
const X509 *x,
int ca)
629 if((ca_ret = check_ca(x)) != 2)
return ca_ret;
644 if(ca)
return check_ca(x);
649 static int check_purpose_timestamp_sign(
const X509_PURPOSE *xp,
const X509 *x,
655 if (ca)
return check_ca(x);
706 x509v3_cache_extensions(issuer);
707 x509v3_cache_extensions(subject);