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 = dup_binstr(hdr.payload, hdr.length); in x509_parse_name()
451 if (os_strlen(val) != hdr.length) { in x509_parse_name()
653 struct asn1_hdr hdr; in x509_parse_validity() local
669 if (asn1_get_next(buf, len, &hdr) < 0 || in x509_parse_validity()
670 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_parse_validity()
671 hdr.tag != ASN1_TAG_SEQUENCE) { in x509_parse_validity()
674 hdr.class, hdr.tag); in x509_parse_validity()
677 pos = hdr.payload; in x509_parse_validity()
678 plen = hdr.length; in x509_parse_validity()
685 if (asn1_get_next(pos, plen, &hdr) < 0 || in x509_parse_validity()
686 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_parse_validity()
687 x509_parse_time(hdr.payload, hdr.length, hdr.tag, in x509_parse_validity()
690 "Time", hdr.payload, hdr.length); in x509_parse_validity()
694 pos = hdr.payload + hdr.length; in x509_parse_validity()
697 if (asn1_get_next(pos, plen, &hdr) < 0 || in x509_parse_validity()
698 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_parse_validity()
699 x509_parse_time(hdr.payload, hdr.length, hdr.tag, in x509_parse_validity()
702 "Time", hdr.payload, hdr.length); in x509_parse_validity()
727 struct asn1_hdr hdr; in x509_parse_ext_key_usage() local
742 if (asn1_get_next(pos, len, &hdr) < 0 || in x509_parse_ext_key_usage()
743 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_parse_ext_key_usage()
744 hdr.tag != ASN1_TAG_BITSTRING || in x509_parse_ext_key_usage()
745 hdr.length < 1) { in x509_parse_ext_key_usage()
748 hdr.class, hdr.tag, hdr.length); in x509_parse_ext_key_usage()
753 cert->key_usage = asn1_bit_string_to_long(hdr.payload, hdr.length); in x509_parse_ext_key_usage()
764 struct asn1_hdr hdr; in x509_parse_ext_basic_constraints() local
774 if (asn1_get_next(pos, len, &hdr) < 0 || in x509_parse_ext_basic_constraints()
775 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_parse_ext_basic_constraints()
776 hdr.tag != ASN1_TAG_SEQUENCE) { in x509_parse_ext_basic_constraints()
779 hdr.class, hdr.tag); in x509_parse_ext_basic_constraints()
785 if (hdr.length == 0) in x509_parse_ext_basic_constraints()
788 if (asn1_get_next(hdr.payload, hdr.length, &hdr) < 0 || in x509_parse_ext_basic_constraints()
789 hdr.class != ASN1_CLASS_UNIVERSAL) { in x509_parse_ext_basic_constraints()
795 if (hdr.tag == ASN1_TAG_BOOLEAN) { in x509_parse_ext_basic_constraints()
796 if (hdr.length != 1) { in x509_parse_ext_basic_constraints()
799 hdr.length); in x509_parse_ext_basic_constraints()
802 cert->ca = hdr.payload[0]; in x509_parse_ext_basic_constraints()
804 if (hdr.payload + hdr.length == pos + len) { in x509_parse_ext_basic_constraints()
810 if (asn1_get_next(hdr.payload + hdr.length, len - hdr.length, in x509_parse_ext_basic_constraints()
811 &hdr) < 0 || in x509_parse_ext_basic_constraints()
812 hdr.class != ASN1_CLASS_UNIVERSAL) { in x509_parse_ext_basic_constraints()
819 if (hdr.tag != ASN1_TAG_INTEGER) { in x509_parse_ext_basic_constraints()
822 hdr.class, hdr.tag); in x509_parse_ext_basic_constraints()
826 pos = hdr.payload; in x509_parse_ext_basic_constraints()
827 left = hdr.length; in x509_parse_ext_basic_constraints()
948 struct asn1_hdr hdr; in x509_parse_ext_alt_name() local
974 for (p = pos, end = pos + len; p < end; p = hdr.payload + hdr.length) { in x509_parse_ext_alt_name()
977 if (asn1_get_next(p, end - p, &hdr) < 0) { in x509_parse_ext_alt_name()
983 if (hdr.class != ASN1_CLASS_CONTEXT_SPECIFIC) in x509_parse_ext_alt_name()
986 switch (hdr.tag) { in x509_parse_ext_alt_name()
988 res = x509_parse_alt_name_rfc8222(name, hdr.payload, in x509_parse_ext_alt_name()
989 hdr.length); in x509_parse_ext_alt_name()
992 res = x509_parse_alt_name_dns(name, hdr.payload, in x509_parse_ext_alt_name()
993 hdr.length); in x509_parse_ext_alt_name()
996 res = x509_parse_alt_name_uri(name, hdr.payload, in x509_parse_ext_alt_name()
997 hdr.length); in x509_parse_ext_alt_name()
1000 res = x509_parse_alt_name_ip(name, hdr.payload, in x509_parse_ext_alt_name()
1001 hdr.length); in x509_parse_ext_alt_name()
1004 res = x509_parse_alt_name_rid(name, hdr.payload, in x509_parse_ext_alt_name()
1005 hdr.length); in x509_parse_ext_alt_name()
1026 struct asn1_hdr hdr; in x509_parse_ext_subject_alt_name() local
1030 if (asn1_get_next(pos, len, &hdr) < 0 || in x509_parse_ext_subject_alt_name()
1031 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_parse_ext_subject_alt_name()
1032 hdr.tag != ASN1_TAG_SEQUENCE) { in x509_parse_ext_subject_alt_name()
1035 hdr.class, hdr.tag); in x509_parse_ext_subject_alt_name()
1042 if (hdr.length == 0) in x509_parse_ext_subject_alt_name()
1045 return x509_parse_ext_alt_name(&cert->subject, hdr.payload, in x509_parse_ext_subject_alt_name()
1046 hdr.length); in x509_parse_ext_subject_alt_name()
1053 struct asn1_hdr hdr; in x509_parse_ext_issuer_alt_name() local
1057 if (asn1_get_next(pos, len, &hdr) < 0 || in x509_parse_ext_issuer_alt_name()
1058 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_parse_ext_issuer_alt_name()
1059 hdr.tag != ASN1_TAG_SEQUENCE) { in x509_parse_ext_issuer_alt_name()
1062 hdr.class, hdr.tag); in x509_parse_ext_issuer_alt_name()
1069 if (hdr.length == 0) in x509_parse_ext_issuer_alt_name()
1072 return x509_parse_ext_alt_name(&cert->issuer, hdr.payload, in x509_parse_ext_issuer_alt_name()
1073 hdr.length); in x509_parse_ext_issuer_alt_name()
1110 struct asn1_hdr hdr; in x509_parse_extension() local
1123 if (asn1_get_next(pos, len, &hdr) < 0 || in x509_parse_extension()
1124 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_parse_extension()
1125 hdr.tag != ASN1_TAG_SEQUENCE) { in x509_parse_extension()
1128 hdr.class, hdr.tag); in x509_parse_extension()
1131 pos = hdr.payload; in x509_parse_extension()
1132 *next = end = pos + hdr.length; in x509_parse_extension()
1140 if (asn1_get_next(pos, end - pos, &hdr) < 0 || in x509_parse_extension()
1141 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_parse_extension()
1142 (hdr.tag != ASN1_TAG_BOOLEAN && in x509_parse_extension()
1143 hdr.tag != ASN1_TAG_OCTETSTRING)) { in x509_parse_extension()
1146 "or OCTET STRING", hdr.class, hdr.tag); in x509_parse_extension()
1150 if (hdr.tag == ASN1_TAG_BOOLEAN) { in x509_parse_extension()
1151 if (hdr.length != 1) { in x509_parse_extension()
1153 "Boolean length (%u)", hdr.length); in x509_parse_extension()
1156 critical_ext = hdr.payload[0]; in x509_parse_extension()
1157 pos = hdr.payload; in x509_parse_extension()
1158 if (asn1_get_next(pos, end - pos, &hdr) < 0 || in x509_parse_extension()
1159 (hdr.class != ASN1_CLASS_UNIVERSAL && in x509_parse_extension()
1160 hdr.class != ASN1_CLASS_PRIVATE) || in x509_parse_extension()
1161 hdr.tag != ASN1_TAG_OCTETSTRING) { in x509_parse_extension()
1165 hdr.class, hdr.tag); in x509_parse_extension()
1173 wpa_hexdump(MSG_MSGDUMP, "X509: extnValue", hdr.payload, hdr.length); in x509_parse_extension()
1175 res = x509_parse_extension_data(cert, &oid, hdr.payload, hdr.length); in x509_parse_extension()
1192 struct asn1_hdr hdr; in x509_parse_extensions() local
1196 if (asn1_get_next(pos, len, &hdr) < 0 || in x509_parse_extensions()
1197 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_parse_extensions()
1198 hdr.tag != ASN1_TAG_SEQUENCE) { in x509_parse_extensions()
1201 "expected SEQUENCE", hdr.class, hdr.tag); in x509_parse_extensions()
1205 pos = hdr.payload; in x509_parse_extensions()
1206 end = pos + hdr.length; in x509_parse_extensions()
1222 struct asn1_hdr hdr; in x509_parse_tbs_certificate() local
1229 if (asn1_get_next(buf, len, &hdr) < 0 || in x509_parse_tbs_certificate()
1230 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_parse_tbs_certificate()
1231 hdr.tag != ASN1_TAG_SEQUENCE) { in x509_parse_tbs_certificate()
1234 hdr.class, hdr.tag); in x509_parse_tbs_certificate()
1237 pos = hdr.payload; in x509_parse_tbs_certificate()
1238 end = *next = pos + hdr.length; in x509_parse_tbs_certificate()
1244 if (asn1_get_next(pos, end - pos, &hdr) < 0) in x509_parse_tbs_certificate()
1246 pos = hdr.payload; in x509_parse_tbs_certificate()
1248 if (hdr.class == ASN1_CLASS_CONTEXT_SPECIFIC) { in x509_parse_tbs_certificate()
1249 if (asn1_get_next(pos, end - pos, &hdr) < 0) in x509_parse_tbs_certificate()
1252 if (hdr.class != ASN1_CLASS_UNIVERSAL || in x509_parse_tbs_certificate()
1253 hdr.tag != ASN1_TAG_INTEGER) { in x509_parse_tbs_certificate()
1256 hdr.class, hdr.tag); in x509_parse_tbs_certificate()
1259 if (hdr.length != 1) { in x509_parse_tbs_certificate()
1261 "length %u (expected 1)", hdr.length); in x509_parse_tbs_certificate()
1264 pos = hdr.payload; in x509_parse_tbs_certificate()
1265 left = hdr.length; in x509_parse_tbs_certificate()
1282 if (asn1_get_next(pos, end - pos, &hdr) < 0) in x509_parse_tbs_certificate()
1289 if (hdr.class != ASN1_CLASS_UNIVERSAL || in x509_parse_tbs_certificate()
1290 hdr.tag != ASN1_TAG_INTEGER) { in x509_parse_tbs_certificate()
1293 hdr.class, hdr.tag); in x509_parse_tbs_certificate()
1297 pos = hdr.payload; in x509_parse_tbs_certificate()
1298 left = hdr.length; in x509_parse_tbs_certificate()
1337 if (asn1_get_next(pos, end - pos, &hdr) < 0 || in x509_parse_tbs_certificate()
1338 hdr.class != ASN1_CLASS_CONTEXT_SPECIFIC) { in x509_parse_tbs_certificate()
1342 hdr.class, hdr.tag); in x509_parse_tbs_certificate()
1346 if (hdr.tag == 1) { in x509_parse_tbs_certificate()
1351 pos = hdr.payload + hdr.length; 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 pos = hdr.payload + hdr.length; in x509_parse_tbs_certificate()
1374 if (asn1_get_next(pos, end - pos, &hdr) < 0 || in x509_parse_tbs_certificate()
1375 hdr.class != ASN1_CLASS_CONTEXT_SPECIFIC) { in x509_parse_tbs_certificate()
1379 hdr.class, hdr.tag); in x509_parse_tbs_certificate()
1384 if (hdr.tag != 3) { in x509_parse_tbs_certificate()
1387 "tbsCertificate fields", hdr.tag); in x509_parse_tbs_certificate()
1400 if (x509_parse_extensions(cert, hdr.payload, hdr.length) < 0) in x509_parse_tbs_certificate()
1403 pos = hdr.payload + hdr.length; in x509_parse_tbs_certificate()
1478 struct asn1_hdr hdr; in x509_certificate_parse() local
1495 if (asn1_get_next(pos, len, &hdr) < 0 || in x509_certificate_parse()
1496 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_certificate_parse()
1497 hdr.tag != ASN1_TAG_SEQUENCE) { in x509_certificate_parse()
1500 hdr.class, hdr.tag); in x509_certificate_parse()
1504 pos = hdr.payload; in x509_certificate_parse()
1506 if (pos + hdr.length > end) { in x509_certificate_parse()
1511 if (pos + hdr.length < end) { in x509_certificate_parse()
1514 pos + hdr.length, end - (pos + hdr.length)); in x509_certificate_parse()
1515 end = pos + hdr.length; in x509_certificate_parse()
1534 if (asn1_get_next(pos, end - pos, &hdr) < 0 || in x509_certificate_parse()
1535 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_certificate_parse()
1536 hdr.tag != ASN1_TAG_BITSTRING) { in x509_certificate_parse()
1539 hdr.class, hdr.tag); in x509_certificate_parse()
1543 if (hdr.length < 1) { in x509_certificate_parse()
1547 pos = hdr.payload; in x509_certificate_parse()
1559 cert->sign_value = os_malloc(hdr.length - 1); in x509_certificate_parse()
1566 os_memcpy(cert->sign_value, pos + 1, hdr.length - 1); in x509_certificate_parse()
1567 cert->sign_value_len = hdr.length - 1; in x509_certificate_parse()
1589 struct asn1_hdr hdr; in x509_certificate_check_signature() local
1639 if (asn1_get_next(data, data_len, &hdr) < 0 || in x509_certificate_check_signature()
1640 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_certificate_check_signature()
1641 hdr.tag != ASN1_TAG_SEQUENCE) { in x509_certificate_check_signature()
1644 hdr.class, hdr.tag); in x509_certificate_check_signature()
1649 pos = hdr.payload; in x509_certificate_check_signature()
1650 end = pos + hdr.length; in x509_certificate_check_signature()
1660 if (asn1_get_next(pos, end - pos, &hdr) < 0 || in x509_certificate_check_signature()
1661 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_certificate_check_signature()
1662 hdr.tag != ASN1_TAG_SEQUENCE) { in x509_certificate_check_signature()
1665 hdr.class, hdr.tag); in x509_certificate_check_signature()
1669 da_end = hdr.payload + hdr.length; in x509_certificate_check_signature()
1671 if (asn1_get_oid(hdr.payload, hdr.length, &oid, &next)) { in x509_certificate_check_signature()
1734 if (asn1_get_next(pos, end - pos, &hdr) < 0 || in x509_certificate_check_signature()
1735 hdr.class != ASN1_CLASS_UNIVERSAL || in x509_certificate_check_signature()
1736 hdr.tag != ASN1_TAG_OCTETSTRING) { in x509_certificate_check_signature()
1739 hdr.class, hdr.tag); in x509_certificate_check_signature()
1744 hdr.payload, hdr.length); in x509_certificate_check_signature()
1778 if (hdr.length != hash_len || in x509_certificate_check_signature()
1779 os_memcmp_const(hdr.payload, hash, hdr.length) != 0) { in x509_certificate_check_signature()
1786 if (hdr.payload + hdr.length < data + data_len) { in x509_certificate_check_signature()
1789 hdr.payload + hdr.length, in x509_certificate_check_signature()
1790 data + data_len - hdr.payload - hdr.length); in x509_certificate_check_signature()