Home | History | Annotate | Download | only in crypto
      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   },
      9   'includes': [
     10     'crypto.gypi',
     11   ],
     12   'targets': [
     13     {
     14       'target_name': 'crypto',
     15       'type': '<(component)',
     16       'product_name': 'crcrypto',  # Avoid colliding with OpenSSL's libcrypto
     17       'dependencies': [
     18         '../base/base.gyp:base',
     19         '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
     20       ],
     21       'defines': [
     22         'CRYPTO_IMPLEMENTATION',
     23       ],
     24       'conditions': [
     25         [ 'os_posix == 1 and OS != "mac" and OS != "ios" and OS != "android"', {
     26           'dependencies': [
     27             '../build/linux/system.gyp:ssl',
     28           ],
     29           'export_dependent_settings': [
     30             '../build/linux/system.gyp:ssl',
     31           ],
     32           'conditions': [
     33             [ 'chromeos==1', {
     34                 'sources/': [ ['include', '_chromeos\\.cc$'] ]
     35               },
     36             ],
     37           ],
     38         }, {  # os_posix != 1 or OS == "mac" or OS == "ios" or OS == "android"
     39             'sources!': [
     40               'hmac_win.cc',
     41               'symmetric_key_win.cc',
     42             ],
     43         }],
     44         [ 'OS != "mac" and OS != "ios"', {
     45           'sources!': [
     46             'apple_keychain.h',
     47             'mock_apple_keychain.cc',
     48             'mock_apple_keychain.h',
     49           ],
     50         }],
     51         [ 'OS == "android"', {
     52           'dependencies': [
     53             '../build/android/ndk.gyp:cpu_features',
     54           ],
     55         }],
     56         [ 'os_bsd==1', {
     57           'link_settings': {
     58             'libraries': [
     59               '-L/usr/local/lib -lexecinfo',
     60               ],
     61             },
     62           },
     63         ],
     64         [ 'OS == "mac"', {
     65           'link_settings': {
     66             'libraries': [
     67               '$(SDKROOT)/System/Library/Frameworks/Security.framework',
     68             ],
     69           },
     70         }, {  # OS != "mac"
     71           'sources!': [
     72             'cssm_init.cc',
     73             'cssm_init.h',
     74             'mac_security_services_lock.cc',
     75             'mac_security_services_lock.h',
     76           ],
     77         }],
     78         [ 'use_openssl == 0 and (OS == "mac" or OS == "ios" or OS == "win")', {
     79           'dependencies': [
     80             '../third_party/nss/nss.gyp:nspr',
     81             '../third_party/nss/nss.gyp:nss',
     82           ],
     83           'export_dependent_settings': [
     84             '../third_party/nss/nss.gyp:nspr',
     85             '../third_party/nss/nss.gyp:nss',
     86           ],
     87         }],
     88         [ 'OS != "win"', {
     89           'sources!': [
     90             'capi_util.h',
     91             'capi_util.cc',
     92           ],
     93         }],
     94         [ 'OS == "win"', {
     95           'msvs_disabled_warnings': [
     96             4267,  # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
     97           ],
     98         }],
     99         [ 'use_openssl==1', {
    100             'dependencies': [
    101               '../third_party/boringssl/boringssl.gyp:boringssl',
    102             ],
    103             # TODO(joth): Use a glob to match exclude patterns once the
    104             #             OpenSSL file set is complete.
    105             'sources!': [
    106               'curve25519-donna.c',
    107               'curve25519_nss.cc',
    108               'ec_private_key_nss.cc',
    109               'ec_signature_creator_nss.cc',
    110               'encryptor_nss.cc',
    111               'hmac_nss.cc',
    112               'rsa_private_key_nss.cc',
    113               'secure_hash_default.cc',
    114               'signature_creator_nss.cc',
    115               'signature_verifier_nss.cc',
    116               'symmetric_key_nss.cc',
    117               'third_party/nss/chromium-blapi.h',
    118               'third_party/nss/chromium-blapit.h',
    119               'third_party/nss/chromium-nss.h',
    120               'third_party/nss/chromium-prtypes.h',
    121               'third_party/nss/chromium-sha256.h',
    122               'third_party/nss/pk11akey.cc',
    123               'third_party/nss/rsawrapr.c',
    124               'third_party/nss/secsign.cc',
    125               'third_party/nss/sha512.cc',
    126             ],
    127           }, {
    128             'sources!': [
    129               'aead_openssl.cc',
    130               'aead_openssl.h',
    131               'curve25519_openssl.cc',
    132               'ec_private_key_openssl.cc',
    133               'ec_signature_creator_openssl.cc',
    134               'encryptor_openssl.cc',
    135               'hmac_openssl.cc',
    136               'openssl_bio_string.cc',
    137               'openssl_bio_string.h',
    138               'openssl_util.cc',
    139               'openssl_util.h',
    140               'rsa_private_key_openssl.cc',
    141               'secure_hash_openssl.cc',
    142               'signature_creator_openssl.cc',
    143               'signature_verifier_openssl.cc',
    144               'symmetric_key_openssl.cc',
    145             ],
    146         },],
    147         [ 'use_openssl==1 and use_nss_certs==0', {
    148             # Some files are built when NSS is used at all, either for the
    149             # internal crypto library or the platform certificate library.
    150             'sources!': [
    151               'nss_key_util.cc',
    152               'nss_key_util.h',
    153               'nss_util.cc',
    154               'nss_util.h',
    155               'nss_util_internal.h',
    156             ],
    157         },],
    158       ],
    159       'sources': [
    160         '<@(crypto_sources)',
    161       ],
    162     },
    163     {
    164       'target_name': 'crypto_unittests',
    165       'type': 'executable',
    166       'sources': [
    167         'aead_openssl_unittest.cc',
    168         'curve25519_unittest.cc',
    169         'ec_private_key_unittest.cc',
    170         'ec_signature_creator_unittest.cc',
    171         'encryptor_unittest.cc',
    172         'ghash_unittest.cc',
    173         'hkdf_unittest.cc',
    174         'hmac_unittest.cc',
    175         'nss_key_util_unittest.cc',
    176         'nss_util_unittest.cc',
    177         'openssl_bio_string_unittest.cc',
    178         'p224_unittest.cc',
    179         'p224_spake_unittest.cc',
    180         'random_unittest.cc',
    181         'rsa_private_key_unittest.cc',
    182         'secure_hash_unittest.cc',
    183         'sha2_unittest.cc',
    184         'signature_creator_unittest.cc',
    185         'signature_verifier_unittest.cc',
    186         'symmetric_key_unittest.cc',
    187       ],
    188       'dependencies': [
    189         'crypto',
    190         'crypto_test_support',
    191         '../base/base.gyp:base',
    192         '../base/base.gyp:run_all_unittests',
    193         '../base/base.gyp:test_support_base',
    194         '../testing/gmock.gyp:gmock',
    195         '../testing/gtest.gyp:gtest',
    196       ],
    197       'conditions': [
    198         [ 'use_nss_certs == 1', {
    199           'conditions': [
    200             [ 'use_allocator!="none"', {
    201                 'dependencies': [
    202                   '../base/allocator/allocator.gyp:allocator',
    203                 ],
    204               },
    205             ],
    206           ],
    207           'dependencies': [
    208             '../build/linux/system.gyp:ssl',
    209           ],
    210         }],
    211         [ 'use_openssl == 1 and use_nss_certs == 0', {
    212           # Some files are built when NSS is used at all, either for the
    213           # internal crypto library or the platform certificate library.
    214           'sources!': [
    215             'nss_key_util_unittest.cc',
    216             'nss_util_unittest.cc',
    217           ],
    218         }],
    219         [ 'use_openssl == 0 and (OS == "mac" or OS == "ios" or OS == "win")', {
    220           'dependencies': [
    221             '../third_party/nss/nss.gyp:nspr',
    222           ],
    223         }],
    224         [ 'OS == "win"', {
    225           # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
    226           'msvs_disabled_warnings': [4267, ],
    227         }],
    228         [ 'use_openssl==1', {
    229           'dependencies': [
    230             '../third_party/boringssl/boringssl.gyp:boringssl',
    231           ],
    232         }, {
    233           'sources!': [
    234             'openssl_bio_string_unittest.cc',
    235           ],
    236         }],
    237       ],
    238     },
    239   ],
    240   'conditions': [
    241     ['OS == "win" and target_arch=="ia32"', {
    242       'targets': [
    243         {
    244           'target_name': 'crypto_nacl_win64',
    245           # We do not want nacl_helper to depend on NSS because this would
    246           # require including a 64-bit copy of NSS. Thus, use the native APIs
    247           # for the helper.
    248           'type': '<(component)',
    249           'dependencies': [
    250             '../base/base.gyp:base_win64',
    251             '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations_win64',
    252           ],
    253           'sources': [
    254             '<@(nacl_win64_sources)',
    255           ],
    256           'defines': [
    257            'CRYPTO_IMPLEMENTATION',
    258            '<@(nacl_win64_defines)',
    259           ],
    260           'configurations': {
    261             'Common_Base': {
    262               'msvs_target_platform': 'x64',
    263             },
    264           },
    265         },
    266       ],
    267     }],
    268     ['use_nss_certs==1', {
    269       'targets': [
    270         {
    271           'target_name': 'crypto_test_support',
    272           'type': 'static_library',
    273           'dependencies': [
    274             '../base/base.gyp:base',
    275             'crypto',
    276           ],
    277           'sources': [
    278             'scoped_test_nss_db.cc',
    279             'scoped_test_nss_db.h',
    280             'scoped_test_nss_chromeos_user.cc',
    281             'scoped_test_nss_chromeos_user.h',
    282             'scoped_test_system_nss_key_slot.cc',
    283             'scoped_test_system_nss_key_slot.h',
    284           ],
    285           'conditions': [
    286             ['use_nss_certs==0', {
    287               'sources!': [
    288                 'scoped_test_nss_db.cc',
    289                 'scoped_test_nss_db.h',
    290               ],
    291             }],
    292             [ 'chromeos==0', {
    293               'sources!': [
    294                 'scoped_test_nss_chromeos_user.cc',
    295                 'scoped_test_nss_chromeos_user.h',
    296                 'scoped_test_system_nss_key_slot.cc',
    297                 'scoped_test_system_nss_key_slot.h',
    298               ],
    299             }],
    300           ],
    301         }
    302       ]}, {  # use_nss_certs==0
    303       'targets': [
    304         {
    305           'target_name': 'crypto_test_support',
    306           'type': 'none',
    307           'sources': [],
    308         }
    309     ]}],
    310     ['test_isolation_mode != "noop"', {
    311       'targets': [
    312         {
    313           'target_name': 'crypto_unittests_run',
    314           'type': 'none',
    315           'dependencies': [
    316             'crypto_unittests',
    317           ],
    318           'includes': [
    319             '../build/isolate.gypi',
    320                       ],
    321           'sources': [
    322             'crypto_unittests.isolate',
    323           ],
    324         },
    325       ],
    326     }],
    327   ],
    328 }
    329