mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-12-23 04:41:12 +00:00
spl: fix vtables/other issues, now boots (not all commands work)
This commit is contained in:
parent
85e8506fa8
commit
bc44e02aed
12 changed files with 131 additions and 127 deletions
|
@ -1 +1 @@
|
||||||
Subproject commit 9e34dbe7e2689eadae205f34d494696b5ea6a3f5
|
Subproject commit 63fc847f8ae43b173a9031071eebb76a1961c41c
|
|
@ -35,7 +35,7 @@ Result CryptoService::DecryptAesKey(Out<AesKey> out_key, KeySource key_source, u
|
||||||
return this->GetSecureMonitorWrapper()->DecryptAesKey(out_key.GetPointer(), key_source, generation, option);
|
return this->GetSecureMonitorWrapper()->DecryptAesKey(out_key.GetPointer(), key_source, generation, option);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result CryptoService::CryptAesCtr(OutBuffer<u8> out_buf, u32 keyslot, InBuffer<u8> in_buf, IvCtr iv_ctr) {
|
Result CryptoService::CryptAesCtr(OutBuffer<u8, BufferType_Type1> out_buf, u32 keyslot, InBuffer<u8, BufferType_Type1> in_buf, IvCtr iv_ctr) {
|
||||||
return this->GetSecureMonitorWrapper()->CryptAesCtr(out_buf.buffer, out_buf.num_elements, keyslot, this, in_buf.buffer, in_buf.num_elements, iv_ctr);
|
return this->GetSecureMonitorWrapper()->CryptAesCtr(out_buf.buffer, out_buf.num_elements, keyslot, this, in_buf.buffer, in_buf.num_elements, iv_ctr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,29 +36,29 @@ class CryptoService : public GeneralService {
|
||||||
virtual Result LoadAesKey(u32 keyslot, AccessKey access_key, KeySource key_source);
|
virtual Result LoadAesKey(u32 keyslot, AccessKey access_key, KeySource key_source);
|
||||||
virtual Result GenerateAesKey(Out<AesKey> out_key, AccessKey access_key, KeySource key_source);
|
virtual Result GenerateAesKey(Out<AesKey> out_key, AccessKey access_key, KeySource key_source);
|
||||||
virtual Result DecryptAesKey(Out<AesKey> out_key, KeySource key_source, u32 generation, u32 option);
|
virtual Result DecryptAesKey(Out<AesKey> out_key, KeySource key_source, u32 generation, u32 option);
|
||||||
virtual Result CryptAesCtr(OutBuffer<u8> out_buf, u32 keyslot, InBuffer<u8> in_buf, IvCtr iv_ctr);
|
virtual Result CryptAesCtr(OutBuffer<u8, BufferType_Type1> out_buf, u32 keyslot, InBuffer<u8, BufferType_Type1> in_buf, IvCtr iv_ctr);
|
||||||
virtual Result ComputeCmac(Out<Cmac> out_cmac, u32 keyslot, InPointer<u8> in_buf);
|
virtual Result ComputeCmac(Out<Cmac> out_cmac, u32 keyslot, InPointer<u8> in_buf);
|
||||||
virtual Result AllocateAesKeyslot(Out<u32> out_keyslot);
|
virtual Result AllocateAesKeyslot(Out<u32> out_keyslot);
|
||||||
virtual Result FreeAesKeyslot(u32 keyslot);
|
virtual Result FreeAesKeyslot(u32 keyslot);
|
||||||
virtual void GetAesKeyslotAvailableEvent(Out<CopiedHandle> out_hnd);
|
virtual void GetAesKeyslotAvailableEvent(Out<CopiedHandle> out_hnd);
|
||||||
public:
|
public:
|
||||||
DEFINE_SERVICE_DISPATCH_TABLE {
|
DEFINE_SERVICE_DISPATCH_TABLE {
|
||||||
MakeServiceCommandMeta<Spl_Cmd_GetConfig, &CryptoService::GetConfig>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_GetConfig, &CryptoService::GetConfig, CryptoService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_ExpMod, &CryptoService::ExpMod>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_ExpMod, &CryptoService::ExpMod, CryptoService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_SetConfig, &CryptoService::SetConfig>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_SetConfig, &CryptoService::SetConfig, CryptoService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_GenerateRandomBytes, &CryptoService::GenerateRandomBytes>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_GenerateRandomBytes, &CryptoService::GenerateRandomBytes, CryptoService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_IsDevelopment, &CryptoService::IsDevelopment>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_IsDevelopment, &CryptoService::IsDevelopment, CryptoService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_SetBootReason, &CryptoService::SetBootReason, FirmwareVersion_300>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_SetBootReason, &CryptoService::SetBootReason, CryptoService, FirmwareVersion_300>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_GetBootReason, &CryptoService::GetBootReason, FirmwareVersion_300>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_GetBootReason, &CryptoService::GetBootReason, CryptoService, FirmwareVersion_300>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_GenerateAesKek, &CryptoService::GenerateAesKek>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_GenerateAesKek, &CryptoService::GenerateAesKek, CryptoService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_LoadAesKey, &CryptoService::LoadAesKey>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_LoadAesKey, &CryptoService::LoadAesKey, CryptoService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_GenerateAesKey, &CryptoService::GenerateAesKey>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_GenerateAesKey, &CryptoService::GenerateAesKey, CryptoService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_DecryptAesKey, &CryptoService::DecryptAesKey>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_DecryptAesKey, &CryptoService::DecryptAesKey, CryptoService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_CryptAesCtr, &CryptoService::CryptAesCtr>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_CryptAesCtr, &CryptoService::CryptAesCtr, CryptoService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_ComputeCmac, &CryptoService::ComputeCmac>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_ComputeCmac, &CryptoService::ComputeCmac, CryptoService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_AllocateAesKeyslot, &CryptoService::AllocateAesKeyslot, FirmwareVersion_200>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_AllocateAesKeyslot, &CryptoService::AllocateAesKeyslot, CryptoService, FirmwareVersion_200>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_FreeAesKeyslot, &CryptoService::FreeAesKeyslot, FirmwareVersion_200>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_FreeAesKeyslot, &CryptoService::FreeAesKeyslot, CryptoService, FirmwareVersion_200>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_GetAesKeyslotAvailableEvent, &CryptoService::GetAesKeyslotAvailableEvent, FirmwareVersion_200>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_GetAesKeyslotAvailableEvent, &CryptoService::GetAesKeyslotAvailableEvent, CryptoService, FirmwareVersion_200>(),
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -39,7 +39,7 @@ class CtrDrbg {
|
||||||
u8 *dst_u8 = reinterpret_cast<u8 *>(dst);
|
u8 *dst_u8 = reinterpret_cast<u8 *>(dst);
|
||||||
|
|
||||||
for (size_t i = 0; i < size; i++) {
|
for (size_t i = 0; i < size; i++) {
|
||||||
dst_u8[i] = src_u8[i];
|
dst_u8[i] ^= src_u8[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,29 +41,29 @@ class EsService : public RsaService {
|
||||||
virtual Result LoadElicenseKey(u32 keyslot, AccessKey access_key);
|
virtual Result LoadElicenseKey(u32 keyslot, AccessKey access_key);
|
||||||
public:
|
public:
|
||||||
DEFINE_SERVICE_DISPATCH_TABLE {
|
DEFINE_SERVICE_DISPATCH_TABLE {
|
||||||
MakeServiceCommandMeta<Spl_Cmd_GetConfig, &EsService::GetConfig>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_GetConfig, &EsService::GetConfig, EsService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_ExpMod, &EsService::ExpMod>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_ExpMod, &EsService::ExpMod, EsService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_SetConfig, &EsService::SetConfig>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_SetConfig, &EsService::SetConfig, EsService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_GenerateRandomBytes, &EsService::GenerateRandomBytes>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_GenerateRandomBytes, &EsService::GenerateRandomBytes, EsService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_IsDevelopment, &EsService::IsDevelopment>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_IsDevelopment, &EsService::IsDevelopment, EsService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_SetBootReason, &EsService::SetBootReason, FirmwareVersion_300>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_SetBootReason, &EsService::SetBootReason, EsService, FirmwareVersion_300>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_GetBootReason, &EsService::GetBootReason, FirmwareVersion_300>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_GetBootReason, &EsService::GetBootReason, EsService, FirmwareVersion_300>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_GenerateAesKek, &EsService::GenerateAesKek>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_GenerateAesKek, &EsService::GenerateAesKek, EsService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_LoadAesKey, &EsService::LoadAesKey>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_LoadAesKey, &EsService::LoadAesKey, EsService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_GenerateAesKey, &EsService::GenerateAesKey>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_GenerateAesKey, &EsService::GenerateAesKey, EsService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_DecryptAesKey, &EsService::DecryptAesKey>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_DecryptAesKey, &EsService::DecryptAesKey, EsService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_CryptAesCtr, &EsService::CryptAesCtr>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_CryptAesCtr, &EsService::CryptAesCtr, EsService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_ComputeCmac, &EsService::ComputeCmac>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_ComputeCmac, &EsService::ComputeCmac, EsService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_AllocateAesKeyslot, &EsService::AllocateAesKeyslot, FirmwareVersion_200>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_AllocateAesKeyslot, &EsService::AllocateAesKeyslot, EsService, FirmwareVersion_200>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_FreeAesKeyslot, &EsService::FreeAesKeyslot, FirmwareVersion_200>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_FreeAesKeyslot, &EsService::FreeAesKeyslot, EsService, FirmwareVersion_200>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_GetAesKeyslotAvailableEvent, &EsService::GetAesKeyslotAvailableEvent, FirmwareVersion_200>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_GetAesKeyslotAvailableEvent, &EsService::GetAesKeyslotAvailableEvent, EsService, FirmwareVersion_200>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_DecryptRsaPrivateKey, &EsService::DecryptRsaPrivateKey>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_DecryptRsaPrivateKey, &EsService::DecryptRsaPrivateKey, EsService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_ImportEsKey, &EsService::ImportEsKey>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_ImportEsKey, &EsService::ImportEsKey, EsService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_UnwrapTitleKey, &EsService::UnwrapTitleKey>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_UnwrapTitleKey, &EsService::UnwrapTitleKey, EsService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_UnwrapCommonTitleKey, &EsService::UnwrapCommonTitleKey, FirmwareVersion_200>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_UnwrapCommonTitleKey, &EsService::UnwrapCommonTitleKey, EsService, FirmwareVersion_200>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_ImportDrmKey, &EsService::ImportDrmKey, FirmwareVersion_500>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_ImportDrmKey, &EsService::ImportDrmKey, EsService, FirmwareVersion_500>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_DrmExpMod, &EsService::DrmExpMod, FirmwareVersion_500>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_DrmExpMod, &EsService::DrmExpMod, EsService, FirmwareVersion_500>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_UnwrapElicenseKey, &EsService::UnwrapElicenseKey, FirmwareVersion_600>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_UnwrapElicenseKey, &EsService::UnwrapElicenseKey, EsService, FirmwareVersion_600>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_LoadElicenseKey, &EsService::LoadElicenseKey, FirmwareVersion_600>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_LoadElicenseKey, &EsService::LoadElicenseKey, EsService, FirmwareVersion_600>(),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -39,27 +39,27 @@ class FsService : public CryptoService {
|
||||||
virtual Result GetPackage2Hash(OutPointerWithClientSize<u8> dst);
|
virtual Result GetPackage2Hash(OutPointerWithClientSize<u8> dst);
|
||||||
public:
|
public:
|
||||||
DEFINE_SERVICE_DISPATCH_TABLE {
|
DEFINE_SERVICE_DISPATCH_TABLE {
|
||||||
MakeServiceCommandMeta<Spl_Cmd_GetConfig, &FsService::GetConfig>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_GetConfig, &FsService::GetConfig, FsService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_ExpMod, &FsService::ExpMod>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_ExpMod, &FsService::ExpMod, FsService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_SetConfig, &FsService::SetConfig>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_SetConfig, &FsService::SetConfig, FsService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_GenerateRandomBytes, &FsService::GenerateRandomBytes>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_GenerateRandomBytes, &FsService::GenerateRandomBytes, FsService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_IsDevelopment, &FsService::IsDevelopment>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_IsDevelopment, &FsService::IsDevelopment, FsService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_SetBootReason, &FsService::SetBootReason, FirmwareVersion_300>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_SetBootReason, &FsService::SetBootReason, FsService, FirmwareVersion_300>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_GetBootReason, &FsService::GetBootReason, FirmwareVersion_300>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_GetBootReason, &FsService::GetBootReason, FsService, FirmwareVersion_300>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_GenerateAesKek, &FsService::GenerateAesKek>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_GenerateAesKek, &FsService::GenerateAesKek, FsService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_LoadAesKey, &FsService::LoadAesKey>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_LoadAesKey, &FsService::LoadAesKey, FsService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_GenerateAesKey, &FsService::GenerateAesKey>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_GenerateAesKey, &FsService::GenerateAesKey, FsService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_DecryptAesKey, &FsService::DecryptAesKey>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_DecryptAesKey, &FsService::DecryptAesKey, FsService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_CryptAesCtr, &FsService::CryptAesCtr>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_CryptAesCtr, &FsService::CryptAesCtr, FsService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_ComputeCmac, &FsService::ComputeCmac>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_ComputeCmac, &FsService::ComputeCmac, FsService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_AllocateAesKeyslot, &FsService::AllocateAesKeyslot, FirmwareVersion_200>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_AllocateAesKeyslot, &FsService::AllocateAesKeyslot, FsService, FirmwareVersion_200>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_FreeAesKeyslot, &FsService::FreeAesKeyslot, FirmwareVersion_200>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_FreeAesKeyslot, &FsService::FreeAesKeyslot, FsService, FirmwareVersion_200>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_GetAesKeyslotAvailableEvent, &FsService::GetAesKeyslotAvailableEvent, FirmwareVersion_200>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_GetAesKeyslotAvailableEvent, &FsService::GetAesKeyslotAvailableEvent, FsService, FirmwareVersion_200>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_ImportLotusKey, &FsService::ImportLotusKey>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_ImportLotusKey, &FsService::ImportLotusKey, FsService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_DecryptLotusMessage, &FsService::DecryptLotusMessage>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_DecryptLotusMessage, &FsService::DecryptLotusMessage, FsService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_GenerateSpecificAesKey, &FsService::GenerateSpecificAesKey>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_GenerateSpecificAesKey, &FsService::GenerateSpecificAesKey, FsService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_LoadTitleKey, &FsService::LoadTitleKey>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_LoadTitleKey, &FsService::LoadTitleKey, FsService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_GetPackage2Hash, &FsService::GetPackage2Hash, FirmwareVersion_500>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_GetPackage2Hash, &FsService::GetPackage2Hash, FsService, FirmwareVersion_500>(),
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -121,8 +121,6 @@ int main(int argc, char **argv)
|
||||||
/* TODO, DeprecatedGeneralService */
|
/* TODO, DeprecatedGeneralService */
|
||||||
}
|
}
|
||||||
|
|
||||||
RebootToRcm();
|
|
||||||
|
|
||||||
/* Loop forever, servicing our services. */
|
/* Loop forever, servicing our services. */
|
||||||
s_server_manager.Process();
|
s_server_manager.Process();
|
||||||
|
|
||||||
|
|
|
@ -35,24 +35,24 @@ class ManuService : public RsaService {
|
||||||
virtual Result ReEncryptRsaPrivateKey(OutPointerWithClientSize<u8> out, InPointer<u8> src, AccessKey access_key_dec, KeySource source_dec, AccessKey access_key_enc, KeySource source_enc, u32 option);
|
virtual Result ReEncryptRsaPrivateKey(OutPointerWithClientSize<u8> out, InPointer<u8> src, AccessKey access_key_dec, KeySource source_dec, AccessKey access_key_enc, KeySource source_enc, u32 option);
|
||||||
public:
|
public:
|
||||||
DEFINE_SERVICE_DISPATCH_TABLE {
|
DEFINE_SERVICE_DISPATCH_TABLE {
|
||||||
MakeServiceCommandMeta<Spl_Cmd_GetConfig, &ManuService::GetConfig>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_GetConfig, &ManuService::GetConfig, ManuService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_ExpMod, &ManuService::ExpMod>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_ExpMod, &ManuService::ExpMod, ManuService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_SetConfig, &ManuService::SetConfig>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_SetConfig, &ManuService::SetConfig, ManuService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_GenerateRandomBytes, &ManuService::GenerateRandomBytes>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_GenerateRandomBytes, &ManuService::GenerateRandomBytes, ManuService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_IsDevelopment, &ManuService::IsDevelopment>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_IsDevelopment, &ManuService::IsDevelopment, ManuService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_SetBootReason, &ManuService::SetBootReason, FirmwareVersion_300>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_SetBootReason, &ManuService::SetBootReason, ManuService, FirmwareVersion_300>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_GetBootReason, &ManuService::GetBootReason, FirmwareVersion_300>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_GetBootReason, &ManuService::GetBootReason, ManuService, FirmwareVersion_300>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_GenerateAesKek, &ManuService::GenerateAesKek>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_GenerateAesKek, &ManuService::GenerateAesKek, ManuService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_LoadAesKey, &ManuService::LoadAesKey>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_LoadAesKey, &ManuService::LoadAesKey, ManuService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_GenerateAesKey, &ManuService::GenerateAesKey>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_GenerateAesKey, &ManuService::GenerateAesKey, ManuService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_DecryptAesKey, &ManuService::DecryptAesKey>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_DecryptAesKey, &ManuService::DecryptAesKey, ManuService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_CryptAesCtr, &ManuService::CryptAesCtr>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_CryptAesCtr, &ManuService::CryptAesCtr, ManuService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_ComputeCmac, &ManuService::ComputeCmac>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_ComputeCmac, &ManuService::ComputeCmac, ManuService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_AllocateAesKeyslot, &ManuService::AllocateAesKeyslot, FirmwareVersion_200>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_AllocateAesKeyslot, &ManuService::AllocateAesKeyslot, ManuService, FirmwareVersion_200>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_FreeAesKeyslot, &ManuService::FreeAesKeyslot, FirmwareVersion_200>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_FreeAesKeyslot, &ManuService::FreeAesKeyslot, ManuService, FirmwareVersion_200>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_GetAesKeyslotAvailableEvent, &ManuService::GetAesKeyslotAvailableEvent, FirmwareVersion_200>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_GetAesKeyslotAvailableEvent, &ManuService::GetAesKeyslotAvailableEvent, ManuService, FirmwareVersion_200>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_DecryptRsaPrivateKey, &ManuService::DecryptRsaPrivateKey>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_DecryptRsaPrivateKey, &ManuService::DecryptRsaPrivateKey, ManuService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_ReEncryptRsaPrivateKey, &ManuService::ReEncryptRsaPrivateKey, FirmwareVersion_500>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_ReEncryptRsaPrivateKey, &ManuService::ReEncryptRsaPrivateKey, ManuService, FirmwareVersion_500>(),
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -35,6 +35,6 @@ class RandomService final : public IServiceObject {
|
||||||
virtual Result GenerateRandomBytes(OutBuffer<u8> out);
|
virtual Result GenerateRandomBytes(OutBuffer<u8> out);
|
||||||
public:
|
public:
|
||||||
DEFINE_SERVICE_DISPATCH_TABLE {
|
DEFINE_SERVICE_DISPATCH_TABLE {
|
||||||
MakeServiceCommandMeta<Spl_Cmd_GenerateRandomBytes, &RandomService::GenerateRandomBytes>(),
|
MakeServiceCommandMeta<Csrng_Cmd_GenerateRandomBytes, &RandomService::GenerateRandomBytes>(),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -35,23 +35,23 @@ class RsaService : public CryptoService {
|
||||||
virtual Result DecryptRsaPrivateKey(OutPointerWithClientSize<u8> dst, InPointer<u8> src, AccessKey access_key, KeySource key_source, u32 option);
|
virtual Result DecryptRsaPrivateKey(OutPointerWithClientSize<u8> dst, InPointer<u8> src, AccessKey access_key, KeySource key_source, u32 option);
|
||||||
public:
|
public:
|
||||||
DEFINE_SERVICE_DISPATCH_TABLE {
|
DEFINE_SERVICE_DISPATCH_TABLE {
|
||||||
MakeServiceCommandMeta<Spl_Cmd_GetConfig, &RsaService::GetConfig>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_GetConfig, &RsaService::GetConfig, RsaService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_ExpMod, &RsaService::ExpMod>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_ExpMod, &RsaService::ExpMod, RsaService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_SetConfig, &RsaService::SetConfig>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_SetConfig, &RsaService::SetConfig, RsaService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_GenerateRandomBytes, &RsaService::GenerateRandomBytes>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_GenerateRandomBytes, &RsaService::GenerateRandomBytes, RsaService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_IsDevelopment, &RsaService::IsDevelopment>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_IsDevelopment, &RsaService::IsDevelopment, RsaService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_SetBootReason, &RsaService::SetBootReason, FirmwareVersion_300>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_SetBootReason, &RsaService::SetBootReason, RsaService, FirmwareVersion_300>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_GetBootReason, &RsaService::GetBootReason, FirmwareVersion_300>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_GetBootReason, &RsaService::GetBootReason, RsaService, FirmwareVersion_300>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_GenerateAesKek, &RsaService::GenerateAesKek>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_GenerateAesKek, &RsaService::GenerateAesKek, RsaService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_LoadAesKey, &RsaService::LoadAesKey>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_LoadAesKey, &RsaService::LoadAesKey, RsaService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_GenerateAesKey, &RsaService::GenerateAesKey>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_GenerateAesKey, &RsaService::GenerateAesKey, RsaService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_DecryptAesKey, &RsaService::DecryptAesKey>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_DecryptAesKey, &RsaService::DecryptAesKey, RsaService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_CryptAesCtr, &RsaService::CryptAesCtr>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_CryptAesCtr, &RsaService::CryptAesCtr, RsaService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_ComputeCmac, &RsaService::ComputeCmac>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_ComputeCmac, &RsaService::ComputeCmac, RsaService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_AllocateAesKeyslot, &RsaService::AllocateAesKeyslot, FirmwareVersion_200>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_AllocateAesKeyslot, &RsaService::AllocateAesKeyslot, RsaService, FirmwareVersion_200>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_FreeAesKeyslot, &RsaService::FreeAesKeyslot, FirmwareVersion_200>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_FreeAesKeyslot, &RsaService::FreeAesKeyslot, RsaService, FirmwareVersion_200>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_GetAesKeyslotAvailableEvent, &RsaService::GetAesKeyslotAvailableEvent, FirmwareVersion_200>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_GetAesKeyslotAvailableEvent, &RsaService::GetAesKeyslotAvailableEvent, RsaService, FirmwareVersion_200>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_DecryptRsaPrivateKey, &RsaService::DecryptRsaPrivateKey>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_DecryptRsaPrivateKey, &RsaService::DecryptRsaPrivateKey, RsaService>(),
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -36,25 +36,25 @@ class SslService : public RsaService {
|
||||||
virtual Result SslExpMod(OutPointerWithClientSize<u8> out, InPointer<u8> base, InPointer<u8> mod);
|
virtual Result SslExpMod(OutPointerWithClientSize<u8> out, InPointer<u8> base, InPointer<u8> mod);
|
||||||
public:
|
public:
|
||||||
DEFINE_SERVICE_DISPATCH_TABLE {
|
DEFINE_SERVICE_DISPATCH_TABLE {
|
||||||
MakeServiceCommandMeta<Spl_Cmd_GetConfig, &SslService::GetConfig>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_GetConfig, &SslService::GetConfig, SslService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_ExpMod, &SslService::ExpMod>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_ExpMod, &SslService::ExpMod, SslService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_SetConfig, &SslService::SetConfig>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_SetConfig, &SslService::SetConfig, SslService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_GenerateRandomBytes, &SslService::GenerateRandomBytes>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_GenerateRandomBytes, &SslService::GenerateRandomBytes, SslService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_IsDevelopment, &SslService::IsDevelopment>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_IsDevelopment, &SslService::IsDevelopment, SslService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_SetBootReason, &SslService::SetBootReason, FirmwareVersion_300>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_SetBootReason, &SslService::SetBootReason, SslService, FirmwareVersion_300>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_GetBootReason, &SslService::GetBootReason, FirmwareVersion_300>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_GetBootReason, &SslService::GetBootReason, SslService, FirmwareVersion_300>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_GenerateAesKek, &SslService::GenerateAesKek>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_GenerateAesKek, &SslService::GenerateAesKek, SslService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_LoadAesKey, &SslService::LoadAesKey>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_LoadAesKey, &SslService::LoadAesKey, SslService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_GenerateAesKey, &SslService::GenerateAesKey>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_GenerateAesKey, &SslService::GenerateAesKey, SslService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_DecryptAesKey, &SslService::DecryptAesKey>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_DecryptAesKey, &SslService::DecryptAesKey, SslService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_CryptAesCtr, &SslService::CryptAesCtr>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_CryptAesCtr, &SslService::CryptAesCtr, SslService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_ComputeCmac, &SslService::ComputeCmac>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_ComputeCmac, &SslService::ComputeCmac, SslService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_AllocateAesKeyslot, &SslService::AllocateAesKeyslot, FirmwareVersion_200>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_AllocateAesKeyslot, &SslService::AllocateAesKeyslot, SslService, FirmwareVersion_200>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_FreeAesKeyslot, &SslService::FreeAesKeyslot, FirmwareVersion_200>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_FreeAesKeyslot, &SslService::FreeAesKeyslot, SslService, FirmwareVersion_200>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_GetAesKeyslotAvailableEvent, &SslService::GetAesKeyslotAvailableEvent, FirmwareVersion_200>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_GetAesKeyslotAvailableEvent, &SslService::GetAesKeyslotAvailableEvent, SslService, FirmwareVersion_200>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_DecryptRsaPrivateKey, &SslService::DecryptRsaPrivateKey>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_DecryptRsaPrivateKey, &SslService::DecryptRsaPrivateKey, SslService>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_ImportSslKey, &SslService::ImportSslKey, FirmwareVersion_500>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_ImportSslKey, &SslService::ImportSslKey, SslService, FirmwareVersion_500>(),
|
||||||
MakeServiceCommandMeta<Spl_Cmd_SslExpMod, &SslService::SslExpMod, FirmwareVersion_500>(),
|
MakeServiceCommandMetaEx<Spl_Cmd_SslExpMod, &SslService::SslExpMod, SslService, FirmwareVersion_500>(),
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -70,10 +70,11 @@ struct BootReasonValue {
|
||||||
};
|
};
|
||||||
static_assert(sizeof(BootReasonValue) == sizeof(u32), "BootReasonValue definition!");
|
static_assert(sizeof(BootReasonValue) == sizeof(u32), "BootReasonValue definition!");
|
||||||
|
|
||||||
|
#pragma pack(push, 1)
|
||||||
struct AesKey {
|
struct AesKey {
|
||||||
union {
|
union {
|
||||||
u8 data[AES_128_KEY_SIZE];
|
u8 data[AES_128_KEY_SIZE];
|
||||||
u8 data64[AES_128_KEY_SIZE / sizeof(u64)];
|
u64 data64[AES_128_KEY_SIZE / sizeof(u64)];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
static_assert(alignof(AesKey) == alignof(u8), "AesKey definition!");
|
static_assert(alignof(AesKey) == alignof(u8), "AesKey definition!");
|
||||||
|
@ -81,7 +82,7 @@ static_assert(alignof(AesKey) == alignof(u8), "AesKey definition!");
|
||||||
struct IvCtr {
|
struct IvCtr {
|
||||||
union {
|
union {
|
||||||
u8 data[AES_128_KEY_SIZE];
|
u8 data[AES_128_KEY_SIZE];
|
||||||
u8 data64[AES_128_KEY_SIZE / sizeof(u64)];
|
u64 data64[AES_128_KEY_SIZE / sizeof(u64)];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
static_assert(alignof(IvCtr) == alignof(u8), "IvCtr definition!");
|
static_assert(alignof(IvCtr) == alignof(u8), "IvCtr definition!");
|
||||||
|
@ -89,7 +90,7 @@ static_assert(alignof(IvCtr) == alignof(u8), "IvCtr definition!");
|
||||||
struct Cmac {
|
struct Cmac {
|
||||||
union {
|
union {
|
||||||
u8 data[AES_128_KEY_SIZE];
|
u8 data[AES_128_KEY_SIZE];
|
||||||
u8 data64[AES_128_KEY_SIZE / sizeof(u64)];
|
u64 data64[AES_128_KEY_SIZE / sizeof(u64)];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
static_assert(alignof(Cmac) == alignof(u8), "Cmac definition!");
|
static_assert(alignof(Cmac) == alignof(u8), "Cmac definition!");
|
||||||
|
@ -97,7 +98,7 @@ static_assert(alignof(Cmac) == alignof(u8), "Cmac definition!");
|
||||||
struct AccessKey {
|
struct AccessKey {
|
||||||
union {
|
union {
|
||||||
u8 data[AES_128_KEY_SIZE];
|
u8 data[AES_128_KEY_SIZE];
|
||||||
u8 data64[AES_128_KEY_SIZE / sizeof(u64)];
|
u64 data64[AES_128_KEY_SIZE / sizeof(u64)];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
static_assert(alignof(AccessKey) == alignof(u8), "AccessKey definition!");
|
static_assert(alignof(AccessKey) == alignof(u8), "AccessKey definition!");
|
||||||
|
@ -105,10 +106,15 @@ static_assert(alignof(AccessKey) == alignof(u8), "AccessKey definition!");
|
||||||
struct KeySource {
|
struct KeySource {
|
||||||
union {
|
union {
|
||||||
u8 data[AES_128_KEY_SIZE];
|
u8 data[AES_128_KEY_SIZE];
|
||||||
u8 data64[AES_128_KEY_SIZE / sizeof(u64)];
|
u64 data64[AES_128_KEY_SIZE / sizeof(u64)];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
static_assert(alignof(AccessKey) == alignof(u8), "KeySource definition!");
|
static_assert(alignof(AccessKey) == alignof(u8), "KeySource definition!");
|
||||||
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
enum CsrngCmd {
|
||||||
|
Csrng_Cmd_GenerateRandomBytes = 0,
|
||||||
|
};
|
||||||
|
|
||||||
enum SplServiceCmd {
|
enum SplServiceCmd {
|
||||||
/* 1.0.0+ */
|
/* 1.0.0+ */
|
||||||
|
|
Loading…
Reference in a new issue