Broifying the code.

Also extending API documentation a bit more and fixing a memory leak.
This commit is contained in:
Robin Sommer 2013-07-23 17:16:57 -07:00
parent 21685d2529
commit 474107fe40
18 changed files with 1651 additions and 1329 deletions

View file

@ -803,10 +803,10 @@ void init_random_seed(uint32 seed, const char* read_file, const char* write_file
bro_srandom(seed, seeds_done);
if ( ! first_seed_saved )
{
first_seed = seed;
first_seed_saved = true;
}
{
first_seed = seed;
first_seed_saved = true;
}
if ( ! hmac_key_set )
{
@ -820,9 +820,9 @@ void init_random_seed(uint32 seed, const char* read_file, const char* write_file
}
unsigned int initial_seed()
{
return first_seed;
}
{
return first_seed;
}
bool have_random_seed()
{
@ -830,7 +830,7 @@ bool have_random_seed()
}
long int bro_prng(long int state)
{
{
// Use our own simple linear congruence PRNG to make sure we are
// predictable across platforms.
static const long int m = 2147483647;
@ -844,14 +844,14 @@ long int bro_prng(long int state)
state += m;
return state;
}
}
long int bro_random()
{
if ( ! bro_rand_determistic )
return random(); // Use system PRNG.
bro_rand_state = bro_prng(bro_rand_state);
bro_rand_state = bro_prng(bro_rand_state);
return bro_rand_state;
}