yuzu-emu
/
yuzu
Archived
1
0
Fork 0

es: Implement ETicket GetTitleKey (8)

Takes a rights ID as input and returns the associated title key, if it exists.
This commit is contained in:
Zach Hilman 2019-04-10 14:00:39 -04:00
parent f15f73a555
commit 475a7a4446
1 changed files with 27 additions and 1 deletions

View File

@ -23,7 +23,7 @@ public:
{5, nullptr, "DeleteAllCommonTicket"},
{6, nullptr, "DeleteAllPersonalizedTicket"},
{7, nullptr, "DeleteAllPersonalizedTicketEx"},
{8, nullptr, "GetTitleKey"},
{8, &ETicket::GetTitleKey, "GetTitleKey"},
{9, nullptr, "CountCommonTicket"},
{10, nullptr, "CountPersonalizedTicket"},
{11, nullptr, "ListCommonTicket"},
@ -96,6 +96,32 @@ private:
rb.Push(RESULT_SUCCESS);
}
void GetTitleKey(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
const auto rights_id = rp.PopRaw<u128>();
LOG_DEBUG(Service_ETicket, "called, rights_id={:016X}{:016X}", rights_id[1], rights_id[0]);
if (!CheckRightsId(ctx, rights_id))
return;
const auto key =
keys.GetKey(Core::Crypto::S128KeyType::Titlekey, rights_id[1], rights_id[0]);
if (key == Core::Crypto::Key128{}) {
LOG_ERROR(Service_ETicket,
"The titlekey doesn't exist in the KeyManager or the rights ID was invalid!");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ERROR_INVALID_RIGHTS_ID);
return;
}
ctx.WriteBuffer(key.data(), key.size());
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
}
};
void InstallInterfaces(SM::ServiceManager& service_manager) {