mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 13:57:57 -07:00
Merge pull request #5846 from leoetlino/fakesigned-tickets
Force ticket to have a correct key index for importing
This commit is contained in:
commit
8da42fad73
@ -463,6 +463,13 @@ HLE::ReturnCode TicketReader::Unpersonalise(HLE::IOSC& iosc)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TicketReader::FixCommonKeyIndex()
|
||||||
|
{
|
||||||
|
u8& index = m_bytes[offsetof(Ticket, common_key_index)];
|
||||||
|
// Assume the ticket is using the normal common key if it's an invalid value.
|
||||||
|
index = index <= 1 ? index : 0;
|
||||||
|
}
|
||||||
|
|
||||||
struct SharedContentMap::Entry
|
struct SharedContentMap::Entry
|
||||||
{
|
{
|
||||||
// ID string
|
// ID string
|
||||||
|
@ -238,6 +238,10 @@ public:
|
|||||||
// Decrypts the title key field for a "personalised" ticket -- one that is device-specific
|
// Decrypts the title key field for a "personalised" ticket -- one that is device-specific
|
||||||
// and has a title key that must be decrypted first.
|
// and has a title key that must be decrypted first.
|
||||||
HLE::ReturnCode Unpersonalise(HLE::IOSC& iosc);
|
HLE::ReturnCode Unpersonalise(HLE::IOSC& iosc);
|
||||||
|
|
||||||
|
// Reset the common key field back to 0 if it's an incorrect value.
|
||||||
|
// Intended for use before importing fakesigned tickets, which tend to have a high bogus index.
|
||||||
|
void FixCommonKeyIndex();
|
||||||
};
|
};
|
||||||
|
|
||||||
class SharedContentMap final
|
class SharedContentMap final
|
||||||
|
@ -54,7 +54,12 @@ bool InstallWAD(const std::string& wad_path)
|
|||||||
IOS::HLE::Device::ES::Context context;
|
IOS::HLE::Device::ES::Context context;
|
||||||
IOS::HLE::ReturnCode ret;
|
IOS::HLE::ReturnCode ret;
|
||||||
const bool checks_enabled = SConfig::GetInstance().m_enable_signature_checks;
|
const bool checks_enabled = SConfig::GetInstance().m_enable_signature_checks;
|
||||||
while ((ret = es->ImportTicket(wad.GetTicket().GetBytes(), wad.GetCertificateChain())) < 0 ||
|
|
||||||
|
IOS::ES::TicketReader ticket = wad.GetTicket();
|
||||||
|
// Ensure the common key index is correct, as it's checked by IOS.
|
||||||
|
ticket.FixCommonKeyIndex();
|
||||||
|
|
||||||
|
while ((ret = es->ImportTicket(ticket.GetBytes(), wad.GetCertificateChain())) < 0 ||
|
||||||
(ret = es->ImportTitleInit(context, tmd.GetBytes(), wad.GetCertificateChain())) < 0)
|
(ret = es->ImportTitleInit(context, tmd.GetBytes(), wad.GetCertificateChain())) < 0)
|
||||||
{
|
{
|
||||||
if (checks_enabled && ret == IOS::HLE::IOSC_FAIL_CHECKVALUE &&
|
if (checks_enabled && ret == IOS::HLE::IOSC_FAIL_CHECKVALUE &&
|
||||||
|
Loading…
Reference in New Issue
Block a user