Go to the documentation of this file.
69 #include "../internal.h"
70 #include "../x509/internal.h"
73 #define V1_ROOT (EXFLAG_V1|EXFLAG_SS)
74 #define ku_reject(x, usage) \
75 (((x)->ex_flags & EXFLAG_KUSAGE) && !((x)->ex_kusage & (usage)))
76 #define xku_reject(x, usage) \
77 (((x)->ex_flags & EXFLAG_XKUSAGE) && !((x)->ex_xkusage & (usage)))
78 #define ns_reject(x, usage) \
79 (((x)->ex_flags & EXFLAG_NSCERT) && !((x)->ex_nscert & (usage)))
111 (
char *)
"nssslserver", NULL},
113 (
char *)
"S/MIME signing", (
char *)
"smimesign", NULL},
116 (
char *)
"smimeencrypt", NULL},
118 (
char *)
"CRL signing", (
char *)
"crlsign", NULL},
120 (
char *)
"any", NULL},
122 (
char *)
"OCSP helper", (
char *)
"ocsphelper", NULL},
125 (
char *)
"timestampsign", NULL},
128 #define X509_PURPOSE_COUNT (sizeof(xstandard)/sizeof(X509_PURPOSE))
134 return (*a)->purpose - (*b)->purpose;
191 if (!strcmp(xptmp->
sname, sname))
204 tmp.purpose = purpose;
208 sk_X509_PURPOSE_sort(xptable);
209 if (!sk_X509_PURPOSE_find(xptable, &
idx, &
tmp))
216 char *
name,
char *sname,
void *
arg)
220 char *name_dup, *sname_dup;
243 if (name_dup == NULL || sname_dup == NULL) {
245 if (name_dup != NULL)
247 if (sname_dup != NULL)
260 ptmp->
name = name_dup;
261 ptmp->
sname = sname_dup;
274 if (!xptable && !(xptable = sk_X509_PURPOSE_new(
xp_cmp))) {
279 if (!sk_X509_PURPOSE_push(xptable, ptmp)) {
330 static int nid_cmp(
const void *void_a,
const void *void_b)
332 const int *
a = void_a, *
b = void_b;
347 static const int supported_nids[] = {
367 (&ex_nid, supported_nids,
sizeof(supported_nids) /
sizeof(
int),
387 for (
i = 0;
i < sk_GENERAL_NAME_num(dp->
CRLissuer);
i++) {
404 if (
x->crldp == NULL && j != -1) {
407 for (
size_t i = 0;
i < sk_DIST_POINT_num(
x->crldp);
i++) {
408 if (!
setup_dp(
x, sk_DIST_POINT_value(
x->crldp,
i))) {
421 EXTENDED_KEY_USAGE *extusage;
466 }
else if (j != -1) {
479 x->ex_pcpathlen = -1;
482 }
else if (j != -1) {
487 if (
usage->length > 0) {
488 x->ex_kusage =
usage->data[0];
489 if (
usage->length > 1)
490 x->ex_kusage |=
usage->data[1] << 8;
495 }
else if (j != -1) {
501 for (
i = 0;
i < sk_ASN1_OBJECT_num(extusage);
i++) {
502 switch (
OBJ_obj2nid(sk_ASN1_OBJECT_value(extusage,
i))) {
542 }
else if (j != -1) {
548 x->ex_nscert =
ns->data[0];
553 }
else if (j != -1) {
557 if (
x->skid == NULL && j != -1) {
561 if (
x->akid == NULL && j != -1) {
573 if (
x->altname == NULL && j != -1) {
577 if (
x->nc == NULL && j != -1) {
648 (KU_DIGITAL_SIGNATURE|KU_KEY_ENCIPHERMENT|KU_KEY_AGREEMENT)
849 for (
i = 0;
i < sk_GENERAL_NAME_num(gens);
i++) {
850 gen = sk_GENERAL_NAME_value(gens,
i);
886 return x->ex_xkusage;
#define NID_policy_mappings
#define ASN1_OCTET_STRING_cmp
#define X509_get_subject_name
ASN1_INTEGER * pcPathLengthConstraint
#define X509_PURPOSE_SSL_CLIENT
int X509_PURPOSE_set(int *p, int purpose)
static int purpose_smime(const X509 *x, int ca)
#define ns_reject(x, usage)
#define X509_V_ERR_AKID_SKID_MISMATCH
#define NID_issuer_alt_name
static int check_purpose_smime_sign(const X509_PURPOSE *xp, const X509 *x, int ca)
void X509_PURPOSE_cleanup(void)
uint32_t X509_get_key_usage(X509 *x)
#define NID_anyExtendedKeyUsage
X509_NAME * directoryName
GENERAL_NAMES * CRLissuer
const ASN1_INTEGER * X509_get0_authority_serial(X509 *x509)
static STACK_OF(X509_PURPOSE)
#define X509_TRUST_SSL_SERVER
static int nid_cmp(const void *void_a, const void *void_b)
#define X509_PURPOSE_SMIME_SIGN
#define OPENSSL_PUT_ERROR(library, reason)
#define NID_authority_key_identifier
#define CRYPTO_MUTEX_unlock_read
#define X509_TRUST_DEFAULT
#define PROXY_CERT_INFO_EXTENSION_free
char * X509_PURPOSE_get0_name(const X509_PURPOSE *xp)
static X509_PURPOSE xstandard[]
static int setup_crldp(X509 *x)
int X509_check_akid(X509 *issuer, AUTHORITY_KEYID *akid)
OPENSSL_EXPORT X509_EXTENSION * ex
static int check_purpose_smime_encrypt(const X509_PURPOSE *xp, const X509 *x, int ca)
#define X509_PURPOSE_DYNAMIC_NAME
#define X509_V_ERR_KEYUSAGE_NO_CERTSIGN
#define X509_V_ERR_UNSPECIFIED
int(* check_purpose)(const struct x509_purpose_st *, const X509 *, int)
const ASN1_OCTET_STRING * X509_get0_authority_key_id(X509 *x509)
int X509_PURPOSE_get_count(void)
#define NID_name_constraints
#define X509_get_issuer_name
static int check_purpose_crl_sign(const X509_PURPOSE *xp, const X509 *x, int ca)
#define X509_get_ext_count
#define NID_subject_key_identifier
#define NID_crl_distribution_points
#define X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH
static int check_purpose_ssl_client(const X509_PURPOSE *xp, const X509 *x, int ca)
#define X509_EXTENSION_get_object
#define X509_PURPOSE_NS_SSL_SERVER
#define X509_PURPOSE_SSL_SERVER
#define KU_KEY_ENCIPHERMENT
uint32_t X509_get_extended_key_usage(X509 *x)
#define X509_V_ERR_SUBJECT_ISSUER_MISMATCH
#define NID_email_protect
static int no_check(const X509_PURPOSE *xp, const X509 *x, int ca)
#define ku_reject(x, usage)
#define NID_inhibit_any_policy
int x509v3_cache_extensions(X509 *x)
int X509_check_purpose(X509 *x, int id, int ca)
char * X509_PURPOSE_get0_sname(const X509_PURPOSE *xp)
const GENERAL_NAMES * X509_get0_authority_issuer(X509 *x509)
static int check_ca(const X509 *x)
DIST_POINT_NAME * distpoint
OPENSSL_EXPORT GENERAL_NAME * gen
static int xp_cmp(const X509_PURPOSE **a, const X509_PURPOSE **b)
static int check_purpose_ssl_server(const X509_PURPOSE *xp, const X509 *x, int ca)
static int ocsp_helper(const X509_PURPOSE *xp, const X509 *x, int ca)
int X509_check_issued(X509 *issuer, X509 *subject)
int X509_PURPOSE_get_trust(const X509_PURPOSE *xp)
#define CRYPTO_MUTEX_lock_read
X509_PURPOSE * X509_PURPOSE_get0(int idx)
#define X509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE
ASN1_BIT_STRING * reasons
#define NID_policy_constraints
uint32_t X509_get_extension_flags(X509 *x)
#define CRLDP_ALL_REASONS
#define X509_PURPOSE_COUNT
union GENERAL_NAME_st::@370 d
#define X509_PURPOSE_OCSP_HELPER
#define X509_PURPOSE_CRL_SIGN
int X509_check_ca(X509 *x)
UniquePtr< SSL_SESSION > ret
#define X509V3_R_INVALID_PURPOSE
int X509_supported_extension(X509_EXTENSION *ex)
#define NID_ext_key_usage
#define CRYPTO_MUTEX_lock_write
static int check_purpose_ns_ssl_server(const X509_PURPOSE *xp, const X509 *x, int ca)
#define BASIC_CONSTRAINTS_free
int X509_PURPOSE_get_id(const X509_PURPOSE *xp)
ASN1_OCTET_STRING * keyid
static void xptable_free(X509_PURPOSE *p)
const OPENSSL_EXPORT EVP_MD * EVP_sha1(void)
static int check_purpose_timestamp_sign(const X509_PURPOSE *xp, const X509 *x, int ca)
#define NID_subject_alt_name
#define KU_DIGITAL_SIGNATURE
int X509_PURPOSE_get_by_id(int purpose)
int X509_PURPOSE_add(int id, int trust, int flags, int(*ck)(const X509_PURPOSE *, const X509 *, int), char *name, char *sname, void *arg)
const ASN1_OCTET_STRING * X509_get0_subject_key_id(X509 *x509)
#define X509_get_serialNumber
#define X509_PURPOSE_TIMESTAMP_SIGN
#define X509_PURPOSE_DYNAMIC
#define NID_proxyCertInfo
#define X509_PURPOSE_SMIME_ENCRYPT
#define NID_netscape_cert_type
OPENSSL_EXPORT void ASN1_BIT_STRING_free(ASN1_BIT_STRING *str)
#define DIST_POINT_set_dpname
static int setup_dp(X509 *x, DIST_POINT *dp)
#define X509_TRUST_COMPAT
#define X509_TRUST_SSL_CLIENT
#define X509_EXTENSION_get_critical
#define NID_certificate_policies
#define CRYPTO_MUTEX_unlock_write
#define V_ASN1_NEG_INTEGER
long X509_get_pathlen(X509 *x509)
#define NID_basic_constraints
#define ERR_R_MALLOC_FAILURE
#define xku_reject(x, usage)
#define KU_NON_REPUDIATION
int X509_PURPOSE_get_by_sname(char *sname)
#define X509_get_ext_by_NID
grpc
Author(s):
autogenerated on Fri May 16 2025 03:00:50