From 01b14c647618b3dd95ba6e3df1230c145d776782 Mon Sep 17 00:00:00 2001 From: Alex Barney Date: Tue, 19 Feb 2019 13:46:29 -0600 Subject: [PATCH] tsec_root_keys starts counting at 0, not 6 --- src/LibHac.Nand/Nand.cs | 2 +- src/LibHac/Keyset.cs | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/LibHac.Nand/Nand.cs b/src/LibHac.Nand/Nand.cs index 23334077..5ef87f82 100644 --- a/src/LibHac.Nand/Nand.cs +++ b/src/LibHac.Nand/Nand.cs @@ -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"), diff --git a/src/LibHac/Keyset.cs b/src/LibHac/Keyset.cs index a82a3fae..9dbdb078 100644 --- a/src/LibHac/Keyset.cs +++ b/src/LibHac/Keyset.cs @@ -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++)