mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-16 11:52:44 +01:00
parent
e9eb3f3799
commit
d3f328ee45
7 changed files with 25 additions and 30 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -4,7 +4,6 @@
|
||||||
# Build directory
|
# Build directory
|
||||||
[Bb]uild*/
|
[Bb]uild*/
|
||||||
doc-build/
|
doc-build/
|
||||||
cmake-build*/
|
|
||||||
|
|
||||||
# Generated source files
|
# Generated source files
|
||||||
src/common/scm_rev.cpp
|
src/common/scm_rev.cpp
|
||||||
|
|
|
@ -648,14 +648,14 @@ void KeyManager::ReloadKeys() {
|
||||||
|
|
||||||
if (Settings::values.use_dev_keys) {
|
if (Settings::values.use_dev_keys) {
|
||||||
dev_mode = true;
|
dev_mode = true;
|
||||||
LoadFromFile(suyu_keys_dir / "dev.keys", 1);
|
LoadFromFile(suyu_keys_dir / "dev.keys", false);
|
||||||
} else {
|
} else {
|
||||||
dev_mode = false;
|
dev_mode = false;
|
||||||
LoadFromFile(suyu_keys_dir / "prod.keys", 2);
|
LoadFromFile(suyu_keys_dir / "prod.keys", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
LoadFromFile(suyu_keys_dir / "title.keys", 3);
|
LoadFromFile(suyu_keys_dir / "title.keys", true);
|
||||||
LoadFromFile(suyu_keys_dir / "console.keys", 4);
|
LoadFromFile(suyu_keys_dir / "console.keys", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool ValidCryptoRevisionString(std::string_view base, size_t begin, size_t length) {
|
static bool ValidCryptoRevisionString(std::string_view base, size_t begin, size_t length) {
|
||||||
|
@ -666,26 +666,11 @@ static bool ValidCryptoRevisionString(std::string_view base, size_t begin, size_
|
||||||
[](u8 c) { return std::isxdigit(c); });
|
[](u8 c) { return std::isxdigit(c); });
|
||||||
}
|
}
|
||||||
|
|
||||||
void KeyManager::LoadFromFile(const std::filesystem::path& file_path, int key_type) {
|
void KeyManager::LoadFromFile(const std::filesystem::path& file_path, bool is_title_keys) {
|
||||||
if (!Common::FS::Exists(file_path)) {
|
if (!Common::FS::Exists(file_path)) {
|
||||||
switch (key_type) {
|
LOG_ERROR(Crypto, "Failed to load key file at '{}': File not found",
|
||||||
case 1:
|
file_path.generic_string());
|
||||||
LOG_ERROR(Crypto, "Issue with Development key file at '{}': File not found",
|
return;
|
||||||
file_path.generic_string());
|
|
||||||
return;
|
|
||||||
case 2:
|
|
||||||
LOG_ERROR(Crypto, "Issue with Production key file at '{}': File not found",
|
|
||||||
file_path.generic_string());
|
|
||||||
return;
|
|
||||||
case 3:
|
|
||||||
LOG_INFO(Crypto, "Issue with Title key file at '{}': File not found",
|
|
||||||
file_path.generic_string());
|
|
||||||
case 4:
|
|
||||||
LOG_INFO(Crypto, "Issue with Console key file at '{}': File not found",
|
|
||||||
file_path.generic_string());
|
|
||||||
default:
|
|
||||||
LOG_ERROR(Crypto, "Unknown Key Type");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ifstream file;
|
std::ifstream file;
|
||||||
|
|
|
@ -312,7 +312,7 @@ private:
|
||||||
RSAKeyPair<2048> eticket_rsa_keypair{};
|
RSAKeyPair<2048> eticket_rsa_keypair{};
|
||||||
|
|
||||||
bool dev_mode;
|
bool dev_mode;
|
||||||
void LoadFromFile(const std::filesystem::path& file_path, int key_type);
|
void LoadFromFile(const std::filesystem::path& file_path, bool is_title_keys);
|
||||||
|
|
||||||
void DeriveGeneralPurposeKeys(std::size_t crypto_revision);
|
void DeriveGeneralPurposeKeys(std::size_t crypto_revision);
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,10 @@ AppLoader_NAX::LoadResult AppLoader_NAX::Load(Kernel::KProcess& process, Core::S
|
||||||
return {ResultStatus::ErrorMissingProductionKeyFile, {}};
|
return {ResultStatus::ErrorMissingProductionKeyFile, {}};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!Core::Crypto::KeyManager::KeyFileExists(true)) {
|
||||||
|
return {ResultStatus::ErrorMissingProductionKeyFile, {}};
|
||||||
|
}
|
||||||
|
|
||||||
return {ResultStatus::ErrorNAXInconvertibleToNCA, {}};
|
return {ResultStatus::ErrorNAXInconvertibleToNCA, {}};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -102,6 +102,10 @@ AppLoader_NSP::LoadResult AppLoader_NSP::Load(Kernel::KProcess& process, Core::S
|
||||||
return {ResultStatus::ErrorMissingProductionKeyFile, {}};
|
return {ResultStatus::ErrorMissingProductionKeyFile, {}};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!Core::Crypto::KeyManager::KeyFileExists(true)) {
|
||||||
|
return {ResultStatus::ErrorMissingProductionKeyFile, {}};
|
||||||
|
}
|
||||||
|
|
||||||
return {ResultStatus::ErrorNSPMissingProgramNCA, {}};
|
return {ResultStatus::ErrorNSPMissingProgramNCA, {}};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,6 +71,10 @@ AppLoader_XCI::LoadResult AppLoader_XCI::Load(Kernel::KProcess& process, Core::S
|
||||||
return {ResultStatus::ErrorMissingProductionKeyFile, {}};
|
return {ResultStatus::ErrorMissingProductionKeyFile, {}};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!xci->HasProgramNCA() && !Core::Crypto::KeyManager::KeyFileExists(true)) {
|
||||||
|
return {ResultStatus::ErrorMissingProductionKeyFile, {}};
|
||||||
|
}
|
||||||
|
|
||||||
const auto result = nca_loader->Load(process, system);
|
const auto result = nca_loader->Load(process, system);
|
||||||
if (result.first != ResultStatus::Success) {
|
if (result.first != ResultStatus::Success) {
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -1755,10 +1755,9 @@ bool GMainWindow::LoadROM(const QString& filename, Service::AM::FrontendAppletPa
|
||||||
if (!ContentManager::AreKeysPresent()) {
|
if (!ContentManager::AreKeysPresent()) {
|
||||||
QMessageBox::warning(this, tr("Derivation Components Missing"),
|
QMessageBox::warning(this, tr("Derivation Components Missing"),
|
||||||
tr("Encryption keys are missing. "
|
tr("Encryption keys are missing. "
|
||||||
"In order to use this emulator"
|
"You need to provide both your own title.keys "
|
||||||
"you need to provide your own prod.keys"
|
"and your own prod.keys "
|
||||||
"Some games might also require your own title.keys as well"
|
"in order to play games"));
|
||||||
"in order to play them."));
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue