1 # Copyright (c) 2012 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. 4 5 { 6 'variables': { 7 'chromium_code': 1, 8 # Put all transitive dependencies for Windows HMAC here. 9 # This is required so that we can build them for nacl win64. 10 'hmac_win64_related_sources': [ 11 'hmac.cc', 12 'hmac.h', 13 'hmac_win.cc', 14 'secure_util.cc', 15 'secure_util.h', 16 'symmetric_key.h', 17 'symmetric_key_win.cc', 18 'third_party/nss/chromium-sha256.h', 19 'third_party/nss/sha512.cc', 20 ], 21 }, 22 'targets': [ 23 { 24 'target_name': 'crypto', 25 'type': '<(component)', 26 'product_name': 'crcrypto', # Avoid colliding with OpenSSL's libcrypto 27 'dependencies': [ 28 '../base/base.gyp:base', 29 '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', 30 ], 31 'defines': [ 32 'CRYPTO_IMPLEMENTATION', 33 ], 34 'msvs_disabled_warnings': [ 35 4018, 36 ], 37 'conditions': [ 38 [ 'os_posix == 1 and OS != "mac" and OS != "ios" and OS != "android"', { 39 'dependencies': [ 40 '../build/linux/system.gyp:ssl', 41 ], 42 'export_dependent_settings': [ 43 '../build/linux/system.gyp:ssl', 44 ], 45 'conditions': [ 46 [ 'chromeos==1', { 47 'sources/': [ ['include', '_chromeos\\.cc$'] ] 48 }, 49 ], 50 ], 51 }, { # os_posix != 1 or OS == "mac" or OS == "ios" or OS == "android" 52 'sources!': [ 53 'hmac_win.cc', 54 'openpgp_symmetric_encryption.cc', 55 'openpgp_symmetric_encryption.h', 56 'symmetric_key_win.cc', 57 ], 58 }], 59 [ 'OS != "mac" and OS != "ios"', { 60 'sources!': [ 61 'apple_keychain.h', 62 'mock_apple_keychain.cc', 63 'mock_apple_keychain.h', 64 ], 65 }], 66 [ 'OS == "android"', { 67 'dependencies': [ 68 '../third_party/openssl/openssl.gyp:openssl', 69 ], 70 'sources/': [ 71 ['exclude', 'ec_private_key_nss\.cc$'], 72 ['exclude', 'ec_signature_creator_nss\.cc$'], 73 ['exclude', 'encryptor_nss\.cc$'], 74 ['exclude', 'hmac_nss\.cc$'], 75 ['exclude', 'signature_verifier_nss\.cc$'], 76 ['exclude', 'symmetric_key_nss\.cc$'], 77 ], 78 }], 79 [ 'os_bsd==1', { 80 'link_settings': { 81 'libraries': [ 82 '-L/usr/local/lib -lexecinfo', 83 ], 84 }, 85 }, 86 ], 87 [ 'OS == "mac"', { 88 'link_settings': { 89 'libraries': [ 90 '$(SDKROOT)/System/Library/Frameworks/Security.framework', 91 ], 92 }, 93 }, { # OS != "mac" 94 'sources!': [ 95 'cssm_init.cc', 96 'cssm_init.h', 97 'mac_security_services_lock.cc', 98 'mac_security_services_lock.h', 99 ], 100 }], 101 [ 'OS == "mac" or OS == "ios" or OS == "win"', { 102 'dependencies': [ 103 '../third_party/nss/nss.gyp:nspr', 104 '../third_party/nss/nss.gyp:nss', 105 ], 106 'export_dependent_settings': [ 107 '../third_party/nss/nss.gyp:nspr', 108 '../third_party/nss/nss.gyp:nss', 109 ], 110 }], 111 [ 'OS != "win"', { 112 'sources!': [ 113 'capi_util.h', 114 'capi_util.cc', 115 ], 116 }], 117 [ 'OS == "win"', { 118 # TODO(jschuh): crbug.com/167187 fix size_t to int truncations. 119 'msvs_disabled_warnings': [4267, ], 120 }], 121 [ 'use_openssl==1', { 122 # TODO(joth): Use a glob to match exclude patterns once the 123 # OpenSSL file set is complete. 124 'sources!': [ 125 'ec_private_key_nss.cc', 126 'ec_signature_creator_nss.cc', 127 'encryptor_nss.cc', 128 'hmac_nss.cc', 129 'nss_util.cc', 130 'nss_util.h', 131 'openpgp_symmetric_encryption.cc', 132 'rsa_private_key_nss.cc', 133 'secure_hash_default.cc', 134 'signature_creator_nss.cc', 135 'signature_verifier_nss.cc', 136 'symmetric_key_nss.cc', 137 'third_party/nss/chromium-blapi.h', 138 'third_party/nss/chromium-blapit.h', 139 'third_party/nss/chromium-nss.h', 140 'third_party/nss/chromium-sha256.h', 141 'third_party/nss/pk11akey.cc', 142 'third_party/nss/rsawrapr.c', 143 'third_party/nss/secsign.cc', 144 'third_party/nss/sha512.cc', 145 ], 146 }, { 147 'sources!': [ 148 'ec_private_key_openssl.cc', 149 'ec_signature_creator_openssl.cc', 150 'encryptor_openssl.cc', 151 'hmac_openssl.cc', 152 'openssl_util.cc', 153 'openssl_util.h', 154 'rsa_private_key_openssl.cc', 155 'secure_hash_openssl.cc', 156 'signature_creator_openssl.cc', 157 'signature_verifier_openssl.cc', 158 'symmetric_key_openssl.cc', 159 ], 160 },], 161 ], 162 'sources': [ 163 # NOTE: all transitive dependencies of HMAC on windows need 164 # to be placed in the source list above. 165 '<@(hmac_win64_related_sources)', 166 'apple_keychain.h', 167 'apple_keychain_ios.mm', 168 'apple_keychain_mac.mm', 169 'capi_util.cc', 170 'capi_util.h', 171 'crypto_export.h', 172 'crypto_module_blocking_password_delegate.h', 173 'cssm_init.cc', 174 'cssm_init.h', 175 'curve25519.cc', 176 'curve25519.h', 177 'curve25519-donna.c', 178 'ghash.cc', 179 'ghash.h', 180 'ec_private_key.h', 181 'ec_private_key_nss.cc', 182 'ec_private_key_openssl.cc', 183 'ec_signature_creator.cc', 184 'ec_signature_creator.h', 185 'ec_signature_creator_impl.h', 186 'ec_signature_creator_nss.cc', 187 'ec_signature_creator_openssl.cc', 188 'encryptor.cc', 189 'encryptor.h', 190 'encryptor_nss.cc', 191 'encryptor_openssl.cc', 192 'hkdf.cc', 193 'hkdf.h', 194 'hmac_nss.cc', 195 'hmac_openssl.cc', 196 'mac_security_services_lock.cc', 197 'mac_security_services_lock.h', 198 'mock_apple_keychain.cc', 199 'mock_apple_keychain.h', 200 'mock_apple_keychain_ios.cc', 201 'mock_apple_keychain_mac.cc', 202 'p224_spake.cc', 203 'p224_spake.h', 204 'nss_util.cc', 205 'nss_util.h', 206 'nss_util_internal.h', 207 'openpgp_symmetric_encryption.cc', 208 'openpgp_symmetric_encryption.h', 209 'openssl_util.cc', 210 'openssl_util.h', 211 'p224.cc', 212 'p224.h', 213 'random.h', 214 'random.cc', 215 'rsa_private_key.cc', 216 'rsa_private_key.h', 217 'rsa_private_key_nss.cc', 218 'rsa_private_key_openssl.cc', 219 'scoped_capi_types.h', 220 'scoped_nss_types.h', 221 'secure_hash.h', 222 'secure_hash_default.cc', 223 'secure_hash_openssl.cc', 224 'sha2.cc', 225 'sha2.h', 226 'signature_creator.h', 227 'signature_creator_nss.cc', 228 'signature_creator_openssl.cc', 229 'signature_verifier.h', 230 'signature_verifier_nss.cc', 231 'signature_verifier_openssl.cc', 232 'symmetric_key_nss.cc', 233 'symmetric_key_openssl.cc', 234 'third_party/nss/chromium-blapi.h', 235 'third_party/nss/chromium-blapit.h', 236 'third_party/nss/chromium-nss.h', 237 'third_party/nss/pk11akey.cc', 238 'third_party/nss/rsawrapr.c', 239 'third_party/nss/secsign.cc', 240 ], 241 }, 242 { 243 'target_name': 'crypto_unittests', 244 'type': 'executable', 245 'sources': [ 246 # Infrastructure files. 247 'run_all_unittests.cc', 248 249 # Tests. 250 'curve25519_unittest.cc', 251 'ec_private_key_unittest.cc', 252 'ec_signature_creator_unittest.cc', 253 'encryptor_unittest.cc', 254 'ghash_unittest.cc', 255 'hkdf_unittest.cc', 256 'hmac_unittest.cc', 257 'nss_util_unittest.cc', 258 'p224_unittest.cc', 259 'p224_spake_unittest.cc', 260 'random_unittest.cc', 261 'rsa_private_key_unittest.cc', 262 'rsa_private_key_nss_unittest.cc', 263 'secure_hash_unittest.cc', 264 'sha2_unittest.cc', 265 'signature_creator_unittest.cc', 266 'signature_verifier_unittest.cc', 267 'symmetric_key_unittest.cc', 268 'openpgp_symmetric_encryption_unittest.cc', 269 ], 270 'dependencies': [ 271 'crypto', 272 '../base/base.gyp:base', 273 '../base/base.gyp:test_support_base', 274 '../testing/gmock.gyp:gmock', 275 '../testing/gtest.gyp:gtest', 276 ], 277 'conditions': [ 278 [ 'os_posix == 1 and OS != "mac" and OS != "android" and OS != "ios"', { 279 'conditions': [ 280 [ 'linux_use_tcmalloc==1', { 281 'dependencies': [ 282 '../base/allocator/allocator.gyp:allocator', 283 ], 284 }, 285 ], 286 ], 287 'dependencies': [ 288 '../build/linux/system.gyp:ssl', 289 ], 290 }, { # os_posix != 1 or OS == "mac" or OS == "android" or OS == "ios" 291 'sources!': [ 292 'rsa_private_key_nss_unittest.cc', 293 'openpgp_symmetric_encryption_unittest.cc', 294 ] 295 }], 296 [ 'OS == "mac" or OS == "ios" or OS == "win"', { 297 'dependencies': [ 298 '../third_party/nss/nss.gyp:nss', 299 ], 300 }], 301 [ 'OS == "mac"', { 302 'dependencies': [ 303 '../third_party/nss/nss.gyp:nspr', 304 ], 305 }], 306 [ 'OS == "win"', { 307 # TODO(jschuh): crbug.com/167187 fix size_t to int truncations. 308 'msvs_disabled_warnings': [4267, ], 309 }], 310 [ 'use_openssl==1', { 311 'sources!': [ 312 'nss_util_unittest.cc', 313 'openpgp_symmetric_encryption_unittest.cc', 314 'rsa_private_key_nss_unittest.cc', 315 ], 316 }], 317 ], 318 }, 319 ], 320 'conditions': [ 321 ['OS == "win" and target_arch=="ia32"', { 322 'targets': [ 323 { 324 'target_name': 'crypto_nacl_win64', 325 # We do not want nacl_helper to depend on NSS because this would 326 # require including a 64-bit copy of NSS. Thus, use the native APIs 327 # for the helper. 328 'type': '<(component)', 329 'dependencies': [ 330 '../base/base.gyp:base_nacl_win64', 331 '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations_win64', 332 ], 333 'sources': [ 334 '<@(hmac_win64_related_sources)', 335 ], 336 'defines': [ 337 'CRYPTO_IMPLEMENTATION', 338 '<@(nacl_win64_defines)', 339 ], 340 'msvs_disabled_warnings': [ 341 4018, 342 ], 343 'configurations': { 344 'Common_Base': { 345 'msvs_target_platform': 'x64', 346 }, 347 }, 348 }, 349 ], 350 }], 351 ], 352 } 353