Skip to content

Commit

Permalink
Sanity check: Assert .code is encrypted before setting normal key
Browse files Browse the repository at this point in the history
  • Loading branch information
wheremyfoodat committed Jul 11, 2024
1 parent 096d0a8 commit e608436
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/loader/ncch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@ bool NCCH::loadFromHeader(Crypto::AESEngine &aesEngine, IOFile& file, const FSIn
// All files in ExeFS use the same IV, though .code uses the secondary key for decryption
// whereas .icon/.banner use the primary key.
FSInfo info = exeFS;
if (secondaryKey.has_value() && info.encryptionInfo.has_value()) {
info.encryptionInfo->normalKey = secondaryKey.value();
if (encrypted && secondaryKey.has_value() && info.encryptionInfo.has_value()) {
info.encryptionInfo->normalKey = *secondaryKey;
}

if (compressCode) {
Expand Down

0 comments on commit e608436

Please sign in to comment.