Move fork_detect files into rand/

Files in the top-level of fipsmodule/ are considered be FIPS-support
files by generate_build_files.py. However, fork_detect is different.
Rather than have more special cases in the support scripts, this change
moves fork_detect into fipsmodule/rand. It's not a perfect fit, and
maybe it could have been its own directory, but it's not bad and fixes
the build for now.

Change-Id: I875088dd458069190dade870e085865e1306f55a
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/40964
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: Adam Langley <agl@google.com>
diff --git a/crypto/CMakeLists.txt b/crypto/CMakeLists.txt
index 68e3496..0339e7d 100644
--- a/crypto/CMakeLists.txt
+++ b/crypto/CMakeLists.txt
@@ -513,10 +513,10 @@
   fipsmodule/ec/ec_test.cc
   fipsmodule/ec/p256-x86_64_test.cc
   fipsmodule/ecdsa/ecdsa_test.cc
-  fipsmodule/fork_detect_test.cc
   fipsmodule/md5/md5_test.cc
   fipsmodule/modes/gcm_test.cc
   fipsmodule/rand/ctrdrbg_test.cc
+  fipsmodule/rand/fork_detect_test.cc
   fipsmodule/sha/sha_test.cc
   hkdf/hkdf_test.cc
   hmac_extra/hmac_test.cc
diff --git a/crypto/fipsmodule/bcm.c b/crypto/fipsmodule/bcm.c
index bc3d6d1..1d9a919 100644
--- a/crypto/fipsmodule/bcm.c
+++ b/crypto/fipsmodule/bcm.c
@@ -77,7 +77,6 @@
 #include "ec/simple_mul.c"
 #include "ec/util.c"
 #include "ec/wnaf.c"
-#include "fork_detect.c"
 #include "hmac/hmac.c"
 #include "md4/md4.c"
 #include "md5/md5.c"
@@ -89,6 +88,7 @@
 #include "modes/ofb.c"
 #include "modes/polyval.c"
 #include "rand/ctrdrbg.c"
+#include "rand/fork_detect.c"
 #include "rand/rand.c"
 #include "rand/urandom.c"
 #include "rsa/blinding.c"
diff --git a/crypto/fipsmodule/fork_detect.c b/crypto/fipsmodule/rand/fork_detect.c
similarity index 98%
rename from crypto/fipsmodule/fork_detect.c
rename to crypto/fipsmodule/rand/fork_detect.c
index baa6bcf..6de6293 100644
--- a/crypto/fipsmodule/fork_detect.c
+++ b/crypto/fipsmodule/rand/fork_detect.c
@@ -27,8 +27,8 @@
 
 #include <openssl/type_check.h>
 
-#include "delocate.h"
-#include "../internal.h"
+#include "../delocate.h"
+#include "../../internal.h"
 
 
 #if defined(MADV_WIPEONFORK)
diff --git a/crypto/fipsmodule/fork_detect.h b/crypto/fipsmodule/rand/fork_detect.h
similarity index 100%
rename from crypto/fipsmodule/fork_detect.h
rename to crypto/fipsmodule/rand/fork_detect.h
diff --git a/crypto/fipsmodule/fork_detect_test.cc b/crypto/fipsmodule/rand/fork_detect_test.cc
similarity index 100%
rename from crypto/fipsmodule/fork_detect_test.cc
rename to crypto/fipsmodule/rand/fork_detect_test.cc
diff --git a/crypto/fipsmodule/rand/rand.c b/crypto/fipsmodule/rand/rand.c
index b9b5184..05d6a29 100644
--- a/crypto/fipsmodule/rand/rand.c
+++ b/crypto/fipsmodule/rand/rand.c
@@ -27,9 +27,9 @@
 #include <openssl/mem.h>
 
 #include "internal.h"
+#include "fork_detect.h"
 #include "../../internal.h"
 #include "../delocate.h"
-#include "../fork_detect.h"
 
 
 // It's assumed that the operating system always has an unfailing source of
diff --git a/crypto/fipsmodule/rand/urandom_test.cc b/crypto/fipsmodule/rand/urandom_test.cc
index cd2e16e..b9e9007 100644
--- a/crypto/fipsmodule/rand/urandom_test.cc
+++ b/crypto/fipsmodule/rand/urandom_test.cc
@@ -28,7 +28,7 @@
 #include <sys/syscall.h>
 #include <sys/user.h>
 
-#include "../fork_detect.h"
+#include "fork_detect.h"
 
 #if !defined(PTRACE_O_EXITKILL)
 #define PTRACE_O_EXITKILL (1 << 20)
diff --git a/crypto/fipsmodule/rsa/rsa_impl.c b/crypto/fipsmodule/rsa/rsa_impl.c
index 280c81a..81b5aa3 100644
--- a/crypto/fipsmodule/rsa/rsa_impl.c
+++ b/crypto/fipsmodule/rsa/rsa_impl.c
@@ -70,7 +70,7 @@
 #include "../bn/internal.h"
 #include "../../internal.h"
 #include "../delocate.h"
-#include "../fork_detect.h"
+#include "../rand/fork_detect.h"
 
 
 static int check_modulus_and_exponent_sizes(const RSA *rsa) {
diff --git a/crypto/rand_extra/rand_test.cc b/crypto/rand_extra/rand_test.cc
index 8e608bf..7f7c19f 100644
--- a/crypto/rand_extra/rand_test.cc
+++ b/crypto/rand_extra/rand_test.cc
@@ -21,7 +21,7 @@
 #include <openssl/cpu.h>
 #include <openssl/span.h>
 
-#include "../fipsmodule/fork_detect.h"
+#include "../fipsmodule/rand/fork_detect.h"
 #include "../fipsmodule/rand/internal.h"
 #include "../test/abi_test.h"
 #include "../test/test_util.h"