/* Finds image given hash of the image. Returns the slot number image is in, or -1 if not found.  */
int img_mgmt_find_by_hash(uint8_t *find, struct image_version *ver)
/* Finds image given hash of the image. Returns the slot number image is in, or -1 if not found.  */
int img_mgmt_find_by_hash(uint8_t *find, struct image_version *ver)
{
	int i;
	uint8_t hash[IMAGE_HASH_LEN];
	for (i = 0; i < 2 * CONFIG_MCUMGR_GRP_IMG_UPDATABLE_IMAGE_NUMBER; i++) {
		if (img_mgmt_read_info(i, ver, hash, NULL) != 0) {
			continue;
		}
		if (!memcmp(hash, find, IMAGE_HASH_LEN)) {
			return i;
		}
	}
	return -1;
}