Add support for ps:ps#GenerateRandomBytes.
This commit is contained in:
parent
9e53a7cd61
commit
5310f1a900
@ -74,3 +74,10 @@ Result PS_GetLocalFriendCodeSeed(u64* seed);
|
|||||||
* @param device_id Pointer to write the device ID to.
|
* @param device_id Pointer to write the device ID to.
|
||||||
*/
|
*/
|
||||||
Result PS_GetDeviceId(u32* device_id);
|
Result PS_GetDeviceId(u32* device_id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Generates cryptographically secure random bytes.
|
||||||
|
* @param out Pointer to the buffer to write the bytes to.
|
||||||
|
* @param len Number of bytes to write.
|
||||||
|
*/
|
||||||
|
Result PS_GenerateRandomBytes(void* out, size_t len);
|
||||||
|
@ -103,3 +103,18 @@ Result PS_GetDeviceId(u32* device_id)
|
|||||||
|
|
||||||
return (Result)cmdbuf[1];
|
return (Result)cmdbuf[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result PS_GenerateRandomBytes(void* out, size_t len)
|
||||||
|
{
|
||||||
|
Result ret = 0;
|
||||||
|
u32 *cmdbuf = getThreadCommandBuffer();
|
||||||
|
|
||||||
|
cmdbuf[0] = IPC_MakeHeader(0xD,1,2); // 0xD0042
|
||||||
|
cmdbuf[1] = len;
|
||||||
|
cmdbuf[2] = IPC_Desc_Buffer(len, IPC_BUFFER_W);
|
||||||
|
cmdbuf[3] = (u32)out;
|
||||||
|
|
||||||
|
if(R_FAILED(ret = svcSendSyncRequest(psHandle)))return ret;
|
||||||
|
|
||||||
|
return (Result)cmdbuf[1];
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user