Kawe Mazidjatari b3a68ed095 Add EABase, EAThread and DirtySDK to R5sdk
DirtySDK (EA's Dirty Sockets library) will be used for the LiveAPI implementation, and depends on: EABase, EAThread.
2024-04-05 18:29:03 +02:00

58 lines
1.5 KiB
C

/*H********************************************************************************/
/*!
\File cryptrandcommon.h
\Description
Common APIs used for internally in the CryptRand module
\Copyright
Copyright (c) 2019 Electronic Arts Inc.
\Version 01/24/2019 (eesponda)
*/
/********************************************************************************H*/
#ifndef _cryptrandcommon_h
#define _cryptrandcommon_h
/*!
\Moduledef CryptRandCommon CryptRandCommon
\Modulemember Crypt
*/
//@{
/*** Include files ****************************************************************/
#include "DirtySDK/platform.h"
#include "DirtySDK/crypt/cryptchacha.h"
/*** Type Definitions *************************************************************/
//! common state used for random number generation
typedef struct CryptRandCommonT
{
CryptChaChaT Cipher; //!< cipher used to generate random numbers
int32_t iBytesLeft; //!< bytes remaining before key rotation
int32_t (*GetEntropy)(uint8_t *pBuffer, int32_t iBufSize); //!< pointer to internal function to get entropy
} CryptRandCommonT;
/*** Functions ********************************************************************/
#if defined(__cplusplus)
extern "C" {
#endif
// initialize the common state
int32_t CryptRandCommonInit(CryptRandCommonT *pCommon);
// generate a psuedo-random number
void CryptRandCommonGet(CryptRandCommonT *pCommon, uint8_t *pBuffer, int32_t iBufSize);
#if defined(__cplusplus)
}
#endif
//@}
#endif // _cryptrandcommon_h