Add more CFGI SecureInfo functions

This commit is contained in:
Joel16 2018-02-14 22:42:18 -06:00
parent 52be537b48
commit 2bf655a55c
2 changed files with 61 additions and 0 deletions

View File

@ -194,3 +194,21 @@ Result CFGI_GetLocalFriendCodeSeedData(u8 *data);
* @param seed Pointer to write the friend code seed to. * @param seed Pointer to write the friend code seed to.
*/ */
Result CFGI_GetLocalFriendCodeSeed(u64* seed); Result CFGI_GetLocalFriendCodeSeed(u64* seed);
/**
* @brief Gets the 0x11-byte data following the SecureInfo signature.
* @param data Pointer to output the buffer. (The size must be at least 0x110-bytes)
*/
Result CFGI_GetSecureInfoData(u8 *data);
/**
* @brief Gets the 0x100-byte RSA-2048 SecureInfo signature.
* @param data Pointer to output the buffer. (The size must be at least 0x110-bytes)
*/
Result CFGI_GetSecureInfoSignature(u8 *data);
/**
* @brief Gets value loaded from SecureInfo offset 0x101.
* @param data Pointer to output the buffer. (The size must be at least 0x110-bytes)
*/
Result CFGI_GetSecureInfoByte101(u8 *data);

View File

@ -373,3 +373,46 @@ Result CFGI_GetLocalFriendCodeSeed(u64* seed)
return (Result)cmdbuf[1]; return (Result)cmdbuf[1];
} }
Result CFGI_GetSecureInfoData(u8 *data)
{
Result ret = 0;
u32 *cmdbuf = getThreadCommandBuffer();
cmdbuf[0] = IPC_MakeHeader(0x814,1,2); // 0x8140042
cmdbuf[1] = (u32)0x11;
cmdbuf[2] = IPC_Desc_Buffer((u32)0x11, IPC_BUFFER_W);
cmdbuf[3] = (u32)data;
if(R_FAILED(ret = svcSendSyncRequest(cfguHandle)))return ret;
return (Result)cmdbuf[1];
}
Result CFGI_GetSecureInfoSignature(u8 *data)
{
Result ret = 0;
u32 *cmdbuf = getThreadCommandBuffer();
cmdbuf[0] = IPC_MakeHeader(0x815,1,2); // 0x8150042
cmdbuf[1] = (u32)0x100;
cmdbuf[2] = IPC_Desc_Buffer((u32)0x100, IPC_BUFFER_W);
cmdbuf[3] = (u32)data;
if(R_FAILED(ret = svcSendSyncRequest(cfguHandle)))return ret;
return (Result)cmdbuf[1];
}
Result CFGI_GetSecureInfoByte101(u8 *data)
{
Result ret = 0;
u32 *cmdbuf = getThreadCommandBuffer();
cmdbuf[0] = IPC_MakeHeader(0x817,0,0); // 0x8170000
cmdbuf[2] = (u32)data;
if(R_FAILED(ret = svcSendSyncRequest(cfguHandle)))return ret;
return (Result)cmdbuf[1];
}