Make the random number generator predictable when fuzzing.
[openssl.git] / fuzz / server.c
index b8a3ac4..4f2c794 100644 (file)
@@ -191,6 +191,10 @@ static const uint8_t kRSAPrivateKeyDER[] = {
 
 static SSL_CTX *ctx;
 
+#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
+extern int rand_predictable;
+#endif
+
 int FuzzerInitialize(int *argc, char ***argv)
 {
     const uint8_t *bufp = kRSAPrivateKeyDER;
@@ -214,6 +218,10 @@ int FuzzerInitialize(int *argc, char ***argv)
     OPENSSL_assert(ret == 1);
     X509_free(cert);
 
+#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
+    rand_predictable = 1;
+#endif
+
     return 1;
 }