yuzu-emu
/
yuzu-mainline
Archived
1
0
Fork 0

Update SPL to fit N's service refactor (4.0.0+) which split into new services.

This commit is contained in:
zkitx 2021-03-11 02:36:48 -05:00
parent daf5c5060b
commit ad653550eb
No known key found for this signature in database
GPG Key ID: 7CD90D55F7F9FBBA
3 changed files with 178 additions and 9 deletions

View File

@ -43,6 +43,11 @@ void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system
auto module = std::make_shared<Module>(); auto module = std::make_shared<Module>();
std::make_shared<CSRNG>(system, module)->InstallAsService(service_manager); std::make_shared<CSRNG>(system, module)->InstallAsService(service_manager);
std::make_shared<SPL>(system, module)->InstallAsService(service_manager); std::make_shared<SPL>(system, module)->InstallAsService(service_manager);
std::make_shared<SPL_MIG>(system, module)->InstallAsService(service_manager);
std::make_shared<SPL_FS>(system, module)->InstallAsService(service_manager);
std::make_shared<SPL_SSL>(system, module)->InstallAsService(service_manager);
std::make_shared<SPL_ES>(system, module)->InstallAsService(service_manager);
std::make_shared<SPL_MANU>(system, module)->InstallAsService(service_manager);
} }
} // namespace Service::SPL } // namespace Service::SPL

View File

@ -8,6 +8,79 @@ namespace Service::SPL {
SPL::SPL(Core::System& system_, std::shared_ptr<Module> module_) SPL::SPL(Core::System& system_, std::shared_ptr<Module> module_)
: Interface(system_, std::move(module_), "spl:") { : Interface(system_, std::move(module_), "spl:") {
// clang-format off
static const FunctionInfo functions[] = {
{0, nullptr, "GetConfig"},
{1, nullptr, "ModularExponentiate"},
{5, nullptr, "SetConfig"},
{7, &SPL::GetRandomBytes, "GetRandomBytes"},
{11, nullptr, "IsDevelopment"},
{24, nullptr, "SetBootReason"},
{25, nullptr, "GetBootReason"},
};
// clang-format on
RegisterHandlers(functions);
}
SPL_MIG::SPL_MIG(Core::System& system_, std::shared_ptr<Module> module_)
: Interface(system_, std::move(module_), "spl:mig") {
// clang-format off
static const FunctionInfo functions[] = {
{0, nullptr, "GetConfig"},
{1, nullptr, "ModularExponentiate"},
{2, nullptr, "GenerateAesKek"},
{3, nullptr, "LoadAesKey"},
{4, nullptr, "GenerateAesKey"},
{5, nullptr, "SetConfig"},
{7, &SPL::GetRandomBytes, "GenerateRandomBytes"},
{11, nullptr, "IsDevelopment"},
{14, nullptr, "DecryptAesKey"},
{15, nullptr, "CryptAesCtr"},
{16, nullptr, "ComputeCmac"},
{21, nullptr, "AllocateAesKeyslot"},
{22, nullptr, "DeallocateAesKeyslot"},
{23, nullptr, "GetAesKeyslotAvailableEvent"},
{24, nullptr, "SetBootReason"},
{25, nullptr, "GetBootReason"},
};
// clang-format on
RegisterHandlers(functions);
}
SPL_FS::SPL_FS(Core::System& system_, std::shared_ptr<Module> module_)
: Interface(system_, std::move(module_), "spl:fs") {
// clang-format off
static const FunctionInfo functions[] = {
{0, nullptr, "GetConfig"},
{1, nullptr, "ModularExponentiate"},
{2, nullptr, "GenerateAesKek"},
{3, nullptr, "LoadAesKey"},
{4, nullptr, "GenerateAesKey"},
{5, nullptr, "SetConfig"},
{7, &SPL::GetRandomBytes, "GenerateRandomBytes"},
{11, nullptr, "IsDevelopment"},
{12, nullptr, "GenerateSpecificAesKey"},
{14, nullptr, "DecryptAesKey"},
{15, nullptr, "CryptAesCtr"},
{16, nullptr, "ComputeCmac"},
{19, nullptr, "LoadTitleKey"},
{21, nullptr, "AllocateAesKeyslot"},
{22, nullptr, "DeallocateAesKeyslot"},
{23, nullptr, "GetAesKeyslotAvailableEvent"},
{24, nullptr, "SetBootReason"},
{25, nullptr, "GetBootReason"},
{31, nullptr, "GetPackage2Hash"},
};
// clang-format on
RegisterHandlers(functions);
}
SPL_SSL::SPL_SSL(Core::System& system_, std::shared_ptr<Module> module_)
: Interface(system_, std::move(module_), "spl:ssl") {
// clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "GetConfig"}, {0, nullptr, "GetConfig"},
{1, nullptr, "ModularExponentiate"}, {1, nullptr, "ModularExponentiate"},
@ -16,18 +89,11 @@ SPL::SPL(Core::System& system_, std::shared_ptr<Module> module_)
{4, nullptr, "GenerateAesKey"}, {4, nullptr, "GenerateAesKey"},
{5, nullptr, "SetConfig"}, {5, nullptr, "SetConfig"},
{7, &SPL::GetRandomBytes, "GetRandomBytes"}, {7, &SPL::GetRandomBytes, "GetRandomBytes"},
{9, nullptr, "ImportLotusKey"},
{10, nullptr, "DecryptLotusMessage"},
{11, nullptr, "IsDevelopment"}, {11, nullptr, "IsDevelopment"},
{12, nullptr, "GenerateSpecificAesKey"},
{13, nullptr, "DecryptDeviceUniqueData"}, {13, nullptr, "DecryptDeviceUniqueData"},
{14, nullptr, "DecryptAesKey"}, {14, nullptr, "DecryptAesKey"},
{15, nullptr, "CryptAesCtr"}, {15, nullptr, "CryptAesCtr"},
{16, nullptr, "ComputeCmac"}, {16, nullptr, "ComputeCmac"},
{17, nullptr, "ImportEsKey"},
{18, nullptr, "UnwrapTitleKey"},
{19, nullptr, "LoadTitleKey"},
{20, nullptr, "PrepareEsCommonKey"},
{21, nullptr, "AllocateAesKeyslot"}, {21, nullptr, "AllocateAesKeyslot"},
{22, nullptr, "DeallocateAesKeySlot"}, {22, nullptr, "DeallocateAesKeySlot"},
{23, nullptr, "GetAesKeyslotAvailableEvent"}, {23, nullptr, "GetAesKeyslotAvailableEvent"},
@ -35,15 +101,83 @@ SPL::SPL(Core::System& system_, std::shared_ptr<Module> module_)
{25, nullptr, "GetBootReason"}, {25, nullptr, "GetBootReason"},
{26, nullptr, "DecryptAndStoreSslClientCertKey"}, {26, nullptr, "DecryptAndStoreSslClientCertKey"},
{27, nullptr, "ModularExponentiateWithSslClientCertKey"}, {27, nullptr, "ModularExponentiateWithSslClientCertKey"},
};
// clang-format on
RegisterHandlers(functions);
}
SPL_ES::SPL_ES(Core::System& system_, std::shared_ptr<Module> module_)
: Interface(system_, std::move(module_), "spl:es") {
// clang-format off
static const FunctionInfo functions[] = {
{0, nullptr, "GetConfig"},
{1, nullptr, "ModularExponentiate"},
{2, nullptr, "GenerateAesKek"},
{3, nullptr, "LoadAesKey"},
{4, nullptr, "GenerateAesKey"},
{5, nullptr, "SetConfig"},
{7, &SPL::GetRandomBytes, "GenerateRandomBytes"},
{11, nullptr, "IsDevelopment"},
{13, nullptr, "DecryptDeviceUniqueData"},
{14, nullptr, "DecryptAesKey"},
{15, nullptr, "CryptAesCtr"},
{16, nullptr, "ComputeCmac"},
{18, nullptr, "UnwrapTitleKey"},
{20, nullptr, "PrepareEsCommonKey"},
{21, nullptr, "AllocateAesKeyslot"},
{22, nullptr, "DeallocateAesKeyslot"},
{23, nullptr, "GetAesKeyslotAvailableEvent"},
{24, nullptr, "SetBootReason"},
{25, nullptr, "GetBootReason"},
{28, nullptr, "DecryptAndStoreDrmDeviceCertKey"}, {28, nullptr, "DecryptAndStoreDrmDeviceCertKey"},
{29, nullptr, "ModularExponentiateWithDrmDeviceCertKey"}, {29, nullptr, "ModularExponentiateWithDrmDeviceCertKey"},
{30, nullptr, "ReencryptDeviceUniqueData "}, {31, nullptr, "PrepareEsArchiveKey"},
{31, nullptr, "PrepareEsArchiveKey"}, // This is also GetPackage2Hash?
{32, nullptr, "LoadPreparedAesKey"}, {32, nullptr, "LoadPreparedAesKey"},
}; };
// clang-format on
RegisterHandlers(functions);
}
SPL_MANU::SPL_MANU(Core::System& system_, std::shared_ptr<Module> module_)
: Interface(system_, std::move(module_), "spl:manu") {
// clang-format off
static const FunctionInfo functions[] = {
{0, nullptr, "GetConfig"},
{1, nullptr, "ModularExponentiate"},
{2, nullptr, "GenerateAesKek"},
{3, nullptr, "LoadAesKey"},
{4, nullptr, "GenerateAesKey"},
{5, nullptr, "SetConfig"},
{7, &SPL::GetRandomBytes, "GetRandomBytes"},
{11, nullptr, "IsDevelopment"},
{13, nullptr, "DecryptDeviceUniqueData"},
{14, nullptr, "DecryptAesKey"},
{15, nullptr, "CryptAesCtr"},
{16, nullptr, "ComputeCmac"},
{21, nullptr, "AllocateAesKeyslot"},
{22, nullptr, "DeallocateAesKeySlot"},
{23, nullptr, "GetAesKeyslotAvailableEvent"},
{24, nullptr, "SetBootReason"},
{25, nullptr, "GetBootReason"},
{30, nullptr, "ReencryptDeviceUniqueData"},
};
// clang-format on
RegisterHandlers(functions); RegisterHandlers(functions);
} }
SPL::~SPL() = default; SPL::~SPL() = default;
SPL_MIG::~SPL_MIG() = default;
SPL_FS::~SPL_FS() = default;
SPL_SSL::~SPL_SSL() = default;
SPL_ES::~SPL_ES() = default;
SPL_MANU::~SPL_MANU() = default;
} // namespace Service::SPL } // namespace Service::SPL

View File

@ -18,4 +18,34 @@ public:
~SPL() override; ~SPL() override;
}; };
class SPL_MIG final : public Module::Interface {
public:
explicit SPL_MIG(Core::System& system_, std::shared_ptr<Module> module_);
~SPL_MIG() override;
};
class SPL_FS final : public Module::Interface {
public:
explicit SPL_FS(Core::System& system_, std::shared_ptr<Module> module_);
~SPL_FS() override;
};
class SPL_SSL final : public Module::Interface {
public:
explicit SPL_SSL(Core::System& system_, std::shared_ptr<Module> module_);
~SPL_SSL() override;
};
class SPL_ES final : public Module::Interface {
public:
explicit SPL_ES(Core::System& system_, std::shared_ptr<Module> module_);
~SPL_ES() override;
};
class SPL_MANU final : public Module::Interface {
public:
explicit SPL_MANU(Core::System& system_, std::shared_ptr<Module> module_);
~SPL_MANU() override;
};
} // namespace Service::SPL } // namespace Service::SPL