Add consolidated GodMode9 key dumping script. (#6396)

This commit is contained in:
Steveice10 2023-04-09 12:16:31 -07:00 committed by GitHub
parent 8d19483b7e
commit b6e73f0d49
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 396 additions and 8 deletions

View file

@ -31,13 +31,12 @@ constexpr std::array<u8, 10> KeyTypes{{
HW::AES::APTWrap,
HW::AES::BOSSDataKey,
0x32, // unknown
HW::AES::DLPDataKey,
HW::AES::DLPNFCDataKey,
HW::AES::CECDDataKey,
0, // invalid
HW::AES::FRDKey,
// Note: According to 3dbrew the KeyY is overridden by Process9 when using this key type.
// TODO: implement this behaviour?
HW::AES::NFCKey,
HW::AES::DLPNFCDataKey,
}};
void PS_PS::EncryptDecryptAes(Kernel::HLERequestContext& ctx) {
@ -60,6 +59,12 @@ void PS_PS::EncryptDecryptAes(Kernel::HLERequestContext& ctx) {
// and encrypted data is actually returned, but the key used is unknown.
ASSERT_MSG(key_type != 7 && key_type < 10, "Key type is invalid");
if (key_type == 0x5) {
HW::AES::SelectDlpNfcKeyYIndex(HW::AES::DlpNfcKeyY::Dlp);
} else if (key_type == 0x9) {
HW::AES::SelectDlpNfcKeyYIndex(HW::AES::DlpNfcKeyY::Nfc);
}
if (!HW::AES::IsNormalKeyAvailable(KeyTypes[key_type])) {
LOG_ERROR(Service_PS,
"Key 0x{:2X} is not available, encryption/decryption will not be correct",