]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
Reseed rdrand after every 128bit sample only
authorMartin Willi <martin@revosec.ch>
Tue, 15 Jan 2013 12:27:35 +0000 (13:27 +0100)
committerMartin Willi <martin@revosec.ch>
Tue, 15 Jan 2013 16:41:54 +0000 (17:41 +0100)
src/libstrongswan/plugins/rdrand/rdrand_rng.c

index d032cbe31d559e619d7b369695e65ba4344d7104..fa66f3ad78a7e236eedd865c5d42b9a8c52a9a5c 100644 (file)
@@ -245,7 +245,7 @@ static bool rdrand_chunk(private_rdrand_rng_t *this, chunk_t chunk)
        /* fill with 8 byte words */
        while (chunk.len >= sizeof(u_int64_t))
        {
-               if (this->quality == RNG_STRONG && chunk.len % FORCE_RESEED)
+               if (this->quality == RNG_STRONG && chunk.len % FORCE_RESEED == 0)
                {
                        if (!reseed())
                        {
@@ -274,7 +274,7 @@ static bool rdrand_chunk(private_rdrand_rng_t *this, chunk_t chunk)
        /* fill with 4 byte words */
        while (chunk.len >= sizeof(u_int32_t))
        {
-               if (this->quality == RNG_STRONG && chunk.len % FORCE_RESEED)
+               if (this->quality == RNG_STRONG && chunk.len % FORCE_RESEED == 0)
                {
                        if (!reseed())
                        {