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",
62 "rsa_private_key_nss.cc",
63 "rsa_private_key_openssl.cc",
64 "scoped_capi_types.h",
66 "secure_hash_default.cc",
68 "secure_hash_openssl.cc",
73 "signature_creator.h",
74 "signature_creator_nss.cc",
75 "signature_creator_openssl.cc",
76 "signature_verifier.h",
77 "signature_verifier_nss.cc",
78 "signature_verifier_openssl.cc",
80 "symmetric_key_nss.cc",
81 "symmetric_key_openssl.cc",
82 "third_party/nss/chromium-blapi.h",
83 "third_party/nss/chromium-blapit.h",
84 "third_party/nss/chromium-nss.h",
85 "third_party/nss/chromium-sha256.h",
86 "third_party/nss/pk11akey.cc",
87 "third_party/nss/rsawrapr.c",
88 "third_party/nss/secsign.cc",
89 "third_party/nss/sha512.cc",
95 "//base/third_party/dynamic_annotations",
98 if (!is_mac && !is_ios) {
101 "mock_apple_keychain.cc",
102 "mock_apple_keychain.h",
110 "mac_security_services_lock.cc",
111 "mac_security_services_lock.h",
122 deps += [ "//third_party/android_tools:cpu_features" ]
126 # Remove NSS files when using OpenSSL
128 "ec_private_key_nss.cc",
129 "ec_signature_creator_nss.cc",
134 "rsa_private_key_nss.cc",
135 "secure_hash_default.cc",
136 "signature_creator_nss.cc",
137 "signature_verifier_nss.cc",
138 "symmetric_key_nss.cc",
139 "third_party/nss/chromium-blapi.h",
140 "third_party/nss/chromium-blapit.h",
141 "third_party/nss/chromium-nss.h",
142 "third_party/nss/pk11akey.cc",
143 "third_party/nss/rsawrapr.c",
144 "third_party/nss/secsign.cc",
147 # Remove OpenSSL when using NSS.
149 "ec_private_key_openssl.cc",
150 "ec_signature_creator_openssl.cc",
151 "encryptor_openssl.cc",
155 "rsa_private_key_openssl.cc",
156 "secure_hash_openssl.cc",
157 "signature_creator_openssl.cc",
158 "signature_verifier_openssl.cc",
159 "symmetric_key_openssl.cc",
163 defines = [ "CRYPTO_IMPLEMENTATION" ]
167 # A minimal crypto subset for hmac-related stuff that small standalone
168 # targets can use to reduce code size on Windows. This does not depend on
169 # OpenSSL/NSS but will use Windows APIs for that functionality.
170 source_set("crypto_minimal_win") {
176 "scoped_capi_types.h",
177 "scoped_nss_types.h",
181 "symmetric_key_win.cc",
182 "third_party/nss/chromium-blapi.h",
183 "third_party/nss/chromium-sha256.h",
184 "third_party/nss/sha512.cc",
189 "//base/third_party/dynamic_annotations",
192 defines = [ "CRYPTO_IMPLEMENTATION" ]
196 test("crypto_unittests") {
199 "curve25519_unittest.cc",
200 "ec_private_key_unittest.cc",
201 "ec_signature_creator_unittest.cc",
202 "encryptor_unittest.cc",
206 "nss_util_unittest.cc",
208 "p224_spake_unittest.cc",
209 "random_unittest.cc",
210 "rsa_private_key_unittest.cc",
211 "rsa_private_key_nss_unittest.cc",
212 "secure_hash_unittest.cc",
214 "signature_creator_unittest.cc",
215 "signature_verifier_unittest.cc",
216 "symmetric_key_unittest.cc",
219 if (use_openssl || !is_linux) {
221 "rsa_private_key_nss_unittest.cc",
226 sources -= [ "nss_util_unittest.cc" ]
233 "//base/test:run_all_unittests",
234 "//base/test:test_support",
240 # This is a meta-target that forwards to NSS's SSL library or OpenSSL,
241 # according to the state of the crypto flags. A target just wanting to depend
242 # on the current SSL library should just depend on this.
245 deps = [ "//third_party/openssl" ]
247 deps = [ "//net/third_party/nss/ssl:libssl" ]
249 # On Linux, we use the system NSS (excepting SSL where we always use our
252 # We always need our SSL header search path to come before the system one
253 # so our versions are used. The libssl target will add the search path we
254 # want, but according to GN's ordering rules, direct_dependent_configs'
255 # search path will get applied before ones inherited from our
256 # dependencies. Therefore, we need to explicitly list our custom libssl's
257 # config here before the system one.
258 direct_dependent_configs = [
259 "//net/third_party/nss/ssl:ssl_config",
260 "//third_party/nss:system_nss_no_ssl_config",
263 # Non-Linux platforms use the hermetic NSS from the tree.
265 "//third_party/nss:nspr",
266 "//third_party/nss:nss",