diff --git a/libexosphere/include/exosphere/pkg1/pkg1_key_generation.hpp b/libexosphere/include/exosphere/pkg1/pkg1_key_generation.hpp index 711f36ba..5e58876f 100644 --- a/libexosphere/include/exosphere/pkg1/pkg1_key_generation.hpp +++ b/libexosphere/include/exosphere/pkg1/pkg1_key_generation.hpp @@ -44,4 +44,12 @@ namespace ams::pkg1 { constexpr inline const int OldMasterKeyCount = KeyGeneration_Count - 1; constexpr inline const int OldDeviceMasterKeyCount = KeyGeneration_Count - KeyGeneration_4_0_0; + constexpr bool IsValidDeviceUniqueKeyGeneration(int generation) { + return generation == KeyGeneration_1_0_0 || (KeyGeneration_4_0_0 <= generation && generation <= KeyGeneration_Current); + } + + constexpr bool IsValidKeyGeneration(int generation) { + return KeyGeneration_Min <= generation && generation <= KeyGeneration_Current; + } + } diff --git a/libexosphere/include/exosphere/pkg1/pkg1_se_key_slots.hpp b/libexosphere/include/exosphere/pkg1/pkg1_se_key_slots.hpp index 614aa5a3..e7c7074f 100644 --- a/libexosphere/include/exosphere/pkg1/pkg1_se_key_slots.hpp +++ b/libexosphere/include/exosphere/pkg1/pkg1_se_key_slots.hpp @@ -53,4 +53,8 @@ namespace ams::pkg1 { RsaKeySlot_PrivateKey = 1, }; + constexpr bool IsUserAesKeySlot(int slot) { + return AesKeySlot_UserStart <= slot && slot < AesKeySlot_UserEnd; + } + }