• Home
  • Raw
  • Download

Lines Matching refs:hdr

185 	struct asn1_hdr hdr;  in x509_parse_algorithm_identifier()  local
195 if (asn1_get_next(buf, len, &hdr) < 0 || in x509_parse_algorithm_identifier()
196 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_parse_algorithm_identifier()
197 hdr.tag != ASN1_TAG_SEQUENCE) { in x509_parse_algorithm_identifier()
200 hdr.class, hdr.tag); in x509_parse_algorithm_identifier()
203 if (hdr.length > buf + len - hdr.payload) in x509_parse_algorithm_identifier()
205 pos = hdr.payload; in x509_parse_algorithm_identifier()
206 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 (hdr.length > end - pos) 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 (hdr.length > buf + len - pos) 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 = dup_binstr(hdr.payload, hdr.length); in x509_parse_name()
451 if (os_strlen(val) != hdr.length) { in x509_parse_name()
652 struct asn1_hdr hdr; in x509_parse_validity() local
668 if (asn1_get_next(buf, len, &hdr) < 0 || in x509_parse_validity()
669 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_parse_validity()
670 hdr.tag != ASN1_TAG_SEQUENCE) { in x509_parse_validity()
673 hdr.class, hdr.tag); in x509_parse_validity()
676 pos = hdr.payload; in x509_parse_validity()
677 plen = hdr.length; in x509_parse_validity()
684 if (asn1_get_next(pos, plen, &hdr) < 0 || in x509_parse_validity()
685 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_parse_validity()
686 x509_parse_time(hdr.payload, hdr.length, hdr.tag, in x509_parse_validity()
689 "Time", hdr.payload, hdr.length); in x509_parse_validity()
693 pos = hdr.payload + hdr.length; in x509_parse_validity()
696 if (asn1_get_next(pos, plen, &hdr) < 0 || in x509_parse_validity()
697 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_parse_validity()
698 x509_parse_time(hdr.payload, hdr.length, hdr.tag, in x509_parse_validity()
701 "Time", hdr.payload, hdr.length); in x509_parse_validity()
735 struct asn1_hdr hdr; in x509_parse_ext_key_usage() local
750 if (asn1_get_next(pos, len, &hdr) < 0 || in x509_parse_ext_key_usage()
751 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_parse_ext_key_usage()
752 hdr.tag != ASN1_TAG_BITSTRING || in x509_parse_ext_key_usage()
753 hdr.length < 1) { in x509_parse_ext_key_usage()
756 hdr.class, hdr.tag, hdr.length); in x509_parse_ext_key_usage()
761 cert->key_usage = asn1_bit_string_to_long(hdr.payload, hdr.length); in x509_parse_ext_key_usage()
772 struct asn1_hdr hdr; in x509_parse_ext_basic_constraints() local
782 if (asn1_get_next(pos, len, &hdr) < 0 || in x509_parse_ext_basic_constraints()
783 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_parse_ext_basic_constraints()
784 hdr.tag != ASN1_TAG_SEQUENCE) { in x509_parse_ext_basic_constraints()
787 hdr.class, hdr.tag); in x509_parse_ext_basic_constraints()
793 if (hdr.length == 0) in x509_parse_ext_basic_constraints()
796 if (asn1_get_next(hdr.payload, hdr.length, &hdr) < 0 || in x509_parse_ext_basic_constraints()
797 hdr.class != ASN1_CLASS_UNIVERSAL) { in x509_parse_ext_basic_constraints()
803 if (hdr.tag == ASN1_TAG_BOOLEAN) { in x509_parse_ext_basic_constraints()
804 if (hdr.length != 1) { in x509_parse_ext_basic_constraints()
807 hdr.length); in x509_parse_ext_basic_constraints()
810 cert->ca = hdr.payload[0]; in x509_parse_ext_basic_constraints()
812 if (hdr.length == pos + len - hdr.payload) { in x509_parse_ext_basic_constraints()
818 if (asn1_get_next(hdr.payload + hdr.length, len - hdr.length, in x509_parse_ext_basic_constraints()
819 &hdr) < 0 || in x509_parse_ext_basic_constraints()
820 hdr.class != ASN1_CLASS_UNIVERSAL) { in x509_parse_ext_basic_constraints()
827 if (hdr.tag != ASN1_TAG_INTEGER) { in x509_parse_ext_basic_constraints()
830 hdr.class, hdr.tag); in x509_parse_ext_basic_constraints()
834 pos = hdr.payload; in x509_parse_ext_basic_constraints()
835 left = hdr.length; in x509_parse_ext_basic_constraints()
956 struct asn1_hdr hdr; in x509_parse_ext_alt_name() local
982 for (p = pos, end = pos + len; p < end; p = hdr.payload + hdr.length) { in x509_parse_ext_alt_name()
985 if (asn1_get_next(p, end - p, &hdr) < 0) { in x509_parse_ext_alt_name()
991 if (hdr.class != ASN1_CLASS_CONTEXT_SPECIFIC) in x509_parse_ext_alt_name()
994 switch (hdr.tag) { in x509_parse_ext_alt_name()
996 res = x509_parse_alt_name_rfc8222(name, hdr.payload, in x509_parse_ext_alt_name()
997 hdr.length); in x509_parse_ext_alt_name()
1000 res = x509_parse_alt_name_dns(name, hdr.payload, in x509_parse_ext_alt_name()
1001 hdr.length); in x509_parse_ext_alt_name()
1004 res = x509_parse_alt_name_uri(name, hdr.payload, in x509_parse_ext_alt_name()
1005 hdr.length); in x509_parse_ext_alt_name()
1008 res = x509_parse_alt_name_ip(name, hdr.payload, in x509_parse_ext_alt_name()
1009 hdr.length); in x509_parse_ext_alt_name()
1012 res = x509_parse_alt_name_rid(name, hdr.payload, in x509_parse_ext_alt_name()
1013 hdr.length); in x509_parse_ext_alt_name()
1034 struct asn1_hdr hdr; in x509_parse_ext_subject_alt_name() local
1038 if (asn1_get_next(pos, len, &hdr) < 0 || in x509_parse_ext_subject_alt_name()
1039 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_parse_ext_subject_alt_name()
1040 hdr.tag != ASN1_TAG_SEQUENCE) { in x509_parse_ext_subject_alt_name()
1043 hdr.class, hdr.tag); in x509_parse_ext_subject_alt_name()
1050 if (hdr.length == 0) in x509_parse_ext_subject_alt_name()
1053 return x509_parse_ext_alt_name(&cert->subject, hdr.payload, in x509_parse_ext_subject_alt_name()
1054 hdr.length); in x509_parse_ext_subject_alt_name()
1061 struct asn1_hdr hdr; in x509_parse_ext_issuer_alt_name() local
1065 if (asn1_get_next(pos, len, &hdr) < 0 || in x509_parse_ext_issuer_alt_name()
1066 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_parse_ext_issuer_alt_name()
1067 hdr.tag != ASN1_TAG_SEQUENCE) { in x509_parse_ext_issuer_alt_name()
1070 hdr.class, hdr.tag); in x509_parse_ext_issuer_alt_name()
1077 if (hdr.length == 0) in x509_parse_ext_issuer_alt_name()
1080 return x509_parse_ext_alt_name(&cert->issuer, hdr.payload, in x509_parse_ext_issuer_alt_name()
1081 hdr.length); in x509_parse_ext_issuer_alt_name()
1137 struct asn1_hdr hdr; in x509_parse_ext_ext_key_usage() local
1147 if (asn1_get_next(pos, len, &hdr) < 0 || in x509_parse_ext_ext_key_usage()
1148 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_parse_ext_ext_key_usage()
1149 hdr.tag != ASN1_TAG_SEQUENCE) { in x509_parse_ext_ext_key_usage()
1152 hdr.class, hdr.tag); in x509_parse_ext_ext_key_usage()
1155 if (hdr.length > pos + len - hdr.payload) in x509_parse_ext_ext_key_usage()
1157 pos = hdr.payload; in x509_parse_ext_ext_key_usage()
1158 end = pos + hdr.length; in x509_parse_ext_ext_key_usage()
1225 struct asn1_hdr hdr; in x509_parse_extension() local
1238 if (asn1_get_next(pos, len, &hdr) < 0 || in x509_parse_extension()
1239 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_parse_extension()
1240 hdr.tag != ASN1_TAG_SEQUENCE) { in x509_parse_extension()
1243 hdr.class, hdr.tag); in x509_parse_extension()
1246 pos = hdr.payload; in x509_parse_extension()
1247 *next = end = pos + hdr.length; in x509_parse_extension()
1255 if (asn1_get_next(pos, end - pos, &hdr) < 0 || in x509_parse_extension()
1256 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_parse_extension()
1257 (hdr.tag != ASN1_TAG_BOOLEAN && in x509_parse_extension()
1258 hdr.tag != ASN1_TAG_OCTETSTRING)) { in x509_parse_extension()
1261 "or OCTET STRING", hdr.class, hdr.tag); in x509_parse_extension()
1265 if (hdr.tag == ASN1_TAG_BOOLEAN) { in x509_parse_extension()
1266 if (hdr.length != 1) { in x509_parse_extension()
1268 "Boolean length (%u)", hdr.length); in x509_parse_extension()
1271 critical_ext = hdr.payload[0]; in x509_parse_extension()
1272 pos = hdr.payload; in x509_parse_extension()
1273 if (asn1_get_next(pos, end - pos, &hdr) < 0 || in x509_parse_extension()
1274 (hdr.class != ASN1_CLASS_UNIVERSAL && in x509_parse_extension()
1275 hdr.class != ASN1_CLASS_PRIVATE) || in x509_parse_extension()
1276 hdr.tag != ASN1_TAG_OCTETSTRING) { in x509_parse_extension()
1280 hdr.class, hdr.tag); in x509_parse_extension()
1288 wpa_hexdump(MSG_MSGDUMP, "X509: extnValue", hdr.payload, hdr.length); in x509_parse_extension()
1290 res = x509_parse_extension_data(cert, &oid, hdr.payload, hdr.length); in x509_parse_extension()
1307 struct asn1_hdr hdr; in x509_parse_extensions() local
1311 if (asn1_get_next(pos, len, &hdr) < 0 || in x509_parse_extensions()
1312 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_parse_extensions()
1313 hdr.tag != ASN1_TAG_SEQUENCE) { in x509_parse_extensions()
1316 "expected SEQUENCE", hdr.class, hdr.tag); in x509_parse_extensions()
1320 pos = hdr.payload; in x509_parse_extensions()
1321 end = pos + hdr.length; in x509_parse_extensions()
1337 struct asn1_hdr hdr; in x509_parse_tbs_certificate() local
1345 if (asn1_get_next(buf, len, &hdr) < 0 || in x509_parse_tbs_certificate()
1346 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_parse_tbs_certificate()
1347 hdr.tag != ASN1_TAG_SEQUENCE) { in x509_parse_tbs_certificate()
1350 hdr.class, hdr.tag); in x509_parse_tbs_certificate()
1353 pos = hdr.payload; in x509_parse_tbs_certificate()
1354 end = *next = pos + hdr.length; in x509_parse_tbs_certificate()
1360 if (asn1_get_next(pos, end - pos, &hdr) < 0) in x509_parse_tbs_certificate()
1362 pos = hdr.payload; in x509_parse_tbs_certificate()
1364 if (hdr.class == ASN1_CLASS_CONTEXT_SPECIFIC) { in x509_parse_tbs_certificate()
1365 if (asn1_get_next(pos, end - pos, &hdr) < 0) in x509_parse_tbs_certificate()
1368 if (hdr.class != ASN1_CLASS_UNIVERSAL || in x509_parse_tbs_certificate()
1369 hdr.tag != ASN1_TAG_INTEGER) { in x509_parse_tbs_certificate()
1372 hdr.class, hdr.tag); in x509_parse_tbs_certificate()
1375 if (hdr.length != 1) { in x509_parse_tbs_certificate()
1377 "length %u (expected 1)", hdr.length); in x509_parse_tbs_certificate()
1380 pos = hdr.payload; in x509_parse_tbs_certificate()
1381 left = hdr.length; in x509_parse_tbs_certificate()
1398 if (asn1_get_next(pos, end - pos, &hdr) < 0) in x509_parse_tbs_certificate()
1405 if (hdr.class != ASN1_CLASS_UNIVERSAL || in x509_parse_tbs_certificate()
1406 hdr.tag != ASN1_TAG_INTEGER || in x509_parse_tbs_certificate()
1407 hdr.length < 1 || hdr.length > X509_MAX_SERIAL_NUM_LEN) { in x509_parse_tbs_certificate()
1410 hdr.class, hdr.tag, hdr.length); in x509_parse_tbs_certificate()
1414 pos = hdr.payload + hdr.length; in x509_parse_tbs_certificate()
1415 while (hdr.length > 0 && hdr.payload[0] == 0) { in x509_parse_tbs_certificate()
1416 hdr.payload++; in x509_parse_tbs_certificate()
1417 hdr.length--; in x509_parse_tbs_certificate()
1419 os_memcpy(cert->serial_number, hdr.payload, hdr.length); in x509_parse_tbs_certificate()
1420 cert->serial_number_len = hdr.length; in x509_parse_tbs_certificate()
1461 if (asn1_get_next(pos, end - pos, &hdr) < 0 || in x509_parse_tbs_certificate()
1462 hdr.class != ASN1_CLASS_CONTEXT_SPECIFIC) { in x509_parse_tbs_certificate()
1466 hdr.class, hdr.tag); in x509_parse_tbs_certificate()
1470 if (hdr.tag == 1) { in x509_parse_tbs_certificate()
1475 pos = hdr.payload + hdr.length; in x509_parse_tbs_certificate()
1479 if (asn1_get_next(pos, end - pos, &hdr) < 0 || in x509_parse_tbs_certificate()
1480 hdr.class != ASN1_CLASS_CONTEXT_SPECIFIC) { in x509_parse_tbs_certificate()
1484 hdr.class, hdr.tag); in x509_parse_tbs_certificate()
1489 if (hdr.tag == 2) { in x509_parse_tbs_certificate()
1494 pos = hdr.payload + hdr.length; in x509_parse_tbs_certificate()
1498 if (asn1_get_next(pos, end - pos, &hdr) < 0 || in x509_parse_tbs_certificate()
1499 hdr.class != ASN1_CLASS_CONTEXT_SPECIFIC) { in x509_parse_tbs_certificate()
1503 hdr.class, hdr.tag); in x509_parse_tbs_certificate()
1508 if (hdr.tag != 3) { in x509_parse_tbs_certificate()
1511 "tbsCertificate fields", hdr.tag); in x509_parse_tbs_certificate()
1524 if (x509_parse_extensions(cert, hdr.payload, hdr.length) < 0) in x509_parse_tbs_certificate()
1527 pos = hdr.payload + hdr.length; in x509_parse_tbs_certificate()
1622 struct asn1_hdr hdr; in x509_certificate_parse() local
1639 if (asn1_get_next(pos, len, &hdr) < 0 || in x509_certificate_parse()
1640 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_certificate_parse()
1641 hdr.tag != ASN1_TAG_SEQUENCE) { in x509_certificate_parse()
1644 hdr.class, hdr.tag); in x509_certificate_parse()
1648 pos = hdr.payload; in x509_certificate_parse()
1650 if (hdr.length > end - pos) { in x509_certificate_parse()
1655 if (hdr.length < end - pos) { in x509_certificate_parse()
1658 pos + hdr.length, end - (pos + hdr.length)); in x509_certificate_parse()
1659 end = pos + hdr.length; in x509_certificate_parse()
1678 if (asn1_get_next(pos, end - pos, &hdr) < 0 || in x509_certificate_parse()
1679 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_certificate_parse()
1680 hdr.tag != ASN1_TAG_BITSTRING) { in x509_certificate_parse()
1683 hdr.class, hdr.tag); in x509_certificate_parse()
1687 if (hdr.length < 1) { in x509_certificate_parse()
1691 pos = hdr.payload; in x509_certificate_parse()
1703 cert->sign_value = os_malloc(hdr.length - 1); in x509_certificate_parse()
1710 os_memcpy(cert->sign_value, pos + 1, hdr.length - 1); in x509_certificate_parse()
1711 cert->sign_value_len = hdr.length - 1; in x509_certificate_parse()
1744 struct asn1_hdr hdr; in x509_check_signature() local
1796 if (asn1_get_next(data, data_len, &hdr) < 0 || in x509_check_signature()
1797 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_check_signature()
1798 hdr.tag != ASN1_TAG_SEQUENCE) { in x509_check_signature()
1801 hdr.class, hdr.tag); in x509_check_signature()
1806 pos = hdr.payload; in x509_check_signature()
1807 end = pos + hdr.length; in x509_check_signature()
1817 if (asn1_get_next(pos, end - pos, &hdr) < 0 || in x509_check_signature()
1818 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_check_signature()
1819 hdr.tag != ASN1_TAG_SEQUENCE) { in x509_check_signature()
1822 hdr.class, hdr.tag); in x509_check_signature()
1826 da_end = hdr.payload + hdr.length; in x509_check_signature()
1828 if (asn1_get_oid(hdr.payload, hdr.length, &oid, &next)) { in x509_check_signature()
1913 if (asn1_get_next(pos, end - pos, &hdr) < 0 || in x509_check_signature()
1914 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_check_signature()
1915 hdr.tag != ASN1_TAG_OCTETSTRING) { in x509_check_signature()
1918 hdr.class, hdr.tag); in x509_check_signature()
1923 hdr.payload, hdr.length); in x509_check_signature()
1964 if (hdr.length != hash_len || in x509_check_signature()
1965 os_memcmp_const(hdr.payload, hash, hdr.length) != 0) { in x509_check_signature()
1972 if (hdr.payload + hdr.length < data + data_len) { in x509_check_signature()
1975 hdr.payload + hdr.length, in x509_check_signature()
1976 data + data_len - hdr.payload - hdr.length); in x509_check_signature()