mirror of https://github.com/wolfSSL/wolfBoot.git
Fixed bug in encrypted-delta update
parent
96903270bd
commit
88a48e5332
|
@ -254,13 +254,18 @@ static int wolfBoot_delta_update(struct wolfBoot_image *boot,
|
|||
if (ret > 0) {
|
||||
#ifdef EXT_ENCRYPTED
|
||||
uint32_t iv_counter = sector * WOLFBOOT_SECTOR_SIZE + len;
|
||||
int wr_ret;
|
||||
iv_counter /= ENCRYPT_BLOCK_SIZE;
|
||||
/* Encrypt + send */
|
||||
crypto_set_iv(nonce, iv_counter);
|
||||
crypto_encrypt(enc_blk, delta_blk, ret);
|
||||
ret = ext_flash_write(
|
||||
wr_ret = ext_flash_write(
|
||||
(uint32_t)(WOLFBOOT_PARTITION_SWAP_ADDRESS + len),
|
||||
enc_blk, ret);
|
||||
if (wr_ret < 0) {
|
||||
ret = wr_ret;
|
||||
goto out;
|
||||
}
|
||||
#else
|
||||
wb_flash_write(swap, len, delta_blk, ret);
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue