bool asn1_peek(struct asn1_data *data, void *p, int len)
{
	if (data->has_error)
		return false;

	if (len < 0 || data->ofs + len < data->ofs || data->ofs + len < len)
		return false;

	if (data->ofs + len > data->length) {
		/* we need to mark the buffer as consumed, so the caller knows
		   this was an out of data error, and not a decode error */
		data->ofs = data->length;
		return false;
	}

	memcpy(p, data->data + data->ofs, len);
	return true;
}
bool asn1_peek(struct asn1_data *data, void *p, int len)
{
	if (data->has_error)
		return false;

	if (len < 0 || data->ofs + len < data->ofs || data->ofs + len < len)
		return false;

	if (data->ofs + len > data->length) {
		 
		data->ofs = data->length;
		return false;
	}

	memcpy(p, data->data + data->ofs, len);
	return true;
}