Handle fips_shared_support.c getting built in other builds.
Other build systems will just take a list of the files, including
fips_shared_support.c, so better to make it a no-op in the
non-shared+FIPS case.
Also add it to the other cases so that the CMake build better matches
other builds in that respect.
Change-Id: I1bea4f6b8266da32340a5fc0fed5fc3680f3b18f
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/36264
Reviewed-by: Adam Langley <agl@google.com>
diff --git a/crypto/fipsmodule/CMakeLists.txt b/crypto/fipsmodule/CMakeLists.txt
index 2fd55fd..e978820 100644
--- a/crypto/fipsmodule/CMakeLists.txt
+++ b/crypto/fipsmodule/CMakeLists.txt
@@ -193,6 +193,7 @@
OBJECT
+ fips_shared_support.c
is_fips.c
)
@@ -209,8 +210,8 @@
OBJECT
- is_fips.c
fips_shared_support.c
+ is_fips.c
)
add_dependencies(fipsmodule global_target)
@@ -242,6 +243,7 @@
OBJECT
bcm.c
+ fips_shared_support.c
is_fips.c
${BCM_ASM_SOURCES}
diff --git a/crypto/fipsmodule/fips_shared_support.c b/crypto/fipsmodule/fips_shared_support.c
index 07d5945..2a66a1f 100644
--- a/crypto/fipsmodule/fips_shared_support.c
+++ b/crypto/fipsmodule/fips_shared_support.c
@@ -15,10 +15,7 @@
#include <stdint.h>
-#if !defined(BORINGSSL_FIPS) || !defined(BORINGSSL_SHARED_LIBRARY)
-#error "This file should only be built in a shared-object FIPS build"
-#endif
-
+#if defined(BORINGSSL_FIPS) && defined(BORINGSSL_SHARED_LIBRARY)
// BORINGSSL_bcm_text_hash is is default hash value for the FIPS integrity check
// that must be replaced with the real value during the build process. This
// value need only be distinct, i.e. so that we can safely search-and-replace it
@@ -32,3 +29,4 @@
0xd7, 0x25, 0xdb, 0x21, 0x98, 0xe9, 0xd5, 0x53, 0xbf, 0x5c, 0x32,
0x06, 0x83, 0x34, 0x0c, 0x65, 0x89, 0x52, 0xbd, 0x1f,
};
+#endif // FIPS && SHARED_LIBRARY