1 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 import("//build/config/crypto.gni")
8 output_name = "crcrypto" # Avoid colliding with OpenSSL's libcrypto.
11 "apple_keychain_ios.mm",
12 "apple_keychain_mac.mm",
22 "ec_private_key_nss.cc",
23 "ec_private_key_openssl.cc",
24 "ec_signature_creator.cc",
25 "ec_signature_creator.h",
26 "ec_signature_creator_impl.h",
27 "ec_signature_creator_nss.cc",
28 "ec_signature_creator_openssl.cc",
32 "encryptor_openssl.cc",
41 "mac_security_services_lock.cc",
42 "mac_security_services_lock.h",
43 # TODO(brettw) these mocks should be moved to a test_support_crypto target
45 "mock_apple_keychain.cc",
46 "mock_apple_keychain.h",
47 "mock_apple_keychain_ios.cc",
48 "mock_apple_keychain_mac.cc",
51 "nss_util_internal.h",
52 "openssl_bio_string.cc",
53 "openssl_bio_string.h",
64 "rsa_private_key_nss.cc",
65 "rsa_private_key_openssl.cc",
66 "scoped_capi_types.h",
68 "secure_hash_default.cc",
70 "secure_hash_openssl.cc",
75 "signature_creator.h",
76 "signature_creator_nss.cc",
77 "signature_creator_openssl.cc",
78 "signature_verifier.h",
79 "signature_verifier_nss.cc",
80 "signature_verifier_openssl.cc",
82 "symmetric_key_nss.cc",
83 "symmetric_key_openssl.cc",
84 "third_party/nss/chromium-blapi.h",
85 "third_party/nss/chromium-blapit.h",
86 "third_party/nss/chromium-nss.h",
87 "third_party/nss/chromium-sha256.h",
88 "third_party/nss/pk11akey.cc",
89 "third_party/nss/rsawrapr.c",
90 "third_party/nss/secsign.cc",
91 "third_party/nss/sha512.cc",
97 "//base/third_party/dynamic_annotations",
100 if (!is_mac && !is_ios) {
103 "mock_apple_keychain.cc",
104 "mock_apple_keychain.h",
112 "mac_security_services_lock.cc",
113 "mac_security_services_lock.h",
124 deps += [ "//third_party/android_tools:cpu_features" ]
128 # Remove NSS files when using OpenSSL
130 "ec_private_key_nss.cc",
131 "ec_signature_creator_nss.cc",
136 "nss_util_internal.h",
137 "rsa_private_key_nss.cc",
138 "secure_hash_default.cc",
139 "signature_creator_nss.cc",
140 "signature_verifier_nss.cc",
141 "symmetric_key_nss.cc",
142 "third_party/nss/chromium-blapi.h",
143 "third_party/nss/chromium-blapit.h",
144 "third_party/nss/chromium-nss.h",
145 "third_party/nss/pk11akey.cc",
146 "third_party/nss/rsawrapr.c",
147 "third_party/nss/secsign.cc",
150 # Remove OpenSSL when using NSS.
152 "ec_private_key_openssl.cc",
153 "ec_signature_creator_openssl.cc",
154 "encryptor_openssl.cc",
156 "openssl_bio_string.cc",
157 "openssl_bio_string.h",
160 "rsa_private_key_openssl.cc",
161 "secure_hash_openssl.cc",
162 "signature_creator_openssl.cc",
163 "signature_verifier_openssl.cc",
164 "symmetric_key_openssl.cc",
168 defines = [ "CRYPTO_IMPLEMENTATION" ]
172 # A minimal crypto subset for hmac-related stuff that small standalone
173 # targets can use to reduce code size on Windows. This does not depend on
174 # OpenSSL/NSS but will use Windows APIs for that functionality.
175 source_set("crypto_minimal_win") {
181 "scoped_capi_types.h",
182 "scoped_nss_types.h",
186 "symmetric_key_win.cc",
187 "third_party/nss/chromium-blapi.h",
188 "third_party/nss/chromium-sha256.h",
189 "third_party/nss/sha512.cc",
194 "//base/third_party/dynamic_annotations",
197 defines = [ "CRYPTO_IMPLEMENTATION" ]
201 test("crypto_unittests") {
204 "curve25519_unittest.cc",
205 "ec_private_key_unittest.cc",
206 "ec_signature_creator_unittest.cc",
207 "encryptor_unittest.cc",
211 "nss_util_unittest.cc",
212 "openssl_bio_string_unittest.cc",
214 "p224_spake_unittest.cc",
215 "random_unittest.cc",
216 "rsa_private_key_unittest.cc",
217 "rsa_private_key_nss_unittest.cc",
218 "secure_hash_unittest.cc",
220 "signature_creator_unittest.cc",
221 "signature_verifier_unittest.cc",
222 "symmetric_key_unittest.cc",
225 if (use_openssl || !is_linux) {
227 "rsa_private_key_nss_unittest.cc",
232 sources -= [ "nss_util_unittest.cc" ]
234 sources -= [ "openssl_bio_string_unittest.cc" ]
242 "//base/test:run_all_unittests",
243 "//base/test:test_support",
249 source_set("test_support") {
251 "scoped_test_nss_db.cc",
252 "scoped_test_nss_db.h",
253 "scoped_test_nss_chromeos_user.cc",
254 "scoped_test_nss_chromeos_user.h",
255 "scoped_test_system_nss_key_slot.cc",
256 "scoped_test_system_nss_key_slot.h",
264 if (!use_nss_certs) {
266 "scoped_test_nss_db.cc",
267 "scoped_test_nss_db.h",
273 "scoped_test_nss_chromeos_user.cc",
274 "scoped_test_nss_chromeos_user.h",
275 "scoped_test_system_nss_key_slot.cc",
276 "scoped_test_system_nss_key_slot.h",
281 # This is a meta-target that forwards to NSS's SSL library or OpenSSL,
282 # according to the state of the crypto flags. A target just wanting to depend
283 # on the current SSL library should just depend on this.
286 deps = [ "//third_party/boringssl" ]
288 deps = [ "//net/third_party/nss/ssl:libssl" ]
290 # On Linux, we use the system NSS (excepting SSL where we always use our
293 # We always need our SSL header search path to come before the system one
294 # so our versions are used. The libssl target will add the search path we
295 # want, but according to GN's ordering rules, public_configs' search path
296 # will get applied before ones inherited from our dependencies.
297 # Therefore, we need to explicitly list our custom libssl's config here
298 # before the system one.
300 "//net/third_party/nss/ssl:ssl_config",
301 "//third_party/nss:system_nss_no_ssl_config",
304 # Non-Linux platforms use the hermetic NSS from the tree.
306 "//third_party/nss:nspr",
307 "//third_party/nss:nss",