Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions boot/bootutil/src/encrypted.c
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,13 @@ boot_enc_set_key(struct enc_key_data *enc_state, const uint8_t *key)
{
int rc;

/* This should not be in production code; there should be no path
* where we set the key twice, without dropping the context first.
*/
if (enc_state->valid == 1) {
BOOT_LOG_DBG("boot_enc_set_key: key allready set (%p)", enc_state);
return -2;
}
rc = bootutil_aes_ctr_set_key(&enc_state->aes_ctr, key);
if (rc != 0) {
boot_enc_drop(enc_state);
Expand Down
Loading