Skip to content

Commit 38eb5a8

Browse files
committed
Titlekey Dumper: general cleanup
1 parent 69c7da1 commit 38eb5a8

2 files changed

Lines changed: 5 additions & 9 deletions

File tree

source/decryptor/titlekey.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ u32 CryptTitlekey(TitleKeyEntry* entry, bool encrypt)
2323

2424
u32 CryptTitlekeysFile(u32 param)
2525
{
26-
EncKeysInfo *info = (EncKeysInfo*)0x20316000;
26+
TitleKeysInfo *info = (TitleKeysInfo*)0x20316000;
2727
char filename[64];
2828

2929
if (InputFileNameSelector(filename, (param & TK_ENCRYPTED) ? "decTitleKeys.bin" : "encTitleKeys.bin",
@@ -68,20 +68,16 @@ u32 DumpTitlekeysNand(u32 param)
6868
{
6969
PartitionInfo* ctrnand_info = GetPartitionInfo(P_CTRNAND);;
7070
u8* buffer = BUFFER_ADDRESS;
71-
EncKeysInfo *info = (EncKeysInfo*) 0x20316000;
71+
TitleKeysInfo *info = (TitleKeysInfo*) 0x20316000;
7272
char filename[64];
7373

7474
u32 nKeys = 0;
7575
u32 nSkipped = 0;
7676
u32 offset = 0;
7777
u32 size = 0;
7878

79-
Debug("Searching for ticket.db...");
80-
if (SeekFileInNand(&offset, &size, "DBS TICKET DB ", ctrnand_info) != 0) {
81-
Debug("Failed!");
79+
if (DebugSeekFileInNand(&offset, &size, "ticket.db", "DBS TICKET DB ", ctrnand_info) != 0)
8280
return 1;
83-
}
84-
Debug("Found at %08X, size %uMB", offset, size / (1024 * 1024));
8581

8682
Debug("%s Title Keys...", (param & TK_ENCRYPTED) ? "Dumping" : "Decrypting");
8783
memset(info, 0, 0x10);
@@ -121,7 +117,7 @@ u32 DumpTitlekeysNand(u32 param)
121117
info->n_entries = nKeys;
122118
ShowProgress(0, 0);
123119

124-
Debug("Decrypted %u unique Titlekeys", nKeys);
120+
Debug("%s %u unique Titlekeys", (param & TK_ENCRYPTED) ? "Dumped" : "Decrypted", nKeys);
125121
Debug("Skipped %u useless Titlekeys", nSkipped);
126122

127123
if (OutputFileNameSelector(filename, (param & TK_ENCRYPTED) ? "encTitleKeys.bin" : "decTitleKeys.bin", NULL) != 0)

source/decryptor/titlekey.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ typedef struct {
1717
u32 n_entries;
1818
u8 reserved[12];
1919
TitleKeyEntry entries[MAX_ENTRIES];
20-
} __attribute__((packed, aligned(16))) EncKeysInfo;
20+
} __attribute__((packed, aligned(16))) TitleKeysInfo;
2121

2222

2323
u32 CryptTitlekey(TitleKeyEntry* entry, bool encrypt);

0 commit comments

Comments
 (0)