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")
6 import("//testing/test.gni")
9 output_name = "crcrypto" # Avoid colliding with OpenSSL's libcrypto.
12 "apple_keychain_ios.mm",
13 "apple_keychain_mac.mm",
23 "ec_private_key_nss.cc",
24 "ec_private_key_openssl.cc",
25 "ec_signature_creator.cc",
26 "ec_signature_creator.h",
27 "ec_signature_creator_impl.h",
28 "ec_signature_creator_nss.cc",
29 "ec_signature_creator_openssl.cc",
33 "encryptor_openssl.cc",
42 "mac_security_services_lock.cc",
43 "mac_security_services_lock.h",
45 # TODO(brettw) these mocks should be moved to a test_support_crypto target
47 "mock_apple_keychain.cc",
48 "mock_apple_keychain.h",
49 "mock_apple_keychain_ios.cc",
50 "mock_apple_keychain_mac.cc",
53 "nss_util_internal.h",
54 "openssl_bio_string.cc",
55 "openssl_bio_string.h",
66 "rsa_private_key_nss.cc",
67 "rsa_private_key_openssl.cc",
68 "scoped_capi_types.h",
71 "secure_hash_default.cc",
72 "secure_hash_openssl.cc",
77 "signature_creator.h",
78 "signature_creator_nss.cc",
79 "signature_creator_openssl.cc",
80 "signature_verifier.h",
81 "signature_verifier_nss.cc",
82 "signature_verifier_openssl.cc",
84 "symmetric_key_nss.cc",
85 "symmetric_key_openssl.cc",
86 "third_party/nss/chromium-blapi.h",
87 "third_party/nss/chromium-blapit.h",
88 "third_party/nss/chromium-nss.h",
89 "third_party/nss/chromium-sha256.h",
90 "third_party/nss/pk11akey.cc",
91 "third_party/nss/rsawrapr.c",
92 "third_party/nss/secsign.cc",
93 "third_party/nss/sha512.cc",
96 # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
97 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
102 "//base/third_party/dynamic_annotations",
105 if (!is_mac && !is_ios) {
108 "mock_apple_keychain.cc",
109 "mock_apple_keychain.h",
117 "mac_security_services_lock.cc",
118 "mac_security_services_lock.h",
129 deps += [ "//third_party/android_tools:cpu_features" ]
133 # Remove NSS files when using OpenSSL
135 "ec_private_key_nss.cc",
136 "ec_signature_creator_nss.cc",
141 "nss_util_internal.h",
142 "rsa_private_key_nss.cc",
143 "secure_hash_default.cc",
144 "signature_creator_nss.cc",
145 "signature_verifier_nss.cc",
146 "symmetric_key_nss.cc",
147 "third_party/nss/chromium-blapi.h",
148 "third_party/nss/chromium-blapit.h",
149 "third_party/nss/chromium-nss.h",
150 "third_party/nss/pk11akey.cc",
151 "third_party/nss/rsawrapr.c",
152 "third_party/nss/secsign.cc",
155 # Remove OpenSSL when using NSS.
157 "ec_private_key_openssl.cc",
158 "ec_signature_creator_openssl.cc",
159 "encryptor_openssl.cc",
161 "openssl_bio_string.cc",
162 "openssl_bio_string.h",
165 "rsa_private_key_openssl.cc",
166 "secure_hash_openssl.cc",
167 "signature_creator_openssl.cc",
168 "signature_verifier_openssl.cc",
169 "symmetric_key_openssl.cc",
173 defines = [ "CRYPTO_IMPLEMENTATION" ]
176 # TODO(GYP): TODO(dpranke), fix the compile errors for this stuff
178 if (false && is_win) {
179 # A minimal crypto subset for hmac-related stuff that small standalone
180 # targets can use to reduce code size on Windows. This does not depend on
181 # OpenSSL/NSS but will use Windows APIs for that functionality.
182 source_set("crypto_minimal_win") {
188 "scoped_capi_types.h",
189 "scoped_nss_types.h",
193 "symmetric_key_win.cc",
194 "third_party/nss/chromium-blapi.h",
195 "third_party/nss/chromium-sha256.h",
196 "third_party/nss/sha512.cc",
201 "//base/third_party/dynamic_annotations",
204 defines = [ "CRYPTO_IMPLEMENTATION" ]
208 # TODO(GYP): Make this link on win as well.
210 test("crypto_unittests") {
213 "curve25519_unittest.cc",
214 "ec_private_key_unittest.cc",
215 "ec_signature_creator_unittest.cc",
216 "encryptor_unittest.cc",
220 "nss_util_unittest.cc",
221 "openssl_bio_string_unittest.cc",
222 "p224_spake_unittest.cc",
224 "random_unittest.cc",
225 "rsa_private_key_nss_unittest.cc",
226 "rsa_private_key_unittest.cc",
227 "secure_hash_unittest.cc",
229 "signature_creator_unittest.cc",
230 "signature_verifier_unittest.cc",
231 "symmetric_key_unittest.cc",
234 if (use_openssl || !is_linux) {
235 sources -= [ "rsa_private_key_nss_unittest.cc" ]
239 sources -= [ "nss_util_unittest.cc" ]
241 sources -= [ "openssl_bio_string_unittest.cc" ]
249 "//base/test:run_all_unittests",
250 "//base/test:test_support",
257 source_set("test_support") {
259 "scoped_test_nss_chromeos_user.cc",
260 "scoped_test_nss_chromeos_user.h",
261 "scoped_test_nss_db.cc",
262 "scoped_test_nss_db.h",
263 "scoped_test_system_nss_key_slot.cc",
264 "scoped_test_system_nss_key_slot.h",
272 if (!use_nss_certs) {
274 "scoped_test_nss_db.cc",
275 "scoped_test_nss_db.h",
281 "scoped_test_nss_chromeos_user.cc",
282 "scoped_test_nss_chromeos_user.h",
283 "scoped_test_system_nss_key_slot.cc",
284 "scoped_test_system_nss_key_slot.h",
289 config("platform_config") {
290 if (!use_openssl && is_clang) {
291 # There is a broken header guard in /usr/include/nss/secmod.h:
292 # https://bugzilla.mozilla.org/show_bug.cgi?id=884072
293 cflags = [ "-Wno-header-guard" ]
297 # This is a meta-target that forwards to NSS's SSL library or OpenSSL,
298 # according to the state of the crypto flags. A target just wanting to depend
299 # on the current SSL library should just depend on this.
303 "//third_party/boringssl",
307 "//net/third_party/nss/ssl:libssl",
310 # On Linux, we use the system NSS (excepting SSL where we always use our
313 # We always need our SSL header search path to come before the system one
314 # so our versions are used. The libssl target will add the search path we
315 # want, but according to GN's ordering rules, public_configs' search path
316 # will get applied before ones inherited from our dependencies.
317 # Therefore, we need to explicitly list our custom libssl's config here
318 # before the system one.
321 "//net/third_party/nss/ssl:ssl_config",
322 "//third_party/nss:system_nss_no_ssl_config",
325 # Non-Linux platforms use the hermetic NSS from the tree.
327 "//third_party/nss:nspr",
328 "//third_party/nss:nss",