From: chaoskagami Date: Sat, 30 Jul 2016 03:03:21 +0000 (-0400) Subject: Checkpoint, to the other branches X-Git-Tag: v0.3.0~66^2~1^2~6 X-Git-Url: https://chaos.moe/g/?a=commitdiff_plain;h=fb06cafc0d9506ac5f33b1f45cada8d4b68fcdca;p=corbenik%2Fcorbenik.git Checkpoint, to the other branches --- diff --git a/source/firm/decryptor.c b/source/firm/decryptor.c index 367e8fc..9a45018 100644 --- a/source/firm/decryptor.c +++ b/source/firm/decryptor.c @@ -46,9 +46,9 @@ cbc_decrypt(void *inbuf, void *outbuf, size_t size, uint32_t mode, uint8_t *iv) size_t current_blocks = blocks > 0xFFFF ? 0xFFFF : blocks; - aes_decrypt(in, out, current_blocks, mode); + memcpy(iv, &in[(current_blocks - 1) * AES_BLOCK_SIZE], AES_BLOCK_SIZE); - memcpy(iv, out + (current_blocks - 1) * AES_BLOCK_SIZE, AES_BLOCK_SIZE); + aes_decrypt(in, out, current_blocks, mode); blocks -= current_blocks; in += AES_BLOCK_SIZE * current_blocks;