diff options
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | changelog.md | 5 | ||||
-rw-r--r-- | source/Common.cpp | 4 | ||||
-rw-r--r-- | source/KeyCollection.cpp | 32 |
4 files changed, 36 insertions, 7 deletions
@@ -32,7 +32,7 @@ include $(DEVKITPRO)/libnx/switch_rules | |||
32 | #--------------------------------------------------------------------------------- | 32 | #--------------------------------------------------------------------------------- |
33 | APP_TITLE := Lockpick | 33 | APP_TITLE := Lockpick |
34 | APP_AUTHOR := shchmue | 34 | APP_AUTHOR := shchmue |
35 | APP_VERSION := 1.2.1 | 35 | APP_VERSION := 1.2.2 |
36 | 36 | ||
37 | TARGET := $(subst $e ,_,$(notdir $(APP_TITLE))) | 37 | TARGET := $(subst $e ,_,$(notdir $(APP_TITLE))) |
38 | BUILD := build | 38 | BUILD := build |
diff --git a/changelog.md b/changelog.md index 6a1aeab..0f6edd0 100644 --- a/changelog.md +++ b/changelog.md | |||
@@ -1,4 +1,9 @@ | |||
1 | # Changelog | 1 | # Changelog |
2 | ## Version 1.2.2 | ||
3 | * Do not overwrite existing keyfile that contains master_key_07 | ||
4 | * Read eticket_rsa_kek from existing keyfile in case user is only running this for titlekeys | ||
5 | * Create /switch folder if needed | ||
6 | |||
2 | ## Version 1.2.1 | 7 | ## Version 1.2.1 |
3 | * Generate bis keys without master keys | 8 | * Generate bis keys without master keys |
4 | * Update file size check to support Hekate v4.8 TSEC dump | 9 | * Update file size check to support Hekate v4.8 TSEC dump |
diff --git a/source/Common.cpp b/source/Common.cpp index a77c0fe..f434e65 100644 --- a/source/Common.cpp +++ b/source/Common.cpp | |||
@@ -142,8 +142,8 @@ namespace Common { | |||
142 | memset(framebuf, 0, gfxGetFramebufferSize()); | 142 | memset(framebuf, 0, gfxGetFramebufferSize()); |
143 | #endif | 143 | #endif |
144 | draw_text(0x010, 0x020, YELLOW, "Lockpick! by shchmue"); | 144 | draw_text(0x010, 0x020, YELLOW, "Lockpick! by shchmue"); |
145 | draw_text(0x190, 0x020, YELLOW, "Note: Only dumps keys 00-06 on 6.2.0"); | 145 | draw_text(0x190, 0x020, YELLOW, "Note: This can only dump keys 00-05 (or 00-06 on 6.2.0)"); |
146 | draw_text(0x190, 0x040, YELLOW, " and keys 00-05 on all other firmwares including 7.0.0+"); | 146 | draw_text(0x190, 0x040, YELLOW, "Use Lockpick_RCM for newer keys on firmware 7.0.0+!"); |
147 | 147 | ||
148 | draw_set_rect(814, 452 + 42 * 0, 450, 42, FLAG_RED); | 148 | draw_set_rect(814, 452 + 42 * 0, 450, 42, FLAG_RED); |
149 | draw_set_rect(814, 452 + 42 * 1, 450, 42, FLAG_ORANGE); | 149 | draw_set_rect(814, 452 + 42 * 1, 450, 42, FLAG_ORANGE); |
diff --git a/source/KeyCollection.cpp b/source/KeyCollection.cpp index 6ffe971..12fa79d 100644 --- a/source/KeyCollection.cpp +++ b/source/KeyCollection.cpp | |||
@@ -21,6 +21,7 @@ | |||
21 | 21 | ||
22 | #include <algorithm> | 22 | #include <algorithm> |
23 | #include <chrono> | 23 | #include <chrono> |
24 | #include <filesystem> | ||
24 | #include <functional> | 25 | #include <functional> |
25 | #include <string> | 26 | #include <string> |
26 | #include <unordered_map> | 27 | #include <unordered_map> |
@@ -228,8 +229,8 @@ void KeyCollection::get_keys() { | |||
228 | } else { | 229 | } else { |
229 | Common::draw_text(0x010, 0x60, RED, "Get Tegra keys..."); | 230 | Common::draw_text(0x010, 0x60, RED, "Get Tegra keys..."); |
230 | Common::draw_text(0x190, 0x60, RED, "Failed"); | 231 | Common::draw_text(0x190, 0x60, RED, "Failed"); |
231 | Common::draw_text(0x190, 0x20, RED, "Warning: Saving limited keyset."); | 232 | Common::draw_text(0x2a0, 0x60, RED, "Warning: Saving limited keyset."); |
232 | Common::draw_text(0x190, 0x40, RED, "Dump Tegra keys with payload and run again to get all keys."); | 233 | Common::draw_text(0x2a0, 0x80, RED, "Dump TSEC and Fuses with Hekate."); |
233 | } | 234 | } |
234 | 235 | ||
235 | profiler_time = profile(&KeyCollection::get_memory_keys, *this); | 236 | profiler_time = profile(&KeyCollection::get_memory_keys, *this); |
@@ -241,8 +242,31 @@ void KeyCollection::get_keys() { | |||
241 | profiler_time = profile(&KeyCollection::derive_keys, *this); | 242 | profiler_time = profile(&KeyCollection::derive_keys, *this); |
242 | Common::draw_text_with_time(0x10, 0x0c0, GREEN, "Derive remaining keys...", profiler_time); | 243 | Common::draw_text_with_time(0x10, 0x0c0, GREEN, "Derive remaining keys...", profiler_time); |
243 | 244 | ||
244 | profiler_time = profile(&KeyCollection::save_keys, *this); | 245 | // avoid crash on CFWs that don't use /switch folder |
245 | Common::draw_text_with_time(0x10, 0x0e0, GREEN, "Saving keys to keyfile...", profiler_time); | 246 | if (!std::filesystem::exists("/switch")) |
247 | std::filesystem::create_directory("/switch"); | ||
248 | // since Lockpick_RCM can dump newer keys, check for existing keyfile | ||
249 | bool Lockpick_RCM_file_found = false; | ||
250 | if (std::filesystem::exists("/switch/prod.keys")) { | ||
251 | FILE *key_file = fopen("/switch/prod.keys", "r"); | ||
252 | char line[0x200]; | ||
253 | while (fgets(line, sizeof(line), key_file)) { | ||
254 | if (strncmp("master_key_07", line, 13) == 0) { | ||
255 | Lockpick_RCM_file_found = true; | ||
256 | } else if (!eticket_rsa_kek.found() && (strncmp("eticket_rsa_kek", line, 15)) == 0) { | ||
257 | // grab eticket_rsa_kek from existing file to make sure we can dump titlekeys | ||
258 | eticket_rsa_kek = Key("eticket_rsa_kek", 0x10, Common::key_string_to_byte_vector(line)); | ||
259 | } | ||
260 | } | ||
261 | fclose(key_file); | ||
262 | } | ||
263 | if (!Lockpick_RCM_file_found) { | ||
264 | profiler_time = profile(&KeyCollection::save_keys, *this); | ||
265 | Common::draw_text_with_time(0x10, 0x0e0, GREEN, "Saving keys to keyfile...", profiler_time); | ||
266 | } else { | ||
267 | Common::draw_text(0x10, 0x0e0, YELLOW, "Saving keys to keyfile..."); | ||
268 | Common::draw_text(0x190, 0x0e0, YELLOW, "Newer keyfile found. Skipped overwriting keys"); | ||
269 | } | ||
246 | 270 | ||
247 | total_time.stop(); | 271 | total_time.stop(); |
248 | Common::draw_line(0x8, 0xf0, 0x280, GREEN); | 272 | Common::draw_line(0x8, 0xf0, 0x280, GREEN); |