summaryrefslogtreecommitdiff
path: root/src/core/hle
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle')
-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) {