1// This file is generated by cargo_embargo.
2// Do not modify this file after the first "rust_*" or "genrule" module
3// because the changes will be overridden on upgrade.
4// Content before the first "rust_*" or "genrule" module is preserved.
5
6package {
7    default_applicable_licenses: ["external_rust_crates_ring_license"],
8}
9
10// Added automatically by a large-scale-change that took the approach of
11// 'apply every license found to every target'. While this makes sure we respect
12// every license restriction, it may not be entirely correct.
13//
14// e.g. GPL in an MIT project might only apply to the contrib/ directory.
15//
16// Please consider splitting the single license below into multiple licenses,
17// taking care not to lose any license_kind information, and overriding the
18// default license using the 'licenses: [...]' property on targets as needed.
19//
20// For unused files, consider creating a 'fileGroup' with "//visibility:private"
21// to attach the license to, and including a comment whether the files may be
22// used in the current project.
23// See: http://go/android-license-faq
24license {
25    name: "external_rust_crates_ring_license",
26    visibility: [":__subpackages__"],
27    license_kinds: [
28        "SPDX-license-identifier-BSD",
29        "SPDX-license-identifier-ISC",
30        "SPDX-license-identifier-MIT",
31        "SPDX-license-identifier-OpenSSL",
32        "legacy_unencumbered",
33    ],
34    license_text: [
35        "LICENSE",
36    ],
37}
38
39rust_library {
40    name: "libring",
41    host_supported: true,
42    crate_name: "ring",
43    cargo_env_compat: true,
44    cargo_pkg_version: "0.17.2",
45    crate_root: "src/lib.rs",
46    edition: "2021",
47    features: [
48        "alloc",
49        "default",
50        "dev_urandom_fallback",
51        "std",
52    ],
53    rustlibs: [
54        "libgetrandom",
55        "liblibc",
56        "libspin",
57        "libuntrusted",
58    ],
59    whole_static_libs: [
60        "libring-core",
61        "libring-test",
62    ],
63    apex_available: [
64        "//apex_available:platform",
65        "com.android.resolv",
66    ],
67    product_available: true,
68    vendor_available: true,
69    min_sdk_version: "29",
70}
71
72rust_test {
73    name: "ring_test_src_lib",
74    host_supported: true,
75    crate_name: "ring",
76    cargo_env_compat: true,
77    cargo_pkg_version: "0.17.2",
78    crate_root: "src/lib.rs",
79    test_suites: ["general-tests"],
80    auto_gen_config: true,
81    test_options: {
82        unit_test: false,
83    },
84    edition: "2021",
85    features: [
86        "alloc",
87        "default",
88        "dev_urandom_fallback",
89        "std",
90    ],
91    rustlibs: [
92        "libcriterion",
93        "libgetrandom",
94        "liblibc",
95        "libspin",
96        "libuntrusted",
97    ],
98    whole_static_libs: [
99        "libring-core",
100        "libring-test",
101    ],
102}
103
104rust_test {
105    name: "ring_test_tests_aead_tests",
106    host_supported: true,
107    crate_name: "aead_tests",
108    cargo_env_compat: true,
109    cargo_pkg_version: "0.17.2",
110    crate_root: "tests/aead_tests.rs",
111    test_suites: ["general-tests"],
112    auto_gen_config: true,
113    test_options: {
114        unit_test: false,
115    },
116    edition: "2021",
117    features: [
118        "alloc",
119        "default",
120        "dev_urandom_fallback",
121        "std",
122    ],
123    rustlibs: [
124        "libcriterion",
125        "libgetrandom",
126        "liblibc",
127        "libring",
128        "libspin",
129        "libuntrusted",
130    ],
131}
132
133rust_test {
134    name: "ring_test_tests_agreement_tests",
135    host_supported: true,
136    crate_name: "agreement_tests",
137    cargo_env_compat: true,
138    cargo_pkg_version: "0.17.2",
139    crate_root: "tests/agreement_tests.rs",
140    test_suites: ["general-tests"],
141    auto_gen_config: true,
142    test_options: {
143        unit_test: false,
144    },
145    edition: "2021",
146    features: [
147        "alloc",
148        "default",
149        "dev_urandom_fallback",
150        "std",
151    ],
152    rustlibs: [
153        "libcriterion",
154        "libgetrandom",
155        "liblibc",
156        "libring",
157        "libspin",
158        "libuntrusted",
159    ],
160}
161
162rust_test {
163    name: "ring_test_tests_constant_time_tests",
164    host_supported: true,
165    crate_name: "constant_time_tests",
166    cargo_env_compat: true,
167    cargo_pkg_version: "0.17.2",
168    crate_root: "tests/constant_time_tests.rs",
169    test_suites: ["general-tests"],
170    auto_gen_config: true,
171    test_options: {
172        unit_test: false,
173    },
174    edition: "2021",
175    features: [
176        "alloc",
177        "default",
178        "dev_urandom_fallback",
179        "std",
180    ],
181    rustlibs: [
182        "libcriterion",
183        "libgetrandom",
184        "liblibc",
185        "libring",
186        "libspin",
187        "libuntrusted",
188    ],
189}
190
191rust_test {
192    name: "ring_test_tests_digest_tests",
193    host_supported: true,
194    crate_name: "digest_tests",
195    cargo_env_compat: true,
196    cargo_pkg_version: "0.17.2",
197    crate_root: "tests/digest_tests.rs",
198    test_suites: ["general-tests"],
199    auto_gen_config: true,
200    test_options: {
201        unit_test: false,
202    },
203    edition: "2021",
204    features: [
205        "alloc",
206        "default",
207        "dev_urandom_fallback",
208        "std",
209    ],
210    rustlibs: [
211        "libcriterion",
212        "libgetrandom",
213        "liblibc",
214        "libring",
215        "libspin",
216        "libuntrusted",
217    ],
218}
219
220rust_test {
221    name: "ring_test_tests_ecdsa_tests",
222    host_supported: true,
223    crate_name: "ecdsa_tests",
224    cargo_env_compat: true,
225    cargo_pkg_version: "0.17.2",
226    crate_root: "tests/ecdsa_tests.rs",
227    test_suites: ["general-tests"],
228    auto_gen_config: true,
229    test_options: {
230        unit_test: false,
231    },
232    edition: "2021",
233    features: [
234        "alloc",
235        "default",
236        "dev_urandom_fallback",
237        "std",
238    ],
239    rustlibs: [
240        "libcriterion",
241        "libgetrandom",
242        "liblibc",
243        "libring",
244        "libspin",
245        "libuntrusted",
246    ],
247}
248
249rust_test {
250    name: "ring_test_tests_ed25519_tests",
251    host_supported: true,
252    crate_name: "ed25519_tests",
253    cargo_env_compat: true,
254    cargo_pkg_version: "0.17.2",
255    crate_root: "tests/ed25519_tests.rs",
256    test_suites: ["general-tests"],
257    auto_gen_config: true,
258    test_options: {
259        unit_test: false,
260    },
261    edition: "2021",
262    features: [
263        "alloc",
264        "default",
265        "dev_urandom_fallback",
266        "std",
267    ],
268    rustlibs: [
269        "libcriterion",
270        "libgetrandom",
271        "liblibc",
272        "libring",
273        "libspin",
274        "libuntrusted",
275    ],
276}
277
278rust_test {
279    name: "ring_test_tests_error_tests",
280    host_supported: true,
281    crate_name: "error_tests",
282    cargo_env_compat: true,
283    cargo_pkg_version: "0.17.2",
284    crate_root: "tests/error_tests.rs",
285    test_suites: ["general-tests"],
286    auto_gen_config: true,
287    test_options: {
288        unit_test: false,
289    },
290    edition: "2021",
291    features: [
292        "alloc",
293        "default",
294        "dev_urandom_fallback",
295        "std",
296    ],
297    rustlibs: [
298        "libcriterion",
299        "libgetrandom",
300        "liblibc",
301        "libring",
302        "libspin",
303        "libuntrusted",
304    ],
305}
306
307rust_test {
308    name: "ring_test_tests_hkdf_tests",
309    host_supported: true,
310    crate_name: "hkdf_tests",
311    cargo_env_compat: true,
312    cargo_pkg_version: "0.17.2",
313    crate_root: "tests/hkdf_tests.rs",
314    test_suites: ["general-tests"],
315    auto_gen_config: true,
316    test_options: {
317        unit_test: false,
318    },
319    edition: "2021",
320    features: [
321        "alloc",
322        "default",
323        "dev_urandom_fallback",
324        "std",
325    ],
326    rustlibs: [
327        "libcriterion",
328        "libgetrandom",
329        "liblibc",
330        "libring",
331        "libspin",
332        "libuntrusted",
333    ],
334}
335
336rust_test {
337    name: "ring_test_tests_hmac_tests",
338    host_supported: true,
339    crate_name: "hmac_tests",
340    cargo_env_compat: true,
341    cargo_pkg_version: "0.17.2",
342    crate_root: "tests/hmac_tests.rs",
343    test_suites: ["general-tests"],
344    auto_gen_config: true,
345    test_options: {
346        unit_test: false,
347    },
348    edition: "2021",
349    features: [
350        "alloc",
351        "default",
352        "dev_urandom_fallback",
353        "std",
354    ],
355    rustlibs: [
356        "libcriterion",
357        "libgetrandom",
358        "liblibc",
359        "libring",
360        "libspin",
361        "libuntrusted",
362    ],
363}
364
365rust_test {
366    name: "ring_test_tests_pbkdf2_tests",
367    host_supported: true,
368    crate_name: "pbkdf2_tests",
369    cargo_env_compat: true,
370    cargo_pkg_version: "0.17.2",
371    crate_root: "tests/pbkdf2_tests.rs",
372    test_suites: ["general-tests"],
373    auto_gen_config: true,
374    test_options: {
375        unit_test: false,
376    },
377    edition: "2021",
378    features: [
379        "alloc",
380        "default",
381        "dev_urandom_fallback",
382        "std",
383    ],
384    rustlibs: [
385        "libcriterion",
386        "libgetrandom",
387        "liblibc",
388        "libring",
389        "libspin",
390        "libuntrusted",
391    ],
392}
393
394rust_test {
395    name: "ring_test_tests_quic_tests",
396    host_supported: true,
397    crate_name: "quic_tests",
398    cargo_env_compat: true,
399    cargo_pkg_version: "0.17.2",
400    crate_root: "tests/quic_tests.rs",
401    test_suites: ["general-tests"],
402    auto_gen_config: true,
403    test_options: {
404        unit_test: false,
405    },
406    edition: "2021",
407    features: [
408        "alloc",
409        "default",
410        "dev_urandom_fallback",
411        "std",
412    ],
413    rustlibs: [
414        "libcriterion",
415        "libgetrandom",
416        "liblibc",
417        "libring",
418        "libspin",
419        "libuntrusted",
420    ],
421}
422
423rust_test {
424    name: "ring_test_tests_rand_tests",
425    host_supported: true,
426    crate_name: "rand_tests",
427    cargo_env_compat: true,
428    cargo_pkg_version: "0.17.2",
429    crate_root: "tests/rand_tests.rs",
430    test_suites: ["general-tests"],
431    auto_gen_config: true,
432    test_options: {
433        unit_test: false,
434    },
435    edition: "2021",
436    features: [
437        "alloc",
438        "default",
439        "dev_urandom_fallback",
440        "std",
441    ],
442    rustlibs: [
443        "libcriterion",
444        "libgetrandom",
445        "liblibc",
446        "libring",
447        "libspin",
448        "libuntrusted",
449    ],
450}
451
452rust_test {
453    name: "ring_test_tests_rsa_tests",
454    host_supported: true,
455    crate_name: "rsa_tests",
456    cargo_env_compat: true,
457    cargo_pkg_version: "0.17.2",
458    crate_root: "tests/rsa_tests.rs",
459    test_suites: ["general-tests"],
460    auto_gen_config: true,
461    test_options: {
462        unit_test: false,
463    },
464    edition: "2021",
465    features: [
466        "alloc",
467        "default",
468        "dev_urandom_fallback",
469        "std",
470    ],
471    rustlibs: [
472        "libcriterion",
473        "libgetrandom",
474        "liblibc",
475        "libring",
476        "libspin",
477        "libuntrusted",
478    ],
479}
480
481rust_test {
482    name: "ring_test_tests_signature_tests",
483    host_supported: true,
484    crate_name: "signature_tests",
485    cargo_env_compat: true,
486    cargo_pkg_version: "0.17.2",
487    crate_root: "tests/signature_tests.rs",
488    test_suites: ["general-tests"],
489    auto_gen_config: true,
490    test_options: {
491        unit_test: false,
492    },
493    edition: "2021",
494    features: [
495        "alloc",
496        "default",
497        "dev_urandom_fallback",
498        "std",
499    ],
500    rustlibs: [
501        "libcriterion",
502        "libgetrandom",
503        "liblibc",
504        "libring",
505        "libspin",
506        "libuntrusted",
507    ],
508}
509
510rust_library_rlib {
511    name: "libring_nostd",
512    crate_name: "ring",
513    cargo_env_compat: true,
514    cargo_pkg_version: "0.17.2",
515    crate_root: "src/lib.rs",
516    edition: "2021",
517    rustlibs: [
518        "libgetrandom",
519        "liblibc",
520        "libspin_nostd",
521        "libuntrusted",
522    ],
523    whole_static_libs: [
524        "libring-core",
525        "libring-test",
526    ],
527    apex_available: [
528        "//apex_available:platform",
529        "com.android.resolv",
530    ],
531    prefer_rlib: true,
532    no_stdlibs: true,
533    stdlibs: [
534        "libcompiler_builtins.rust_sysroot",
535        "libcore.rust_sysroot",
536    ],
537    product_available: true,
538    vendor_available: true,
539    min_sdk_version: "29",
540}
541
542cc_library_static {
543    name: "libring-core",
544    host_supported: true,
545    srcs: [
546        "crypto/cpu_intel.c",
547        "crypto/fipsmodule/aes/aes_nohw.c",
548        "crypto/crypto.c",
549        "crypto/poly1305/poly1305.c",
550        "crypto/poly1305/poly1305_vec.c",
551        "crypto/curve25519/curve25519.c",
552        "crypto/fipsmodule/ec/ecp_nistz.c",
553        "crypto/fipsmodule/ec/gfp_p256.c",
554        "crypto/fipsmodule/ec/gfp_p384.c",
555        "crypto/fipsmodule/ec/p256.c",
556        "crypto/fipsmodule/ec/p256-nistz.c",
557        "crypto/limbs/limbs.c",
558        "crypto/mem.c",
559        "crypto/fipsmodule/bn/montgomery.c",
560        "crypto/fipsmodule/bn/montgomery_inv.c",
561    ],
562
563    arch: {
564        arm: {
565            srcs: [
566                "crypto/poly1305/poly1305_arm.c",
567                "crypto/poly1305/poly1305_arm_asm.S",
568                "pregenerated/armv4-mont-linux32.S",
569                "crypto/curve25519/asm/x25519-asm-arm.S",
570                "pregenerated/sha256-armv4-linux32.S",
571                "pregenerated/sha512-armv4-linux32.S",
572                "pregenerated/aesv8-armx-linux32.S",
573                "pregenerated/bsaes-armv7-linux32.S",
574                "pregenerated/ghashv8-armx-linux32.S",
575                "pregenerated/vpaes-armv7-linux32.S",
576                "pregenerated/ghash-armv4-linux32.S",
577                "pregenerated/chacha-armv4-linux32.S",
578            ],
579        },
580        arm64: {
581            srcs: [
582                "pregenerated/aesv8-armx-linux64.S",
583                "pregenerated/armv8-mont-linux64.S",
584                "pregenerated/chacha20_poly1305_armv8-linux64.S",
585                "pregenerated/chacha-armv8-linux64.S",
586                "pregenerated/ghash-neon-armv8-linux64.S",
587                "pregenerated/ghashv8-armx-linux64.S",
588                "pregenerated/p256-armv8-asm-linux64.S",
589                "pregenerated/sha256-armv8-linux64.S",
590                "pregenerated/sha512-armv8-linux64.S",
591                "pregenerated/vpaes-armv8-linux64.S",
592            ],
593        },
594        x86: {
595            srcs: [
596                "pregenerated/aesni-x86-elf.S",
597                "pregenerated/chacha-x86-elf.S",
598                "pregenerated/ghash-x86-elf.S",
599                "pregenerated/vpaes-x86-elf.S",
600                "pregenerated/x86-mont-elf.S",
601            ],
602        },
603        x86_64: {
604            srcs: [
605                "crypto/curve25519/curve25519_64_adx.c",
606                "pregenerated/aesni-gcm-x86_64-elf.S",
607                "pregenerated/aesni-x86_64-elf.S",
608                "pregenerated/chacha-x86_64-elf.S",
609                "pregenerated/chacha20_poly1305_x86_64-elf.S",
610                "pregenerated/ghash-x86_64-elf.S",
611                "pregenerated/p256-x86_64-asm-elf.S",
612                "pregenerated/sha256-x86_64-elf.S",
613                "pregenerated/sha512-x86_64-elf.S",
614                "pregenerated/vpaes-x86_64-elf.S",
615                "pregenerated/x86_64-mont5-elf.S",
616                "pregenerated/x86_64-mont-elf.S",
617                "third_party/fiat/asm/fiat_curve25519_adx_mul.S",
618                "third_party/fiat/asm/fiat_curve25519_adx_square.S",
619            ],
620        },
621        riscv64: {
622            cflags: ["-DOPENSSL_NO_ASM"],
623        },
624    },
625
626    cflags: [
627        "-O3",
628        "-Wno-error",
629        "-fPIC",
630        "-fdata-sections",
631        "-ffunction-sections",
632        "-fno-omit-frame-pointer",
633        "-fno-strict-aliasing",
634        "-fstack-protector",
635        "-fvisibility=hidden",
636        "-DNDEBUG",
637    ],
638    local_include_dirs: ["include"],
639    apex_available: [
640        "//apex_available:platform",
641        "com.android.resolv",
642    ],
643    vendor_available: true,
644    product_available: true,
645    min_sdk_version: "29",
646
647    // b/336916369: This library gets linked into a rust rlib.  Disable LTO
648    // until cross-language lto is supported.
649    lto: {
650        never: true,
651    },
652}
653
654cc_library_static {
655    name: "libring-test",
656    host_supported: true,
657    srcs: [
658        "crypto/constant_time_test.c",
659    ],
660    local_include_dirs: ["include"],
661    apex_available: [
662        "//apex_available:platform",
663        "com.android.resolv",
664    ],
665    vendor_available: true,
666    product_available: true,
667    min_sdk_version: "29",
668
669    // b/336916369: This library gets linked into a rust rlib.  Disable LTO
670    // until cross-language lto is supported.
671    lto: {
672        never: true,
673    },
674}
675