Make rand_add predictable when fuzzing
authorKurt Roeckx <kurt@roeckx.be>
Thu, 5 Jan 2017 18:59:14 +0000 (19:59 +0100)
committerKurt Roeckx <kurt@roeckx.be>
Fri, 6 Jan 2017 17:26:58 +0000 (18:26 +0100)
Reviewed-by: Rich Salz <rsalz@openssl.org>
GH: #2182

crypto/rand/md_rand.c

index 88820bbb917674e18644d308d862c6ec30d612e2..78da14a8e602717a60792d777bf2aab2f6d18f6a 100644 (file)
@@ -126,6 +126,11 @@ static int rand_add(const void *buf, int num, double add)
     if (!num)
         return 1;
 
+#ifdef PREDICT
+    if (rand_predictable)
+        return 1;
+#endif
+
     /*
      * (Based on the rand(3) manpage)
      *