core: Add support for loading NSPs with personalized tickets. (#10048)
Co-authored-by: Morph <39850852+Morph1984@users.noreply.github.com>
This commit is contained in:
parent
c24ed3ecaf
commit
0a51fe7854
5 changed files with 185 additions and 144 deletions
|
@ -122,20 +122,18 @@ private:
|
|||
}
|
||||
|
||||
void ImportTicket(HLERequestContext& ctx) {
|
||||
const auto ticket = ctx.ReadBuffer();
|
||||
const auto raw_ticket = ctx.ReadBuffer();
|
||||
[[maybe_unused]] const auto cert = ctx.ReadBuffer(1);
|
||||
|
||||
if (ticket.size() < sizeof(Core::Crypto::Ticket)) {
|
||||
if (raw_ticket.size() < sizeof(Core::Crypto::Ticket)) {
|
||||
LOG_ERROR(Service_ETicket, "The input buffer is not large enough!");
|
||||
IPC::ResponseBuilder rb{ctx, 2};
|
||||
rb.Push(ERROR_INVALID_ARGUMENT);
|
||||
return;
|
||||
}
|
||||
|
||||
Core::Crypto::Ticket raw{};
|
||||
std::memcpy(&raw, ticket.data(), sizeof(Core::Crypto::Ticket));
|
||||
|
||||
if (!keys.AddTicketPersonalized(raw)) {
|
||||
Core::Crypto::Ticket ticket = Core::Crypto::Ticket::Read(raw_ticket);
|
||||
if (!keys.AddTicket(ticket)) {
|
||||
LOG_ERROR(Service_ETicket, "The ticket could not be imported!");
|
||||
IPC::ResponseBuilder rb{ctx, 2};
|
||||
rb.Push(ERROR_INVALID_ARGUMENT);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue