nyx: Do not over decrypt pkg1 on t210b01

This commit is contained in:
CTCaer 2021-01-11 23:28:06 +02:00
parent 2370ca0a44
commit 7aa1e77642
3 changed files with 5 additions and 2 deletions

View file

@ -970,6 +970,7 @@ int hos_launch(ini_sec_t *cfg)
}
// Patch kip1s in memory if needed.
if (ctxt.kip1_patches)
gfx_printf("%kPatching kips%k\n", 0xFFFFBA00, 0xFFCCCCCC);
const char* unappliedPatch = pkg2_patch_kips(&kip1_info, ctxt.kip1_patches);
if (unappliedPatch != NULL)

View file

@ -211,6 +211,7 @@ int pkg1_decrypt(const pkg1_id_t *id, u8 *pkg1)
hdr = (pk11_hdr_t *)(pkg1 + id->pkg11_off + 0x20);
// Use BEK for T210B01.
// Additionally, skip 0x20 bytes from decryption to maintain the header.
se_aes_iv_clear(13);
se_aes_crypt_cbc(13, 0, pkg1 + 0x20, oem_hdr->size - 0x20, pkg1 + 0x20, oem_hdr->size - 0x20);
}

View file

@ -94,8 +94,9 @@ int pkg1_decrypt(const pkg1_id_t *id, u8 *pkg1)
hdr = (pk11_hdr_t *)(pkg1 + id->pkg11_off + 0x20);
// Use BEK for T210B01.
// Additionally, skip 0x20 bytes from decryption to maintain the header.
se_aes_iv_clear(13);
se_aes_crypt_cbc(13, 0, pkg1 + 0x20, oem_hdr->size, pkg1 + 0x20, oem_hdr->size);
se_aes_crypt_cbc(13, 0, pkg1 + 0x20, oem_hdr->size - 0x20, pkg1 + 0x20, oem_hdr->size - 0x20);
}
// Return if header is valid.