Changeset 5959:b568f7b84e08 in roaraudio for libroar/random.c


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

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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 
Note: See TracChangeset for help on using the changeset viewer.