Lines Matching refs:hdr
25 static int asn1_valid_der_boolean(struct asn1_hdr *hdr)
28 if (hdr->length != 1) {
30 hdr->length);
34 if (hdr->payload[0] != 0 && hdr->payload[0] != 0xff) {
37 hdr->payload[0]);
45 static int asn1_valid_der(struct asn1_hdr *hdr)
47 if (hdr->class != ASN1_CLASS_UNIVERSAL)
49 if (hdr->tag == ASN1_TAG_BOOLEAN && !asn1_valid_der_boolean(hdr))
55 int asn1_get_next(const u8 *buf, size_t len, struct asn1_hdr *hdr)
60 os_memset(hdr, 0, sizeof(*hdr));
68 hdr->identifier = *pos++;
69 hdr->class = hdr->identifier >> 6;
70 hdr->constructed = !!(hdr->identifier & (1 << 5));
72 if ((hdr->identifier & 0x1f) == 0x1f) {
73 hdr->tag = 0;
83 hdr->tag = (hdr->tag << 7) | (tmp & 0x7f);
86 hdr->tag = hdr->identifier & 0x1f;
100 hdr->length = 0;
111 hdr->length = (hdr->length << 8) | *pos++;
115 hdr->length = tmp;
118 if (end < pos || hdr->length > (unsigned int) (end - pos)) {
123 hdr->payload = pos;
125 return asn1_valid_der(hdr) ? 0 : -1;
176 struct asn1_hdr hdr;
178 if (asn1_get_next(buf, len, &hdr) < 0 || hdr.length == 0)
181 if (hdr.class != ASN1_CLASS_UNIVERSAL || hdr.tag != ASN1_TAG_OID) {
183 "tag 0x%x", hdr.class, hdr.tag);
187 *next = hdr.payload + hdr.length;
189 return asn1_parse_oid(hdr.payload, hdr.length, oid);