summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorGravatar Zach Hilman2019-04-10 14:00:39 -0400
committerGravatar Zach Hilman2019-07-07 21:38:33 -0400
commit475a7a4446b169b46d4fb34f3b022f7b369e5bf9 (patch)
tree98d7098978296365129b106c555343af9855a2a1 /src/core
parentes: Implement ETicket ImportTicket (1) (diff)
downloadyuzu-475a7a4446b169b46d4fb34f3b022f7b369e5bf9.tar.gz
yuzu-475a7a4446b169b46d4fb34f3b022f7b369e5bf9.tar.xz
yuzu-475a7a4446b169b46d4fb34f3b022f7b369e5bf9.zip
es: Implement ETicket GetTitleKey (8)
Takes a rights ID as input and returns the associated title key, if it exists.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/hle/service/es/es.cpp28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/core/hle/service/es/es.cpp b/src/core/hle/service/es/es.cpp
index 787927be0..65dfaa2a0 100644
--- a/src/core/hle/service/es/es.cpp
+++ b/src/core/hle/service/es/es.cpp
@@ -23,7 +23,7 @@ public:
23 {5, nullptr, "DeleteAllCommonTicket"}, 23 {5, nullptr, "DeleteAllCommonTicket"},
24 {6, nullptr, "DeleteAllPersonalizedTicket"}, 24 {6, nullptr, "DeleteAllPersonalizedTicket"},
25 {7, nullptr, "DeleteAllPersonalizedTicketEx"}, 25 {7, nullptr, "DeleteAllPersonalizedTicketEx"},
26 {8, nullptr, "GetTitleKey"}, 26 {8, &ETicket::GetTitleKey, "GetTitleKey"},
27 {9, nullptr, "CountCommonTicket"}, 27 {9, nullptr, "CountCommonTicket"},
28 {10, nullptr, "CountPersonalizedTicket"}, 28 {10, nullptr, "CountPersonalizedTicket"},
29 {11, nullptr, "ListCommonTicket"}, 29 {11, nullptr, "ListCommonTicket"},
@@ -96,6 +96,32 @@ private:
96 rb.Push(RESULT_SUCCESS); 96 rb.Push(RESULT_SUCCESS);
97 } 97 }
98 98
99 void GetTitleKey(Kernel::HLERequestContext& ctx) {
100 IPC::RequestParser rp{ctx};
101 const auto rights_id = rp.PopRaw<u128>();
102
103 LOG_DEBUG(Service_ETicket, "called, rights_id={:016X}{:016X}", rights_id[1], rights_id[0]);
104
105 if (!CheckRightsId(ctx, rights_id))
106 return;
107
108 const auto key =
109 keys.GetKey(Core::Crypto::S128KeyType::Titlekey, rights_id[1], rights_id[0]);
110
111 if (key == Core::Crypto::Key128{}) {
112 LOG_ERROR(Service_ETicket,
113 "The titlekey doesn't exist in the KeyManager or the rights ID was invalid!");
114 IPC::ResponseBuilder rb{ctx, 2};
115 rb.Push(ERROR_INVALID_RIGHTS_ID);
116 return;
117 }
118
119 ctx.WriteBuffer(key.data(), key.size());
120
121 IPC::ResponseBuilder rb{ctx, 2};
122 rb.Push(RESULT_SUCCESS);
123 }
124
99}; 125};
100 126
101void InstallInterfaces(SM::ServiceManager& service_manager) { 127void InstallInterfaces(SM::ServiceManager& service_manager) {