mirror of
https://github.com/SciresM/hactool
synced 2025-02-16 19:28:23 +00:00
Fix NAX0 decryption
Decryption would fail because the encrypted file wasn't always a multiple of the encryption sector length. This makes sure the data to be decrypted is a multiple of the sector length.
This commit is contained in:
parent
42849efaa4
commit
1856b5db23
1 changed files with 3 additions and 2 deletions
5
nax0.c
5
nax0.c
|
@ -129,8 +129,9 @@ void nax0_save(nax0_ctx_t *ctx) {
|
|||
fprintf(stderr, "Failed to read file!\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
aes_xts_decrypt(ctx->aes_ctx, buf, buf, read_size, (ofs - 0x4000) >> 14, 0x4000);
|
||||
|
||||
uint64_t dec_size = (read_size + 0x3FFF) & ~0x3FFF;
|
||||
aes_xts_decrypt(ctx->aes_ctx, buf, buf, dec_size, (ofs - 0x4000) >> 14, 0x4000);
|
||||
|
||||
if (fwrite(buf, 1, read_size, f_dec) != read_size) {
|
||||
fprintf(stderr, "Failed to write file!\n");
|
||||
|
|
Loading…
Add table
Reference in a new issue