Enable registration of per-frame Mojo services from Java
[chromium-blink-merge.git] / build / secondary / third_party / nss / BUILD.gn
blob25d449e14dc171b3635d59ff3d54e022fd3cf196
1 # Copyright 2014 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/linux/pkg_config.gni")
7 if (is_linux) {
8   # This is a dependency on NSS with no libssl. On Linux we use a built-in SSL
9   # library but the system NSS libraries. Non-Linux platforms using NSS use the
10   # hermetic one in //third_party/nss.
11   #
12   # Generally you should depend on //crypto:platform instead of using this
13   # config since that will properly pick up NSS or OpenSSL depending on
14   # platform and build config.
15   pkg_config("system_nss_no_ssl_config") {
16     packages = [ "nss" ]
17     extra_args = [
18       "-v",
19       "-lssl3",
20     ]
21   }
22 } else {
23   include_nss_root_certs = is_ios
24   include_nss_libpkix = is_ios
26   config("nspr_config") {
27     defines = [ "NO_NSPR_10_SUPPORT" ]
28     include_dirs = [
29       "nspr/pr/include",
30       "nspr/lib/ds",
31       "nspr/lib/libc/include",
32     ]
34     if (component_mode != "shared_library") {
35       defines += [ "NSPR_STATIC" ]
36     }
37   }
39   component("nspr") {
40     output_name = "crnspr"
41     sources = [
42       "nspr/lib/ds/plarena.c",
43       "nspr/lib/ds/plarena.h",
44       "nspr/lib/ds/plarenas.h",
45       "nspr/lib/ds/plhash.c",
46       "nspr/lib/ds/plhash.h",
47       "nspr/lib/libc/include/plbase64.h",
48       "nspr/lib/libc/include/plerror.h",
49       "nspr/lib/libc/include/plgetopt.h",
50       "nspr/lib/libc/include/plstr.h",
51       "nspr/lib/libc/src/base64.c",
52       "nspr/lib/libc/src/plerror.c",
53       "nspr/lib/libc/src/plgetopt.c",
54       "nspr/lib/libc/src/strcase.c",
55       "nspr/lib/libc/src/strcat.c",
56       "nspr/lib/libc/src/strchr.c",
57       "nspr/lib/libc/src/strcmp.c",
58       "nspr/lib/libc/src/strcpy.c",
59       "nspr/lib/libc/src/strdup.c",
60       "nspr/lib/libc/src/strlen.c",
61       "nspr/lib/libc/src/strpbrk.c",
62       "nspr/lib/libc/src/strstr.c",
63       "nspr/lib/libc/src/strtok.c",
64       "nspr/pr/include/md/_darwin.cfg",
65       "nspr/pr/include/md/_darwin.h",
66       "nspr/pr/include/md/_pcos.h",
67       "nspr/pr/include/md/_pth.h",
68       "nspr/pr/include/md/_unix_errors.h",
69       "nspr/pr/include/md/_unixos.h",
70       "nspr/pr/include/md/_win32_errors.h",
71       "nspr/pr/include/md/_win95.cfg",
72       "nspr/pr/include/md/_win95.h",
73       "nspr/pr/include/md/prosdep.h",
74       "nspr/pr/include/nspr.h",
75       "nspr/pr/include/obsolete/pralarm.h",
76       "nspr/pr/include/obsolete/probslet.h",
77       "nspr/pr/include/obsolete/protypes.h",
78       "nspr/pr/include/obsolete/prsem.h",
79       "nspr/pr/include/pratom.h",
80       "nspr/pr/include/prbit.h",
81       "nspr/pr/include/prclist.h",
82       "nspr/pr/include/prcmon.h",
83       "nspr/pr/include/prcountr.h",
84       "nspr/pr/include/prcpucfg.h",
85       "nspr/pr/include/prcvar.h",
86       "nspr/pr/include/prdtoa.h",
87       "nspr/pr/include/prenv.h",
88       "nspr/pr/include/prerr.h",
89       "nspr/pr/include/prerror.h",
90       "nspr/pr/include/prinet.h",
91       "nspr/pr/include/prinit.h",
92       "nspr/pr/include/prinrval.h",
93       "nspr/pr/include/prio.h",
94       "nspr/pr/include/pripcsem.h",
95       "nspr/pr/include/private/pprio.h",
96       "nspr/pr/include/private/pprmwait.h",
97       "nspr/pr/include/private/pprthred.h",
98       "nspr/pr/include/private/primpl.h",
99       "nspr/pr/include/private/prpriv.h",
100       "nspr/pr/include/prlink.h",
101       "nspr/pr/include/prlock.h",
102       "nspr/pr/include/prlog.h",
103       "nspr/pr/include/prlong.h",
104       "nspr/pr/include/prmem.h",
105       "nspr/pr/include/prmon.h",
106       "nspr/pr/include/prmwait.h",
107       "nspr/pr/include/prnetdb.h",
108       "nspr/pr/include/prolock.h",
109       "nspr/pr/include/prpdce.h",
110       "nspr/pr/include/prprf.h",
111       "nspr/pr/include/prproces.h",
112       "nspr/pr/include/prrng.h",
113       "nspr/pr/include/prrwlock.h",
114       "nspr/pr/include/prshm.h",
115       "nspr/pr/include/prshma.h",
116       "nspr/pr/include/prsystem.h",
117       "nspr/pr/include/prthread.h",
118       "nspr/pr/include/prtime.h",
119       "nspr/pr/include/prtpool.h",
120       "nspr/pr/include/prtrace.h",
121       "nspr/pr/include/prtypes.h",
122       "nspr/pr/include/prvrsion.h",
123       "nspr/pr/include/prwin16.h",
124       "nspr/pr/src/io/prdir.c",
125       "nspr/pr/src/io/prfdcach.c",
126       "nspr/pr/src/io/prfile.c",
127       "nspr/pr/src/io/prio.c",
128       "nspr/pr/src/io/priometh.c",
129       "nspr/pr/src/io/pripv6.c",
130       "nspr/pr/src/io/prlayer.c",
131       "nspr/pr/src/io/prlog.c",
132       "nspr/pr/src/io/prmapopt.c",
133       "nspr/pr/src/io/prmmap.c",
134       "nspr/pr/src/io/prmwait.c",
135       "nspr/pr/src/io/prpolevt.c",
136       "nspr/pr/src/io/prprf.c",
137       "nspr/pr/src/io/prscanf.c",
138       "nspr/pr/src/io/prsocket.c",
139       "nspr/pr/src/io/prstdio.c",
140       "nspr/pr/src/linking/prlink.c",
141       "nspr/pr/src/malloc/prmalloc.c",
142       "nspr/pr/src/malloc/prmem.c",
143       "nspr/pr/src/md/prosdep.c",
144       "nspr/pr/src/md/unix/darwin.c",
145       "nspr/pr/src/md/unix/os_Darwin.s",
146       "nspr/pr/src/md/unix/unix.c",
147       "nspr/pr/src/md/unix/unix_errors.c",
148       "nspr/pr/src/md/unix/uxproces.c",
149       "nspr/pr/src/md/unix/uxrng.c",
150       "nspr/pr/src/md/unix/uxshm.c",
151       "nspr/pr/src/md/unix/uxwrap.c",
152       "nspr/pr/src/md/windows/ntgc.c",
153       "nspr/pr/src/md/windows/ntinrval.c",
154       "nspr/pr/src/md/windows/ntmisc.c",
155       "nspr/pr/src/md/windows/ntsec.c",
156       "nspr/pr/src/md/windows/ntsem.c",
157       "nspr/pr/src/md/windows/w32ipcsem.c",
158       "nspr/pr/src/md/windows/w32poll.c",
159       "nspr/pr/src/md/windows/w32rng.c",
160       "nspr/pr/src/md/windows/w32shm.c",
161       "nspr/pr/src/md/windows/w95cv.c",
162       "nspr/pr/src/md/windows/w95dllmain.c",
163       "nspr/pr/src/md/windows/w95io.c",
164       "nspr/pr/src/md/windows/w95sock.c",
165       "nspr/pr/src/md/windows/w95thred.c",
166       "nspr/pr/src/md/windows/win32_errors.c",
167       "nspr/pr/src/memory/prseg.c",
168       "nspr/pr/src/memory/prshm.c",
169       "nspr/pr/src/memory/prshma.c",
170       "nspr/pr/src/misc/pralarm.c",
171       "nspr/pr/src/misc/pratom.c",
172       "nspr/pr/src/misc/praton.c",
173       "nspr/pr/src/misc/prcountr.c",
174       "nspr/pr/src/misc/prdtoa.c",
175       "nspr/pr/src/misc/prenv.c",
176       "nspr/pr/src/misc/prerr.c",
177       "nspr/pr/src/misc/prerror.c",
178       "nspr/pr/src/misc/prerrortable.c",
179       "nspr/pr/src/misc/prinit.c",
180       "nspr/pr/src/misc/prinrval.c",
181       "nspr/pr/src/misc/pripc.c",
182       "nspr/pr/src/misc/pripcsem.c",
183       "nspr/pr/src/misc/prlog2.c",
184       "nspr/pr/src/misc/prlong.c",
185       "nspr/pr/src/misc/prnetdb.c",
186       "nspr/pr/src/misc/prolock.c",
187       "nspr/pr/src/misc/prrng.c",
188       "nspr/pr/src/misc/prsystem.c",
189       "nspr/pr/src/misc/prthinfo.c",
190       "nspr/pr/src/misc/prtime.c",
191       "nspr/pr/src/misc/prtpool.c",
192       "nspr/pr/src/misc/prtrace.c",
193       "nspr/pr/src/pthreads/ptio.c",
194       "nspr/pr/src/pthreads/ptmisc.c",
195       "nspr/pr/src/pthreads/ptsynch.c",
196       "nspr/pr/src/pthreads/ptthread.c",
197       "nspr/pr/src/threads/combined/prucpu.c",
198       "nspr/pr/src/threads/combined/prucv.c",
199       "nspr/pr/src/threads/combined/prulock.c",
200       "nspr/pr/src/threads/combined/prustack.c",
201       "nspr/pr/src/threads/combined/pruthr.c",
202       "nspr/pr/src/threads/prcmon.c",
203       "nspr/pr/src/threads/prcthr.c",
204       "nspr/pr/src/threads/prdump.c",
205       "nspr/pr/src/threads/prmon.c",
206       "nspr/pr/src/threads/prrwlock.c",
207       "nspr/pr/src/threads/prsem.c",
208       "nspr/pr/src/threads/prtpd.c",
209     ]
211     public_configs = [ ":nspr_config" ]
213     configs -= [ "//build/config/compiler:chromium_code" ]
214     if (is_win) {
215       configs -= [
216         "//build/config/win:unicode",  # Requires 8-bit mode.
217         "//build/config/win:lean_and_mean",  # Won"t compile with lean and mean.
218       ]
219     }
220     configs += [
221       "//build/config/compiler:no_chromium_code",
222       "//build/config/compiler:no_size_t_to_int_warning",
223     ]
225     cflags = []
226     defines = [
227       "_NSPR_BUILD_",
228       "FORCE_PR_LOG",
229     ]
231     include_dirs = [ "nspr/pr/include/private" ]
233     if (is_win) {
234       cflags = [ "/wd4554" ]  # Check precidence.
235       defines += [
236         "XP_PC",
237         "WIN32",
238         "WIN95",
239         "_PR_GLOBAL_THREADS_ONLY",
240         "_CRT_SECURE_NO_WARNINGS",
241       ]
242     } else {
243       sources -= [
244         "nspr/pr/src/md/windows/ntgc.c",
245         "nspr/pr/src/md/windows/ntinrval.c",
246         "nspr/pr/src/md/windows/ntmisc.c",
247         "nspr/pr/src/md/windows/ntsec.c",
248         "nspr/pr/src/md/windows/ntsem.c",
249         "nspr/pr/src/md/windows/w32ipcsem.c",
250         "nspr/pr/src/md/windows/w32poll.c",
251         "nspr/pr/src/md/windows/w32rng.c",
252         "nspr/pr/src/md/windows/w32shm.c",
253         "nspr/pr/src/md/windows/w95cv.c",
254         "nspr/pr/src/md/windows/w95dllmain.c",
255         "nspr/pr/src/md/windows/w95io.c",
256         "nspr/pr/src/md/windows/w95sock.c",
257         "nspr/pr/src/md/windows/w95thred.c",
258         "nspr/pr/src/md/windows/win32_errors.c",
259         "nspr/pr/src/threads/combined/prucpu.c",
260         "nspr/pr/src/threads/combined/prucv.c",
261         "nspr/pr/src/threads/combined/prulock.c",
262         "nspr/pr/src/threads/combined/prustack.c",
263         "nspr/pr/src/threads/combined/pruthr.c",
264       ]
265     }
267     if (!is_posix) {
268       sources -= [
269         "nspr/pr/src/md/unix/darwin.c",
270         "nspr/pr/src/md/unix/os_Darwin.s",
271         "nspr/pr/src/md/unix/unix.c",
272         "nspr/pr/src/md/unix/unix_errors.c",
273         "nspr/pr/src/md/unix/uxproces.c",
274         "nspr/pr/src/md/unix/uxrng.c",
275         "nspr/pr/src/md/unix/uxshm.c",
276         "nspr/pr/src/md/unix/uxwrap.c",
277         "nspr/pr/src/pthreads/ptio.c",
278         "nspr/pr/src/pthreads/ptmisc.c",
279         "nspr/pr/src/pthreads/ptsynch.c",
280         "nspr/pr/src/pthreads/ptthread.c",
281       ]
282     }
284     if (current_cpu == "x86") {
285       defines += [ "_X86_" ]
286     } else if (current_cpu == "x64") {
287       defines += [ "_AMD64_" ]
288     }
290     if (is_mac || is_ios) {
291       sources -= [
292         "nspr/pr/src/io/prdir.c",
293         "nspr/pr/src/io/prfile.c",
294         "nspr/pr/src/io/prio.c",
295         "nspr/pr/src/io/prsocket.c",
296         "nspr/pr/src/misc/pripcsem.c",
297         "nspr/pr/src/threads/prcthr.c",
298         "nspr/pr/src/threads/prdump.c",
299         "nspr/pr/src/threads/prmon.c",
300         "nspr/pr/src/threads/prsem.c",
301       ]
302       defines += [
303         "XP_UNIX",
304         "DARWIN",
305         "XP_MACOSX",
306         "_PR_PTHREADS",
307         "HAVE_BSD_FLOCK",
308         "HAVE_DLADDR",
309         "HAVE_LCHOWN",
310         "HAVE_SOCKLEN_T",
311         "HAVE_STRERROR",
312       ]
313     }
315     if (is_mac) {
316       defines += [ "HAVE_CRT_EXTERNS_H" ]
317       libs = [
318         "CoreFoundation.framework",
319         "CoreServices.framework",
320       ]
321     }
323     if (is_clang) {
324       cflags += [
325         # nspr uses a bunch of deprecated functions (NSLinkModule etc) in
326         # prlink.c on mac.
327         "-Wno-deprecated-declarations",
329         # nspr passes "const char*" through "void*".
330         "-Wno-incompatible-pointer-types",
332         # nspr passes "int*" through "unsigned int*".
333         "-Wno-pointer-sign",
334       ]
336       # nspr uses assert(!"foo") instead of assert(false && "foo").
337       configs -= [ "//build/config/clang:extra_warnings" ]
338     }
339   }
341   component("nss") {
342     output_name = "crnss"
343     sources = [
344       # Ensure at least one object file is produced, so that MSVC does not
345       # warn when creating the static/shared library. See the note for
346       # the "nssckbi" target for why the "nss" target was split as such.
347       "nss/lib/nss/nssver.c",
348     ]
350     public_deps = [
351       ":nss_static",
352     ]
354     if (include_nss_root_certs) {
355       public_deps += [ ":nssckbi" ]
356     }
358     if (component_mode == "shared_library") {
359       if (is_mac) {
360         ldflags = [ "-all_load" ]
361       } else if (is_win) {
362         # Pass the def file to the linker.
363         ldflags =
364             [ "/DEF:" + rebase_path("nss/exports_win.def", root_build_dir) ]
365       }
366     }
367   }
369   config("nssckbi_config") {
370     include_dirs = [ "nss/lib/ckfw/builtins" ]
371   }
373   # This is really more of a pseudo-target to work around the fact that
374   # a single static_library target cannot contain two object files of the
375   # same name (hash.o / hash.obj). Logically, this is part of the
376   # "nss_static" target. By separating it out, it creates a possible
377   # circular dependency between "nss_static" and "nssckbi" when
378   # "exclude_nss_root_certs" is not specified, as "nss_static" depends on
379   # the "builtinsC_GetFunctionList" exported by this target. This is an
380   # artifact of how NSS is being statically built, which is not an
381   # officially supported configuration - normally, "nssckbi.dll/so" would
382   # depend on libnss3.dll/so, and the higher layer caller would instruct
383   # libnss3.dll to dynamically load nssckbi.dll, breaking the circle.
384   #
385   # TODO(rsleevi): http://crbug.com/128134 - Break the circular dependency
386   # without requiring nssckbi to be built as a shared library.
387   source_set("nssckbi") {
388     visibility = [ ":nss" ]  # This target is internal implementation detail.
390     sources = [
391       "nss/lib/ckfw/builtins/anchor.c",
392       "nss/lib/ckfw/builtins/bfind.c",
393       "nss/lib/ckfw/builtins/binst.c",
394       "nss/lib/ckfw/builtins/bobject.c",
395       "nss/lib/ckfw/builtins/bsession.c",
396       "nss/lib/ckfw/builtins/bslot.c",
397       "nss/lib/ckfw/builtins/btoken.c",
398       "nss/lib/ckfw/builtins/builtins.h",
399       "nss/lib/ckfw/builtins/certdata.c",
400       "nss/lib/ckfw/builtins/ckbiver.c",
401       "nss/lib/ckfw/builtins/constants.c",
402       "nss/lib/ckfw/builtins/nssckbi.h",
403       "nss/lib/ckfw/ck.h",
404       "nss/lib/ckfw/ckfw.h",
405       "nss/lib/ckfw/ckfwm.h",
406       "nss/lib/ckfw/ckfwtm.h",
407       "nss/lib/ckfw/ckmd.h",
408       "nss/lib/ckfw/ckt.h",
409       "nss/lib/ckfw/crypto.c",
410       "nss/lib/ckfw/find.c",
411       "nss/lib/ckfw/hash.c",
412       "nss/lib/ckfw/instance.c",
413       "nss/lib/ckfw/mechanism.c",
414       "nss/lib/ckfw/mutex.c",
415       "nss/lib/ckfw/nssck.api",
416       "nss/lib/ckfw/nssckepv.h",
417       "nss/lib/ckfw/nssckft.h",
418       "nss/lib/ckfw/nssckfw.h",
419       "nss/lib/ckfw/nssckfwc.h",
420       "nss/lib/ckfw/nssckfwt.h",
421       "nss/lib/ckfw/nssckg.h",
422       "nss/lib/ckfw/nssckmdt.h",
423       "nss/lib/ckfw/nssckt.h",
424       "nss/lib/ckfw/object.c",
425       "nss/lib/ckfw/session.c",
426       "nss/lib/ckfw/sessobj.c",
427       "nss/lib/ckfw/slot.c",
428       "nss/lib/ckfw/token.c",
429       "nss/lib/ckfw/wrap.c",
430     ]
432     configs -= [ "//build/config/compiler:chromium_code" ]
434     if (is_win) {
435       configs -= [ "//build/config/win:unicode" ]  # Requires 8-bit mode.
436     }
437     configs += [ "//build/config/compiler:no_chromium_code" ]
439     include_dirs = [ "nss/lib/ckfw" ]
440     public_configs = [ ":nssckbi_config" ]
442     public_deps = [
443       ":nss_static",
444     ]
445   }
447   config("nss_static_config") {
448     defines = [
449       "NSS_STATIC",
450       "NSS_USE_STATIC_LIBS",
451       "USE_UTIL_DIRECTLY",
452     ]
453     if (is_win) {
454       defines += [ "_WINDOWS" ]
455     }
456     include_dirs = [
457       "nspr/pr/include",
458       "nspr/lib/ds",
459       "nspr/lib/libc/include",
460       "nss/lib/base",
461       "nss/lib/certdb",
462       "nss/lib/certhigh",
463       "nss/lib/cryptohi",
464       "nss/lib/dev",
465       "nss/lib/freebl",
466       "nss/lib/freebl/ecl",
467       "nss/lib/nss",
468       "nss/lib/pk11wrap",
469       "nss/lib/pkcs7",
470       "nss/lib/pki",
471       "nss/lib/smime",
472       "nss/lib/softoken",
473       "nss/lib/util",
474     ]
475   }
477   if (is_win && current_cpu == "x86") {
478     source_set("nss_static_avx") {
479       sources = [
480         "nss/lib/freebl/intel-gcm-wrap.c",
481         "nss/lib/freebl/intel-gcm-x86-masm.asm",
482         "nss/lib/freebl/intel-gcm.h",
483       ]
484       defines = [
485         "_WINDOWS",
486         "_X86_",
487         "INTEL_GCM",
488         "MP_API_COMPATIBLE",
489         "MP_ASSEMBLY_DIV_2DX1D",
490         "MP_ASSEMBLY_MULTIPLY",
491         "MP_ASSEMBLY_SQUARE",
492         "MP_NO_MP_WORD",
493         "MP_USE_UINT_DIGIT",
494         "NSS_DISABLE_DBM",
495         "NSS_STATIC",
496         "NSS_USE_STATIC_LIBS",
497         "NSS_X86",
498         "NSS_X86_OR_X64",
499         "RIJNDAEL_INCLUDE_TABLES",
500         "SHLIB_PREFIX=\"\"",
501         "SHLIB_SUFFIX=\"dll\"",
502         "SHLIB_VERSION=\"3\"",
503         "SOFTOKEN_LIB_NAME=\"softokn3.dll\"",
504         "SOFTOKEN_SHLIB_VERSION=\"3\"",
505         "USE_HW_AES",
506         "USE_UTIL_DIRECTLY",
507         "WIN32",
508         "WIN95",
509         "XP_PC",
510       ]
511       include_dirs = [
512         "nspr/pr/include",
513         "nspr/lib/ds",
514         "nspr/lib/libc/include",
515         "nss/lib/freebl/ecl",
516         "nss/lib/util",
517       ]
518     }
519   }
521   source_set("nss_static") {
522     visibility = [ ":*" ]  # Internal implementation detail.
524     sources = [
525       "nss/lib/base/arena.c",
526       "nss/lib/base/base.h",
527       "nss/lib/base/baset.h",
528       "nss/lib/base/error.c",
529       "nss/lib/base/errorval.c",
530       "nss/lib/base/hash.c",
531       "nss/lib/base/hashops.c",
532       "nss/lib/base/item.c",
533       "nss/lib/base/libc.c",
534       "nss/lib/base/list.c",
535       "nss/lib/base/nssbase.h",
536       "nss/lib/base/nssbaset.h",
537       "nss/lib/base/nssutf8.c",
538       "nss/lib/base/tracker.c",
539       "nss/lib/certdb/alg1485.c",
540       "nss/lib/certdb/cert.h",
541       "nss/lib/certdb/certdb.c",
542       "nss/lib/certdb/certdb.h",
543       "nss/lib/certdb/certi.h",
544       "nss/lib/certdb/certt.h",
545       "nss/lib/certdb/certv3.c",
546       "nss/lib/certdb/certxutl.c",
547       "nss/lib/certdb/certxutl.h",
548       "nss/lib/certdb/crl.c",
549       "nss/lib/certdb/genname.c",
550       "nss/lib/certdb/genname.h",
551       "nss/lib/certdb/polcyxtn.c",
552       "nss/lib/certdb/secname.c",
553       "nss/lib/certdb/stanpcertdb.c",
554       "nss/lib/certdb/xauthkid.c",
555       "nss/lib/certdb/xbsconst.c",
556       "nss/lib/certdb/xconst.c",
557       "nss/lib/certdb/xconst.h",
558       "nss/lib/certhigh/certhigh.c",
559       "nss/lib/certhigh/certhtml.c",
560       "nss/lib/certhigh/certreq.c",
561       "nss/lib/certhigh/certvfy.c",
562       "nss/lib/certhigh/crlv2.c",
563       "nss/lib/certhigh/ocsp.c",
564       "nss/lib/certhigh/ocsp.h",
565       "nss/lib/certhigh/ocspi.h",
566       "nss/lib/certhigh/ocspsig.c",
567       "nss/lib/certhigh/ocspt.h",
568       "nss/lib/certhigh/ocspti.h",
569       "nss/lib/certhigh/xcrldist.c",
570       "nss/lib/cryptohi/cryptohi.h",
571       "nss/lib/cryptohi/cryptoht.h",
572       "nss/lib/cryptohi/dsautil.c",
573       "nss/lib/cryptohi/key.h",
574       "nss/lib/cryptohi/keyhi.h",
575       "nss/lib/cryptohi/keyi.h",
576       "nss/lib/cryptohi/keyt.h",
577       "nss/lib/cryptohi/keythi.h",
578       "nss/lib/cryptohi/sechash.c",
579       "nss/lib/cryptohi/sechash.h",
580       "nss/lib/cryptohi/seckey.c",
581       "nss/lib/cryptohi/secsign.c",
582       "nss/lib/cryptohi/secvfy.c",
583       "nss/lib/dev/ckhelper.c",
584       "nss/lib/dev/ckhelper.h",
585       "nss/lib/dev/dev.h",
586       "nss/lib/dev/devm.h",
587       "nss/lib/dev/devslot.c",
588       "nss/lib/dev/devt.h",
589       "nss/lib/dev/devtm.h",
590       "nss/lib/dev/devtoken.c",
591       "nss/lib/dev/devutil.c",
592       "nss/lib/dev/nssdev.h",
593       "nss/lib/dev/nssdevt.h",
594       "nss/lib/freebl/aeskeywrap.c",
595       "nss/lib/freebl/alg2268.c",
596       "nss/lib/freebl/alghmac.c",
597       "nss/lib/freebl/alghmac.h",
598       "nss/lib/freebl/arcfive.c",
599       "nss/lib/freebl/arcfour.c",
600       "nss/lib/freebl/blapi.h",
601       "nss/lib/freebl/blapii.h",
602       "nss/lib/freebl/blapit.h",
603       "nss/lib/freebl/camellia.c",
604       "nss/lib/freebl/camellia.h",
605       "nss/lib/freebl/chacha20/chacha20.c",
606       "nss/lib/freebl/chacha20/chacha20.h",
607       "nss/lib/freebl/chacha20/chacha20_vec.c",
608       "nss/lib/freebl/chacha20poly1305.c",
609       "nss/lib/freebl/chacha20poly1305.h",
610       "nss/lib/freebl/ctr.c",
611       "nss/lib/freebl/ctr.h",
612       "nss/lib/freebl/cts.c",
613       "nss/lib/freebl/cts.h",
614       "nss/lib/freebl/des.c",
615       "nss/lib/freebl/des.h",
616       "nss/lib/freebl/desblapi.c",
617       "nss/lib/freebl/dh.c",
618       "nss/lib/freebl/drbg.c",
619       "nss/lib/freebl/dsa.c",
620       "nss/lib/freebl/ec.c",
621       "nss/lib/freebl/ec.h",
622       "nss/lib/freebl/ecdecode.c",
623       "nss/lib/freebl/ecl/ec2.h",
624       "nss/lib/freebl/ecl/ec_naf.c",
625       "nss/lib/freebl/ecl/ecl-curve.h",
626       "nss/lib/freebl/ecl/ecl-exp.h",
627       "nss/lib/freebl/ecl/ecl-priv.h",
628       "nss/lib/freebl/ecl/ecl.c",
629       "nss/lib/freebl/ecl/ecl.h",
630       "nss/lib/freebl/ecl/ecl_curve.c",
631       "nss/lib/freebl/ecl/ecl_gf.c",
632       "nss/lib/freebl/ecl/ecl_mult.c",
633       "nss/lib/freebl/ecl/ecp.h",
634       "nss/lib/freebl/ecl/ecp_256.c",
635       "nss/lib/freebl/ecl/ecp_256_32.c",
636       "nss/lib/freebl/ecl/ecp_384.c",
637       "nss/lib/freebl/ecl/ecp_521.c",
638       "nss/lib/freebl/ecl/ecp_aff.c",
639       "nss/lib/freebl/ecl/ecp_jac.c",
640       "nss/lib/freebl/ecl/ecp_jm.c",
641       "nss/lib/freebl/ecl/ecp_mont.c",
642       "nss/lib/freebl/gcm.c",
643       "nss/lib/freebl/gcm.h",
644       "nss/lib/freebl/hmacct.c",
645       "nss/lib/freebl/hmacct.h",
646       "nss/lib/freebl/intel-aes-x86-masm.asm",
647       "nss/lib/freebl/intel-aes.h",
648       "nss/lib/freebl/jpake.c",
649       "nss/lib/freebl/md2.c",
650       "nss/lib/freebl/md5.c",
651       "nss/lib/freebl/mpi/logtab.h",
652       "nss/lib/freebl/mpi/mp_gf2m-priv.h",
653       "nss/lib/freebl/mpi/mp_gf2m.c",
654       "nss/lib/freebl/mpi/mp_gf2m.h",
655       "nss/lib/freebl/mpi/mpcpucache.c",
656       "nss/lib/freebl/mpi/mpi-config.h",
657       "nss/lib/freebl/mpi/mpi-priv.h",
658       "nss/lib/freebl/mpi/mpi.c",
659       "nss/lib/freebl/mpi/mpi.h",
660       "nss/lib/freebl/mpi/mpi_amd64.c",
661       "nss/lib/freebl/mpi/mpi_arm.c",
662       "nss/lib/freebl/mpi/mpi_arm_mac.c",
663       "nss/lib/freebl/mpi/mpi_x86_asm.c",
664       "nss/lib/freebl/mpi/mplogic.c",
665       "nss/lib/freebl/mpi/mplogic.h",
666       "nss/lib/freebl/mpi/mpmontg.c",
667       "nss/lib/freebl/mpi/mpprime.c",
668       "nss/lib/freebl/mpi/mpprime.h",
669       "nss/lib/freebl/mpi/primes.c",
670       "nss/lib/freebl/nss_build_config_mac.h",
671       "nss/lib/freebl/poly1305/poly1305-donna-x64-sse2-incremental-source.c",
672       "nss/lib/freebl/poly1305/poly1305.c",
673       "nss/lib/freebl/poly1305/poly1305.h",
674       "nss/lib/freebl/pqg.c",
675       "nss/lib/freebl/pqg.h",
676       "nss/lib/freebl/rawhash.c",
677       "nss/lib/freebl/rijndael.c",
678       "nss/lib/freebl/rijndael.h",
679       "nss/lib/freebl/rijndael32.tab",
680       "nss/lib/freebl/rsa.c",
681       "nss/lib/freebl/rsapkcs.c",
682       "nss/lib/freebl/secmpi.h",
683       "nss/lib/freebl/secrng.h",
684       "nss/lib/freebl/seed.c",
685       "nss/lib/freebl/seed.h",
686       "nss/lib/freebl/sha256.h",
687       "nss/lib/freebl/sha512.c",
688       "nss/lib/freebl/sha_fast.c",
689       "nss/lib/freebl/sha_fast.h",
690       "nss/lib/freebl/shsign.h",
691       "nss/lib/freebl/shvfy.c",
692       "nss/lib/freebl/sysrand.c",
693       "nss/lib/freebl/tlsprfalg.c",
694       "nss/lib/freebl/unix_rand.c",
695       "nss/lib/freebl/win_rand.c",
696       "nss/lib/nss/nss.h",
697       "nss/lib/nss/nssinit.c",
698       "nss/lib/nss/nssrenam.h",
699       "nss/lib/nss/utilwrap.c",
700       "nss/lib/pk11wrap/debug_module.c",
701       "nss/lib/pk11wrap/dev3hack.c",
702       "nss/lib/pk11wrap/dev3hack.h",
703       "nss/lib/pk11wrap/pk11akey.c",
704       "nss/lib/pk11wrap/pk11auth.c",
705       "nss/lib/pk11wrap/pk11cert.c",
706       "nss/lib/pk11wrap/pk11cxt.c",
707       "nss/lib/pk11wrap/pk11err.c",
708       "nss/lib/pk11wrap/pk11func.h",
709       "nss/lib/pk11wrap/pk11kea.c",
710       "nss/lib/pk11wrap/pk11list.c",
711       "nss/lib/pk11wrap/pk11load.c",
712       "nss/lib/pk11wrap/pk11mech.c",
713       "nss/lib/pk11wrap/pk11merge.c",
714       "nss/lib/pk11wrap/pk11nobj.c",
715       "nss/lib/pk11wrap/pk11obj.c",
716       "nss/lib/pk11wrap/pk11pars.c",
717       "nss/lib/pk11wrap/pk11pbe.c",
718       "nss/lib/pk11wrap/pk11pk12.c",
719       "nss/lib/pk11wrap/pk11pqg.c",
720       "nss/lib/pk11wrap/pk11pqg.h",
721       "nss/lib/pk11wrap/pk11priv.h",
722       "nss/lib/pk11wrap/pk11pub.h",
723       "nss/lib/pk11wrap/pk11sdr.c",
724       "nss/lib/pk11wrap/pk11sdr.h",
725       "nss/lib/pk11wrap/pk11skey.c",
726       "nss/lib/pk11wrap/pk11slot.c",
727       "nss/lib/pk11wrap/pk11util.c",
728       "nss/lib/pk11wrap/secmod.h",
729       "nss/lib/pk11wrap/secmodi.h",
730       "nss/lib/pk11wrap/secmodt.h",
731       "nss/lib/pk11wrap/secmodti.h",
732       "nss/lib/pk11wrap/secpkcs5.h",
733       "nss/lib/pkcs7/certread.c",
734       "nss/lib/pkcs7/p7common.c",
735       "nss/lib/pkcs7/p7create.c",
736       "nss/lib/pkcs7/p7decode.c",
737       "nss/lib/pkcs7/p7encode.c",
738       "nss/lib/pkcs7/p7local.c",
739       "nss/lib/pkcs7/p7local.h",
740       "nss/lib/pkcs7/pkcs7t.h",
741       "nss/lib/pkcs7/secmime.c",
742       "nss/lib/pkcs7/secmime.h",
743       "nss/lib/pkcs7/secpkcs7.h",
744       "nss/lib/pki/asymmkey.c",
745       "nss/lib/pki/certdecode.c",
746       "nss/lib/pki/certificate.c",
747       "nss/lib/pki/cryptocontext.c",
748       "nss/lib/pki/nsspki.h",
749       "nss/lib/pki/nsspkit.h",
750       "nss/lib/pki/pki.h",
751       "nss/lib/pki/pki3hack.c",
752       "nss/lib/pki/pki3hack.h",
753       "nss/lib/pki/pkibase.c",
754       "nss/lib/pki/pkim.h",
755       "nss/lib/pki/pkistore.c",
756       "nss/lib/pki/pkistore.h",
757       "nss/lib/pki/pkit.h",
758       "nss/lib/pki/pkitm.h",
759       "nss/lib/pki/symmkey.c",
760       "nss/lib/pki/tdcache.c",
761       "nss/lib/pki/trustdomain.c",
762       "nss/lib/smime/cms.h",
763       "nss/lib/smime/cmslocal.h",
764       "nss/lib/smime/cmsreclist.h",
765       "nss/lib/smime/cmst.h",
766       "nss/lib/smime/smime.h",
767       "nss/lib/softoken/fipsaudt.c",
768       "nss/lib/softoken/fipstest.c",
769       "nss/lib/softoken/fipstokn.c",
770       "nss/lib/softoken/jpakesftk.c",
771       "nss/lib/softoken/lgglue.c",
772       "nss/lib/softoken/lgglue.h",
773       "nss/lib/softoken/lowkey.c",
774       "nss/lib/softoken/lowkeyi.h",
775       "nss/lib/softoken/lowkeyti.h",
776       "nss/lib/softoken/lowpbe.c",
777       "nss/lib/softoken/lowpbe.h",
778       "nss/lib/softoken/padbuf.c",
779       "nss/lib/softoken/pkcs11.c",
780       "nss/lib/softoken/pkcs11c.c",
781       "nss/lib/softoken/pkcs11i.h",
782       "nss/lib/softoken/pkcs11ni.h",
783       "nss/lib/softoken/pkcs11u.c",
784       "nss/lib/softoken/sdb.c",
785       "nss/lib/softoken/sdb.h",
786       "nss/lib/softoken/sftkdb.c",
787       "nss/lib/softoken/sftkdb.h",
788       "nss/lib/softoken/sftkdbt.h",
789       "nss/lib/softoken/sftkdbti.h",
790       "nss/lib/softoken/sftkhmac.c",
791       "nss/lib/softoken/sftkpars.c",
792       "nss/lib/softoken/sftkpars.h",
793       "nss/lib/softoken/sftkpwd.c",
794       "nss/lib/softoken/softkver.c",
795       "nss/lib/softoken/softkver.h",
796       "nss/lib/softoken/softoken.h",
797       "nss/lib/softoken/softoknt.h",
798       "nss/lib/softoken/tlsprf.c",
799       "nss/lib/ssl/sslerr.h",
800       "nss/lib/util/SECerrs.h",
801       "nss/lib/util/base64.h",
802       "nss/lib/util/ciferfam.h",
803       "nss/lib/util/derdec.c",
804       "nss/lib/util/derenc.c",
805       "nss/lib/util/dersubr.c",
806       "nss/lib/util/dertime.c",
807       "nss/lib/util/errstrs.c",
808       "nss/lib/util/hasht.h",
809       "nss/lib/util/nssb64.h",
810       "nss/lib/util/nssb64d.c",
811       "nss/lib/util/nssb64e.c",
812       "nss/lib/util/nssb64t.h",
813       "nss/lib/util/nssilckt.h",
814       "nss/lib/util/nssilock.c",
815       "nss/lib/util/nssilock.h",
816       "nss/lib/util/nsslocks.h",
817       "nss/lib/util/nssrwlk.c",
818       "nss/lib/util/nssrwlk.h",
819       "nss/lib/util/nssrwlkt.h",
820       "nss/lib/util/nssutil.h",
821       "nss/lib/util/oidstring.c",
822       "nss/lib/util/pkcs11.h",
823       "nss/lib/util/pkcs11f.h",
824       "nss/lib/util/pkcs11n.h",
825       "nss/lib/util/pkcs11p.h",
826       "nss/lib/util/pkcs11t.h",
827       "nss/lib/util/pkcs11u.h",
828       "nss/lib/util/pkcs1sig.c",
829       "nss/lib/util/pkcs1sig.h",
830       "nss/lib/util/portreg.c",
831       "nss/lib/util/portreg.h",
832       "nss/lib/util/quickder.c",
833       "nss/lib/util/secalgid.c",
834       "nss/lib/util/secasn1.h",
835       "nss/lib/util/secasn1d.c",
836       "nss/lib/util/secasn1e.c",
837       "nss/lib/util/secasn1t.h",
838       "nss/lib/util/secasn1u.c",
839       "nss/lib/util/seccomon.h",
840       "nss/lib/util/secder.h",
841       "nss/lib/util/secdert.h",
842       "nss/lib/util/secdig.c",
843       "nss/lib/util/secdig.h",
844       "nss/lib/util/secdigt.h",
845       "nss/lib/util/secerr.h",
846       "nss/lib/util/secitem.c",
847       "nss/lib/util/secitem.h",
848       "nss/lib/util/secoid.c",
849       "nss/lib/util/secoid.h",
850       "nss/lib/util/secoidt.h",
851       "nss/lib/util/secport.c",
852       "nss/lib/util/secport.h",
853       "nss/lib/util/sectime.c",
854       "nss/lib/util/templates.c",
855       "nss/lib/util/utf8.c",
856       "nss/lib/util/utilmod.c",
857       "nss/lib/util/utilmodt.h",
858       "nss/lib/util/utilpars.c",
859       "nss/lib/util/utilpars.h",
860       "nss/lib/util/utilparst.h",
861       "nss/lib/util/utilrename.h",
862     ]
864     sources -= [
865       # mpi_arm.c is included by mpi_arm_mac.c.
866       # NOTE: mpi_arm.c can be used directly on Linux. mpi_arm.c will need
867       # to be excluded conditionally if we start to build NSS on Linux.
868       "nss/lib/freebl/mpi/mpi_arm.c",
870       # primes.c is included by mpprime.c.
871       "nss/lib/freebl/mpi/primes.c",
873       # unix_rand.c and win_rand.c are included by sysrand.c.
874       "nss/lib/freebl/unix_rand.c",
875       "nss/lib/freebl/win_rand.c",
877       # debug_module.c is included by pk11load.c.
878       "nss/lib/pk11wrap/debug_module.c",
879     ]
881     configs -= [ "//build/config/compiler:chromium_code" ]
882     if (is_win) {
883       configs -= [ "//build/config/win:unicode" ]  # Requires 8-bit mode.
884     }
885     configs += [
886       "//build/config/compiler:no_chromium_code",
887       "//build/config/compiler:no_size_t_to_int_warning",
888     ]
889     public_configs = [ ":nss_static_config" ]
891     cflags = []
893     # Only need the defines and includes not in nss_static_config.
894     defines = [
895       "MP_API_COMPATIBLE",
896       "NSS_DISABLE_DBM",
897       "RIJNDAEL_INCLUDE_TABLES",
898       "SHLIB_VERSION=\"3\"",
899       "SOFTOKEN_SHLIB_VERSION=\"3\"",
900     ]
901     include_dirs = [
902       "nss/lib/freebl/mpi",
903       "nss/lib/ssl",
904     ]
906     if (is_win) {
907       cflags += [ "/wd4101" ]  # Unreferenced local variable.
908     }
910     if (include_nss_libpkix) {
911       sources += [
912         "nss/lib/certhigh/certvfypkix.c",
913         "nss/lib/certhigh/certvfypkixprint.c",
914         "nss/lib/libpkix/include/pkix.h",
915         "nss/lib/libpkix/include/pkix_certsel.h",
916         "nss/lib/libpkix/include/pkix_certstore.h",
917         "nss/lib/libpkix/include/pkix_checker.h",
918         "nss/lib/libpkix/include/pkix_crlsel.h",
919         "nss/lib/libpkix/include/pkix_errorstrings.h",
920         "nss/lib/libpkix/include/pkix_params.h",
921         "nss/lib/libpkix/include/pkix_pl_pki.h",
922         "nss/lib/libpkix/include/pkix_pl_system.h",
923         "nss/lib/libpkix/include/pkix_results.h",
924         "nss/lib/libpkix/include/pkix_revchecker.h",
925         "nss/lib/libpkix/include/pkix_sample_modules.h",
926         "nss/lib/libpkix/include/pkix_util.h",
927         "nss/lib/libpkix/include/pkixt.h",
928         "nss/lib/libpkix/pkix/certsel/pkix_certselector.c",
929         "nss/lib/libpkix/pkix/certsel/pkix_certselector.h",
930         "nss/lib/libpkix/pkix/certsel/pkix_comcertselparams.c",
931         "nss/lib/libpkix/pkix/certsel/pkix_comcertselparams.h",
932         "nss/lib/libpkix/pkix/checker/pkix_basicconstraintschecker.c",
933         "nss/lib/libpkix/pkix/checker/pkix_basicconstraintschecker.h",
934         "nss/lib/libpkix/pkix/checker/pkix_certchainchecker.c",
935         "nss/lib/libpkix/pkix/checker/pkix_certchainchecker.h",
936         "nss/lib/libpkix/pkix/checker/pkix_crlchecker.c",
937         "nss/lib/libpkix/pkix/checker/pkix_crlchecker.h",
938         "nss/lib/libpkix/pkix/checker/pkix_ekuchecker.c",
939         "nss/lib/libpkix/pkix/checker/pkix_ekuchecker.h",
940         "nss/lib/libpkix/pkix/checker/pkix_expirationchecker.c",
941         "nss/lib/libpkix/pkix/checker/pkix_expirationchecker.h",
942         "nss/lib/libpkix/pkix/checker/pkix_namechainingchecker.c",
943         "nss/lib/libpkix/pkix/checker/pkix_namechainingchecker.h",
944         "nss/lib/libpkix/pkix/checker/pkix_nameconstraintschecker.c",
945         "nss/lib/libpkix/pkix/checker/pkix_nameconstraintschecker.h",
946         "nss/lib/libpkix/pkix/checker/pkix_ocspchecker.c",
947         "nss/lib/libpkix/pkix/checker/pkix_ocspchecker.h",
948         "nss/lib/libpkix/pkix/checker/pkix_policychecker.c",
949         "nss/lib/libpkix/pkix/checker/pkix_policychecker.h",
950         "nss/lib/libpkix/pkix/checker/pkix_revocationchecker.c",
951         "nss/lib/libpkix/pkix/checker/pkix_revocationchecker.h",
952         "nss/lib/libpkix/pkix/checker/pkix_revocationmethod.c",
953         "nss/lib/libpkix/pkix/checker/pkix_revocationmethod.h",
954         "nss/lib/libpkix/pkix/checker/pkix_signaturechecker.c",
955         "nss/lib/libpkix/pkix/checker/pkix_signaturechecker.h",
956         "nss/lib/libpkix/pkix/checker/pkix_targetcertchecker.c",
957         "nss/lib/libpkix/pkix/checker/pkix_targetcertchecker.h",
958         "nss/lib/libpkix/pkix/crlsel/pkix_comcrlselparams.c",
959         "nss/lib/libpkix/pkix/crlsel/pkix_comcrlselparams.h",
960         "nss/lib/libpkix/pkix/crlsel/pkix_crlselector.c",
961         "nss/lib/libpkix/pkix/crlsel/pkix_crlselector.h",
962         "nss/lib/libpkix/pkix/params/pkix_procparams.c",
963         "nss/lib/libpkix/pkix/params/pkix_procparams.h",
964         "nss/lib/libpkix/pkix/params/pkix_resourcelimits.c",
965         "nss/lib/libpkix/pkix/params/pkix_resourcelimits.h",
966         "nss/lib/libpkix/pkix/params/pkix_trustanchor.c",
967         "nss/lib/libpkix/pkix/params/pkix_trustanchor.h",
968         "nss/lib/libpkix/pkix/params/pkix_valparams.c",
969         "nss/lib/libpkix/pkix/params/pkix_valparams.h",
970         "nss/lib/libpkix/pkix/results/pkix_buildresult.c",
971         "nss/lib/libpkix/pkix/results/pkix_buildresult.h",
972         "nss/lib/libpkix/pkix/results/pkix_policynode.c",
973         "nss/lib/libpkix/pkix/results/pkix_policynode.h",
974         "nss/lib/libpkix/pkix/results/pkix_valresult.c",
975         "nss/lib/libpkix/pkix/results/pkix_valresult.h",
976         "nss/lib/libpkix/pkix/results/pkix_verifynode.c",
977         "nss/lib/libpkix/pkix/results/pkix_verifynode.h",
978         "nss/lib/libpkix/pkix/store/pkix_store.c",
979         "nss/lib/libpkix/pkix/store/pkix_store.h",
980         "nss/lib/libpkix/pkix/top/pkix_build.c",
981         "nss/lib/libpkix/pkix/top/pkix_build.h",
982         "nss/lib/libpkix/pkix/top/pkix_lifecycle.c",
983         "nss/lib/libpkix/pkix/top/pkix_lifecycle.h",
984         "nss/lib/libpkix/pkix/top/pkix_validate.c",
985         "nss/lib/libpkix/pkix/top/pkix_validate.h",
986         "nss/lib/libpkix/pkix/util/pkix_error.c",
987         "nss/lib/libpkix/pkix/util/pkix_error.h",
988         "nss/lib/libpkix/pkix/util/pkix_errpaths.c",
989         "nss/lib/libpkix/pkix/util/pkix_list.c",
990         "nss/lib/libpkix/pkix/util/pkix_list.h",
991         "nss/lib/libpkix/pkix/util/pkix_logger.c",
992         "nss/lib/libpkix/pkix/util/pkix_logger.h",
993         "nss/lib/libpkix/pkix/util/pkix_tools.c",
994         "nss/lib/libpkix/pkix/util/pkix_tools.h",
995         "nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_aiamgr.c",
996         "nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_aiamgr.h",
997         "nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_colcertstore.c",
998         "nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_colcertstore.h",
999         "nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_httpcertstore.c",
1000         "nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_httpcertstore.h",
1001         "nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_httpdefaultclient.c",
1002         "nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_httpdefaultclient.h",
1003         "nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_nsscontext.c",
1004         "nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_nsscontext.h",
1005         "nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_pk11certstore.c",
1006         "nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_pk11certstore.h",
1007         "nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_socket.c",
1008         "nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_socket.h",
1009         "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_basicconstraints.c",
1010         "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_basicconstraints.h",
1011         "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_cert.c",
1012         "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_cert.h",
1013         "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_certpolicyinfo.c",
1014         "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_certpolicyinfo.h",
1015         "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_certpolicymap.c",
1016         "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_certpolicymap.h",
1017         "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_certpolicyqualifier.c",
1018         "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_certpolicyqualifier.h",
1019         "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_crl.c",
1020         "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_crl.h",
1021         "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_crldp.c",
1022         "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_crldp.h",
1023         "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_crlentry.c",
1024         "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_crlentry.h",
1025         "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_date.c",
1026         "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_date.h",
1027         "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_generalname.c",
1028         "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_generalname.h",
1029         "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_infoaccess.c",
1030         "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_infoaccess.h",
1031         "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_nameconstraints.c",
1032         "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_nameconstraints.h",
1033         "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_ocspcertid.c",
1034         "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_ocspcertid.h",
1035         "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_ocsprequest.c",
1036         "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_ocsprequest.h",
1037         "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_ocspresponse.c",
1038         "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_ocspresponse.h",
1039         "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_publickey.c",
1040         "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_publickey.h",
1041         "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_x500name.c",
1042         "nss/lib/libpkix/pkix_pl_nss/pki/pkix_pl_x500name.h",
1043         "nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_bigint.c",
1044         "nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_bigint.h",
1045         "nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_bytearray.c",
1046         "nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_bytearray.h",
1047         "nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_common.c",
1048         "nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_common.h",
1049         "nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_error.c",
1050         "nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_hashtable.c",
1051         "nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_hashtable.h",
1052         "nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_lifecycle.c",
1053         "nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_lifecycle.h",
1054         "nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_mem.c",
1055         "nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_mem.h",
1056         "nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_monitorlock.c",
1057         "nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_monitorlock.h",
1058         "nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_mutex.c",
1059         "nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_mutex.h",
1060         "nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_object.c",
1061         "nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_object.h",
1062         "nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_oid.c",
1063         "nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_oid.h",
1064         "nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_primhash.c",
1065         "nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_primhash.h",
1066         "nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_rwlock.c",
1067         "nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_rwlock.h",
1068         "nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_string.c",
1069         "nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_string.h",
1070       ]
1072       # Disable the LDAP code in libpkix.
1073       defines += [ "NSS_PKIX_NO_LDAP" ]
1075       include_dirs += [
1076         "nss/lib/libpkix/include",
1077         "nss/lib/libpkix/pkix/certsel",
1078         "nss/lib/libpkix/pkix/checker",
1079         "nss/lib/libpkix/pkix/crlsel",
1080         "nss/lib/libpkix/pkix/params",
1081         "nss/lib/libpkix/pkix/results",
1082         "nss/lib/libpkix/pkix/store",
1083         "nss/lib/libpkix/pkix/top",
1084         "nss/lib/libpkix/pkix/util",
1085         "nss/lib/libpkix/pkix_pl_nss/module",
1086         "nss/lib/libpkix/pkix_pl_nss/pki",
1087         "nss/lib/libpkix/pkix_pl_nss/system",
1088       ]
1089     } else {
1090       defines += [ "NSS_DISABLE_LIBPKIX" ]
1091     }
1093     if (!include_nss_root_certs) {
1094       defines += [ "NSS_DISABLE_ROOT_CERTS" ]
1095     }
1097     if (current_cpu == "x64" && !is_win) {
1098       sources -= [
1099         "nss/lib/freebl/chacha20/chacha20.c",
1100         "nss/lib/freebl/poly1305/poly1305.c",
1101       ]
1102     } else {
1103       sources -= [
1104         "nss/lib/freebl/chacha20/chacha20_vec.c",
1105         "nss/lib/freebl/poly1305/poly1305-donna-x64-sse2-incremental-source.c",
1106       ]
1107     }
1109     if (is_mac || is_ios) {
1110       sources -= [ "nss/lib/freebl/mpi/mpi_amd64.c" ]
1111       cflags += [
1112         "-include",
1113         rebase_path("//third_party/nss/nss/lib/freebl/nss_build_config_mac.h",
1114                     root_build_dir),
1115       ]
1116       defines += [
1117         "XP_UNIX",
1118         "DARWIN",
1119         "HAVE_STRERROR",
1120         "HAVE_BSD_FLOCK",
1121         "SHLIB_SUFFIX=\"dylib\"",
1122         "SHLIB_PREFIX=\"lib\"",
1123         "SOFTOKEN_LIB_NAME=\"libsoftokn3.dylib\"",
1124       ]
1126       configs -= [ "//build/config/gcc:symbol_visibility_hidden" ]
1127     } else {
1128       # Not Mac/iOS.
1129       sources -= [ "nss/lib/freebl/mpi/mpi_arm_mac.c" ]
1130     }
1132     if (is_win) {
1133       defines += [
1134         "SHLIB_SUFFIX=\"dll\"",
1135         "SHLIB_PREFIX=\"\"",
1136         "SOFTOKEN_LIB_NAME=\"softokn3.dll\"",
1137         "XP_PC",
1138         "WIN32",
1139         "WIN95",
1140       ]
1142       if (current_cpu == "x86") {
1143         defines += [
1144           "NSS_X86_OR_X64",
1145           "NSS_X86",
1146           "_X86_",
1147           "MP_ASSEMBLY_MULTIPLY",
1148           "MP_ASSEMBLY_SQUARE",
1149           "MP_ASSEMBLY_DIV_2DX1D",
1150           "MP_USE_UINT_DIGIT",
1151           "MP_NO_MP_WORD",
1152           "USE_HW_AES",
1153           "INTEL_GCM",
1154         ]
1155         sources -= [ "nss/lib/freebl/mpi/mpi_amd64.c" ]
1156       } else if (current_cpu == "x64") {
1157         sources -= [
1158           "nss/lib/freebl/intel-aes-x86-masm.asm",
1159           "nss/lib/freebl/mpi/mpi_amd64.c",
1160           "nss/lib/freebl/mpi/mpi_x86_asm.c",
1161         ]
1162         defines += [
1163           "NSS_USE_64",
1164           "NSS_X86_OR_X64",
1165           "NSS_X64",
1166           "_AMD64_",
1167           "MP_CHAR_STORE_SLOW",
1168           "MP_IS_LITTLE_ENDIAN",
1169           "WIN64",
1170         ]
1171       }
1172     } else {
1173       # Not Windows.
1174       sources -= [
1175         # mpi_x86_asm.c contains MSVC inline assembly code.
1176         "nss/lib/freebl/mpi/mpi_x86_asm.c",
1177       ]
1178     }
1180     if (is_clang) {
1181       cflags += [
1182         # nss doesn"t explicitly cast between different enum types.
1183         "-Wno-conversion",
1185         # nss passes "const char*" through "void*".
1186         "-Wno-incompatible-pointer-types",
1188         # nss prefers `a && b || c` over `(a && b) || c`.
1189         "-Wno-logical-op-parentheses",
1191         # nss doesn"t use exhaustive switches on enums
1192         "-Wno-switch",
1194         # nss has some `unsigned < 0` checks.
1195         "-Wno-tautological-compare",
1196       ]
1197     }
1199     public_deps = [
1200       ":nspr",
1201     ]
1202     deps = [
1203       ":nspr",
1204       "//third_party/sqlite",
1205     ]
1207     if (is_win && current_cpu == "x86") {
1208       deps += [ ":nss_static_avx" ]
1209     }
1210   }
1211 }  # Windows/Mac/iOS.