|
|
|
@ -468,6 +468,7 @@ OAES_RET oaes_sprintf(
|
|
|
|
|
#ifdef OAES_HAVE_ISAAC
|
|
|
|
|
static void oaes_get_seed( char buf[RANDSIZ + 1] )
|
|
|
|
|
{
|
|
|
|
|
#ifndef __FreeBSD__
|
|
|
|
|
struct timeb timer;
|
|
|
|
|
struct tm *gmTimer;
|
|
|
|
|
char * _test = NULL;
|
|
|
|
@ -479,13 +480,27 @@ static void oaes_get_seed( char buf[RANDSIZ + 1] )
|
|
|
|
|
gmTimer->tm_year + 1900, gmTimer->tm_mon + 1, gmTimer->tm_mday,
|
|
|
|
|
gmTimer->tm_hour, gmTimer->tm_min, gmTimer->tm_sec, timer.millitm,
|
|
|
|
|
_test + timer.millitm, getpid() );
|
|
|
|
|
#else
|
|
|
|
|
struct timeval timer;
|
|
|
|
|
struct tm *gmTimer;
|
|
|
|
|
char * _test = NULL;
|
|
|
|
|
|
|
|
|
|
gettimeofday(&timer, NULL);
|
|
|
|
|
gmTimer = gmtime( &timer.tv_sec );
|
|
|
|
|
_test = (char *) calloc( sizeof( char ), timer.tv_usec/1000 );
|
|
|
|
|
sprintf( buf, "%04d%02d%02d%02d%02d%02d%03d%p%d",
|
|
|
|
|
gmTimer->tm_year + 1900, gmTimer->tm_mon + 1, gmTimer->tm_mday,
|
|
|
|
|
gmTimer->tm_hour, gmTimer->tm_min, gmTimer->tm_sec, timer.tv_usec/1000,
|
|
|
|
|
_test + timer.tv_usec/1000, getpid() );
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if( _test )
|
|
|
|
|
free( _test );
|
|
|
|
|
}
|
|
|
|
|
#else
|
|
|
|
|
static uint32_t oaes_get_seed(void)
|
|
|
|
|
{
|
|
|
|
|
#ifndef __FreeBSD__
|
|
|
|
|
struct timeb timer;
|
|
|
|
|
struct tm *gmTimer;
|
|
|
|
|
char * _test = NULL;
|
|
|
|
@ -497,6 +512,19 @@ static uint32_t oaes_get_seed(void)
|
|
|
|
|
_ret = gmTimer->tm_year + 1900 + gmTimer->tm_mon + 1 + gmTimer->tm_mday +
|
|
|
|
|
gmTimer->tm_hour + gmTimer->tm_min + gmTimer->tm_sec + timer.millitm +
|
|
|
|
|
(uintptr_t) ( _test + timer.millitm ) + getpid();
|
|
|
|
|
#else
|
|
|
|
|
struct timeval timer;
|
|
|
|
|
struct tm *gmTimer;
|
|
|
|
|
char * _test = NULL;
|
|
|
|
|
uint32_t _ret = 0;
|
|
|
|
|
|
|
|
|
|
gettimeofday(&timer, NULL);
|
|
|
|
|
gmTimer = gmtime( &timer.tv_sec );
|
|
|
|
|
_test = (char *) calloc( sizeof( char ), timer.tv_usec/1000 );
|
|
|
|
|
_ret = gmTimer->tm_year + 1900 + gmTimer->tm_mon + 1 + gmTimer->tm_mday +
|
|
|
|
|
gmTimer->tm_hour + gmTimer->tm_min + gmTimer->tm_sec + timer.tv_usec/1000 +
|
|
|
|
|
(uintptr_t) ( _test + timer.tv_usec/1000 ) + getpid();
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if( _test )
|
|
|
|
|
free( _test );
|
|
|
|
|