3 Commits

Author SHA1 Message Date
09f9e4242c Bump version to v1.2.6 2019-09-10 14:21:55 -06:00
b2ca9c881d Fix bis key generation for newer hardware 2019-09-10 14:17:27 -06:00
0c6bb239f0 Update for libnx v2.3.0 FsBisStorageId syntax 2019-08-04 09:47:46 -06:00
5 changed files with 24 additions and 9 deletions

View File

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

View File

@ -36,7 +36,7 @@ Notes
Building
=
Release built with [libnx release v2.2.0](https://github.com/switchbrew/libnx).
Release built with [libnx release v2.4.0](https://github.com/switchbrew/libnx).
Uses `freetype` which comes with `switch-portlibs` via `devkitPro pacman`:
```

View File

@ -1,4 +1,7 @@
# Changelog
## Version 1.2.6
* Fix bis key generation on newer hardware
## Version 1.2.5
* Support Hekate v5 fuse dump format
* Make names consistent with libnx v2.2.0

View File

@ -402,16 +402,28 @@ void KeyCollection::derive_keys() {
splCryptoExit();
}
if (bis_key_source_00.found() && bis_key_source_01.found() && bis_key_source_02.found()) {
u64 key_generation = 0;
SetSysFirmwareVersion ver;
setsysInitialize();
setsysGetFirmwareVersion(&ver);
setsysExit();
Result rc = 0;
if (ver.major >= 5) {
rc = splGetConfig(SplConfigItem_NewKeyGeneration, &key_generation);
}
if (R_SUCCEEDED(rc) && bis_key_source_00.found() && bis_key_source_01.found() && bis_key_source_02.found()) {
u8 tempbiskek[0x10], tempbiskey[0x20];
splFsInitialize();
splFsGenerateSpecificAesKey(bis_key_source_00.key.data() + 0x00, 0, 0, tempbiskey + 0x00);
splFsGenerateSpecificAesKey(bis_key_source_00.key.data() + 0x10, 0, 0, tempbiskey + 0x10);
splFsGenerateSpecificAesKey(bis_key_source_00.key.data() + 0x00, key_generation, 0, tempbiskey + 0x00);
splFsGenerateSpecificAesKey(bis_key_source_00.key.data() + 0x10, key_generation, 0, tempbiskey + 0x10);
bis_key.push_back(Key {"bis_key_00", 0x20, byte_vector(tempbiskey, tempbiskey + 0x20)});
splFsExit();
splCryptoInitialize();
splCryptoGenerateAesKek(bis_kek_source.key.data(), 0, 1, tempbiskek);
splCryptoGenerateAesKek(bis_kek_source.key.data(), key_generation, 1, tempbiskek);
splCryptoGenerateAesKey(tempbiskek, bis_key_source_01.key.data() + 0x00, tempbiskey + 0x00);
splCryptoGenerateAesKey(tempbiskek, bis_key_source_01.key.data() + 0x10, tempbiskey + 0x10);
bis_key.push_back(Key {"bis_key_01", 0x20, byte_vector(tempbiskey, tempbiskey + 0x20)});
@ -474,7 +486,7 @@ void KeyCollection::derive_keys() {
FRESULT fr;
FIL save_file;
fsOpenBisStorage(&storage, 31);
fsOpenBisStorage(&storage, FsBisStorageId_System);
if (f_mount(&fs, "", 1) ||
f_chdir("/save") ||
f_open(&save_file, "8000000000000043", FA_READ | FA_OPEN_EXISTING))
@ -634,7 +646,7 @@ void KeyCollection::get_titlekeys() {
// map of all found rights ids and corresponding titlekeys
std::unordered_map<std::string, std::string> titlekeys;
fsOpenBisStorage(&storage, 31);
fsOpenBisStorage(&storage, FsBisStorageId_System);
if (f_mount(&fs, "", 1) || f_chdir("/save")) return;
if (f_open(&save_file, "80000000000000e1", FA_READ | FA_OPEN_EXISTING)) return;
while ((common_count != 0) && (titlekeys_dumped < common_count)) {

View File

@ -101,7 +101,7 @@ void KeyLocation::get_from_memory(u64 tid, u8 seg_mask) {
void KeyLocation::get_keyblobs() {
FsStorage boot0;
fsOpenBisStorage(&boot0, 0);
fsOpenBisStorage(&boot0, FsBisStorageId_Boot0);
data.resize(0x200 * KNOWN_KEYBLOBS);
fsStorageRead(&boot0, KEYBLOB_OFFSET, data.data(), data.size());
fsStorageClose(&boot0);