boot: Change boot_enc_load to take slot number instead of image
In all cases where boot_enc_load is called it is known what slot
is addressed, so it is better to just pass the slot number
instead of making the boot_enc_load figure out slot number from
image index and provided flash area object.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
diff --git a/boot/bootutil/src/encrypted.c b/boot/bootutil/src/encrypted.c
index 09b9a78..f3516ac 100644
--- a/boot/bootutil/src/encrypted.c
+++ b/boot/bootutil/src/encrypted.c
@@ -607,7 +607,7 @@
* Load encryption key.
*/
int
-boot_enc_load(struct enc_key_data *enc_state, int image_index,
+boot_enc_load(struct enc_key_data *enc_state, int slot,
const struct image_header *hdr, const struct flash_area *fap,
struct boot_status *bs)
{
@@ -619,15 +619,8 @@
#else
uint8_t buf[EXPECTED_ENC_LEN];
#endif
- uint8_t slot;
int rc;
- rc = flash_area_id_to_multi_image_slot(image_index, flash_area_get_id(fap));
- if (rc < 0) {
- return rc;
- }
- slot = rc;
-
/* Already loaded... */
if (enc_state[slot].valid) {
return 1;