From cfadea2994424ad68d93cb0a2d0ef83e18c335fc Mon Sep 17 00:00:00 2001 From: jakcron Date: Sun, 22 Sep 2024 23:46:52 +0800 Subject: [PATCH] Fix bug where KeyAreaEncryptionKeys were not calcd --- src/KeyBag.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/KeyBag.cpp b/src/KeyBag.cpp index 11df8de..a3ae08d 100644 --- a/src/KeyBag.cpp +++ b/src/KeyBag.cpp @@ -421,7 +421,7 @@ void nstool::KeyBagInitializer::importBaseKeyFile(const tc::io::Path& keyfile_pa for (size_t keak_idx = 0; keak_idx < pie::hac::nca::kKeyAreaEncryptionKeyNum; keak_idx++) { - if (key_area_key_source[keak_idx].isSet() && nca_key_area_encryption_key[keak_idx].find(itr->first) != nca_key_area_encryption_key[keak_idx].end()) + if (key_area_key_source[keak_idx].isSet() && nca_key_area_encryption_key[keak_idx].find(itr->first) == nca_key_area_encryption_key[keak_idx].end()) { aes128_key_t nca_key_area_encryption_key_tmp; pie::hac::AesKeygen::generateKey(nca_key_area_encryption_key_tmp.data(), aes_kek_generation_source.get().data(), key_area_key_source[keak_idx].get().data(), aes_key_generation_source.get().data(), itr->second.data());