From bc6e45ab3b3847bd87f44aa0c8a203deb5ef005a Mon Sep 17 00:00:00 2001 From: Sam Kenny <968135+sammiq@users.noreply.github.com> Date: Thu, 6 Oct 2022 14:52:01 +1100 Subject: [PATCH] fix secure1 secondary key calc (#6149) --- src/core/file_sys/ncch_container.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/core/file_sys/ncch_container.cpp b/src/core/file_sys/ncch_container.cpp index 7ba5fec3f..540f16e78 100644 --- a/src/core/file_sys/ncch_container.cpp +++ b/src/core/file_sys/ncch_container.cpp @@ -247,7 +247,12 @@ Loader::ResultStatus NCCHContainer::Load() { switch (ncch_header.secondary_key_slot) { case 0: LOG_DEBUG(Service_FS, "Secure1 crypto"); - secondary_key = primary_key; + SetKeyY(KeySlotID::NCCHSecure1, key_y_secondary); + if (!IsNormalKeyAvailable(KeySlotID::NCCHSecure1)) { + LOG_ERROR(Service_FS, "Secure1 KeyX missing"); + failed_to_decrypt = true; + } + secondary_key = GetNormalKey(KeySlotID::NCCHSecure1); break; case 1: LOG_DEBUG(Service_FS, "Secure2 crypto");