VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Crypto/rdrand.h
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2019-01-31 01:05:19 +0100
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2019-02-01 00:35:50 +0100
commit61c1baa4bf5a97675187a37cf203e1937a060daa (patch)
treedbf4cba079f6497740fecd325b22bf47f6a03731 /src/Crypto/rdrand.h
parent915855f43b6bd30c2e01a49e261f813ccc7a0237 (diff)
downloadVeraCrypt-61c1baa4bf5a97675187a37cf203e1937a060daa.tar.gz
VeraCrypt-61c1baa4bf5a97675187a37cf203e1937a060daa.zip
Windows: use CPU RDRAND or RDSEED as an additional entropy source for our random generator when available
Diffstat (limited to 'src/Crypto/rdrand.h')
-rw-r--r--src/Crypto/rdrand.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/Crypto/rdrand.h b/src/Crypto/rdrand.h
new file mode 100644
index 00000000..ff8cfd29
--- /dev/null
+++ b/src/Crypto/rdrand.h
@@ -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