Lines Matching full:name
18 static void x509_free_name(struct x509_name *name) in x509_free_name() argument
22 for (i = 0; i < name->num_attr; i++) { in x509_free_name()
23 os_free(name->attr[i].value); in x509_free_name()
24 name->attr[i].value = NULL; in x509_free_name()
25 name->attr[i].type = X509_NAME_ATTR_NOT_USED; in x509_free_name()
27 name->num_attr = 0; in x509_free_name()
28 os_free(name->email); in x509_free_name()
29 name->email = NULL; in x509_free_name()
31 os_free(name->alt_email); in x509_free_name()
32 os_free(name->dns); in x509_free_name()
33 os_free(name->uri); in x509_free_name()
34 os_free(name->ip); in x509_free_name()
35 name->alt_email = name->dns = name->uri = NULL; in x509_free_name()
36 name->ip = NULL; in x509_free_name()
37 name->ip_len = 0; in x509_free_name()
38 os_memset(&name->rid, 0, sizeof(name->rid)); in x509_free_name()
143 * @a: Certificate name
144 * @b: Certificate name
293 static int x509_parse_name(const u8 *buf, size_t len, struct x509_name *name, in x509_parse_name() argument
302 * Name ::= CHOICE { RDNSequence } in x509_parse_name()
317 "(Name / RDNSequencer) - found class %d tag 0x%x", in x509_parse_name()
337 x509_free_name(name); in x509_parse_name()
350 x509_free_name(name); in x509_parse_name()
358 x509_free_name(name); in x509_parse_name()
366 x509_free_name(name); in x509_parse_name()
372 * distinguished name qualifier, state or province name, in x509_parse_name()
373 * common name, serial number. in x509_parse_name()
374 * SHOULD: locality, title, surname, given name, initials, in x509_parse_name()
414 os_free(name->email); in x509_parse_name()
415 name->email = os_malloc(hdr.length + 1); in x509_parse_name()
416 if (name->email == NULL) { in x509_parse_name()
417 x509_free_name(name); in x509_parse_name()
420 os_memcpy(name->email, hdr.payload, hdr.length); in x509_parse_name()
421 name->email[hdr.length] = '\0'; in x509_parse_name()
441 if (name->num_attr == X509_MAX_NAME_ATTRIBUTES) { in x509_parse_name()
442 wpa_printf(MSG_INFO, "X509: Too many Name attributes"); in x509_parse_name()
443 x509_free_name(name); in x509_parse_name()
449 x509_free_name(name); in x509_parse_name()
457 x509_free_name(name); in x509_parse_name()
461 name->attr[name->num_attr].type = type; in x509_parse_name()
462 name->attr[name->num_attr].value = val; in x509_parse_name()
463 name->num_attr++; in x509_parse_name()
528 * x509_name_string - Convert an X.509 certificate name into a string
529 * @name: Name to convert
533 void x509_name_string(struct x509_name *name, char *buf, size_t len) in x509_name_string() argument
545 for (i = 0; i < name->num_attr; i++) { in x509_name_string()
547 x509_name_attr_str(name->attr[i].type), in x509_name_string()
548 name->attr[i].value); in x509_name_string()
561 if (name->email) { in x509_name_string()
563 name->email); in x509_name_string()
777 static int x509_parse_alt_name_rfc8222(struct x509_name *name, in x509_parse_alt_name_rfc8222() argument
782 os_free(name->alt_email); in x509_parse_alt_name_rfc8222()
783 name->alt_email = (char *)os_zalloc(len + 1); in x509_parse_alt_name_rfc8222()
784 if (name->alt_email == NULL) in x509_parse_alt_name_rfc8222()
786 os_memcpy(name->alt_email, pos, len); in x509_parse_alt_name_rfc8222()
787 if (os_strlen(name->alt_email) != len) { in x509_parse_alt_name_rfc8222()
790 name->alt_email); in x509_parse_alt_name_rfc8222()
791 os_free(name->alt_email); in x509_parse_alt_name_rfc8222()
792 name->alt_email = NULL; in x509_parse_alt_name_rfc8222()
799 static int x509_parse_alt_name_dns(struct x509_name *name, in x509_parse_alt_name_dns() argument
804 os_free(name->dns); in x509_parse_alt_name_dns()
805 name->dns = (char *)os_zalloc(len + 1); in x509_parse_alt_name_dns()
806 if (name->dns == NULL) in x509_parse_alt_name_dns()
808 os_memcpy(name->dns, pos, len); in x509_parse_alt_name_dns()
809 if (os_strlen(name->dns) != len) { in x509_parse_alt_name_dns()
812 name->dns); in x509_parse_alt_name_dns()
813 os_free(name->dns); in x509_parse_alt_name_dns()
814 name->dns = NULL; in x509_parse_alt_name_dns()
821 static int x509_parse_alt_name_uri(struct x509_name *name, in x509_parse_alt_name_uri() argument
828 os_free(name->uri); in x509_parse_alt_name_uri()
829 name->uri = (char *)os_zalloc(len + 1); in x509_parse_alt_name_uri()
830 if (name->uri == NULL) in x509_parse_alt_name_uri()
832 os_memcpy(name->uri, pos, len); in x509_parse_alt_name_uri()
833 if (os_strlen(name->uri) != len) { in x509_parse_alt_name_uri()
836 "(%s[NUL])", name->uri); in x509_parse_alt_name_uri()
837 os_free(name->uri); in x509_parse_alt_name_uri()
838 name->uri = NULL; in x509_parse_alt_name_uri()
845 static int x509_parse_alt_name_ip(struct x509_name *name, in x509_parse_alt_name_ip() argument
850 os_free(name->ip); in x509_parse_alt_name_ip()
851 name->ip = os_malloc(len); in x509_parse_alt_name_ip()
852 if (name->ip == NULL) in x509_parse_alt_name_ip()
854 os_memcpy(name->ip, pos, len); in x509_parse_alt_name_ip()
855 name->ip_len = len; in x509_parse_alt_name_ip()
860 static int x509_parse_alt_name_rid(struct x509_name *name, in x509_parse_alt_name_rid() argument
866 if (asn1_parse_oid(pos, len, &name->rid) < 0) in x509_parse_alt_name_rid()
869 asn1_oid_to_str(&name->rid, buf, sizeof(buf)); in x509_parse_alt_name_rid()
876 static int x509_parse_ext_alt_name(struct x509_name *name, in x509_parse_ext_alt_name() argument
890 * directoryName [4] Name, in x509_parse_ext_alt_name()
919 res = x509_parse_alt_name_rfc8222(name, hdr.payload, in x509_parse_ext_alt_name()
923 res = x509_parse_alt_name_dns(name, hdr.payload, in x509_parse_ext_alt_name()
927 res = x509_parse_alt_name_uri(name, hdr.payload, in x509_parse_ext_alt_name()
931 res = x509_parse_alt_name_ip(name, hdr.payload, in x509_parse_ext_alt_name()
935 res = x509_parse_alt_name_rid(name, hdr.payload, in x509_parse_ext_alt_name()
1017 * name constraints (section 4.2.1.11) in x509_parse_extension_data()
1242 /* issuer Name */ in x509_parse_tbs_certificate()
1252 /* subject Name */ in x509_parse_tbs_certificate()
1853 "chain issuer name mismatch"); in x509_certificate_chain_validate()
1938 * x509_certificate_get_subject - Get a certificate based on Subject name
1940 * @name: Subject name to search for
1941 * Returns: Pointer to the certificate with the given Subject name or
1946 struct x509_name *name) in x509_certificate_get_subject() argument
1951 if (x509_name_compare(&cert->subject, name) == 0) in x509_certificate_get_subject()