Skip to content

Commit

Permalink
Key 0x2C is different per platform (d0k3#842)
Browse files Browse the repository at this point in the history
Change KeyY to generate same KeyNormal on dev
  • Loading branch information
luigoalma authored and MisterSheeple committed Apr 19, 2024
1 parent d38323a commit 1d7976b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions arm9/source/crypto/keydb.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,13 @@ u32 GetUnitKeysType(void)
}

void CryptAesKeyInfo(AesKeyInfo* info) {
static u8 zeroes[16] = { 0 };
static const u8 zeros[16] = { 0 };
static const u8 keyY_dev[16] = {
0xA2, 0x32, 0x4A, 0x7E, 0x7C, 0xE6, 0x1A, 0x9A, 0x45, 0x4A, 0x52, 0x19, 0xB3, 0x5B, 0xE9, 0x3B };
const u8* aeskeyY = GetUnitKeysType() == KEYS_DEVKIT ? &keyY_dev[0] : &zeros[0];
u8 ctr[16] = { 0 };
memcpy(ctr, (void*) info, 12); // CTR -> slot + type + id + zeroes
setup_aeskeyY(0x2C, zeroes);
setup_aeskeyY(0x2C, aeskeyY);
use_aeskey(0x2C);
set_ctr(ctr);
aes_decrypt(info->key, info->key, 1, AES_CNT_CTRNAND_MODE);
Expand Down

0 comments on commit 1d7976b

Please sign in to comment.