random: Protect another use of jent_rng_collector.
authorNIIBE Yutaka <gniibe@fsij.org>
Tue, 10 Apr 2018 02:01:57 +0000 (11:01 +0900)
committerNIIBE Yutaka <gniibe@fsij.org>
Tue, 10 Apr 2018 02:01:57 +0000 (11:01 +0900)
* random/rndjent.c (_gcry_rndjent_get_version): Lock the access.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
random/rndjent.c

index 6e56c8a..0c5a820 100644 (file)
@@ -334,11 +334,13 @@ _gcry_rndjent_get_version (int *r_active)
     {
       if (r_active)
         {
+          lock_rng ();
           /* Make sure the RNG is initialized.  */
           _gcry_rndjent_poll (NULL, 0, 0);
           /* To ease debugging we store 2 for a clock_gettime based
            * implementation and 1 for a rdtsc based code.  */
           *r_active = jent_rng_collector? is_rng_available () : 0;
+          unlock_rng ();
         }
       return jent_version ();
     }