Lines Matching refs:hdr

184 	struct asn1_hdr hdr;
194 if (asn1_get_next(buf, len, &hdr) < 0 ||
195 hdr.class != ASN1_CLASS_UNIVERSAL ||
196 hdr.tag != ASN1_TAG_SEQUENCE) {
199 hdr.class, hdr.tag);
202 pos = hdr.payload;
203 end = pos + hdr.length;
223 struct asn1_hdr hdr;
236 if (asn1_get_next(pos, end - pos, &hdr) < 0 ||
237 hdr.class != ASN1_CLASS_UNIVERSAL ||
238 hdr.tag != ASN1_TAG_SEQUENCE) {
241 hdr.class, hdr.tag);
244 pos = hdr.payload;
246 if (pos + hdr.length > end)
248 end = pos + hdr.length;
255 if (asn1_get_next(pos, end - pos, &hdr) < 0 ||
256 hdr.class != ASN1_CLASS_UNIVERSAL ||
257 hdr.tag != ASN1_TAG_BITSTRING) {
260 hdr.class, hdr.tag);
263 if (hdr.length < 1)
265 pos = hdr.payload;
277 cert->public_key = os_malloc(hdr.length - 1);
283 os_memcpy(cert->public_key, pos + 1, hdr.length - 1);
284 cert->public_key_len = hdr.length - 1;
295 struct asn1_hdr hdr;
312 if (asn1_get_next(buf, len, &hdr) < 0 ||
313 hdr.class != ASN1_CLASS_UNIVERSAL ||
314 hdr.tag != ASN1_TAG_SEQUENCE) {
317 hdr.class, hdr.tag);
320 pos = hdr.payload;
322 if (pos + hdr.length > buf + len)
325 end = *next = pos + hdr.length;
330 if (asn1_get_next(pos, end - pos, &hdr) < 0 ||
331 hdr.class != ASN1_CLASS_UNIVERSAL ||
332 hdr.tag != ASN1_TAG_SET) {
335 "%d tag 0x%x", hdr.class, hdr.tag);
340 set_pos = hdr.payload;
341 pos = set_end = hdr.payload + hdr.length;
343 if (asn1_get_next(set_pos, set_end - set_pos, &hdr) < 0 ||
344 hdr.class != ASN1_CLASS_UNIVERSAL ||
345 hdr.tag != ASN1_TAG_SEQUENCE) {
348 "tag 0x%x", hdr.class, hdr.tag);
353 seq_pos = hdr.payload;
354 seq_end = hdr.payload + hdr.length;
361 if (asn1_get_next(seq_pos, seq_end - seq_pos, &hdr) < 0 ||
362 hdr.class != ASN1_CLASS_UNIVERSAL) {
414 name->email = os_malloc(hdr.length + 1);
419 os_memcpy(name->email, hdr.payload, hdr.length);
420 name->email[hdr.length] = '\0';
436 hdr.payload, hdr.length);
446 val = dup_binstr(hdr.payload, hdr.length);
451 if (os_strlen(val) != hdr.length) {
653 struct asn1_hdr hdr;
669 if (asn1_get_next(buf, len, &hdr) < 0 ||
670 hdr.class != ASN1_CLASS_UNIVERSAL ||
671 hdr.tag != ASN1_TAG_SEQUENCE) {
674 hdr.class, hdr.tag);
677 pos = hdr.payload;
678 plen = hdr.length;
685 if (asn1_get_next(pos, plen, &hdr) < 0 ||
686 hdr.class != ASN1_CLASS_UNIVERSAL ||
687 x509_parse_time(hdr.payload, hdr.length, hdr.tag,
690 "Time", hdr.payload, hdr.length);
694 pos = hdr.payload + hdr.length;
697 if (asn1_get_next(pos, plen, &hdr) < 0 ||
698 hdr.class != ASN1_CLASS_UNIVERSAL ||
699 x509_parse_time(hdr.payload, hdr.length, hdr.tag,
702 "Time", hdr.payload, hdr.length);
727 struct asn1_hdr hdr;
742 if (asn1_get_next(pos, len, &hdr) < 0 ||
743 hdr.class != ASN1_CLASS_UNIVERSAL ||
744 hdr.tag != ASN1_TAG_BITSTRING ||
745 hdr.length < 1) {
748 hdr.class, hdr.tag, hdr.length);
753 cert->key_usage = asn1_bit_string_to_long(hdr.payload, hdr.length);
764 struct asn1_hdr hdr;
774 if (asn1_get_next(pos, len, &hdr) < 0 ||
775 hdr.class != ASN1_CLASS_UNIVERSAL ||
776 hdr.tag != ASN1_TAG_SEQUENCE) {
779 hdr.class, hdr.tag);
785 if (hdr.length == 0)
788 if (asn1_get_next(hdr.payload, hdr.length, &hdr) < 0 ||
789 hdr.class != ASN1_CLASS_UNIVERSAL) {
795 if (hdr.tag == ASN1_TAG_BOOLEAN) {
796 if (hdr.length != 1) {
799 hdr.length);
802 cert->ca = hdr.payload[0];
804 if (hdr.payload + hdr.length == pos + len) {
810 if (asn1_get_next(hdr.payload + hdr.length, len - hdr.length,
811 &hdr) < 0 ||
812 hdr.class != ASN1_CLASS_UNIVERSAL) {
819 if (hdr.tag != ASN1_TAG_INTEGER) {
822 hdr.class, hdr.tag);
826 pos = hdr.payload;
827 left = hdr.length;
948 struct asn1_hdr hdr;
974 for (p = pos, end = pos + len; p < end; p = hdr.payload + hdr.length) {
977 if (asn1_get_next(p, end - p, &hdr) < 0) {
983 if (hdr.class != ASN1_CLASS_CONTEXT_SPECIFIC)
986 switch (hdr.tag) {
988 res = x509_parse_alt_name_rfc8222(name, hdr.payload,
989 hdr.length);
992 res = x509_parse_alt_name_dns(name, hdr.payload,
993 hdr.length);
996 res = x509_parse_alt_name_uri(name, hdr.payload,
997 hdr.length);
1000 res = x509_parse_alt_name_ip(name, hdr.payload,
1001 hdr.length);
1004 res = x509_parse_alt_name_rid(name, hdr.payload,
1005 hdr.length);
1026 struct asn1_hdr hdr;
1030 if (asn1_get_next(pos, len, &hdr) < 0 ||
1031 hdr.class != ASN1_CLASS_UNIVERSAL ||
1032 hdr.tag != ASN1_TAG_SEQUENCE) {
1035 hdr.class, hdr.tag);
1042 if (hdr.length == 0)
1045 return x509_parse_ext_alt_name(&cert->subject, hdr.payload,
1046 hdr.length);
1053 struct asn1_hdr hdr;
1057 if (asn1_get_next(pos, len, &hdr) < 0 ||
1058 hdr.class != ASN1_CLASS_UNIVERSAL ||
1059 hdr.tag != ASN1_TAG_SEQUENCE) {
1062 hdr.class, hdr.tag);
1069 if (hdr.length == 0)
1072 return x509_parse_ext_alt_name(&cert->issuer, hdr.payload,
1073 hdr.length);
1110 struct asn1_hdr hdr;
1123 if (asn1_get_next(pos, len, &hdr) < 0 ||
1124 hdr.class != ASN1_CLASS_UNIVERSAL ||
1125 hdr.tag != ASN1_TAG_SEQUENCE) {
1128 hdr.class, hdr.tag);
1131 pos = hdr.payload;
1132 *next = end = pos + hdr.length;
1140 if (asn1_get_next(pos, end - pos, &hdr) < 0 ||
1141 hdr.class != ASN1_CLASS_UNIVERSAL ||
1142 (hdr.tag != ASN1_TAG_BOOLEAN &&
1143 hdr.tag != ASN1_TAG_OCTETSTRING)) {
1146 "or OCTET STRING", hdr.class, hdr.tag);
1150 if (hdr.tag == ASN1_TAG_BOOLEAN) {
1151 if (hdr.length != 1) {
1153 "Boolean length (%u)", hdr.length);
1156 critical_ext = hdr.payload[0];
1157 pos = hdr.payload;
1158 if (asn1_get_next(pos, end - pos, &hdr) < 0 ||
1159 (hdr.class != ASN1_CLASS_UNIVERSAL &&
1160 hdr.class != ASN1_CLASS_PRIVATE) ||
1161 hdr.tag != ASN1_TAG_OCTETSTRING) {
1165 hdr.class, hdr.tag);
1173 wpa_hexdump(MSG_MSGDUMP, "X509: extnValue", hdr.payload, hdr.length);
1175 res = x509_parse_extension_data(cert, &oid, hdr.payload, hdr.length);
1192 struct asn1_hdr hdr;
1196 if (asn1_get_next(pos, len, &hdr) < 0 ||
1197 hdr.class != ASN1_CLASS_UNIVERSAL ||
1198 hdr.tag != ASN1_TAG_SEQUENCE) {
1201 "expected SEQUENCE", hdr.class, hdr.tag);
1205 pos = hdr.payload;
1206 end = pos + hdr.length;
1222 struct asn1_hdr hdr;
1229 if (asn1_get_next(buf, len, &hdr) < 0 ||
1230 hdr.class != ASN1_CLASS_UNIVERSAL ||
1231 hdr.tag != ASN1_TAG_SEQUENCE) {
1234 hdr.class, hdr.tag);
1237 pos = hdr.payload;
1238 end = *next = pos + hdr.length;
1244 if (asn1_get_next(pos, end - pos, &hdr) < 0)
1246 pos = hdr.payload;
1248 if (hdr.class == ASN1_CLASS_CONTEXT_SPECIFIC) {
1249 if (asn1_get_next(pos, end - pos, &hdr) < 0)
1252 if (hdr.class != ASN1_CLASS_UNIVERSAL ||
1253 hdr.tag != ASN1_TAG_INTEGER) {
1256 hdr.class, hdr.tag);
1259 if (hdr.length != 1) {
1261 "length %u (expected 1)", hdr.length);
1264 pos = hdr.payload;
1265 left = hdr.length;
1282 if (asn1_get_next(pos, end - pos, &hdr) < 0)
1289 if (hdr.class != ASN1_CLASS_UNIVERSAL ||
1290 hdr.tag != ASN1_TAG_INTEGER) {
1293 hdr.class, hdr.tag);
1297 pos = hdr.payload;
1298 left = hdr.length;
1337 if (asn1_get_next(pos, end - pos, &hdr) < 0 ||
1338 hdr.class != ASN1_CLASS_CONTEXT_SPECIFIC) {
1342 hdr.class, hdr.tag);
1346 if (hdr.tag == 1) {
1351 pos = hdr.payload + hdr.length;
1355 if (asn1_get_next(pos, end - pos, &hdr) < 0 ||
1356 hdr.class != ASN1_CLASS_CONTEXT_SPECIFIC) {
1360 hdr.class, hdr.tag);
1365 if (hdr.tag == 2) {
1370 pos = hdr.payload + hdr.length;
1374 if (asn1_get_next(pos, end - pos, &hdr) < 0 ||
1375 hdr.class != ASN1_CLASS_CONTEXT_SPECIFIC) {
1379 hdr.class, hdr.tag);
1384 if (hdr.tag != 3) {
1387 "tbsCertificate fields", hdr.tag);
1400 if (x509_parse_extensions(cert, hdr.payload, hdr.length) < 0)
1403 pos = hdr.payload + hdr.length;
1478 struct asn1_hdr hdr;
1495 if (asn1_get_next(pos, len, &hdr) < 0 ||
1496 hdr.class != ASN1_CLASS_UNIVERSAL ||
1497 hdr.tag != ASN1_TAG_SEQUENCE) {
1500 hdr.class, hdr.tag);
1504 pos = hdr.payload;
1506 if (pos + hdr.length > end) {
1511 if (pos + hdr.length < end) {
1514 pos + hdr.length, end - pos + hdr.length);
1515 end = pos + hdr.length;
1534 if (asn1_get_next(pos, end - pos, &hdr) < 0 ||
1535 hdr.class != ASN1_CLASS_UNIVERSAL ||
1536 hdr.tag != ASN1_TAG_BITSTRING) {
1539 hdr.class, hdr.tag);
1543 if (hdr.length < 1) {
1547 pos = hdr.payload;
1559 cert->sign_value = os_malloc(hdr.length - 1);
1566 os_memcpy(cert->sign_value, pos + 1, hdr.length - 1);
1567 cert->sign_value_len = hdr.length - 1;
1589 struct asn1_hdr hdr;
1639 if (asn1_get_next(data, data_len, &hdr) < 0 ||
1640 hdr.class != ASN1_CLASS_UNIVERSAL ||
1641 hdr.tag != ASN1_TAG_SEQUENCE) {
1644 hdr.class, hdr.tag);
1649 pos = hdr.payload;
1650 end = pos + hdr.length;
1660 if (asn1_get_next(pos, end - pos, &hdr) < 0 ||
1661 hdr.class != ASN1_CLASS_UNIVERSAL ||
1662 hdr.tag != ASN1_TAG_SEQUENCE) {
1665 hdr.class, hdr.tag);
1669 da_end = hdr.payload + hdr.length;
1671 if (asn1_get_oid(hdr.payload, hdr.length, &oid, &next)) {
1734 if (asn1_get_next(pos, end - pos, &hdr) < 0 ||
1735 hdr.class != ASN1_CLASS_UNIVERSAL ||
1736 hdr.tag != ASN1_TAG_OCTETSTRING) {
1739 hdr.class, hdr.tag);
1744 hdr.payload, hdr.length);
1778 if (hdr.length != hash_len ||
1779 os_memcmp_const(hdr.payload, hash, hdr.length) != 0) {
1786 if (hdr.payload + hdr.length < data + data_len) {
1789 hdr.payload + hdr.length,
1790 data + data_len - hdr.payload - hdr.length);