Skip to main content
Tweeted twitter.com/#!/StackCrypto/status/436539823739142146
Minimal re-formatting and language tuning.
Source Link
e-sushi
  • 18.1k
  • 12
  • 85
  • 235

The question

There are limits to how much you can use a the DRBG before you have to reseed it. But, but are there any limits to how much you must use it before reseeding? 

Take the following following scenarios as an example.example…

seed     = seedFromUrandom    // Reads entropy from /dev/urandom
genStart = drbgFromSeed seed
 
(v1, gen1) = genBytes genStart // Generates random data and the next state 
                               // of the DRBG as a tuple
 
/*
    Code using the random data in v1
*/
 
(v2, gen2) = genBytes gen1 // Generates more random data and the next state
                           // of the DRBG as a tuple. Note that gen1 is 
                           // used here and not genStart.
 
/*
    Code using the random data in v2
*/
seed     = seedFromUrandom    // Reads entropy from /dev/urandom
genStart = drbgFromSeed seed
(v1, _)  = genBytes genStart // Generates random data and ignores the
                             // next instance of the DRBG.
 
/*
    Code using the random data in v1
*/
 
seed     = seedFromUrandom    // Reads entropy from /dev/urandom
genStart = drbgFromSeed seed
(v2, _)  = genBytes genStart // Generates random data and ignores the
                             // next instance of the DRBG.
 
/*
    Code using the random data in v2
*/

Background information

When I say DRBG I mean the NIST standardized number-theoretically secure random number generator. Either HMAC (SHA512), Hash (SHA512) or counter (AES 128).Please note:

Like stated in the pseudo-code entropy is read from /dev/urandom

  • When I say “DRBG”, I mean the NIST standardized number-theoretically secure random number generator. Either HMAC (SHA512), Hash (SHA512), or counter (AES 128).
  • Like stated in the pseudo-code, entropy is read from /dev/urandom.

The question

There are limits to how much you can use a the DRBG before you have to reseed it. But are there limits to much you must use it before reseeding? Take the following scenarios as an example.

seed     = seedFromUrandom    // Reads entropy from /dev/urandom
genStart = drbgFromSeed seed
 
(v1, gen1) = genBytes genStart // Generates random data and the next state 
                               // of the DRBG as a tuple
 
/*
    Code using the random data in v1
*/
 
(v2, gen2) = genBytes gen1 // Generates more random data and the next state
                           // of the DRBG as a tuple. Note that gen1 is 
                           // used here and not genStart.
 
/*
    Code using the random data in v2
*/
seed     = seedFromUrandom    // Reads entropy from /dev/urandom
genStart = drbgFromSeed seed
(v1, _)  = genBytes genStart // Generates random data and ignores the
                             // next instance of the DRBG.
 
/*
    Code using the random data in v1
*/
 
seed     = seedFromUrandom    // Reads entropy from /dev/urandom
genStart = drbgFromSeed seed
(v2, _)  = genBytes genStart // Generates random data and ignores the
                             // next instance of the DRBG.
 
/*
    Code using the random data in v2
*/

Background information

When I say DRBG I mean the NIST standardized number-theoretically secure random number generator. Either HMAC (SHA512), Hash (SHA512) or counter (AES 128).

Like stated in the pseudo-code entropy is read from /dev/urandom

There are limits to how much you can use a the DRBG before you have to reseed it, but are there any limits to how much you must use it before reseeding? 

Take the following scenarios as an example…

seed     = seedFromUrandom    // Reads entropy from /dev/urandom
genStart = drbgFromSeed seed
(v1, gen1) = genBytes genStart // Generates random data and the next state 
                               // of the DRBG as a tuple
/*
    Code using the random data in v1
*/
(v2, gen2) = genBytes gen1 // Generates more random data and the next state
                           // of the DRBG as a tuple. Note that gen1 is 
                           // used here and not genStart.
/*
    Code using the random data in v2
*/
seed     = seedFromUrandom    // Reads entropy from /dev/urandom
genStart = drbgFromSeed seed
(v1, _)  = genBytes genStart // Generates random data and ignores the
                             // next instance of the DRBG.
/*
    Code using the random data in v1
*/
seed     = seedFromUrandom    // Reads entropy from /dev/urandom
genStart = drbgFromSeed seed
(v2, _)  = genBytes genStart // Generates random data and ignores the
                             // next instance of the DRBG.
/*
    Code using the random data in v2
*/

Please note:

  • When I say “DRBG”, I mean the NIST standardized number-theoretically secure random number generator. Either HMAC (SHA512), Hash (SHA512), or counter (AES 128).
  • Like stated in the pseudo-code, entropy is read from /dev/urandom.
Source Link

Seed / reseed DRBG too often?

The question

There are limits to how much you can use a the DRBG before you have to reseed it. But are there limits to much you must use it before reseeding? Take the following scenarios as an example.

Usually you seed the DRBG once, then you use that instance until you reach the reseed limit. Like so:

seed     = seedFromUrandom    // Reads entropy from /dev/urandom
genStart = drbgFromSeed seed

(v1, gen1) = genBytes genStart // Generates random data and the next state 
                               // of the DRBG as a tuple

/*
    Code using the random data in v1
*/

(v2, gen2) = genBytes gen1 // Generates more random data and the next state
                           // of the DRBG as a tuple. Note that gen1 is 
                           // used here and not genStart.

/*
    Code using the random data in v2
*/

What if you created a newly seeded instance each time you want to generate random data? Like so:

seed     = seedFromUrandom    // Reads entropy from /dev/urandom
genStart = drbgFromSeed seed
(v1, _)  = genBytes genStart // Generates random data and ignores the
                             // next instance of the DRBG.

/*
    Code using the random data in v1
*/

seed     = seedFromUrandom    // Reads entropy from /dev/urandom
genStart = drbgFromSeed seed
(v2, _)  = genBytes genStart // Generates random data and ignores the
                             // next instance of the DRBG.

/*
    Code using the random data in v2
*/

Background information

When I say DRBG I mean the NIST standardized number-theoretically secure random number generator. Either HMAC (SHA512), Hash (SHA512) or counter (AES 128).

Like stated in the pseudo-code entropy is read from /dev/urandom