OLD | NEW |
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import("//build/config/crypto.gni") | 5 import("//build/config/crypto.gni") |
6 import("//testing/test.gni") | 6 import("//testing/test.gni") |
7 | 7 |
8 if (is_nacl) { | 8 component("crypto") { |
9 component("crypto") { | 9 output_name = "crcrypto" # Avoid colliding with OpenSSL's libcrypto. |
10 output_name = "crcrypto" # Avoid colliding with OpenSSL's libcrypto. | 10 sources = [ |
11 sources = [ | 11 "aead_openssl.cc", |
12 "random.cc", | 12 "aead_openssl.h", |
13 "random.h", | 13 "aes_128_gcm_helpers_nss.cc", |
14 ] | 14 "aes_128_gcm_helpers_nss.h", |
15 deps = [ | 15 "apple_keychain.h", |
16 "//base", | 16 "apple_keychain_ios.mm", |
| 17 "apple_keychain_mac.mm", |
| 18 "capi_util.cc", |
| 19 "capi_util.h", |
| 20 "crypto_export.h", |
| 21 "cssm_init.cc", |
| 22 "cssm_init.h", |
| 23 "curve25519-donna.c", |
| 24 "curve25519.cc", |
| 25 "curve25519.h", |
| 26 "ec_private_key.h", |
| 27 "ec_private_key_nss.cc", |
| 28 "ec_private_key_openssl.cc", |
| 29 "ec_signature_creator.cc", |
| 30 "ec_signature_creator.h", |
| 31 "ec_signature_creator_impl.h", |
| 32 "ec_signature_creator_nss.cc", |
| 33 "ec_signature_creator_openssl.cc", |
| 34 "encryptor.cc", |
| 35 "encryptor.h", |
| 36 "encryptor_nss.cc", |
| 37 "encryptor_openssl.cc", |
| 38 "ghash.cc", |
| 39 "ghash.h", |
| 40 "hkdf.cc", |
| 41 "hkdf.h", |
| 42 "hmac.cc", |
| 43 "hmac.h", |
| 44 "hmac_nss.cc", |
| 45 "hmac_openssl.cc", |
| 46 "mac_security_services_lock.cc", |
| 47 "mac_security_services_lock.h", |
| 48 |
| 49 # TODO(brettw) these mocks should be moved to a test_support_crypto target |
| 50 # if possible. |
| 51 "mock_apple_keychain.cc", |
| 52 "mock_apple_keychain.h", |
| 53 "mock_apple_keychain_ios.cc", |
| 54 "mock_apple_keychain_mac.cc", |
| 55 "nss_key_util.cc", |
| 56 "nss_key_util.h", |
| 57 "nss_util.cc", |
| 58 "nss_util.h", |
| 59 "nss_util_internal.h", |
| 60 "openssl_bio_string.cc", |
| 61 "openssl_bio_string.h", |
| 62 "openssl_util.cc", |
| 63 "openssl_util.h", |
| 64 "p224.cc", |
| 65 "p224.h", |
| 66 "p224_spake.cc", |
| 67 "p224_spake.h", |
| 68 "random.cc", |
| 69 "random.h", |
| 70 "rsa_private_key.cc", |
| 71 "rsa_private_key.h", |
| 72 "rsa_private_key_nss.cc", |
| 73 "rsa_private_key_openssl.cc", |
| 74 "scoped_capi_types.h", |
| 75 "scoped_nss_types.h", |
| 76 "secure_hash.h", |
| 77 "secure_hash_default.cc", |
| 78 "secure_hash_openssl.cc", |
| 79 "secure_util.cc", |
| 80 "secure_util.h", |
| 81 "sha2.cc", |
| 82 "sha2.h", |
| 83 "signature_creator.h", |
| 84 "signature_creator_nss.cc", |
| 85 "signature_creator_openssl.cc", |
| 86 "signature_verifier.h", |
| 87 "signature_verifier_nss.cc", |
| 88 "signature_verifier_openssl.cc", |
| 89 "symmetric_key.h", |
| 90 "symmetric_key_nss.cc", |
| 91 "symmetric_key_openssl.cc", |
| 92 "third_party/nss/chromium-blapi.h", |
| 93 "third_party/nss/chromium-blapit.h", |
| 94 "third_party/nss/chromium-nss.h", |
| 95 "third_party/nss/chromium-sha256.h", |
| 96 "third_party/nss/pk11akey.cc", |
| 97 "third_party/nss/rsawrapr.c", |
| 98 "third_party/nss/secsign.cc", |
| 99 "third_party/nss/sha512.cc", |
| 100 ] |
| 101 |
| 102 # TODO(jschuh): crbug.com/167187 fix size_t to int truncations. |
| 103 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ] |
| 104 |
| 105 deps = [ |
| 106 ":platform", |
| 107 "//base", |
| 108 "//base/third_party/dynamic_annotations", |
| 109 ] |
| 110 |
| 111 if (!is_mac && !is_ios) { |
| 112 sources -= [ |
| 113 "apple_keychain.h", |
| 114 "mock_apple_keychain.cc", |
| 115 "mock_apple_keychain.h", |
17 ] | 116 ] |
18 } | 117 } |
19 } else { | 118 |
20 component("crypto") { | 119 if (!is_mac) { |
21 output_name = "crcrypto" # Avoid colliding with OpenSSL's libcrypto. | 120 sources -= [ |
22 sources = [ | 121 "cssm_init.cc", |
| 122 "cssm_init.h", |
| 123 "mac_security_services_lock.cc", |
| 124 "mac_security_services_lock.h", |
| 125 ] |
| 126 } |
| 127 if (!is_win) { |
| 128 sources -= [ |
| 129 "capi_util.cc", |
| 130 "capi_util.h", |
| 131 ] |
| 132 } |
| 133 |
| 134 if (is_android) { |
| 135 deps += [ "//third_party/android_tools:cpu_features" ] |
| 136 } |
| 137 |
| 138 if (use_openssl) { |
| 139 # Remove NSS files when using OpenSSL |
| 140 sources -= [ |
| 141 "aes_128_gcm_helpers_nss.cc", |
| 142 "aes_128_gcm_helpers_nss.h", |
| 143 "ec_private_key_nss.cc", |
| 144 "ec_signature_creator_nss.cc", |
| 145 "encryptor_nss.cc", |
| 146 "hmac_nss.cc", |
| 147 "rsa_private_key_nss.cc", |
| 148 "secure_hash_default.cc", |
| 149 "signature_creator_nss.cc", |
| 150 "signature_verifier_nss.cc", |
| 151 "symmetric_key_nss.cc", |
| 152 "third_party/nss/chromium-blapi.h", |
| 153 "third_party/nss/chromium-blapit.h", |
| 154 "third_party/nss/chromium-nss.h", |
| 155 "third_party/nss/pk11akey.cc", |
| 156 "third_party/nss/rsawrapr.c", |
| 157 "third_party/nss/secsign.cc", |
| 158 ] |
| 159 } else { |
| 160 # Remove OpenSSL when using NSS. |
| 161 sources -= [ |
23 "aead_openssl.cc", | 162 "aead_openssl.cc", |
24 "aead_openssl.h", | 163 "aead_openssl.h", |
25 "aes_128_gcm_helpers_nss.cc", | |
26 "aes_128_gcm_helpers_nss.h", | |
27 "apple_keychain.h", | |
28 "apple_keychain_ios.mm", | |
29 "apple_keychain_mac.mm", | |
30 "capi_util.cc", | |
31 "capi_util.h", | |
32 "crypto_export.h", | |
33 "cssm_init.cc", | |
34 "cssm_init.h", | |
35 "curve25519-donna.c", | |
36 "curve25519.cc", | |
37 "curve25519.h", | |
38 "ec_private_key.h", | |
39 "ec_private_key_nss.cc", | |
40 "ec_private_key_openssl.cc", | 164 "ec_private_key_openssl.cc", |
41 "ec_signature_creator.cc", | |
42 "ec_signature_creator.h", | |
43 "ec_signature_creator_impl.h", | |
44 "ec_signature_creator_nss.cc", | |
45 "ec_signature_creator_openssl.cc", | 165 "ec_signature_creator_openssl.cc", |
46 "encryptor.cc", | |
47 "encryptor.h", | |
48 "encryptor_nss.cc", | |
49 "encryptor_openssl.cc", | 166 "encryptor_openssl.cc", |
50 "ghash.cc", | |
51 "ghash.h", | |
52 "hkdf.cc", | |
53 "hkdf.h", | |
54 "hmac.cc", | |
55 "hmac.h", | |
56 "hmac_nss.cc", | |
57 "hmac_openssl.cc", | 167 "hmac_openssl.cc", |
58 "mac_security_services_lock.cc", | 168 "openssl_bio_string.cc", |
59 "mac_security_services_lock.h", | 169 "openssl_bio_string.h", |
| 170 "openssl_util.cc", |
| 171 "openssl_util.h", |
| 172 "rsa_private_key_openssl.cc", |
| 173 "secure_hash_openssl.cc", |
| 174 "signature_creator_openssl.cc", |
| 175 "signature_verifier_openssl.cc", |
| 176 "symmetric_key_openssl.cc", |
| 177 ] |
| 178 } |
60 | 179 |
61 # TODO(brettw) these mocks should be moved to a test_support_crypto target | 180 # Some files are built when NSS is used at all, either for the internal crypto |
62 # if possible. | 181 # library or the platform certificate library. |
63 "mock_apple_keychain.cc", | 182 if (use_openssl && !use_nss_certs) { |
64 "mock_apple_keychain.h", | 183 sources -= [ |
65 "mock_apple_keychain_ios.cc", | |
66 "mock_apple_keychain_mac.cc", | |
67 "nss_key_util.cc", | 184 "nss_key_util.cc", |
68 "nss_key_util.h", | 185 "nss_key_util.h", |
69 "nss_util.cc", | 186 "nss_util.cc", |
70 "nss_util.h", | 187 "nss_util.h", |
71 "nss_util_internal.h", | 188 "nss_util_internal.h", |
72 "openssl_bio_string.cc", | |
73 "openssl_bio_string.h", | |
74 "openssl_util.cc", | |
75 "openssl_util.h", | |
76 "p224.cc", | |
77 "p224.h", | |
78 "p224_spake.cc", | |
79 "p224_spake.h", | |
80 "random.cc", | |
81 "random.h", | |
82 "rsa_private_key.cc", | |
83 "rsa_private_key.h", | |
84 "rsa_private_key_nss.cc", | |
85 "rsa_private_key_openssl.cc", | |
86 "scoped_capi_types.h", | |
87 "scoped_nss_types.h", | |
88 "secure_hash.h", | |
89 "secure_hash_default.cc", | |
90 "secure_hash_openssl.cc", | |
91 "secure_util.cc", | |
92 "secure_util.h", | |
93 "sha2.cc", | |
94 "sha2.h", | |
95 "signature_creator.h", | |
96 "signature_creator_nss.cc", | |
97 "signature_creator_openssl.cc", | |
98 "signature_verifier.h", | |
99 "signature_verifier_nss.cc", | |
100 "signature_verifier_openssl.cc", | |
101 "symmetric_key.h", | |
102 "symmetric_key_nss.cc", | |
103 "symmetric_key_openssl.cc", | |
104 "third_party/nss/chromium-blapi.h", | |
105 "third_party/nss/chromium-blapit.h", | |
106 "third_party/nss/chromium-nss.h", | |
107 "third_party/nss/chromium-sha256.h", | |
108 "third_party/nss/pk11akey.cc", | |
109 "third_party/nss/rsawrapr.c", | |
110 "third_party/nss/secsign.cc", | |
111 "third_party/nss/sha512.cc", | |
112 ] | 189 ] |
| 190 } |
113 | 191 |
114 # TODO(jschuh): crbug.com/167187 fix size_t to int truncations. | 192 defines = [ "CRYPTO_IMPLEMENTATION" ] |
115 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ] | |
116 | 193 |
117 deps = [ | 194 if (is_nacl) { |
118 ":platform", | 195 deps += [ "//native_client_sdk/src/libraries/nacl_io" ] |
119 "//base", | |
120 "//base/third_party/dynamic_annotations", | |
121 ] | |
122 | |
123 if (!is_mac && !is_ios) { | |
124 sources -= [ | |
125 "apple_keychain.h", | |
126 "mock_apple_keychain.cc", | |
127 "mock_apple_keychain.h", | |
128 ] | |
129 } | |
130 | |
131 if (!is_mac) { | |
132 sources -= [ | |
133 "cssm_init.cc", | |
134 "cssm_init.h", | |
135 "mac_security_services_lock.cc", | |
136 "mac_security_services_lock.h", | |
137 ] | |
138 } | |
139 if (!is_win) { | |
140 sources -= [ | |
141 "capi_util.cc", | |
142 "capi_util.h", | |
143 ] | |
144 } | |
145 | |
146 if (is_android) { | |
147 deps += [ "//third_party/android_tools:cpu_features" ] | |
148 } | |
149 | |
150 if (use_openssl) { | |
151 # Remove NSS files when using OpenSSL | |
152 sources -= [ | |
153 "aes_128_gcm_helpers_nss.cc", | |
154 "aes_128_gcm_helpers_nss.h", | |
155 "ec_private_key_nss.cc", | |
156 "ec_signature_creator_nss.cc", | |
157 "encryptor_nss.cc", | |
158 "hmac_nss.cc", | |
159 "rsa_private_key_nss.cc", | |
160 "secure_hash_default.cc", | |
161 "signature_creator_nss.cc", | |
162 "signature_verifier_nss.cc", | |
163 "symmetric_key_nss.cc", | |
164 "third_party/nss/chromium-blapi.h", | |
165 "third_party/nss/chromium-blapit.h", | |
166 "third_party/nss/chromium-nss.h", | |
167 "third_party/nss/pk11akey.cc", | |
168 "third_party/nss/rsawrapr.c", | |
169 "third_party/nss/secsign.cc", | |
170 ] | |
171 } else { | |
172 # Remove OpenSSL when using NSS. | |
173 sources -= [ | |
174 "aead_openssl.cc", | |
175 "aead_openssl.h", | |
176 "ec_private_key_openssl.cc", | |
177 "ec_signature_creator_openssl.cc", | |
178 "encryptor_openssl.cc", | |
179 "hmac_openssl.cc", | |
180 "openssl_bio_string.cc", | |
181 "openssl_bio_string.h", | |
182 "openssl_util.cc", | |
183 "openssl_util.h", | |
184 "rsa_private_key_openssl.cc", | |
185 "secure_hash_openssl.cc", | |
186 "signature_creator_openssl.cc", | |
187 "signature_verifier_openssl.cc", | |
188 "symmetric_key_openssl.cc", | |
189 ] | |
190 } | |
191 | |
192 # Some files are built when NSS is used at all, either for the internal cryp
to | |
193 # library or the platform certificate library. | |
194 if (use_openssl && !use_nss_certs) { | |
195 sources -= [ | |
196 "nss_key_util.cc", | |
197 "nss_key_util.h", | |
198 "nss_util.cc", | |
199 "nss_util.h", | |
200 "nss_util_internal.h", | |
201 ] | |
202 } | |
203 | |
204 defines = [ "CRYPTO_IMPLEMENTATION" ] | |
205 } | 196 } |
206 } | 197 } |
207 | 198 |
208 # TODO(GYP): TODO(dpranke), fix the compile errors for this stuff | 199 # TODO(GYP): TODO(dpranke), fix the compile errors for this stuff |
209 # and make it work. | 200 # and make it work. |
210 if (false && is_win) { | 201 if (false && is_win) { |
211 # A minimal crypto subset for hmac-related stuff that small standalone | 202 # A minimal crypto subset for hmac-related stuff that small standalone |
212 # targets can use to reduce code size on Windows. This does not depend on | 203 # targets can use to reduce code size on Windows. This does not depend on |
213 # OpenSSL/NSS but will use Windows APIs for that functionality. | 204 # OpenSSL/NSS but will use Windows APIs for that functionality. |
214 source_set("crypto_minimal_win") { | 205 source_set("crypto_minimal_win") { |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 public_configs += [ "//third_party/nss:system_nss_no_ssl_config" ] | 365 public_configs += [ "//third_party/nss:system_nss_no_ssl_config" ] |
375 } else { | 366 } else { |
376 # Non-Linux platforms use the hermetic NSS from the tree. | 367 # Non-Linux platforms use the hermetic NSS from the tree. |
377 public_deps = [ | 368 public_deps = [ |
378 "//third_party/nss:nspr", | 369 "//third_party/nss:nspr", |
379 "//third_party/nss:nss", | 370 "//third_party/nss:nss", |
380 ] | 371 ] |
381 } | 372 } |
382 } | 373 } |
383 } | 374 } |
OLD | NEW |