Lines Matching full:cursor

71 	__inout		efx_asn1_cursor_t	*cursor,  in efx_asn1_parse_header_match_tag()  argument
76 if (cursor == NULL || cursor->buffer == NULL || cursor->length < 2) { in efx_asn1_parse_header_match_tag()
81 cursor->tag = cursor->buffer[0]; in efx_asn1_parse_header_match_tag()
82 if (cursor->tag != tag) { in efx_asn1_parse_header_match_tag()
88 if ((cursor->tag & 0x1F) == 0x1F) { in efx_asn1_parse_header_match_tag()
94 if ((cursor->buffer[1] & 0x80) == 0) { in efx_asn1_parse_header_match_tag()
96 cursor->hdr_size = 2; in efx_asn1_parse_header_match_tag()
97 cursor->val_size = cursor->buffer[1]; in efx_asn1_parse_header_match_tag()
100 uint32_t nbytes = cursor->buffer[1] & 0x7F; in efx_asn1_parse_header_match_tag()
108 if (2 + nbytes > cursor->length) { in efx_asn1_parse_header_match_tag()
118 cursor->hdr_size = 2 + nbytes; in efx_asn1_parse_header_match_tag()
119 cursor->val_size = 0; in efx_asn1_parse_header_match_tag()
120 for (offset = 2; offset < cursor->hdr_size; offset++) { in efx_asn1_parse_header_match_tag()
121 cursor->val_size = in efx_asn1_parse_header_match_tag()
122 (cursor->val_size << 8) | cursor->buffer[offset]; in efx_asn1_parse_header_match_tag()
126 if ((cursor->hdr_size + cursor->val_size) > cursor->length) { in efx_asn1_parse_header_match_tag()
155 __inout efx_asn1_cursor_t *cursor, in efx_asn1_enter_tag() argument
160 if (cursor == NULL) { in efx_asn1_enter_tag()
170 rc = efx_asn1_parse_header_match_tag(cursor, tag); in efx_asn1_enter_tag()
176 /* Limit cursor range to nested TLV */ in efx_asn1_enter_tag()
177 cursor->buffer += cursor->hdr_size; in efx_asn1_enter_tag()
178 cursor->length = cursor->val_size; in efx_asn1_enter_tag()
194 * Advance cursor to next TLV on a successful match.
198 __inout efx_asn1_cursor_t *cursor, in efx_asn1_match_tag_value() argument
205 if (cursor == NULL) { in efx_asn1_match_tag_value()
209 rc = efx_asn1_parse_header_match_tag(cursor, tag); in efx_asn1_match_tag_value()
214 if (cursor->val_size != val_size) { in efx_asn1_match_tag_value()
219 if (memcmp(cursor->buffer + cursor->hdr_size, valp, val_size) != 0) { in efx_asn1_match_tag_value()
224 cursor->buffer += cursor->hdr_size + cursor->val_size; in efx_asn1_match_tag_value()
225 cursor->length -= cursor->hdr_size + cursor->val_size; in efx_asn1_match_tag_value()
241 /* Advance cursor to next TLV */
244 __inout efx_asn1_cursor_t *cursor, in efx_asn1_skip_tag() argument
249 if (cursor == NULL) { in efx_asn1_skip_tag()
254 rc = efx_asn1_parse_header_match_tag(cursor, tag); in efx_asn1_skip_tag()
259 cursor->buffer += cursor->hdr_size + cursor->val_size; in efx_asn1_skip_tag()
260 cursor->length -= cursor->hdr_size + cursor->val_size; in efx_asn1_skip_tag()
275 __inout efx_asn1_cursor_t *cursor, in efx_asn1_get_tag_value() argument
282 if (cursor == NULL || valp == NULL || val_sizep == NULL) { in efx_asn1_get_tag_value()
287 rc = efx_asn1_parse_header_match_tag(cursor, tag); in efx_asn1_get_tag_value()
292 *valp = cursor->buffer + cursor->hdr_size; in efx_asn1_get_tag_value()
293 *val_sizep = cursor->val_size; in efx_asn1_get_tag_value()
334 efx_asn1_cursor_t cursor; in efx_check_signed_image_header() local
343 cursor.buffer = (uint8_t *)bufferp; in efx_check_signed_image_header()
344 cursor.length = buffer_size; in efx_check_signed_image_header()
347 rc = efx_asn1_enter_tag(&cursor, ASN1_TAG_SEQUENCE); in efx_check_signed_image_header()
352 rc = efx_asn1_match_tag_value(&cursor, ASN1_TAG_OBJ_ID, in efx_check_signed_image_header()
358 rc = efx_asn1_enter_tag(&cursor, ASN1_TAG_CONS_CONTEXT(0)); in efx_check_signed_image_header()
363 rc = efx_asn1_enter_tag(&cursor, ASN1_TAG_SEQUENCE); in efx_check_signed_image_header()
368 rc = efx_asn1_match_tag_value(&cursor, ASN1_TAG_INTEGER, in efx_check_signed_image_header()
374 rc = efx_asn1_skip_tag(&cursor, ASN1_TAG_SET); in efx_check_signed_image_header()
379 rc = efx_asn1_enter_tag(&cursor, ASN1_TAG_SEQUENCE); in efx_check_signed_image_header()
384 rc = efx_asn1_match_tag_value(&cursor, ASN1_TAG_OBJ_ID, in efx_check_signed_image_header()
390 rc = efx_asn1_enter_tag(&cursor, ASN1_TAG_CONS_CONTEXT(0)); in efx_check_signed_image_header()
400 rc = efx_asn1_get_tag_value(&cursor, ASN1_TAG_OCTET_STRING, in efx_check_signed_image_header()