1
0
mirror of https://github.com/veracrypt/VeraCrypt.git synced 2025-11-12 19:38:26 -06:00

Windows: use CPU RDRAND or RDSEED as an additional entropy source for our random generator when available

This commit is contained in:
Mounir IDRASSI
2019-01-31 01:05:19 +01:00
parent 915855f43b
commit 61c1baa4bf
8 changed files with 544 additions and 5 deletions

26
src/Crypto/rdrand.h Normal file
View File

@@ -0,0 +1,26 @@
#ifndef HEADER_Crypto_RDRAND
#define HEADER_Crypto_RDRAND
#include "Common/Tcdefs.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
* generate bufLen random bytes using CPU RDRAND instruction
* return 1 in case of success and 0 in case of failure
*/
int RDRAND_getBytes(unsigned char* buf, size_t bufLen);
/*
* generate bufLen random bytes using CPU RDSEED instruction
* return 1 in case of success and 0 in case of failure
*/
int RDSEED_getBytes(unsigned char* buf, size_t bufLen);
#ifdef __cplusplus
}
#endif
#endif