From c37e64cba55256dff3ca4575dfcac1cfb2aa111e Mon Sep 17 00:00:00 2001 From: Adam Langley Date: Thu, 30 May 2019 16:13:39 -0700 Subject: [PATCH] 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 --- crypto/fipsmodule/CMakeLists.txt | 4 +++- crypto/fipsmodule/fips_shared_support.c | 6 ++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/crypto/fipsmodule/CMakeLists.txt b/crypto/fipsmodule/CMakeLists.txt index 2fd55fd1c..e97882004 100644 --- a/crypto/fipsmodule/CMakeLists.txt +++ b/crypto/fipsmodule/CMakeLists.txt @@ -193,6 +193,7 @@ if(FIPS_DELOCATE) OBJECT + fips_shared_support.c is_fips.c ) @@ -209,8 +210,8 @@ elseif(FIPS_SHARED) OBJECT - is_fips.c fips_shared_support.c + is_fips.c ) add_dependencies(fipsmodule global_target) @@ -242,6 +243,7 @@ else() 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 07d5945f8..2a66a1f06 100644 --- a/crypto/fipsmodule/fips_shared_support.c +++ b/crypto/fipsmodule/fips_shared_support.c @@ -15,10 +15,7 @@ #include -#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 @@ const uint8_t BORINGSSL_bcm_text_hash[64] = { 0xd7, 0x25, 0xdb, 0x21, 0x98, 0xe9, 0xd5, 0x53, 0xbf, 0x5c, 0x32, 0x06, 0x83, 0x34, 0x0c, 0x65, 0x89, 0x52, 0xbd, 0x1f, }; +#endif // FIPS && SHARED_LIBRARY