/* Finds the TLVs in the specified image slot, if any.  */
static int img_mgmt_find_tlvs(int slot, size_t *start_off, size_t *end_off, uint16_t magic)
/* Finds the TLVs in the specified image slot, if any.  */
static int img_mgmt_find_tlvs(int slot, size_t *start_off, size_t *end_off, uint16_t magic)
{
	struct image_tlv_info tlv_info;
	int rc;
	rc = img_mgmt_read(slot, *start_off, &tlv_info, sizeof(tlv_info));
	if (rc != 0) {
		return rc;
	}
	if (tlv_info.it_magic != magic) {
		return IMG_MGMT_ERR_NO_TLVS;
	}
	*start_off += sizeof(tlv_info);
	*end_off = *start_off + tlv_info.it_tlv_tot;
	return IMG_MGMT_ERR_OK;
}