Merge pull request #6088 from leoetlino/personalised-import

IOS: Assume ticket is unpersonalised for WAD imports
This commit is contained in:
Leo Lam 2017-10-03 19:59:52 +02:00 committed by GitHub
commit d790660b59
3 changed files with 14 additions and 4 deletions

View File

@ -106,7 +106,15 @@ public:
s32 SeekContent(u32 cfd, u32 offset, SeekMode mode, u32 uid); s32 SeekContent(u32 cfd, u32 offset, SeekMode mode, u32 uid);
// Title management // Title management
ReturnCode ImportTicket(const std::vector<u8>& ticket_bytes, const std::vector<u8>& cert_chain); enum class TicketImportType
{
// Ticket may be personalised, so use console specific data for decryption if needed.
PossiblyPersonalised,
// Ticket is unpersonalised, so ignore any console specific decryption data.
Unpersonalised,
};
ReturnCode ImportTicket(const std::vector<u8>& ticket_bytes, const std::vector<u8>& cert_chain,
TicketImportType type = TicketImportType::PossiblyPersonalised);
ReturnCode ImportTmd(Context& context, const std::vector<u8>& tmd_bytes); ReturnCode ImportTmd(Context& context, const std::vector<u8>& tmd_bytes);
ReturnCode ImportTitleInit(Context& context, const std::vector<u8>& tmd_bytes, ReturnCode ImportTitleInit(Context& context, const std::vector<u8>& tmd_bytes,
const std::vector<u8>& cert_chain); const std::vector<u8>& cert_chain);

View File

@ -56,7 +56,8 @@ void ES::TitleImportExportContext::DoState(PointerWrap& p)
p.Do(content.buffer); p.Do(content.buffer);
} }
ReturnCode ES::ImportTicket(const std::vector<u8>& ticket_bytes, const std::vector<u8>& cert_chain) ReturnCode ES::ImportTicket(const std::vector<u8>& ticket_bytes, const std::vector<u8>& cert_chain,
TicketImportType type)
{ {
IOS::ES::TicketReader ticket{ticket_bytes}; IOS::ES::TicketReader ticket{ticket_bytes};
if (!ticket.IsValid()) if (!ticket.IsValid())
@ -64,7 +65,7 @@ ReturnCode ES::ImportTicket(const std::vector<u8>& ticket_bytes, const std::vect
const u32 ticket_device_id = ticket.GetDeviceId(); const u32 ticket_device_id = ticket.GetDeviceId();
const u32 device_id = EcWii::GetInstance().GetNGID(); const u32 device_id = EcWii::GetInstance().GetNGID();
if (ticket_device_id != 0) if (type == TicketImportType::PossiblyPersonalised && ticket_device_id != 0)
{ {
if (device_id != ticket_device_id) if (device_id != ticket_device_id)
{ {

View File

@ -65,7 +65,8 @@ static bool InstallWAD(IOS::HLE::Kernel& ios, const DiscIO::WiiWAD& wad)
// Ensure the common key index is correct, as it's checked by IOS. // Ensure the common key index is correct, as it's checked by IOS.
ticket.FixCommonKeyIndex(); ticket.FixCommonKeyIndex();
while ((ret = es->ImportTicket(ticket.GetBytes(), wad.GetCertificateChain())) < 0 || while ((ret = es->ImportTicket(ticket.GetBytes(), wad.GetCertificateChain(),
IOS::HLE::Device::ES::TicketImportType::Unpersonalised)) < 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 &&