diff --git a/libctru/include/3ds/services/cfgu.h b/libctru/include/3ds/services/cfgu.h index d8db9dd..774e5aa 100644 --- a/libctru/include/3ds/services/cfgu.h +++ b/libctru/include/3ds/services/cfgu.h @@ -194,3 +194,21 @@ Result CFGI_GetLocalFriendCodeSeedData(u8 *data); * @param seed Pointer to write the friend code seed to. */ 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); diff --git a/libctru/source/services/cfgu.c b/libctru/source/services/cfgu.c index cc960bc..05c200e 100644 --- a/libctru/source/services/cfgu.c +++ b/libctru/source/services/cfgu.c @@ -373,3 +373,46 @@ Result CFGI_GetLocalFriendCodeSeed(u64* seed) 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]; +}