mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-18 03:31:31 +12:00
[NCCH loader] Fix crypto check
This commit is contained in:
parent
ea4b812765
commit
cba1b9f39b
1 changed files with 8 additions and 8 deletions
|
@ -54,14 +54,6 @@ bool NCCH::loadFromHeader(Crypto::AESEngine &aesEngine, IOFile& file, const FSIn
|
||||||
romFS.hashRegionSize = u64(*(u32*)&header[0x1B8]) * mediaUnit;
|
romFS.hashRegionSize = u64(*(u32*)&header[0x1B8]) * mediaUnit;
|
||||||
|
|
||||||
if (encrypted) {
|
if (encrypted) {
|
||||||
if (!aesEngine.haveKeys()) {
|
|
||||||
Helpers::panic(
|
|
||||||
"Loaded an encrypted ROM but AES keys don't seem to have been provided correctly! Navigate to the emulator's\n"
|
|
||||||
"app data folder and make sure you have a sysdata directory with a file called aes_keys.txt which contains your keys!"
|
|
||||||
);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Crypto::AESKey primaryKeyY;
|
Crypto::AESKey primaryKeyY;
|
||||||
Crypto::AESKey secondaryKeyY;
|
Crypto::AESKey secondaryKeyY;
|
||||||
std::memcpy(primaryKeyY.data(), header, primaryKeyY.size());
|
std::memcpy(primaryKeyY.data(), header, primaryKeyY.size());
|
||||||
|
@ -128,6 +120,14 @@ bool NCCH::loadFromHeader(Crypto::AESEngine &aesEngine, IOFile& file, const FSIn
|
||||||
}
|
}
|
||||||
// If it's truly encrypted, we need to read section again.
|
// If it's truly encrypted, we need to read section again.
|
||||||
if (encrypted) {
|
if (encrypted) {
|
||||||
|
if (!aesEngine.haveKeys()) {
|
||||||
|
Helpers::panic(
|
||||||
|
"Loaded an encrypted ROM but AES keys don't seem to have been provided correctly! Navigate to the emulator's\n"
|
||||||
|
"app data folder and make sure you have a sysdata directory with a file called aes_keys.txt which contains your keys!"
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
auto [success, bytes] = readFromFile(file, exheaderInfo, &exheader[0], 0, exheaderSize);
|
auto [success, bytes] = readFromFile(file, exheaderInfo, &exheader[0], 0, exheaderSize);
|
||||||
if (!success || bytes != exheaderSize) {
|
if (!success || bytes != exheaderSize) {
|
||||||
printf("Failed to read Extended NCCH header\n");
|
printf("Failed to read Extended NCCH header\n");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue