mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-29 14:05:17 -04:00
sf: Change interface definition methodology (#1074)
* sf: Begin experimenting with new interface declaration format * sf: convert fs interfaces to new format * sf: finish conversion of libstrat to new definitions * sf: convert loader to new format * sf: convert spl to new format * sf: update ncm for new format * sf: convert pm to new format * sf: convert ro/sm to new format * sf: update fatal for new format * sf: support building dmnt under new scheme * sf: update ams.mitm for new format * sf: correct invocation def for pointer holder * fs: correct 10.x+ user bindings for Get*SpaceSize
This commit is contained in:
parent
94eb2195d3
commit
9fde97cfdd
190 changed files with 3220 additions and 3172 deletions
|
@ -18,112 +18,39 @@
|
|||
|
||||
namespace ams::spl {
|
||||
|
||||
class DeprecatedService : public sf::IServiceObject {
|
||||
protected:
|
||||
enum class CommandId {
|
||||
/* 1.0.0+ */
|
||||
GetConfig = 0,
|
||||
ExpMod = 1,
|
||||
GenerateAesKek = 2,
|
||||
LoadAesKey = 3,
|
||||
GenerateAesKey = 4,
|
||||
SetConfig = 5,
|
||||
GenerateRandomBytes = 7,
|
||||
ImportLotusKey = 9,
|
||||
DecryptLotusMessage = 10,
|
||||
IsDevelopment = 11,
|
||||
GenerateSpecificAesKey = 12,
|
||||
DecryptRsaPrivateKeyDeprecated = 13,
|
||||
DecryptRsaPrivateKey = 13,
|
||||
DecryptAesKey = 14,
|
||||
CryptAesCtrDeprecated = 15,
|
||||
CryptAesCtr = 15,
|
||||
ComputeCmac = 16,
|
||||
ImportEsKey = 17,
|
||||
UnwrapTitleKeyDeprecated = 18,
|
||||
UnwrapTitleKey = 18,
|
||||
LoadTitleKey = 19,
|
||||
|
||||
/* 2.0.0+ */
|
||||
UnwrapCommonTitleKeyDeprecated = 20,
|
||||
UnwrapCommonTitleKey = 20,
|
||||
AllocateAesKeyslot = 21,
|
||||
FreeAesKeyslot = 22,
|
||||
GetAesKeyslotAvailableEvent = 23,
|
||||
|
||||
/* 3.0.0+ */
|
||||
SetBootReason = 24,
|
||||
GetBootReason = 25,
|
||||
};
|
||||
class DeprecatedService final {
|
||||
public:
|
||||
virtual ~DeprecatedService();
|
||||
public:
|
||||
DeprecatedService() { /* ... */ }
|
||||
virtual ~DeprecatedService() { /* ... */ }
|
||||
protected:
|
||||
/* Actual commands. */
|
||||
virtual Result GetConfig(sf::Out<u64> out, u32 which);
|
||||
virtual Result ExpMod(const sf::OutPointerBuffer &out, const sf::InPointerBuffer &base, const sf::InPointerBuffer &exp, const sf::InPointerBuffer &mod);
|
||||
virtual Result GenerateAesKek(sf::Out<AccessKey> out_access_key, KeySource key_source, u32 generation, u32 option);
|
||||
virtual Result LoadAesKey(s32 keyslot, AccessKey access_key, KeySource key_source);
|
||||
virtual Result GenerateAesKey(sf::Out<AesKey> out_key, AccessKey access_key, KeySource key_source);
|
||||
virtual Result SetConfig(u32 which, u64 value);
|
||||
virtual Result GenerateRandomBytes(const sf::OutPointerBuffer &out);
|
||||
virtual Result ImportLotusKey(const sf::InPointerBuffer &src, AccessKey access_key, KeySource key_source, u32 option);
|
||||
virtual Result DecryptLotusMessage(sf::Out<u32> out_size, const sf::OutPointerBuffer &out, const sf::InPointerBuffer &base, const sf::InPointerBuffer &mod, const sf::InPointerBuffer &label_digest);
|
||||
virtual Result IsDevelopment(sf::Out<bool> is_dev);
|
||||
virtual Result GenerateSpecificAesKey(sf::Out<AesKey> out_key, KeySource key_source, u32 generation, u32 which);
|
||||
virtual Result DecryptRsaPrivateKey(const sf::OutPointerBuffer &dst, const sf::InPointerBuffer &src, AccessKey access_key, KeySource key_source, u32 option);
|
||||
virtual Result DecryptAesKey(sf::Out<AesKey> out_key, KeySource key_source, u32 generation, u32 option);
|
||||
virtual Result CryptAesCtrDeprecated(const sf::OutBuffer &out_buf, s32 keyslot, const sf::InBuffer &in_buf, IvCtr iv_ctr);
|
||||
virtual Result CryptAesCtr(const sf::OutNonSecureBuffer &out_buf, s32 keyslot, const sf::InNonSecureBuffer &in_buf, IvCtr iv_ctr);
|
||||
virtual Result ComputeCmac(sf::Out<Cmac> out_cmac, s32 keyslot, const sf::InPointerBuffer &in_buf);
|
||||
virtual Result ImportEsKey(const sf::InPointerBuffer &src, AccessKey access_key, KeySource key_source, u32 option);
|
||||
virtual Result UnwrapTitleKeyDeprecated(sf::Out<AccessKey> out_access_key, const sf::InPointerBuffer &base, const sf::InPointerBuffer &mod, const sf::InPointerBuffer &label_digest);
|
||||
virtual Result UnwrapTitleKey(sf::Out<AccessKey> out_access_key, const sf::InPointerBuffer &base, const sf::InPointerBuffer &mod, const sf::InPointerBuffer &label_digest, u32 generation);
|
||||
virtual Result LoadTitleKey(s32 keyslot, AccessKey access_key);
|
||||
virtual Result UnwrapCommonTitleKeyDeprecated(sf::Out<AccessKey> out_access_key, KeySource key_source);
|
||||
virtual Result UnwrapCommonTitleKey(sf::Out<AccessKey> out_access_key, KeySource key_source, u32 generation);
|
||||
virtual Result AllocateAesKeyslot(sf::Out<s32> out_keyslot);
|
||||
virtual Result FreeAesKeyslot(s32 keyslot);
|
||||
virtual void GetAesKeyslotAvailableEvent(sf::OutCopyHandle out_hnd);
|
||||
virtual Result SetBootReason(BootReasonValue boot_reason);
|
||||
virtual Result GetBootReason(sf::Out<BootReasonValue> out);
|
||||
public:
|
||||
DEFINE_SERVICE_DISPATCH_TABLE {
|
||||
MAKE_SERVICE_COMMAND_META(GetConfig),
|
||||
MAKE_SERVICE_COMMAND_META(ExpMod),
|
||||
MAKE_SERVICE_COMMAND_META(GenerateAesKek),
|
||||
MAKE_SERVICE_COMMAND_META(LoadAesKey),
|
||||
MAKE_SERVICE_COMMAND_META(GenerateAesKey),
|
||||
MAKE_SERVICE_COMMAND_META(SetConfig),
|
||||
MAKE_SERVICE_COMMAND_META(GenerateRandomBytes),
|
||||
MAKE_SERVICE_COMMAND_META(ImportLotusKey),
|
||||
MAKE_SERVICE_COMMAND_META(DecryptLotusMessage),
|
||||
MAKE_SERVICE_COMMAND_META(IsDevelopment),
|
||||
MAKE_SERVICE_COMMAND_META(GenerateSpecificAesKey),
|
||||
MAKE_SERVICE_COMMAND_META(DecryptRsaPrivateKey),
|
||||
MAKE_SERVICE_COMMAND_META(DecryptAesKey),
|
||||
|
||||
MAKE_SERVICE_COMMAND_META(CryptAesCtrDeprecated, hos::Version_1_0_0, hos::Version_1_0_0),
|
||||
MAKE_SERVICE_COMMAND_META(CryptAesCtr, hos::Version_2_0_0),
|
||||
|
||||
MAKE_SERVICE_COMMAND_META(ComputeCmac),
|
||||
MAKE_SERVICE_COMMAND_META(ImportEsKey),
|
||||
|
||||
MAKE_SERVICE_COMMAND_META(UnwrapTitleKeyDeprecated, hos::Version_1_0_0, hos::Version_2_0_0),
|
||||
MAKE_SERVICE_COMMAND_META(UnwrapTitleKey, hos::Version_3_0_0),
|
||||
|
||||
MAKE_SERVICE_COMMAND_META(LoadTitleKey),
|
||||
|
||||
MAKE_SERVICE_COMMAND_META(UnwrapCommonTitleKeyDeprecated, hos::Version_2_0_0, hos::Version_2_3_0),
|
||||
MAKE_SERVICE_COMMAND_META(UnwrapCommonTitleKey, hos::Version_3_0_0),
|
||||
|
||||
MAKE_SERVICE_COMMAND_META(AllocateAesKeyslot /* Atmosphere extension: This was added in hos::Version_2_0_0, but is allowed on older firmware by atmosphere. */),
|
||||
MAKE_SERVICE_COMMAND_META(FreeAesKeyslot /* Atmosphere extension: This was added in hos::Version_2_0_0, but is allowed on older firmware by atmosphere. */),
|
||||
MAKE_SERVICE_COMMAND_META(GetAesKeyslotAvailableEvent /* Atmosphere extension: This was added in hos::Version_2_0_0, but is allowed on older firmware by atmosphere. */),
|
||||
|
||||
MAKE_SERVICE_COMMAND_META(SetBootReason, hos::Version_3_0_0),
|
||||
MAKE_SERVICE_COMMAND_META(GetBootReason, hos::Version_3_0_0),
|
||||
};
|
||||
Result GetConfig(sf::Out<u64> out, u32 which);
|
||||
Result ModularExponentiate(const sf::OutPointerBuffer &out, const sf::InPointerBuffer &base, const sf::InPointerBuffer &exp, const sf::InPointerBuffer &mod);
|
||||
Result GenerateAesKek(sf::Out<AccessKey> out_access_key, KeySource key_source, u32 generation, u32 option);
|
||||
Result LoadAesKey(s32 keyslot, AccessKey access_key, KeySource key_source);
|
||||
Result GenerateAesKey(sf::Out<AesKey> out_key, AccessKey access_key, KeySource key_source);
|
||||
Result SetConfig(u32 which, u64 value);
|
||||
Result GenerateRandomBytes(const sf::OutPointerBuffer &out);
|
||||
Result DecryptAndStoreGcKey(const sf::InPointerBuffer &src, AccessKey access_key, KeySource key_source, u32 option);
|
||||
Result DecryptGcMessage(sf::Out<u32> out_size, const sf::OutPointerBuffer &out, const sf::InPointerBuffer &base, const sf::InPointerBuffer &mod, const sf::InPointerBuffer &label_digest);
|
||||
Result IsDevelopment(sf::Out<bool> is_dev);
|
||||
Result GenerateSpecificAesKey(sf::Out<AesKey> out_key, KeySource key_source, u32 generation, u32 which);
|
||||
Result DecryptDeviceUniqueData(const sf::OutPointerBuffer &dst, const sf::InPointerBuffer &src, AccessKey access_key, KeySource key_source, u32 option);
|
||||
Result DecryptAesKey(sf::Out<AesKey> out_key, KeySource key_source, u32 generation, u32 option);
|
||||
Result ComputeCtrDeprecated(const sf::OutBuffer &out_buf, s32 keyslot, const sf::InBuffer &in_buf, IvCtr iv_ctr);
|
||||
Result ComputeCtr(const sf::OutNonSecureBuffer &out_buf, s32 keyslot, const sf::InNonSecureBuffer &in_buf, IvCtr iv_ctr);
|
||||
Result ComputeCmac(sf::Out<Cmac> out_cmac, s32 keyslot, const sf::InPointerBuffer &in_buf);
|
||||
Result LoadEsDeviceKey(const sf::InPointerBuffer &src, AccessKey access_key, KeySource key_source, u32 option);
|
||||
Result PrepareEsTitleKeyDeprecated(sf::Out<AccessKey> out_access_key, const sf::InPointerBuffer &base, const sf::InPointerBuffer &mod, const sf::InPointerBuffer &label_digest);
|
||||
Result PrepareEsTitleKey(sf::Out<AccessKey> out_access_key, const sf::InPointerBuffer &base, const sf::InPointerBuffer &mod, const sf::InPointerBuffer &label_digest, u32 generation);
|
||||
Result LoadPreparedAesKey(s32 keyslot, AccessKey access_key);
|
||||
Result PrepareCommonEsTitleKeyDeprecated(sf::Out<AccessKey> out_access_key, KeySource key_source);
|
||||
Result PrepareCommonEsTitleKey(sf::Out<AccessKey> out_access_key, KeySource key_source, u32 generation);
|
||||
Result AllocateAesKeySlot(sf::Out<s32> out_keyslot);
|
||||
Result DeallocateAesKeySlot(s32 keyslot);
|
||||
Result GetAesKeySlotAvailableEvent(sf::OutCopyHandle out_hnd);
|
||||
Result SetBootReason(BootReasonValue boot_reason);
|
||||
Result GetBootReason(sf::Out<BootReasonValue> out);
|
||||
};
|
||||
static_assert(spl::impl::IsIDeprecatedGeneralInterface<DeprecatedService>);
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue