Go to the documentation of this file.
68 #include "../internal.h"
69 #include "../x509/internal.h"
127 for (
i = 0;
i < sk_CONF_VALUE_num(nval);
i++) {
128 val = sk_CONF_VALUE_value(nval,
i);
129 if (!strncmp(val->
name,
"permitted", 9) && val->
name[9]) {
130 ptree = &ncons->permittedSubtrees;
132 }
else if (!strncmp(val->
name,
"excluded", 8) && val->
name[8]) {
133 ptree = &ncons->excludedSubtrees;
144 *ptree = sk_GENERAL_SUBTREE_new_null();
145 if (!*ptree || !sk_GENERAL_SUBTREE_push(*ptree, sub))
168 bp,
ind,
"Permitted");
170 bp,
ind,
"Excluded");
180 if (sk_GENERAL_SUBTREE_num(trees) > 0)
182 for (
i = 0;
i < sk_GENERAL_SUBTREE_num(trees);
i++) {
183 tree = sk_GENERAL_SUBTREE_value(trees,
i);
203 p[0],
p[1],
p[2],
p[3],
p[4],
p[5],
p[6],
p[7]);
204 }
else if (
len == 32) {
205 for (
i = 0;
i < 16;
i++) {
245 size_t constraint_count = sk_GENERAL_SUBTREE_num(nc->permittedSubtrees) +
246 sk_GENERAL_SUBTREE_num(nc->excludedSubtrees);
247 size_t check_count = constraint_count * name_count;
249 constraint_count < sk_GENERAL_SUBTREE_num(nc->permittedSubtrees) ||
250 (constraint_count && check_count / constraint_count != name_count) ||
251 check_count > 1 << 20) {
287 for (j = 0;
j < sk_GENERAL_NAME_num(
x->altname);
j++) {
309 for (
i = 0;
i < sk_GENERAL_SUBTREE_num(nc->permittedSubtrees);
i++) {
310 sub = sk_GENERAL_SUBTREE_value(nc->permittedSubtrees,
i);
332 for (
i = 0;
i < sk_GENERAL_SUBTREE_num(nc->excludedSubtrees);
i++) {
333 sub = sk_GENERAL_SUBTREE_value(nc->excludedSubtrees,
i);
353 switch (
base->type) {
365 base->d.uniformResourceIdentifier);
414 static int has_suffix_case(
const CBS *
a,
const CBS *
b)
426 CBS dns_cbs, base_cbs;
438 if (has_suffix_case(&dns_cbs, &base_cbs)) {
467 CBS eml_cbs, base_cbs;
474 CBS eml_local, base_local;
482 if (has_suffix_case(&eml_cbs, &base_cbs)) {
492 if (
CBS_len(&base_local) > 0) {
516 CBS uri_cbs, base_cbs;
525 !
CBS_get_u8(&uri_cbs, &
byte) ||
byte !=
'/' ||
526 !
CBS_get_u8(&uri_cbs, &
byte) ||
byte !=
'/') {
546 if (has_suffix_case(&host, &base_cbs)) {
#define NID_pkcs9_emailAddress
#define v2i_GENERAL_NAME_ex
#define X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE
#define X509_get_subject_name
static int OPENSSL_memcmp(const void *s1, const void *s2, size_t n)
static int nc_match_single(GENERAL_NAME *sub, GENERAL_NAME *gen)
#define X509_NAME_entry_count
static int do_i2r_name_constraints(const X509V3_EXT_METHOD *method, STACK_OF(GENERAL_SUBTREE) *trees, BIO *bp, int ind, const char *name)
X509_NAME * directoryName
static int nc_uri(ASN1_IA5STRING *uri, ASN1_IA5STRING *base)
ASN1_IA5STRING * uniformResourceIdentifier
static int equal_case(const unsigned char *pattern, size_t pattern_len, const unsigned char *subject, size_t subject_len, unsigned int flags)
const X509V3_EXT_METHOD v3_name_constraints
#define OPENSSL_PUT_ERROR(library, reason)
unsigned char match[65280+2]
static int copy(grpc_slice_buffer *input, grpc_slice_buffer *output)
#define X509_V_ERR_UNSUPPORTED_NAME_SYNTAX
#define X509_V_ERR_SUBTREE_MINMAX
#define ASN1_ITEM_ref(name)
#define X509_NAME_get_index_by_NID
#define NAME_CONSTRAINTS_free
#define CBS_get_until_first
#define X509_V_ERR_UNSPECIFIED
#define NID_name_constraints
static int nc_dn(X509_NAME *sub, X509_NAME *nm)
#define X509_NAME_get_entry
#define X509_V_ERR_PERMITTED_VIOLATION
#define GENERAL_NAME_print
ASN1_IA5STRING * rfc822Name
#define X509_V_ERR_OUT_OF_MEM
unsigned char * canon_enc
#define X509_NAME_ENTRY_get_data
#define ASN1_SEQUENCE(tname)
OPENSSL_EXPORT GENERAL_NAME * gen
#define ASN1_IMP_OPT(stname, field, type, tag)
OPENSSL_EXPORT int NAME_CONSTRAINTS_check(X509 *x, NAME_CONSTRAINTS *nc)
#define GENERAL_SUBTREE_free
ASN1_SEQUENCE_END(X509_NAME_ENTRY)
static void * v2i_NAME_CONSTRAINTS(const X509V3_EXT_METHOD *method, X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval)
#define ASN1_IMP_SEQUENCE_OF_OPT(stname, field, type, tag)
#define X509V3_R_INVALID_SYNTAX
static int nc_email(ASN1_IA5STRING *sub, ASN1_IA5STRING *eml)
union GENERAL_NAME_st::@370 d
static int i2r_NAME_CONSTRAINTS(const X509V3_EXT_METHOD *method, void *a, BIO *bp, int ind)
static int nc_dns(ASN1_IA5STRING *sub, ASN1_IA5STRING *dns)
static bool starts_with(const char *s, const char *prefix)
#define IMPLEMENT_ASN1_ALLOC_FUNCTIONS(stname)
#define X509_V_ERR_EXCLUDED_VIOLATION
#define NAME_CONSTRAINTS_new
#define GENERAL_SUBTREE_new
static int print_nc_ipadd(BIO *bp, ASN1_OCTET_STRING *ip)
static int nc_match(GENERAL_NAME *gen, NAME_CONSTRAINTS *nc)
#define ERR_R_MALLOC_FAILURE
#define ASN1_SIMPLE(stname, field, type)
grpc
Author(s):
autogenerated on Fri May 16 2025 03:00:50