Browse Source

Change to use arc4random_buf(3) if available

Signed-off-by: OBATA Akio <obache@wizdas.com>
pull/66/head
OBATA Akio 2 months ago
parent
commit
027c45db6f
3 changed files with 6 additions and 1 deletions
  1. 1
    0
      config.h.cmake
  2. 1
    0
      tdm/ConfigureChecks.cmake
  3. 4
    1
      tdm/backend/genauth.c

+ 1
- 0
config.h.cmake View File

@@ -188,6 +188,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
- 0
tdm/ConfigureChecks.cmake View File

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

+ 4
- 1
tdm/backend/genauth.c View File

@@ -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