tsec_root_keys starts counting at 0, not 6

This commit is contained in:
Alex Barney 2019-02-19 13:46:29 -06:00
parent 8d1c5449d1
commit 01b14c6476
2 changed files with 4 additions and 6 deletions

View file

@ -24,7 +24,7 @@ namespace LibHac.Nand
GuidPartitionInfo[] partitions = disc.Partitions.Select(x => (GuidPartitionInfo)x).ToArray();
ProdInfo = partitions.FirstOrDefault(x => x.Name == "PRODINFO");
ProdInfoF = partitions.FirstOrDefault(x => x.Name == "PRODINFOF");
Package2 = new GuidPartitionInfo[]
Package2 = new[]
{
partitions.FirstOrDefault(x => x.Name == "BCPKG2-1-Normal-Main"),
partitions.FirstOrDefault(x => x.Name == "BCPKG2-2-Normal-Sub"),

View file

@ -213,9 +213,9 @@ namespace LibHac
{
for (int i = UsedKeyblobCount; i < 0x20; i++)
{
if (TsecRootKeys[i].IsEmpty() || MasterKekSources[i].IsEmpty()) continue;
if (TsecRootKeys[i - UsedKeyblobCount].IsEmpty() || MasterKekSources[i].IsEmpty()) continue;
Crypto.DecryptEcb(TsecRootKeys[i], MasterKekSources[i], MasterKeks[i], 0x10);
Crypto.DecryptEcb(TsecRootKeys[i - UsedKeyblobCount], MasterKekSources[i], MasterKeks[i], 0x10);
}
}
@ -570,9 +570,7 @@ namespace LibHac
new KeyValue("ssl_rsa_kek", 0x10, 120, set => set.SslRsaKek),
new KeyValue("xci_header_key", 0x10, 130, set => set.XciHeaderKey),
new KeyValue("header_key", 0x20, 220, set => set.HeaderKey),
new KeyValue("tsec_root_key", 0x10, -1, set => set.TsecRootKeys[6])
new KeyValue("header_key", 0x20, 220, set => set.HeaderKey)
};
for (int slot = 0; slot < 0x20; slot++)