Browse Source

Change to use arc4random_buf(3) if available

Signed-off-by: OBATA Akio <obache@wizdas.com>
(cherry picked from commit 027c45db6f)
pull/182/head
OBATA Akio 3 years ago committed by Slávek Banko
parent
commit
eb6fecd543
No known key found for this signature in database
GPG Key ID: 608F5293A04BE668
  1. 1
      config.h.cmake
  2. 1
      tdm/ConfigureChecks.cmake
  3. 5
      tdm/backend/genauth.c

1
config.h.cmake

@ -185,6 +185,7 @@
#cmakedefine HAVE_ARC4RANDOM 1
#cmakedefine DEV_RANDOM "@DEV_RANDOM@"
#cmakedefine HAVE_ARC4RANDOM_BUF 1
#cmakedefine USE_PAM 1
#cmakedefine TDM_PAM_SERVICE "@TDM_PAM_SERVICE@"

1
tdm/ConfigureChecks.cmake

@ -98,6 +98,7 @@ if( NOT HAVE_ARC4RANDOM )
set( DEV_RANDOM "/dev/random" CACHE INTERNAL "" FORCE )
endif( )
endif (NOT HAVE_ARC4RANDOM)
check_function_exists( arc4random_buf HAVE_ARC4RANDOM_BUF )
# Xau
pkg_search_module( XAU xau )

5
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)

Loading…
Cancel
Save