From 23fb80ac10939785cc6cca721923b72f28894760 Mon Sep 17 00:00:00 2001 From: d0k3 Date: Thu, 5 May 2016 17:19:41 +0200 Subject: [PATCH] Somewhat dirty workaround for Panda units --- source/common.h | 3 +++ source/decryptor/keys.c | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/source/common.h b/source/common.h index 49aaeb7..1af5695 100644 --- a/source/common.h +++ b/source/common.h @@ -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++) { diff --git a/source/decryptor/keys.c b/source/decryptor/keys.c index 003c85d..584cf47 100644 --- a/source/decryptor/keys.c +++ b/source/decryptor/keys.c @@ -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); @@ -298,6 +302,7 @@ u32 CheckKeySlot(u32 keyslot, char type) keyXState |= (u64) 1 << keyslot; return 0; } + #endif } }