Remove function that marks encr keys invalid
Just use existing zeroize function, which also takes care of zeroing out
the encryption key data.
Signed-off-by: Fabio Utzig <utzig@apache.org>
diff --git a/boot/bootutil/src/encrypted.c b/boot/bootutil/src/encrypted.c
index c2c656d..72e1481 100644
--- a/boot/bootutil/src/encrypted.c
+++ b/boot/bootutil/src/encrypted.c
@@ -321,17 +321,6 @@
}
void
-boot_enc_mark_keys_invalid(struct enc_key_data *enc_state)
-{
- size_t slot;
-
- for (slot = 0; slot < BOOT_NUM_SLOTS; ++slot) {
- memset(&enc_state[slot].aes, 0, sizeof(enc_state[slot].aes));
- enc_state[slot].valid = 0;
- }
-}
-
-void
boot_encrypt(struct enc_key_data *enc_state, int image_index,
const struct flash_area *fap, uint32_t off, uint32_t sz,
uint32_t blk_off, uint8_t *buf)
@@ -382,7 +371,8 @@
/**
* Clears encrypted state after use.
*/
-void boot_enc_zeroize(struct enc_key_data *enc_state)
+void
+boot_enc_zeroize(struct enc_key_data *enc_state)
{
memset(enc_state, 0, sizeof(struct enc_key_data) * BOOT_NUM_SLOTS);
}
diff --git a/boot/bootutil/src/loader.c b/boot/bootutil/src/loader.c
index 95bf878..15cefb3 100644
--- a/boot/bootutil/src/loader.c
+++ b/boot/bootutil/src/loader.c
@@ -2284,7 +2284,7 @@
* another images). Therefore, mark them as invalid to force their reload
* by boot_enc_load().
*/
- boot_enc_mark_keys_invalid(state->enc);
+ boot_enc_zeroize(state->enc);
#endif
image_index = BOOT_CURR_IMG(state);
@@ -2330,7 +2330,7 @@
* another images). Therefore, mark them as invalid to force their reload
* by boot_enc_load().
*/
- boot_enc_mark_keys_invalid(state->enc);
+ boot_enc_zeroize(state->enc);
#endif /* MCUBOOT_ENC_IMAGES */
/* Indicate that swap is not aborted */