summaryrefslogtreecommitdiff
path: root/fuzz/fuzz.gyp
blob: 1ccc9df8f94d81bcc73d74d5cc3d961c8bf51313 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
{
  'includes': [
    '../coreconf/config.gypi',
  ],
  'variables': {
    'use_fuzzing_engine': '<!(test -f /usr/lib/libFuzzingEngine.a && echo 1 || echo 0)',
  },
  'target_defaults': {
    'variables': {
      'debug_optimization_level': '2',
    },
    'target_conditions': [
      [ '_type=="executable"', {
        'libraries!': [
          '<@(nspr_libs)',
        ],
        'libraries': [
          '<(nss_dist_obj_dir)/lib/libplds4.a',
          '<(nss_dist_obj_dir)/lib/libnspr4.a',
          '<(nss_dist_obj_dir)/lib/libplc4.a',
        ],
      }],
    ],
  },
  'targets': [
    {
      'target_name': 'fuzz_base',
      'dependencies': [
        '<(DEPTH)/lib/certdb/certdb.gyp:certdb',
        '<(DEPTH)/lib/certhigh/certhigh.gyp:certhi',
        '<(DEPTH)/lib/cryptohi/cryptohi.gyp:cryptohi',
        '<(DEPTH)/lib/base/base.gyp:nssb',
        '<(DEPTH)/lib/dev/dev.gyp:nssdev',
        '<(DEPTH)/lib/pki/pki.gyp:nsspki',
        '<(DEPTH)/lib/util/util.gyp:nssutil',
        '<(DEPTH)/lib/nss/nss.gyp:nss_static',
        '<(DEPTH)/lib/pkcs7/pkcs7.gyp:pkcs7',
        # This is a static build of pk11wrap, softoken, and freebl.
        '<(DEPTH)/lib/pk11wrap/pk11wrap.gyp:pk11wrap_static',
      ],
      'conditions': [
        ['use_fuzzing_engine==0', {
          'type': 'static_library',
          'sources': [
            'libFuzzer/FuzzerCrossOver.cpp',
            'libFuzzer/FuzzerDriver.cpp',
            'libFuzzer/FuzzerExtFunctionsDlsym.cpp',
            'libFuzzer/FuzzerExtFunctionsWeak.cpp',
            'libFuzzer/FuzzerExtFunctionsWeakAlias.cpp',
            'libFuzzer/FuzzerIO.cpp',
            'libFuzzer/FuzzerIOPosix.cpp',
            'libFuzzer/FuzzerIOWindows.cpp',
            'libFuzzer/FuzzerLoop.cpp',
            'libFuzzer/FuzzerMain.cpp',
            'libFuzzer/FuzzerMerge.cpp',
            'libFuzzer/FuzzerMutate.cpp',
            'libFuzzer/FuzzerSHA1.cpp',
            'libFuzzer/FuzzerTracePC.cpp',
            'libFuzzer/FuzzerTraceState.cpp',
            'libFuzzer/FuzzerUtil.cpp',
            'libFuzzer/FuzzerUtilDarwin.cpp',
            'libFuzzer/FuzzerUtilLinux.cpp',
            'libFuzzer/FuzzerUtilPosix.cpp',
            'libFuzzer/FuzzerUtilWindows.cpp',
          ],
          'cflags/': [
            ['exclude', '-fsanitize-coverage'],
          ],
          'xcode_settings': {
            'OTHER_CFLAGS/': [
              ['exclude', '-fsanitize-coverage'],
            ],
          },
          'direct_dependent_settings': {
            'include_dirs': [
              'libFuzzer',
            ],
          },
        }, {
          'type': 'none',
          'direct_dependent_settings': {
            'libraries': ['-lFuzzingEngine'],
          }
        }]
      ],
    },
    {
      'target_name': 'nssfuzz-pkcs8',
      'type': 'executable',
      'sources': [
        'asn1_mutators.cc',
        'initialize.cc',
        'pkcs8_target.cc',
      ],
      'dependencies': [
        '<(DEPTH)/exports.gyp:nss_exports',
        'fuzz_base',
      ],
    },
    {
      'target_name': 'nssfuzz-quickder',
      'type': 'executable',
      'sources': [
        'asn1_mutators.cc',
        'initialize.cc',
        'quickder_target.cc',
      ],
      'dependencies': [
        '<(DEPTH)/exports.gyp:nss_exports',
        'fuzz_base',
      ],
    },
    {
      'target_name': 'nssfuzz-hash',
      'type': 'executable',
      'sources': [
        'hash_target.cc',
        'initialize.cc',
      ],
      'dependencies': [
        '<(DEPTH)/exports.gyp:nss_exports',
        'fuzz_base',
      ],
    },
    {
      'target_name': 'nssfuzz',
      'type': 'none',
      'dependencies': [
        'nssfuzz-hash',
        'nssfuzz-pkcs8',
        'nssfuzz-quickder',
      ],
    }
  ],
}