exo2: fix bugs in Cmac and DeviceId calculation

This commit is contained in:
Michael Scire 2020-05-16 11:59:16 -07:00 committed by SciresM
parent bb3a8a888f
commit a0b08d0540
2 changed files with 4 additions and 4 deletions

View file

@ -200,7 +200,7 @@ namespace ams::fuse {
void GetEcid(br::BootEcid *out) { void GetEcid(br::BootEcid *out) {
/* Get the registers. */ /* Get the registers. */
const volatile auto &chip = GetChipRegisters(); volatile auto &chip = GetChipRegisters();
/* Read the ecid components. */ /* Read the ecid components. */
const u32 vendor = reg::Read(chip.FUSE_OPT_VENDOR_CODE) & ((1u << 4) - 1); const u32 vendor = reg::Read(chip.FUSE_OPT_VENDOR_CODE) & ((1u << 4) - 1);
@ -224,7 +224,7 @@ namespace ams::fuse {
u64 GetDeviceId() { u64 GetDeviceId() {
/* Get the registers. */ /* Get the registers. */
const volatile auto &chip = GetChipRegisters(); volatile auto &chip = GetChipRegisters();
/* Read the device id components. */ /* Read the device id components. */
/* NOTE: Device ID is "basically" just an alternate encoding of Ecid. */ /* NOTE: Device ID is "basically" just an alternate encoding of Ecid. */

View file

@ -181,7 +181,7 @@ namespace ams::se {
u8 prev = 0; u8 prev = 0;
for (int i = AesBlockSize - 1; i >= 0; --i) { for (int i = AesBlockSize - 1; i >= 0; --i) {
const u8 top = (subkey[i] >> 7); const u8 top = (subkey[i] >> 7);
subkey[i] = ((subkey[i] << 1) | top); subkey[i] = ((subkey[i] << 1) | prev);
prev = top; prev = top;
} }
@ -220,7 +220,7 @@ namespace ams::se {
ExpandSubkey(subkey); ExpandSubkey(subkey);
/* Account for last block. */ /* Account for last block. */
if (last_block_size) { if (last_block_size != AesBlockSize) {
ExpandSubkey(subkey); ExpandSubkey(subkey);
} }
} }