mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-27 13:14:15 -04:00
ams: deduplicate static initialization logic
This commit is contained in:
parent
78f7218c4f
commit
30fac905af
24 changed files with 202 additions and 262 deletions
|
@ -112,13 +112,13 @@ namespace ams::fssystem {
|
|||
NcaCryptoConfiguration g_nca_crypto_configuration_prod;
|
||||
|
||||
constexpr inline s32 KeySlotCacheEntryCount = 3;
|
||||
KeySlotCache g_key_slot_cache;
|
||||
util::optional<KeySlotCacheEntry> g_key_slot_cache_entry[KeySlotCacheEntryCount];
|
||||
constinit KeySlotCache g_key_slot_cache;
|
||||
constinit util::optional<KeySlotCacheEntry> g_key_slot_cache_entry[KeySlotCacheEntryCount];
|
||||
|
||||
spl::AccessKey &GetNcaKekAccessKey(s32 key_type) {
|
||||
static spl::AccessKey s_nca_kek_access_key_array[KeyAreaEncryptionKeyCount] = {};
|
||||
static spl::AccessKey s_nca_header_kek_access_key = {};
|
||||
static spl::AccessKey s_invalid_nca_kek_access_key = {};
|
||||
AMS_FUNCTION_LOCAL_STATIC_CONSTINIT(spl::AccessKey, s_nca_kek_access_key_array[KeyAreaEncryptionKeyCount]);
|
||||
AMS_FUNCTION_LOCAL_STATIC_CONSTINIT(spl::AccessKey, s_nca_header_kek_access_key);
|
||||
AMS_FUNCTION_LOCAL_STATIC_CONSTINIT(spl::AccessKey, s_invalid_nca_kek_access_key);
|
||||
|
||||
if (key_type > static_cast<s32>(KeyType::NcaHeaderKey) || IsInvalidKeyTypeValue(key_type)) {
|
||||
return s_invalid_nca_kek_access_key;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue