From 2c1c67dd3bd78c74c6db1aa53da192207ffe0cdb Mon Sep 17 00:00:00 2001 From: xbzk Date: Thu, 11 Jun 2026 09:40:01 -0300 Subject: [PATCH] [service, spl] handle spl:mig AES generation commands --- src/core/hle/service/spl/spl.cpp | 7 ++++-- src/core/hle/service/spl/spl_module.cpp | 30 +++++++++++++++++++++++++ src/core/hle/service/spl/spl_module.h | 5 +++++ 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/src/core/hle/service/spl/spl.cpp b/src/core/hle/service/spl/spl.cpp index fde212186f..377c602610 100644 --- a/src/core/hle/service/spl/spl.cpp +++ b/src/core/hle/service/spl/spl.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -28,9 +31,9 @@ SPL_MIG::SPL_MIG(Core::System& system_, std::shared_ptr module_) static const FunctionInfo functions[] = { {0, &SPL::GetConfig, "GetConfig"}, {1, &SPL::ModularExponentiate, "ModularExponentiate"}, - {2, nullptr, "GenerateAesKek"}, + {2, &SPL::GenerateAesKek, "GenerateAesKek"}, {3, nullptr, "LoadAesKey"}, - {4, nullptr, "GenerateAesKey"}, + {4, &SPL::GenerateAesKey, "GenerateAesKey"}, {5, &SPL::SetConfig, "SetConfig"}, {7, &SPL::GenerateRandomBytes, "GenerateRandomBytes"}, {11, &SPL::IsDevelopment, "IsDevelopment"}, diff --git a/src/core/hle/service/spl/spl_module.cpp b/src/core/hle/service/spl/spl_module.cpp index 17c9f8a887..d62cecf9a2 100644 --- a/src/core/hle/service/spl/spl_module.cpp +++ b/src/core/hle/service/spl/spl_module.cpp @@ -59,6 +59,36 @@ void Module::Interface::ModularExponentiate(HLERequestContext& ctx) { rb.Push(ResultSecureMonitorNotImplemented); } +void Module::Interface::GenerateAesKek(HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + [[maybe_unused]] const auto key_source = rp.PopRaw(); + const auto generation = rp.Pop(); + const auto option = rp.Pop(); + + LOG_WARNING(Service_SPL, "(STUBBED) called, generation={:#x}, option={:#x}", generation, + option); + + AccessKey access_key{}; + + IPC::ResponseBuilder rb{ctx, 6}; + rb.Push(ResultSuccess); + rb.PushRaw(access_key); +} + +void Module::Interface::GenerateAesKey(HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + [[maybe_unused]] const auto access_key = rp.PopRaw(); + [[maybe_unused]] const auto key_source = rp.PopRaw(); + + LOG_WARNING(Service_SPL, "(STUBBED) called"); + + AesKey aes_key{}; + + IPC::ResponseBuilder rb{ctx, 6}; + rb.Push(ResultSuccess); + rb.PushRaw(aes_key); +} + void Module::Interface::SetConfig(HLERequestContext& ctx) { UNIMPLEMENTED_MSG("SetConfig is not implemented!"); diff --git a/src/core/hle/service/spl/spl_module.h b/src/core/hle/service/spl/spl_module.h index 06dcffa6c4..6cf2b49f39 100644 --- a/src/core/hle/service/spl/spl_module.h +++ b/src/core/hle/service/spl/spl_module.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -25,6 +28,8 @@ public: // General void GetConfig(HLERequestContext& ctx); void ModularExponentiate(HLERequestContext& ctx); + void GenerateAesKek(HLERequestContext& ctx); + void GenerateAesKey(HLERequestContext& ctx); void SetConfig(HLERequestContext& ctx); void GenerateRandomBytes(HLERequestContext& ctx); void IsDevelopment(HLERequestContext& ctx);