summaryrefslogtreecommitdiffstats
path: root/tdm/backend/genauth.c
diff options
context:
space:
mode:
authorOBATA Akio <[email protected]>2019-08-18 18:28:04 +0900
committerTDE Gitea <[email protected]>2019-08-18 13:38:50 +0000
commit027c45db6f63a04eb31eac481f9264ab9760dce1 (patch)
treeae692633870b22d4cfda6838c92c8b1ebcc64c8a /tdm/backend/genauth.c
parent60e5e374553ce75f2e499888c8592bbeaa6f8b1e (diff)
downloadtdebase-027c45db6f63a04eb31eac481f9264ab9760dce1.tar.gz
tdebase-027c45db6f63a04eb31eac481f9264ab9760dce1.zip
Change to use arc4random_buf(3) if available
Signed-off-by: OBATA Akio <[email protected]>
Diffstat (limited to 'tdm/backend/genauth.c')
-rw-r--r--tdm/backend/genauth.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/tdm/backend/genauth.c b/tdm/backend/genauth.c
index 6da95cce0..1bde2fc85 100644
--- a/tdm/backend/genauth.c
+++ b/tdm/backend/genauth.c
@@ -432,7 +432,10 @@ AddPreGetEntropy( void )
int
GenerateAuthData( char *auth, int len )
{
-#ifdef HAVE_ARC4RANDOM
+#ifdef HAVE_ARC4RANDOM_BUF
+ arc4random_buf((void*)auth, (size_t)len);
+ return 1;
+#elif defined(HAVE_ARC4RANDOM)
int i;
unsigned *rnd = (unsigned *)auth;
if (sizeof(unsigned) == 4)