Move keys location and check FILE instead of using exists
This commit is contained in:
parent
09f9e4242c
commit
514275fc50
2 changed files with 6 additions and 4 deletions
|
@ -191,8 +191,8 @@ namespace Common {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// support biskeydump v7 dump
|
// support biskeydump v7 dump
|
||||||
if (std::filesystem::exists("/device.keys")) {
|
|
||||||
FILE *key_file = fopen("/device.keys", "r");
|
FILE *key_file = fopen("/device.keys", "r");
|
||||||
|
if (key_file) {
|
||||||
char line[0x100];
|
char line[0x100];
|
||||||
while (fgets(line, sizeof(line), key_file) && !(sbk.found() && tsec.found())) {
|
while (fgets(line, sizeof(line), key_file) && !(sbk.found() && tsec.found())) {
|
||||||
if (strncmp("secure_boot_key", line, 15) == 0)
|
if (strncmp("secure_boot_key", line, 15) == 0)
|
||||||
|
|
|
@ -245,10 +245,12 @@ void KeyCollection::get_keys() {
|
||||||
// avoid crash on CFWs that don't use /switch folder
|
// avoid crash on CFWs that don't use /switch folder
|
||||||
if (!std::filesystem::exists("/switch"))
|
if (!std::filesystem::exists("/switch"))
|
||||||
std::filesystem::create_directory("/switch");
|
std::filesystem::create_directory("/switch");
|
||||||
|
if (!std::filesystem::exists("/switch/Lockpick"))
|
||||||
|
std::filesystem::create_directory("/switch/Lockpick");
|
||||||
// since Lockpick_RCM can dump newer keys, check for existing keyfile
|
// since Lockpick_RCM can dump newer keys, check for existing keyfile
|
||||||
bool Lockpick_RCM_file_found = false;
|
bool Lockpick_RCM_file_found = false;
|
||||||
if (std::filesystem::exists("/switch/prod.keys")) {
|
FILE *key_file = fopen("/switch/Lockpick/prod.keys", "r");
|
||||||
FILE *key_file = fopen("/switch/prod.keys", "r");
|
if (key_file) {
|
||||||
char line[0x200];
|
char line[0x200];
|
||||||
while (fgets(line, sizeof(line), key_file)) {
|
while (fgets(line, sizeof(line), key_file)) {
|
||||||
if (strncmp("master_key_07", line, 13) == 0) {
|
if (strncmp("master_key_07", line, 13) == 0) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue