• Home
  • Raw
  • Download

Lines Matching refs:hdr

184 	struct asn1_hdr hdr;  in x509_parse_algorithm_identifier()  local
194 if (asn1_get_next(buf, len, &hdr) < 0 || in x509_parse_algorithm_identifier()
195 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_parse_algorithm_identifier()
196 hdr.tag != ASN1_TAG_SEQUENCE) { in x509_parse_algorithm_identifier()
199 hdr.class, hdr.tag); in x509_parse_algorithm_identifier()
202 pos = hdr.payload; in x509_parse_algorithm_identifier()
203 end = pos + hdr.length; in x509_parse_algorithm_identifier()
223 struct asn1_hdr hdr; in x509_parse_public_key() local
236 if (asn1_get_next(pos, end - pos, &hdr) < 0 || in x509_parse_public_key()
237 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_parse_public_key()
238 hdr.tag != ASN1_TAG_SEQUENCE) { in x509_parse_public_key()
241 hdr.class, hdr.tag); in x509_parse_public_key()
244 pos = hdr.payload; in x509_parse_public_key()
246 if (pos + hdr.length > end) in x509_parse_public_key()
248 end = pos + hdr.length; in x509_parse_public_key()
255 if (asn1_get_next(pos, end - pos, &hdr) < 0 || in x509_parse_public_key()
256 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_parse_public_key()
257 hdr.tag != ASN1_TAG_BITSTRING) { in x509_parse_public_key()
260 hdr.class, hdr.tag); in x509_parse_public_key()
263 if (hdr.length < 1) in x509_parse_public_key()
265 pos = hdr.payload; in x509_parse_public_key()
277 cert->public_key = os_malloc(hdr.length - 1); in x509_parse_public_key()
283 os_memcpy(cert->public_key, pos + 1, hdr.length - 1); in x509_parse_public_key()
284 cert->public_key_len = hdr.length - 1; in x509_parse_public_key()
295 struct asn1_hdr hdr; in x509_parse_name() local
312 if (asn1_get_next(buf, len, &hdr) < 0 || in x509_parse_name()
313 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_parse_name()
314 hdr.tag != ASN1_TAG_SEQUENCE) { in x509_parse_name()
317 hdr.class, hdr.tag); in x509_parse_name()
320 pos = hdr.payload; in x509_parse_name()
322 if (pos + hdr.length > buf + len) in x509_parse_name()
325 end = *next = pos + hdr.length; in x509_parse_name()
330 if (asn1_get_next(pos, end - pos, &hdr) < 0 || in x509_parse_name()
331 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_parse_name()
332 hdr.tag != ASN1_TAG_SET) { in x509_parse_name()
335 "%d tag 0x%x", hdr.class, hdr.tag); in x509_parse_name()
340 set_pos = hdr.payload; in x509_parse_name()
341 pos = set_end = hdr.payload + hdr.length; in x509_parse_name()
343 if (asn1_get_next(set_pos, set_end - set_pos, &hdr) < 0 || in x509_parse_name()
344 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_parse_name()
345 hdr.tag != ASN1_TAG_SEQUENCE) { in x509_parse_name()
348 "tag 0x%x", hdr.class, hdr.tag); in x509_parse_name()
353 seq_pos = hdr.payload; in x509_parse_name()
354 seq_end = hdr.payload + hdr.length; in x509_parse_name()
361 if (asn1_get_next(seq_pos, seq_end - seq_pos, &hdr) < 0 || in x509_parse_name()
362 hdr.class != ASN1_CLASS_UNIVERSAL) { in x509_parse_name()
414 name->email = os_malloc(hdr.length + 1); in x509_parse_name()
419 os_memcpy(name->email, hdr.payload, hdr.length); in x509_parse_name()
420 name->email[hdr.length] = '\0'; in x509_parse_name()
436 hdr.payload, hdr.length); in x509_parse_name()
446 val = os_malloc(hdr.length + 1); in x509_parse_name()
451 os_memcpy(val, hdr.payload, hdr.length); in x509_parse_name()
452 val[hdr.length] = '\0'; in x509_parse_name()
453 if (os_strlen(val) != hdr.length) { in x509_parse_name()
654 struct asn1_hdr hdr; in x509_parse_validity() local
670 if (asn1_get_next(buf, len, &hdr) < 0 || in x509_parse_validity()
671 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_parse_validity()
672 hdr.tag != ASN1_TAG_SEQUENCE) { in x509_parse_validity()
675 hdr.class, hdr.tag); in x509_parse_validity()
678 pos = hdr.payload; in x509_parse_validity()
679 plen = hdr.length; in x509_parse_validity()
686 if (asn1_get_next(pos, plen, &hdr) < 0 || in x509_parse_validity()
687 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_parse_validity()
688 x509_parse_time(hdr.payload, hdr.length, hdr.tag, in x509_parse_validity()
691 "Time", hdr.payload, hdr.length); in x509_parse_validity()
695 pos = hdr.payload + hdr.length; in x509_parse_validity()
698 if (asn1_get_next(pos, plen, &hdr) < 0 || in x509_parse_validity()
699 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_parse_validity()
700 x509_parse_time(hdr.payload, hdr.length, hdr.tag, in x509_parse_validity()
703 "Time", hdr.payload, hdr.length); in x509_parse_validity()
728 struct asn1_hdr hdr; in x509_parse_ext_key_usage() local
743 if (asn1_get_next(pos, len, &hdr) < 0 || in x509_parse_ext_key_usage()
744 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_parse_ext_key_usage()
745 hdr.tag != ASN1_TAG_BITSTRING || in x509_parse_ext_key_usage()
746 hdr.length < 1) { in x509_parse_ext_key_usage()
749 hdr.class, hdr.tag, hdr.length); in x509_parse_ext_key_usage()
754 cert->key_usage = asn1_bit_string_to_long(hdr.payload, hdr.length); in x509_parse_ext_key_usage()
765 struct asn1_hdr hdr; in x509_parse_ext_basic_constraints() local
775 if (asn1_get_next(pos, len, &hdr) < 0 || in x509_parse_ext_basic_constraints()
776 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_parse_ext_basic_constraints()
777 hdr.tag != ASN1_TAG_SEQUENCE) { in x509_parse_ext_basic_constraints()
780 hdr.class, hdr.tag); in x509_parse_ext_basic_constraints()
786 if (hdr.length == 0) in x509_parse_ext_basic_constraints()
789 if (asn1_get_next(hdr.payload, hdr.length, &hdr) < 0 || in x509_parse_ext_basic_constraints()
790 hdr.class != ASN1_CLASS_UNIVERSAL) { in x509_parse_ext_basic_constraints()
796 if (hdr.tag == ASN1_TAG_BOOLEAN) { in x509_parse_ext_basic_constraints()
797 if (hdr.length != 1) { in x509_parse_ext_basic_constraints()
800 hdr.length); in x509_parse_ext_basic_constraints()
803 cert->ca = hdr.payload[0]; in x509_parse_ext_basic_constraints()
805 if (hdr.payload + hdr.length == pos + len) { in x509_parse_ext_basic_constraints()
811 if (asn1_get_next(hdr.payload + hdr.length, len - hdr.length, in x509_parse_ext_basic_constraints()
812 &hdr) < 0 || in x509_parse_ext_basic_constraints()
813 hdr.class != ASN1_CLASS_UNIVERSAL) { in x509_parse_ext_basic_constraints()
820 if (hdr.tag != ASN1_TAG_INTEGER) { in x509_parse_ext_basic_constraints()
823 hdr.class, hdr.tag); in x509_parse_ext_basic_constraints()
827 pos = hdr.payload; in x509_parse_ext_basic_constraints()
828 left = hdr.length; in x509_parse_ext_basic_constraints()
949 struct asn1_hdr hdr; in x509_parse_ext_alt_name() local
975 for (p = pos, end = pos + len; p < end; p = hdr.payload + hdr.length) { in x509_parse_ext_alt_name()
978 if (asn1_get_next(p, end - p, &hdr) < 0) { in x509_parse_ext_alt_name()
984 if (hdr.class != ASN1_CLASS_CONTEXT_SPECIFIC) in x509_parse_ext_alt_name()
987 switch (hdr.tag) { in x509_parse_ext_alt_name()
989 res = x509_parse_alt_name_rfc8222(name, hdr.payload, in x509_parse_ext_alt_name()
990 hdr.length); in x509_parse_ext_alt_name()
993 res = x509_parse_alt_name_dns(name, hdr.payload, in x509_parse_ext_alt_name()
994 hdr.length); in x509_parse_ext_alt_name()
997 res = x509_parse_alt_name_uri(name, hdr.payload, in x509_parse_ext_alt_name()
998 hdr.length); in x509_parse_ext_alt_name()
1001 res = x509_parse_alt_name_ip(name, hdr.payload, in x509_parse_ext_alt_name()
1002 hdr.length); in x509_parse_ext_alt_name()
1005 res = x509_parse_alt_name_rid(name, hdr.payload, in x509_parse_ext_alt_name()
1006 hdr.length); in x509_parse_ext_alt_name()
1027 struct asn1_hdr hdr; in x509_parse_ext_subject_alt_name() local
1031 if (asn1_get_next(pos, len, &hdr) < 0 || in x509_parse_ext_subject_alt_name()
1032 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_parse_ext_subject_alt_name()
1033 hdr.tag != ASN1_TAG_SEQUENCE) { in x509_parse_ext_subject_alt_name()
1036 hdr.class, hdr.tag); in x509_parse_ext_subject_alt_name()
1043 if (hdr.length == 0) in x509_parse_ext_subject_alt_name()
1046 return x509_parse_ext_alt_name(&cert->subject, hdr.payload, in x509_parse_ext_subject_alt_name()
1047 hdr.length); in x509_parse_ext_subject_alt_name()
1054 struct asn1_hdr hdr; in x509_parse_ext_issuer_alt_name() local
1058 if (asn1_get_next(pos, len, &hdr) < 0 || in x509_parse_ext_issuer_alt_name()
1059 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_parse_ext_issuer_alt_name()
1060 hdr.tag != ASN1_TAG_SEQUENCE) { in x509_parse_ext_issuer_alt_name()
1063 hdr.class, hdr.tag); in x509_parse_ext_issuer_alt_name()
1070 if (hdr.length == 0) in x509_parse_ext_issuer_alt_name()
1073 return x509_parse_ext_alt_name(&cert->issuer, hdr.payload, in x509_parse_ext_issuer_alt_name()
1074 hdr.length); in x509_parse_ext_issuer_alt_name()
1111 struct asn1_hdr hdr; in x509_parse_extension() local
1124 if (asn1_get_next(pos, len, &hdr) < 0 || in x509_parse_extension()
1125 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_parse_extension()
1126 hdr.tag != ASN1_TAG_SEQUENCE) { in x509_parse_extension()
1129 hdr.class, hdr.tag); in x509_parse_extension()
1132 pos = hdr.payload; in x509_parse_extension()
1133 *next = end = pos + hdr.length; in x509_parse_extension()
1141 if (asn1_get_next(pos, end - pos, &hdr) < 0 || in x509_parse_extension()
1142 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_parse_extension()
1143 (hdr.tag != ASN1_TAG_BOOLEAN && in x509_parse_extension()
1144 hdr.tag != ASN1_TAG_OCTETSTRING)) { in x509_parse_extension()
1147 "or OCTET STRING", hdr.class, hdr.tag); in x509_parse_extension()
1151 if (hdr.tag == ASN1_TAG_BOOLEAN) { in x509_parse_extension()
1152 if (hdr.length != 1) { in x509_parse_extension()
1154 "Boolean length (%u)", hdr.length); in x509_parse_extension()
1157 critical_ext = hdr.payload[0]; in x509_parse_extension()
1158 pos = hdr.payload; in x509_parse_extension()
1159 if (asn1_get_next(pos, end - pos, &hdr) < 0 || in x509_parse_extension()
1160 (hdr.class != ASN1_CLASS_UNIVERSAL && in x509_parse_extension()
1161 hdr.class != ASN1_CLASS_PRIVATE) || in x509_parse_extension()
1162 hdr.tag != ASN1_TAG_OCTETSTRING) { in x509_parse_extension()
1166 hdr.class, hdr.tag); in x509_parse_extension()
1174 wpa_hexdump(MSG_MSGDUMP, "X509: extnValue", hdr.payload, hdr.length); in x509_parse_extension()
1176 res = x509_parse_extension_data(cert, &oid, hdr.payload, hdr.length); in x509_parse_extension()
1193 struct asn1_hdr hdr; in x509_parse_extensions() local
1197 if (asn1_get_next(pos, len, &hdr) < 0 || in x509_parse_extensions()
1198 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_parse_extensions()
1199 hdr.tag != ASN1_TAG_SEQUENCE) { in x509_parse_extensions()
1202 "expected SEQUENCE", hdr.class, hdr.tag); in x509_parse_extensions()
1206 pos = hdr.payload; in x509_parse_extensions()
1207 end = pos + hdr.length; in x509_parse_extensions()
1223 struct asn1_hdr hdr; in x509_parse_tbs_certificate() local
1230 if (asn1_get_next(buf, len, &hdr) < 0 || in x509_parse_tbs_certificate()
1231 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_parse_tbs_certificate()
1232 hdr.tag != ASN1_TAG_SEQUENCE) { in x509_parse_tbs_certificate()
1235 hdr.class, hdr.tag); in x509_parse_tbs_certificate()
1238 pos = hdr.payload; in x509_parse_tbs_certificate()
1239 end = *next = pos + hdr.length; in x509_parse_tbs_certificate()
1245 if (asn1_get_next(pos, end - pos, &hdr) < 0) in x509_parse_tbs_certificate()
1247 pos = hdr.payload; in x509_parse_tbs_certificate()
1249 if (hdr.class == ASN1_CLASS_CONTEXT_SPECIFIC) { in x509_parse_tbs_certificate()
1250 if (asn1_get_next(pos, end - pos, &hdr) < 0) in x509_parse_tbs_certificate()
1253 if (hdr.class != ASN1_CLASS_UNIVERSAL || in x509_parse_tbs_certificate()
1254 hdr.tag != ASN1_TAG_INTEGER) { in x509_parse_tbs_certificate()
1257 hdr.class, hdr.tag); in x509_parse_tbs_certificate()
1260 if (hdr.length != 1) { in x509_parse_tbs_certificate()
1262 "length %u (expected 1)", hdr.length); in x509_parse_tbs_certificate()
1265 pos = hdr.payload; in x509_parse_tbs_certificate()
1266 left = hdr.length; in x509_parse_tbs_certificate()
1283 if (asn1_get_next(pos, end - pos, &hdr) < 0) in x509_parse_tbs_certificate()
1290 if (hdr.class != ASN1_CLASS_UNIVERSAL || in x509_parse_tbs_certificate()
1291 hdr.tag != ASN1_TAG_INTEGER) { in x509_parse_tbs_certificate()
1294 hdr.class, hdr.tag); in x509_parse_tbs_certificate()
1298 pos = hdr.payload; in x509_parse_tbs_certificate()
1299 left = hdr.length; in x509_parse_tbs_certificate()
1338 if (asn1_get_next(pos, end - pos, &hdr) < 0 || in x509_parse_tbs_certificate()
1339 hdr.class != ASN1_CLASS_CONTEXT_SPECIFIC) { in x509_parse_tbs_certificate()
1343 hdr.class, hdr.tag); in x509_parse_tbs_certificate()
1347 if (hdr.tag == 1) { in x509_parse_tbs_certificate()
1352 if (hdr.payload + hdr.length == end) in x509_parse_tbs_certificate()
1355 if (asn1_get_next(pos, end - pos, &hdr) < 0 || in x509_parse_tbs_certificate()
1356 hdr.class != ASN1_CLASS_CONTEXT_SPECIFIC) { in x509_parse_tbs_certificate()
1360 hdr.class, hdr.tag); in x509_parse_tbs_certificate()
1365 if (hdr.tag == 2) { in x509_parse_tbs_certificate()
1370 if (hdr.payload + hdr.length == end) in x509_parse_tbs_certificate()
1373 if (asn1_get_next(pos, end - pos, &hdr) < 0 || in x509_parse_tbs_certificate()
1374 hdr.class != ASN1_CLASS_CONTEXT_SPECIFIC) { in x509_parse_tbs_certificate()
1378 hdr.class, hdr.tag); in x509_parse_tbs_certificate()
1383 if (hdr.tag != 3) { in x509_parse_tbs_certificate()
1386 "tbsCertificate fields", hdr.tag); in x509_parse_tbs_certificate()
1399 if (x509_parse_extensions(cert, hdr.payload, hdr.length) < 0) in x509_parse_tbs_certificate()
1402 pos = hdr.payload + hdr.length; in x509_parse_tbs_certificate()
1477 struct asn1_hdr hdr; in x509_certificate_parse() local
1494 if (asn1_get_next(pos, len, &hdr) < 0 || in x509_certificate_parse()
1495 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_certificate_parse()
1496 hdr.tag != ASN1_TAG_SEQUENCE) { in x509_certificate_parse()
1499 hdr.class, hdr.tag); in x509_certificate_parse()
1503 pos = hdr.payload; in x509_certificate_parse()
1505 if (pos + hdr.length > end) { in x509_certificate_parse()
1510 if (pos + hdr.length < end) { in x509_certificate_parse()
1513 pos + hdr.length, end - pos + hdr.length); in x509_certificate_parse()
1514 end = pos + hdr.length; in x509_certificate_parse()
1533 if (asn1_get_next(pos, end - pos, &hdr) < 0 || in x509_certificate_parse()
1534 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_certificate_parse()
1535 hdr.tag != ASN1_TAG_BITSTRING) { in x509_certificate_parse()
1538 hdr.class, hdr.tag); in x509_certificate_parse()
1542 if (hdr.length < 1) { in x509_certificate_parse()
1546 pos = hdr.payload; in x509_certificate_parse()
1558 cert->sign_value = os_malloc(hdr.length - 1); in x509_certificate_parse()
1565 os_memcpy(cert->sign_value, pos + 1, hdr.length - 1); in x509_certificate_parse()
1566 cert->sign_value_len = hdr.length - 1; in x509_certificate_parse()
1588 struct asn1_hdr hdr; in x509_certificate_check_signature() local
1638 if (asn1_get_next(data, data_len, &hdr) < 0 || in x509_certificate_check_signature()
1639 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_certificate_check_signature()
1640 hdr.tag != ASN1_TAG_SEQUENCE) { in x509_certificate_check_signature()
1643 hdr.class, hdr.tag); in x509_certificate_check_signature()
1648 pos = hdr.payload; in x509_certificate_check_signature()
1649 end = pos + hdr.length; in x509_certificate_check_signature()
1659 if (asn1_get_next(pos, end - pos, &hdr) < 0 || in x509_certificate_check_signature()
1660 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_certificate_check_signature()
1661 hdr.tag != ASN1_TAG_SEQUENCE) { in x509_certificate_check_signature()
1664 hdr.class, hdr.tag); in x509_certificate_check_signature()
1668 da_end = hdr.payload + hdr.length; in x509_certificate_check_signature()
1670 if (asn1_get_oid(hdr.payload, hdr.length, &oid, &next)) { in x509_certificate_check_signature()
1733 if (asn1_get_next(pos, end - pos, &hdr) < 0 || in x509_certificate_check_signature()
1734 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_certificate_check_signature()
1735 hdr.tag != ASN1_TAG_OCTETSTRING) { in x509_certificate_check_signature()
1738 hdr.class, hdr.tag); in x509_certificate_check_signature()
1743 hdr.payload, hdr.length); in x509_certificate_check_signature()
1777 if (hdr.length != hash_len || in x509_certificate_check_signature()
1778 os_memcmp(hdr.payload, hash, hdr.length) != 0) { in x509_certificate_check_signature()