From ceff2f3712d66904747f77619cd6dc12a5dcea8b Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Sat, 30 Oct 2021 11:21:25 -0700 Subject: [PATCH] spl: fix legacy physical keyslot compatibility --- .../include/stratosphere/spl/impl/spl_api_impl.hpp | 2 +- libstratosphere/source/spl/impl/spl_api_impl.cpp | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/libstratosphere/include/stratosphere/spl/impl/spl_api_impl.hpp b/libstratosphere/include/stratosphere/spl/impl/spl_api_impl.hpp index b64d8414..db235432 100644 --- a/libstratosphere/include/stratosphere/spl/impl/spl_api_impl.hpp +++ b/libstratosphere/include/stratosphere/spl/impl/spl_api_impl.hpp @@ -51,7 +51,7 @@ namespace ams::spl::impl { Result AllocateAesKeySlot(s32 *out_keyslot); Result DeallocateAesKeySlot(s32 keyslot); - Result TestAesKeySlot(s32 *out_index, s32 keyslot); + Result TestAesKeySlot(s32 *out_index, bool *out_virtual, s32 keyslot); os::SystemEvent *GetAesKeySlotAvailableEvent(); diff --git a/libstratosphere/source/spl/impl/spl_api_impl.cpp b/libstratosphere/source/spl/impl/spl_api_impl.cpp index ed1fe883..a4183c38 100644 --- a/libstratosphere/source/spl/impl/spl_api_impl.cpp +++ b/libstratosphere/source/spl/impl/spl_api_impl.cpp @@ -729,9 +729,10 @@ namespace ams::spl::impl { return ResultSuccess(); } - Result TestAesKeySlot(s32 *out_index, s32 keyslot) { + Result TestAesKeySlot(s32 *out_index, bool *out_virtual, s32 keyslot) { if (g_is_physical_keyslot_allowed && IsPhysicalAesKeySlot(keyslot)) { - *out_index = keyslot; + *out_index = keyslot; + *out_virtual = false; return ResultSuccess(); } @@ -740,7 +741,8 @@ namespace ams::spl::impl { const s32 index = GetVirtualAesKeySlotIndex(keyslot); R_UNLESS(g_is_aes_keyslot_allocated[index], spl::ResultInvalidKeySlot()); - *out_index = index; + *out_index = index; + *out_virtual = true; return ResultSuccess(); }