spl.cpp 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #include "core/hle/service/spl/spl.h"
  4. namespace Service::SPL {
  5. SPL::SPL(Core::System& system_, std::shared_ptr<Module> module_)
  6. : Interface(system_, std::move(module_), "spl:") {
  7. // clang-format off
  8. static const FunctionInfo functions[] = {
  9. {0, &SPL::GetConfig, "GetConfig"},
  10. {1, &SPL::ModularExponentiate, "ModularExponentiate"},
  11. {5, &SPL::SetConfig, "SetConfig"},
  12. {7, &SPL::GenerateRandomBytes, "GenerateRandomBytes"},
  13. {11, &SPL::IsDevelopment, "IsDevelopment"},
  14. {24, &SPL::SetBootReason, "SetBootReason"},
  15. {25, &SPL::GetBootReason, "GetBootReason"},
  16. };
  17. // clang-format on
  18. RegisterHandlers(functions);
  19. }
  20. SPL_MIG::SPL_MIG(Core::System& system_, std::shared_ptr<Module> module_)
  21. : Interface(system_, std::move(module_), "spl:mig") {
  22. // clang-format off
  23. static const FunctionInfo functions[] = {
  24. {0, &SPL::GetConfig, "GetConfig"},
  25. {1, &SPL::ModularExponentiate, "ModularExponentiate"},
  26. {2, nullptr, "GenerateAesKek"},
  27. {3, nullptr, "LoadAesKey"},
  28. {4, nullptr, "GenerateAesKey"},
  29. {5, &SPL::SetConfig, "SetConfig"},
  30. {7, &SPL::GenerateRandomBytes, "GenerateRandomBytes"},
  31. {11, &SPL::IsDevelopment, "IsDevelopment"},
  32. {14, nullptr, "DecryptAesKey"},
  33. {15, nullptr, "CryptAesCtr"},
  34. {16, nullptr, "ComputeCmac"},
  35. {21, nullptr, "AllocateAesKeyslot"},
  36. {22, nullptr, "DeallocateAesKeySlot"},
  37. {23, nullptr, "GetAesKeyslotAvailableEvent"},
  38. {24, &SPL::SetBootReason, "SetBootReason"},
  39. {25, &SPL::GetBootReason, "GetBootReason"},
  40. };
  41. // clang-format on
  42. RegisterHandlers(functions);
  43. }
  44. SPL_FS::SPL_FS(Core::System& system_, std::shared_ptr<Module> module_)
  45. : Interface(system_, std::move(module_), "spl:fs") {
  46. // clang-format off
  47. static const FunctionInfo functions[] = {
  48. {0, &SPL::GetConfig, "GetConfig"},
  49. {1, &SPL::ModularExponentiate, "ModularExponentiate"},
  50. {2, nullptr, "GenerateAesKek"},
  51. {3, nullptr, "LoadAesKey"},
  52. {4, nullptr, "GenerateAesKey"},
  53. {5, &SPL::SetConfig, "SetConfig"},
  54. {7, &SPL::GenerateRandomBytes, "GenerateRandomBytes"},
  55. {9, nullptr, "ImportLotusKey"},
  56. {10, nullptr, "DecryptLotusMessage"},
  57. {11, &SPL::IsDevelopment, "IsDevelopment"},
  58. {12, nullptr, "GenerateSpecificAesKey"},
  59. {14, nullptr, "DecryptAesKey"},
  60. {15, nullptr, "CryptAesCtr"},
  61. {16, nullptr, "ComputeCmac"},
  62. {19, nullptr, "LoadTitleKey"},
  63. {21, nullptr, "AllocateAesKeyslot"},
  64. {22, nullptr, "DeallocateAesKeySlot"},
  65. {23, nullptr, "GetAesKeyslotAvailableEvent"},
  66. {24, &SPL::SetBootReason, "SetBootReason"},
  67. {25, &SPL::GetBootReason, "GetBootReason"},
  68. {31, nullptr, "GetPackage2Hash"},
  69. };
  70. // clang-format on
  71. RegisterHandlers(functions);
  72. }
  73. SPL_SSL::SPL_SSL(Core::System& system_, std::shared_ptr<Module> module_)
  74. : Interface(system_, std::move(module_), "spl:ssl") {
  75. // clang-format off
  76. static const FunctionInfo functions[] = {
  77. {0, &SPL::GetConfig, "GetConfig"},
  78. {1, &SPL::ModularExponentiate, "ModularExponentiate"},
  79. {2, nullptr, "GenerateAesKek"},
  80. {3, nullptr, "LoadAesKey"},
  81. {4, nullptr, "GenerateAesKey"},
  82. {5, &SPL::SetConfig, "SetConfig"},
  83. {7, &SPL::GenerateRandomBytes, "GenerateRandomBytes"},
  84. {11, &SPL::IsDevelopment, "IsDevelopment"},
  85. {13, nullptr, "DecryptDeviceUniqueData"},
  86. {14, nullptr, "DecryptAesKey"},
  87. {15, nullptr, "CryptAesCtr"},
  88. {16, nullptr, "ComputeCmac"},
  89. {21, nullptr, "AllocateAesKeyslot"},
  90. {22, nullptr, "DeallocateAesKeySlot"},
  91. {23, nullptr, "GetAesKeyslotAvailableEvent"},
  92. {24, &SPL::SetBootReason, "SetBootReason"},
  93. {25, &SPL::GetBootReason, "GetBootReason"},
  94. {26, nullptr, "DecryptAndStoreSslClientCertKey"},
  95. {27, nullptr, "ModularExponentiateWithSslClientCertKey"},
  96. };
  97. // clang-format on
  98. RegisterHandlers(functions);
  99. }
  100. SPL_ES::SPL_ES(Core::System& system_, std::shared_ptr<Module> module_)
  101. : Interface(system_, std::move(module_), "spl:es") {
  102. // clang-format off
  103. static const FunctionInfo functions[] = {
  104. {0, &SPL::GetConfig, "GetConfig"},
  105. {1, &SPL::ModularExponentiate, "ModularExponentiate"},
  106. {2, nullptr, "GenerateAesKek"},
  107. {3, nullptr, "LoadAesKey"},
  108. {4, nullptr, "GenerateAesKey"},
  109. {5, &SPL::SetConfig, "SetConfig"},
  110. {7, &SPL::GenerateRandomBytes, "GenerateRandomBytes"},
  111. {11, &SPL::IsDevelopment, "IsDevelopment"},
  112. {13, nullptr, "DecryptDeviceUniqueData"},
  113. {14, nullptr, "DecryptAesKey"},
  114. {15, nullptr, "CryptAesCtr"},
  115. {16, nullptr, "ComputeCmac"},
  116. {17, nullptr, "ImportEsKey"},
  117. {18, nullptr, "UnwrapTitleKey"},
  118. {20, nullptr, "PrepareEsCommonKey"},
  119. {21, nullptr, "AllocateAesKeyslot"},
  120. {22, nullptr, "DeallocateAesKeySlot"},
  121. {23, nullptr, "GetAesKeyslotAvailableEvent"},
  122. {24, &SPL::SetBootReason, "SetBootReason"},
  123. {25, &SPL::GetBootReason, "GetBootReason"},
  124. {28, nullptr, "DecryptAndStoreDrmDeviceCertKey"},
  125. {29, nullptr, "ModularExponentiateWithDrmDeviceCertKey"},
  126. {31, nullptr, "PrepareEsArchiveKey"},
  127. {32, nullptr, "LoadPreparedAesKey"},
  128. };
  129. // clang-format on
  130. RegisterHandlers(functions);
  131. }
  132. SPL_MANU::SPL_MANU(Core::System& system_, std::shared_ptr<Module> module_)
  133. : Interface(system_, std::move(module_), "spl:manu") {
  134. // clang-format off
  135. static const FunctionInfo functions[] = {
  136. {0, &SPL::GetConfig, "GetConfig"},
  137. {1, &SPL::ModularExponentiate, "ModularExponentiate"},
  138. {2, nullptr, "GenerateAesKek"},
  139. {3, nullptr, "LoadAesKey"},
  140. {4, nullptr, "GenerateAesKey"},
  141. {5, &SPL::SetConfig, "SetConfig"},
  142. {7, &SPL::GenerateRandomBytes, "GenerateRandomBytes"},
  143. {11, &SPL::IsDevelopment, "IsDevelopment"},
  144. {13, nullptr, "DecryptDeviceUniqueData"},
  145. {14, nullptr, "DecryptAesKey"},
  146. {15, nullptr, "CryptAesCtr"},
  147. {16, nullptr, "ComputeCmac"},
  148. {21, nullptr, "AllocateAesKeyslot"},
  149. {22, nullptr, "DeallocateAesKeySlot"},
  150. {23, nullptr, "GetAesKeyslotAvailableEvent"},
  151. {24, &SPL::SetBootReason, "SetBootReason"},
  152. {25, &SPL::GetBootReason, "GetBootReason"},
  153. {30, nullptr, "ReencryptDeviceUniqueData"},
  154. };
  155. // clang-format on
  156. RegisterHandlers(functions);
  157. }
  158. SPL::~SPL() = default;
  159. SPL_MIG::~SPL_MIG() = default;
  160. SPL_FS::~SPL_FS() = default;
  161. SPL_SSL::~SPL_SSL() = default;
  162. SPL_ES::~SPL_ES() = default;
  163. SPL_MANU::~SPL_MANU() = default;
  164. } // namespace Service::SPL