mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 05:47:56 -07:00
IOS/ES: Verify containers in ImportTicket
This commit is contained in:
parent
07d83ada39
commit
719af1aff4
@ -112,7 +112,7 @@ public:
|
||||
std::vector<std::array<u8, 20>> GetSharedContents() const;
|
||||
|
||||
// Title management
|
||||
ReturnCode ImportTicket(const std::vector<u8>& ticket_bytes);
|
||||
ReturnCode ImportTicket(const std::vector<u8>& ticket_bytes, const std::vector<u8>& cert_chain);
|
||||
ReturnCode ImportTmd(Context& context, const std::vector<u8>& tmd_bytes);
|
||||
ReturnCode ImportTitleInit(Context& context, const std::vector<u8>& tmd_bytes);
|
||||
ReturnCode ImportContentBegin(Context& context, u64 title_id, u32 content_id);
|
||||
|
@ -46,7 +46,7 @@ static ReturnCode WriteTicket(const IOS::ES::TicketReader& ticket)
|
||||
return ticket_file.WriteBytes(raw_ticket.data(), raw_ticket.size()) ? IPC_SUCCESS : ES_EIO;
|
||||
}
|
||||
|
||||
ReturnCode ES::ImportTicket(const std::vector<u8>& ticket_bytes)
|
||||
ReturnCode ES::ImportTicket(const std::vector<u8>& ticket_bytes, const std::vector<u8>& cert_chain)
|
||||
{
|
||||
IOS::ES::TicketReader ticket{ticket_bytes};
|
||||
if (!ticket.IsValid())
|
||||
@ -70,6 +70,11 @@ ReturnCode ES::ImportTicket(const std::vector<u8>& ticket_bytes)
|
||||
}
|
||||
}
|
||||
|
||||
const ReturnCode verify_ret =
|
||||
VerifyContainer(VerifyContainerType::Ticket, VerifyMode::UpdateCertStore, ticket, cert_chain);
|
||||
if (verify_ret != IPC_SUCCESS)
|
||||
return verify_ret;
|
||||
|
||||
const ReturnCode write_ret = WriteTicket(ticket);
|
||||
if (write_ret != IPC_SUCCESS)
|
||||
return write_ret;
|
||||
@ -85,7 +90,9 @@ IPCCommandResult ES::ImportTicket(const IOCtlVRequest& request)
|
||||
|
||||
std::vector<u8> bytes(request.in_vectors[0].size);
|
||||
Memory::CopyFromEmu(bytes.data(), request.in_vectors[0].address, request.in_vectors[0].size);
|
||||
return GetDefaultReply(ImportTicket(bytes));
|
||||
std::vector<u8> cert_chain(request.in_vectors[1].size);
|
||||
Memory::CopyFromEmu(bytes.data(), request.in_vectors[1].address, request.in_vectors[1].size);
|
||||
return GetDefaultReply(ImportTicket(bytes, cert_chain));
|
||||
}
|
||||
|
||||
ReturnCode ES::ImportTmd(Context& context, const std::vector<u8>& tmd_bytes)
|
||||
|
@ -27,7 +27,7 @@ bool InstallWAD(const std::string& wad_path)
|
||||
const auto es = ios.GetES();
|
||||
|
||||
IOS::HLE::Device::ES::Context context;
|
||||
if (es->ImportTicket(wad.GetTicket().GetBytes()) < 0 ||
|
||||
if (es->ImportTicket(wad.GetTicket().GetBytes(), wad.GetCertificateChain()) < 0 ||
|
||||
es->ImportTitleInit(context, tmd.GetBytes()) < 0)
|
||||
{
|
||||
PanicAlertT("WAD installation failed: Could not initialise title import.");
|
||||
|
Loading…
Reference in New Issue
Block a user