Skip to content

Commit

Permalink
Somewhat dirty workaround for Panda units
Browse files Browse the repository at this point in the history
  • Loading branch information
d0k3 committed May 5, 2016
1 parent 3bd0915 commit 23fb80a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions source/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
#define WORK_DIR "/Decrypt9"
#define LOG_FILE "Decrypt9.log"

// if defined, assume a panda unit
// #define PANDA_WORKAROUND

static inline u32 strchrcount(const char* str, char symbol) {
u32 count = 0;
for (u32 i = 0; str[i] != '\0'; i++) {
Expand Down
5 changes: 5 additions & 0 deletions source/decryptor/keys.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,10 @@ u32 CheckKeySlot(u32 keyslot, char type)
// if is not, we may still be able to verify the currently set one (for NCCH keys)
for (u32 p = 0; (type == 'X') && (p < sizeof(keyNcchSamples) / sizeof(AesNcchSampleInfo)); p++) {
if (keyNcchSamples[p].slot == keyslot) { // only for keyslots in the keyNcchSamples table!
#ifdef PANDA_WORKAROUND
keyXState |= (u64) 1 << keyslot;
return 0;
#else
u8 sample[16] = { 0 };
CryptBufferInfo info = {.keyslot = keyslot, .setKeyY = 1, .buffer = sample, .size = 16, .mode = AES_CNT_CTRNAND_MODE};
memset(info.ctr, 0x00, 16);
Expand All @@ -298,6 +302,7 @@ u32 CheckKeySlot(u32 keyslot, char type)
keyXState |= (u64) 1 << keyslot;
return 0;
}
#endif
}
}

Expand Down

0 comments on commit 23fb80a

Please sign in to comment.