Changeset 5959:b568f7b84e08 in roaraudio


Ignore:
Timestamp:
01/04/14 05:16:50 (6 years ago)
Author:
phi
Branch:
default
Message:

Also use uname() and hostid for seeding nonce generator.

Files:
5 edited

Legend:

Unmodified
Added
Removed
  • ChangeLog

    r5958 r5959  
    99        * Added support for setting a default device for roard at compile time. 
    1010        * Removed OpenSSL support (See: #366) 
     11        * Also use uname() and hostid for seeding nonce generator. 
    1112 
    1213v. 1.0beta10 - Tue Oct 15 2013 12:03 CEST 
  • libroar/config.c

    r5895 r5959  
    7070  } 
    7171 
     72  roar_random_salt_nonce(&config, sizeof(config)); 
     73 
    7274  inited++; 
    7375 } 
     
    345347  } 
    346348 } 
     349 
     350 roar_random_salt_nonce(&config, sizeof(config)); 
    347351 
    348352 return 0; 
  • libroar/random.c

    r5823 r5959  
    3838#ifdef ROAR_HAVE_LIBGCRYPT 
    3939#include <gcrypt.h> 
     40#endif 
     41 
     42#ifdef ROAR_HAVE_UNAME 
     43#include <sys/utsname.h> 
    4044#endif 
    4145 
     
    7175 volatile uint32_t now = time(NULL); 
    7276#endif 
     77#ifdef ROAR_HAVE_UNAME 
     78 static struct utsname utsname; 
     79#endif 
    7380 
    7481 roar_random_init(); 
     
    9097  roar_hash_buffer(off+TIGER_DIGESTLEN, buf, TIGER_BLOCKLEN, ROAR_HT_TIGER); 
    9198 
     99  // init is now done: 
    92100  inited = 1; 
     101 
     102  // do additional seeding: 
     103 
     104#ifdef ROAR_HAVE_UNAME 
     105  if ( uname(&utsname) == 0 ) { 
     106   roar_random_salt_nonce(&utsname, sizeof(utsname)); 
     107  } 
     108#endif 
    93109 } 
    94110 
  • libroar/serverinfo.c

    r5825 r5959  
    123123#ifdef ROAR_HAVE_GETHOSTID 
    124124 hostid = gethostid(); 
     125 roar_random_salt_nonce(&hostid, sizeof(hostid)); 
    125126 snprintf(hostidbuf, _HOSTID_BUFLEN, sizeof(long) == 8 ? "0x%.16lx" : "0x%.8lx", hostid); 
    126127 ret->hostid = hostidbuf; 
     
    131132#ifdef ROAR_HAVE_UNAME 
    132133 if ( !utsname_inited ) 
    133   if ( uname(&utsname) == 0 ) 
     134  if ( uname(&utsname) == 0 ) { 
    134135   utsname_inited = 1; 
     136   roar_random_salt_nonce(&utsname, sizeof(utsname)); 
     137  } 
    135138 
    136139 if ( utsname_inited ) { 
  • roard/req.c

    r5826 r5959  
    817817#ifdef ROAR_HAVE_UNAME 
    818818   if ( uname(&utsname) == 0 ) { 
     819    roar_random_salt_nonce(&utsname, sizeof(utsname)); 
    819820    info.un.sysname  = utsname.sysname; 
    820821    info.un.release  = utsname.release; 
Note: See TracChangeset for help on using the changeset viewer.