Lines Matching full:name
17 void x509_free_name(struct x509_name *name) in x509_free_name() argument
21 for (i = 0; i < name->num_attr; i++) { in x509_free_name()
22 os_free(name->attr[i].value); in x509_free_name()
23 name->attr[i].value = NULL; in x509_free_name()
24 name->attr[i].type = X509_NAME_ATTR_NOT_USED; in x509_free_name()
26 name->num_attr = 0; in x509_free_name()
27 os_free(name->email); in x509_free_name()
28 name->email = NULL; in x509_free_name()
30 os_free(name->alt_email); in x509_free_name()
31 os_free(name->dns); in x509_free_name()
32 os_free(name->uri); in x509_free_name()
33 os_free(name->ip); in x509_free_name()
34 name->alt_email = name->dns = name->uri = NULL; in x509_free_name()
35 name->ip = NULL; in x509_free_name()
36 name->ip_len = 0; in x509_free_name()
37 os_memset(&name->rid, 0, sizeof(name->rid)); in x509_free_name()
143 * @a: Certificate name
144 * @b: Certificate name
285 int x509_parse_name(const u8 *buf, size_t len, struct x509_name *name, in x509_parse_name() argument
294 * Name ::= CHOICE { RDNSequence } in x509_parse_name()
307 "X509: Expected SEQUENCE (Name / RDNSequencer)"); in x509_parse_name()
324 x509_free_name(name); in x509_parse_name()
335 x509_free_name(name); in x509_parse_name()
343 x509_free_name(name); in x509_parse_name()
351 x509_free_name(name); in x509_parse_name()
364 * distinguished name qualifier, state or province name, in x509_parse_name()
365 * common name, serial number. in x509_parse_name()
366 * SHOULD: locality, title, surname, given name, initials, in x509_parse_name()
406 os_free(name->email); in x509_parse_name()
407 name->email = os_malloc(hdr.length + 1); in x509_parse_name()
408 if (name->email == NULL) { in x509_parse_name()
409 x509_free_name(name); in x509_parse_name()
412 os_memcpy(name->email, hdr.payload, hdr.length); in x509_parse_name()
413 name->email[hdr.length] = '\0'; in x509_parse_name()
433 if (name->num_attr == X509_MAX_NAME_ATTRIBUTES) { in x509_parse_name()
434 wpa_printf(MSG_INFO, "X509: Too many Name attributes"); in x509_parse_name()
435 x509_free_name(name); in x509_parse_name()
441 x509_free_name(name); in x509_parse_name()
449 x509_free_name(name); in x509_parse_name()
453 name->attr[name->num_attr].type = type; in x509_parse_name()
454 name->attr[name->num_attr].value = val; in x509_parse_name()
455 name->num_attr++; in x509_parse_name()
487 * x509_name_string - Convert an X.509 certificate name into a string
488 * @name: Name to convert
492 void x509_name_string(struct x509_name *name, char *buf, size_t len) in x509_name_string() argument
504 for (i = 0; i < name->num_attr; i++) { in x509_name_string()
506 x509_name_attr_str(name->attr[i].type), in x509_name_string()
507 name->attr[i].value); in x509_name_string()
520 if (name->email) { in x509_name_string()
522 name->email); in x509_name_string()
877 static int x509_parse_alt_name_rfc8222(struct x509_name *name, in x509_parse_alt_name_rfc8222() argument
882 os_free(name->alt_email); in x509_parse_alt_name_rfc8222()
883 name->alt_email = os_zalloc(len + 1); in x509_parse_alt_name_rfc8222()
884 if (name->alt_email == NULL) in x509_parse_alt_name_rfc8222()
886 os_memcpy(name->alt_email, pos, len); in x509_parse_alt_name_rfc8222()
887 if (os_strlen(name->alt_email) != len) { in x509_parse_alt_name_rfc8222()
890 name->alt_email); in x509_parse_alt_name_rfc8222()
891 os_free(name->alt_email); in x509_parse_alt_name_rfc8222()
892 name->alt_email = NULL; in x509_parse_alt_name_rfc8222()
899 static int x509_parse_alt_name_dns(struct x509_name *name, in x509_parse_alt_name_dns() argument
904 os_free(name->dns); in x509_parse_alt_name_dns()
905 name->dns = os_zalloc(len + 1); in x509_parse_alt_name_dns()
906 if (name->dns == NULL) in x509_parse_alt_name_dns()
908 os_memcpy(name->dns, pos, len); in x509_parse_alt_name_dns()
909 if (os_strlen(name->dns) != len) { in x509_parse_alt_name_dns()
912 name->dns); in x509_parse_alt_name_dns()
913 os_free(name->dns); in x509_parse_alt_name_dns()
914 name->dns = NULL; in x509_parse_alt_name_dns()
921 static int x509_parse_alt_name_uri(struct x509_name *name, in x509_parse_alt_name_uri() argument
928 os_free(name->uri); in x509_parse_alt_name_uri()
929 name->uri = os_zalloc(len + 1); in x509_parse_alt_name_uri()
930 if (name->uri == NULL) in x509_parse_alt_name_uri()
932 os_memcpy(name->uri, pos, len); in x509_parse_alt_name_uri()
933 if (os_strlen(name->uri) != len) { in x509_parse_alt_name_uri()
936 "(%s[NUL])", name->uri); in x509_parse_alt_name_uri()
937 os_free(name->uri); in x509_parse_alt_name_uri()
938 name->uri = NULL; in x509_parse_alt_name_uri()
945 static int x509_parse_alt_name_ip(struct x509_name *name, in x509_parse_alt_name_ip() argument
950 os_free(name->ip); in x509_parse_alt_name_ip()
951 name->ip = os_memdup(pos, len); in x509_parse_alt_name_ip()
952 if (name->ip == NULL) in x509_parse_alt_name_ip()
954 name->ip_len = len; in x509_parse_alt_name_ip()
959 static int x509_parse_alt_name_rid(struct x509_name *name, in x509_parse_alt_name_rid() argument
965 if (asn1_parse_oid(pos, len, &name->rid) < 0) in x509_parse_alt_name_rid()
968 asn1_oid_to_str(&name->rid, buf, sizeof(buf)); in x509_parse_alt_name_rid()
975 static int x509_parse_ext_alt_name(struct x509_name *name, in x509_parse_ext_alt_name() argument
989 * directoryName [4] Name, in x509_parse_ext_alt_name()
1018 res = x509_parse_alt_name_rfc8222(name, hdr.payload, in x509_parse_ext_alt_name()
1022 res = x509_parse_alt_name_dns(name, hdr.payload, in x509_parse_ext_alt_name()
1026 res = x509_parse_alt_name_uri(name, hdr.payload, in x509_parse_ext_alt_name()
1030 res = x509_parse_alt_name_ip(name, hdr.payload, in x509_parse_ext_alt_name()
1034 res = x509_parse_alt_name_rid(name, hdr.payload, in x509_parse_ext_alt_name()
1336 * name constraints (section 4.2.1.11) in x509_parse_extension_data()
1546 /* issuer Name */ in x509_parse_tbs_certificate()
1556 /* subject Name */ in x509_parse_tbs_certificate()
2181 "chain issuer name mismatch"); in x509_certificate_chain_validate()
2267 * x509_certificate_get_subject - Get a certificate based on Subject name
2269 * @name: Subject name to search for
2270 * Returns: Pointer to the certificate with the given Subject name or
2275 struct x509_name *name) in x509_certificate_get_subject() argument
2280 if (x509_name_compare(&cert->subject, name) == 0) in x509_certificate_get_subject()