Skip to content

Commit 283d190

Browse files
committed
Replace dependency on openssl/commoncrypto for md5 by just copying the md5 implementation from boringssl
1 parent ff50941 commit 283d190

File tree

6 files changed

+400
-159
lines changed

6 files changed

+400
-159
lines changed

Firestore/core/CMakeLists.txt

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,8 @@ if(TARGET OpenSSL::Crypto)
9898
CMAKE_REQUIRED_INCLUDES OpenSSL::Crypto INTERFACE_INCLUDE_DIRECTORIES
9999
)
100100
check_include_files(openssl/rand.h HAVE_OPENSSL_RAND_H)
101-
check_include_files(openssl/md5.h HAVE_OPENSSL_MD5_H)
102101
endif()
103102

104-
check_symbol_exists(CC_MD5_Init CommonCrypto/CommonDigest.h HAVE_COMMONCRYPTO_MD5)
105-
106103
firebase_ios_glob(
107104
util_sources EXCLUDE src/util/secure_random_*.cc
108105
)
@@ -123,24 +120,6 @@ else()
123120
)
124121
endif()
125122

126-
if(HAVE_COMMONCRYPTO_MD5)
127-
set(FIRESTORE_MD5_IMPL_COMMONCRYPTO 1)
128-
firebase_ios_glob(
129-
util_sources APPEND
130-
src/util/md5_commoncrypto.cc
131-
)
132-
elseif(HAVE_OPENSSL_MD5_H)
133-
set(FIRESTORE_MD5_IMPL_OPENSSL 1)
134-
firebase_ios_glob(
135-
util_sources APPEND
136-
src/util/md5_openssl.cc
137-
)
138-
else()
139-
message(
140-
FATAL_ERROR
141-
"Don't know how to calculate md5 digests on this platform."
142-
)
143-
endif()
144123

145124
configure_file(
146125
src/util/config_detected.h.in
@@ -169,7 +148,7 @@ target_link_libraries(
169148
grpc++
170149
)
171150

172-
if(HAVE_OPENSSL_RAND_H OR FIRESTORE_MD5_IMPL_OPENSSL)
151+
if(HAVE_OPENSSL_RAND_H)
173152
target_link_libraries(
174153
firestore_util PRIVATE
175154
OpenSSL::Crypto

Firestore/core/src/util/config.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,9 @@
4646
// Handle CocoaPods the same way since the settings are the same.
4747
#define HAVE_ARC4RANDOM 1
4848
#define HAVE_LIBDISPATCH 1
49-
#define FIRESTORE_MD5_IMPL_COMMONCRYPTO 1
5049

5150
#elif __linux__ && SWIFT_PACKAGE
5251
#define HAVE_OPENSSL_RAND_H 1
53-
#define FIRESTORE_MD5_IMPL_OPENSSL 1
5452

5553
#else
5654
#error "Unknown build configuration"

Firestore/core/src/util/config_detected.h.in

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,4 @@
2727

2828
#cmakedefine HAVE_OPENSSL_RAND_H 1
2929

30-
// Exactly one of the following FIRESTORE_MD5_IMPL_ will be defined.
31-
#cmakedefine FIRESTORE_MD5_IMPL_COMMONCRYPTO 1
32-
#cmakedefine FIRESTORE_MD5_IMPL_OPENSSL 1
33-
3430
#endif // FIRESTORE_CORE_SRC_UTIL_CONFIG_DETECTED_H_

0 commit comments

Comments
 (0)