v1.2.4: Support emunand FS memory layout

This commit is contained in:
shchmue 2019-06-16 13:09:14 -04:00
parent 90563f6e63
commit 31a882496f
4 changed files with 20 additions and 2 deletions

View file

@ -32,7 +32,7 @@ include $(DEVKITPRO)/libnx/switch_rules
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
APP_TITLE := Lockpick APP_TITLE := Lockpick
APP_AUTHOR := shchmue APP_AUTHOR := shchmue
APP_VERSION := 1.2.3 APP_VERSION := 1.2.4
TARGET := $(subst $e ,_,$(notdir $(APP_TITLE))) TARGET := $(subst $e ,_,$(notdir $(APP_TITLE)))
BUILD := build BUILD := build

View file

@ -1,4 +1,8 @@
# Changelog # Changelog
## Version 1.2.4
* Support new emunand FS memory layout
* No longer save header_key if empty
## Version 1.2.3 ## Version 1.2.3
* Remove mbedtls dependency in favor of new libnx crypto library * Remove mbedtls dependency in favor of new libnx crypto library
* Remove libnx 1.6.0 support since crypto requires later commit * Remove libnx 1.6.0 support since crypto requires later commit

View file

@ -392,7 +392,6 @@ void KeyCollection::get_memory_keys() {
} }
void KeyCollection::derive_keys() { void KeyCollection::derive_keys() {
header_key = {"header_key", 0x20, {}};
if (header_kek_source.found() && header_key_source.found()) { if (header_kek_source.found() && header_key_source.found()) {
u8 tempheaderkek[0x10], tempheaderkey[0x20]; u8 tempheaderkek[0x10], tempheaderkey[0x20];
splCryptoInitialize(); splCryptoInitialize();

View file

@ -62,7 +62,22 @@ void KeyLocation::get_from_memory(u64 tid, u8 seg_mask) {
u32 page_info; u32 page_info;
u64 addr = 0; u64 addr = 0;
u64 last_text_addr = 0;
// locate "real" .text segment as Atmosphere emuNAND has two
for (;;) {
svcQueryDebugProcessMemory(&mem_info, &page_info, debug_handle, addr);
if ((mem_info.perm & Perm_X) &&
((mem_info.type & 0xff) >= MemType_CodeStatic) &&
((mem_info.type & 0xff) < MemType_Heap))
{
last_text_addr = mem_info.addr;
}
addr = mem_info.addr + mem_info.size;
if (addr == 0) break;
}
addr = last_text_addr;
for (u8 segment = 1; segment < BIT(3); ) for (u8 segment = 1; segment < BIT(3); )
{ {
svcQueryDebugProcessMemory(&mem_info, &page_info, debug_handle, addr); svcQueryDebugProcessMemory(&mem_info, &page_info, debug_handle, addr);