diff options
| author | 2019-04-16 09:12:04 -0400 | |
|---|---|---|
| committer | 2019-07-07 21:38:33 -0400 | |
| commit | f8718ae779bbdc6a3f514b5ce141515baa97e14f (patch) | |
| tree | 4a7712329982e2cb512412cbb4a17fa52a53f780 /src/core/hle | |
| parent | es: Implement ETicket GetPersonalizedTicketData (17) (diff) | |
| download | yuzu-f8718ae779bbdc6a3f514b5ce141515baa97e14f.tar.gz yuzu-f8718ae779bbdc6a3f514b5ce141515baa97e14f.tar.xz yuzu-f8718ae779bbdc6a3f514b5ce141515baa97e14f.zip | |
key_manager: Add structure for Ticket parsing
Diffstat (limited to 'src/core/hle')
| -rw-r--r-- | src/core/hle/service/es/es.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/core/hle/service/es/es.cpp b/src/core/hle/service/es/es.cpp index d17fb778c..7e01f88b9 100644 --- a/src/core/hle/service/es/es.cpp +++ b/src/core/hle/service/es/es.cpp | |||
| @@ -75,15 +75,15 @@ private: | |||
| 75 | const auto ticket = ctx.ReadBuffer(); | 75 | const auto ticket = ctx.ReadBuffer(); |
| 76 | const auto cert = ctx.ReadBuffer(1); | 76 | const auto cert = ctx.ReadBuffer(1); |
| 77 | 77 | ||
| 78 | if (ticket.size() < sizeof(Core::Crypto::TicketRaw)) { | 78 | if (ticket.size() < sizeof(Core::Crypto::Ticket)) { |
| 79 | LOG_ERROR(Service_ETicket, "The input buffer is not large enough!"); | 79 | LOG_ERROR(Service_ETicket, "The input buffer is not large enough!"); |
| 80 | IPC::ResponseBuilder rb{ctx, 2}; | 80 | IPC::ResponseBuilder rb{ctx, 2}; |
| 81 | rb.Push(ERROR_INVALID_ARGUMENT); | 81 | rb.Push(ERROR_INVALID_ARGUMENT); |
| 82 | return; | 82 | return; |
| 83 | } | 83 | } |
| 84 | 84 | ||
| 85 | Core::Crypto::TicketRaw raw; | 85 | Core::Crypto::Ticket raw{}; |
| 86 | std::memcpy(raw.data(), ticket.data(), sizeof(Core::Crypto::TicketRaw)); | 86 | std::memcpy(&raw, ticket.data(), sizeof(Core::Crypto::Ticket)); |
| 87 | 87 | ||
| 88 | if (!keys.AddTicketPersonalized(raw)) { | 88 | if (!keys.AddTicketPersonalized(raw)) { |
| 89 | LOG_ERROR(Service_ETicket, "The ticket could not be imported!"); | 89 | LOG_ERROR(Service_ETicket, "The ticket could not be imported!"); |
| @@ -203,7 +203,7 @@ private: | |||
| 203 | 203 | ||
| 204 | IPC::ResponseBuilder rb{ctx, 4}; | 204 | IPC::ResponseBuilder rb{ctx, 4}; |
| 205 | rb.Push(RESULT_SUCCESS); | 205 | rb.Push(RESULT_SUCCESS); |
| 206 | rb.Push<u64>(ticket.size()); | 206 | rb.Push<u64>(ticket.GetSize()); |
| 207 | } | 207 | } |
| 208 | 208 | ||
| 209 | void GetPersonalizedTicketSize(Kernel::HLERequestContext& ctx) { | 209 | void GetPersonalizedTicketSize(Kernel::HLERequestContext& ctx) { |
| @@ -219,7 +219,7 @@ private: | |||
| 219 | 219 | ||
| 220 | IPC::ResponseBuilder rb{ctx, 4}; | 220 | IPC::ResponseBuilder rb{ctx, 4}; |
| 221 | rb.Push(RESULT_SUCCESS); | 221 | rb.Push(RESULT_SUCCESS); |
| 222 | rb.Push<u64>(ticket.size()); | 222 | rb.Push<u64>(ticket.GetSize()); |
| 223 | } | 223 | } |
| 224 | 224 | ||
| 225 | void GetCommonTicketData(Kernel::HLERequestContext& ctx) { | 225 | void GetCommonTicketData(Kernel::HLERequestContext& ctx) { |
| @@ -233,8 +233,8 @@ private: | |||
| 233 | 233 | ||
| 234 | const auto ticket = keys.GetCommonTickets().at(rights_id); | 234 | const auto ticket = keys.GetCommonTickets().at(rights_id); |
| 235 | 235 | ||
| 236 | const auto write_size = std::min(ticket.size(), ctx.GetWriteBufferSize()); | 236 | const auto write_size = std::min(ticket.GetSize(), ctx.GetWriteBufferSize()); |
| 237 | ctx.WriteBuffer(ticket.data(), write_size); | 237 | ctx.WriteBuffer(&ticket, write_size); |
| 238 | 238 | ||
| 239 | IPC::ResponseBuilder rb{ctx, 4}; | 239 | IPC::ResponseBuilder rb{ctx, 4}; |
| 240 | rb.Push(RESULT_SUCCESS); | 240 | rb.Push(RESULT_SUCCESS); |
| @@ -252,8 +252,8 @@ private: | |||
| 252 | 252 | ||
| 253 | const auto ticket = keys.GetPersonalizedTickets().at(rights_id); | 253 | const auto ticket = keys.GetPersonalizedTickets().at(rights_id); |
| 254 | 254 | ||
| 255 | const auto write_size = std::min(ticket.size(), ctx.GetWriteBufferSize()); | 255 | const auto write_size = std::min(ticket.GetSize(), ctx.GetWriteBufferSize()); |
| 256 | ctx.WriteBuffer(ticket.data(), write_size); | 256 | ctx.WriteBuffer(&ticket, write_size); |
| 257 | 257 | ||
| 258 | IPC::ResponseBuilder rb{ctx, 4}; | 258 | IPC::ResponseBuilder rb{ctx, 4}; |
| 259 | rb.Push(RESULT_SUCCESS); | 259 | rb.Push(RESULT_SUCCESS); |