David Drysdale | 64e07e3 | 2022-06-10 14:45:45 +0100 | [diff] [blame] | 1 | // Copyright 2022, The Android Open Source Project |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | package { |
| 16 | default_applicable_licenses: ["system_keymint_license"], |
| 17 | } |
| 18 | |
| 19 | rust_defaults { |
| 20 | name: "kmr_common_defaults", |
| 21 | edition: "2021", |
David Drysdale | 63e6ad6 | 2023-05-05 17:41:08 +0100 | [diff] [blame] | 22 | lints: "android", |
David Drysdale | 64e07e3 | 2022-06-10 14:45:45 +0100 | [diff] [blame] | 23 | rustlibs: [ |
| 24 | "libciborium", |
| 25 | "libciborium_io", |
| 26 | "libcoset", |
David Drysdale | 0b3938d | 2022-09-28 16:49:16 +0100 | [diff] [blame] | 27 | "libder", |
| 28 | "libkmr_wire", |
David Drysdale | 64e07e3 | 2022-06-10 14:45:45 +0100 | [diff] [blame] | 29 | "liblog_rust", |
David Drysdale | 0b3938d | 2022-09-28 16:49:16 +0100 | [diff] [blame] | 30 | "libpkcs1", |
| 31 | "libpkcs8", |
| 32 | "libsec1", |
| 33 | "libspki", |
| 34 | "libzeroize", |
David Drysdale | 64e07e3 | 2022-06-10 14:45:45 +0100 | [diff] [blame] | 35 | ], |
| 36 | proc_macros: [ |
| 37 | "libenumn", |
| 38 | "libkmr_derive", |
| 39 | ], |
| 40 | } |
| 41 | |
David Drysdale | bb137d2 | 2023-12-03 07:35:09 +0000 | [diff] [blame] | 42 | rust_library { |
David Drysdale | 64e07e3 | 2022-06-10 14:45:45 +0100 | [diff] [blame] | 43 | name: "libkmr_common", |
| 44 | crate_name: "kmr_common", |
| 45 | srcs: ["src/lib.rs"], |
David Drysdale | bb137d2 | 2023-12-03 07:35:09 +0000 | [diff] [blame] | 46 | host_supported: true, |
David Drysdale | 64e07e3 | 2022-06-10 14:45:45 +0100 | [diff] [blame] | 47 | vendor_available: true, |
| 48 | defaults: [ |
| 49 | "kmr_common_defaults", |
| 50 | ], |
| 51 | } |
| 52 | |
David Drysdale | 362244b | 2023-10-04 16:47:50 +0100 | [diff] [blame] | 53 | |
| 54 | rust_library_rlib { |
| 55 | name: "libkmr_common_nostd", |
| 56 | crate_name: "kmr_common", |
| 57 | srcs: ["src/lib.rs"], |
| 58 | edition: "2021", |
| 59 | lints: "android", |
| 60 | vendor_available: true, |
| 61 | prefer_rlib: true, |
| 62 | no_stdlibs: true, |
| 63 | rustlibs: [ |
| 64 | "libciborium_nostd", |
| 65 | "libciborium_io_nostd", |
| 66 | "libcoset_nostd", |
| 67 | "libder_nostd", |
| 68 | "libkmr_wire_nostd", |
| 69 | "liblog_rust_nostd", |
| 70 | "libpkcs1_nostd", |
| 71 | "libpkcs8_nostd", |
| 72 | "libsec1_nostd", |
| 73 | "libspki_nostd", |
| 74 | "libzeroize_nostd", |
| 75 | ], |
| 76 | proc_macros: [ |
| 77 | "libenumn", |
| 78 | "libkmr_derive", |
| 79 | ], |
| 80 | stdlibs: [ |
| 81 | "liballoc.rust_sysroot", |
| 82 | "libcompiler_builtins.rust_sysroot", |
| 83 | "libcore.rust_sysroot", |
| 84 | ], |
| 85 | } |
| 86 | |
David Drysdale | 0b3938d | 2022-09-28 16:49:16 +0100 | [diff] [blame] | 87 | rust_test_host { |
David Drysdale | 64e07e3 | 2022-06-10 14:45:45 +0100 | [diff] [blame] | 88 | name: "libkmr_common_test", |
| 89 | crate_name: "kmr_common_test", |
| 90 | srcs: ["src/lib.rs"], |
| 91 | defaults: [ |
| 92 | "kmr_common_defaults", |
| 93 | ], |
David Drysdale | 6512c70 | 2022-11-01 11:32:14 +0000 | [diff] [blame] | 94 | rustlibs: [ |
| 95 | "libhex", |
| 96 | ], |
David Drysdale | 64e07e3 | 2022-06-10 14:45:45 +0100 | [diff] [blame] | 97 | test_suites: ["general-tests"], |
| 98 | } |
| 99 | |
| 100 | rust_binary_host { |
| 101 | name: "kmr_cddl_dump", |
| 102 | crate_name: "kmr_cddl_dump", |
| 103 | srcs: ["src/bin/cddl-dump.rs"], |
David Drysdale | 0b3938d | 2022-09-28 16:49:16 +0100 | [diff] [blame] | 104 | rustlibs: [ |
| 105 | "libkmr_common", |
| 106 | "libkmr_wire", |
| 107 | ], |
David Drysdale | 64e07e3 | 2022-06-10 14:45:45 +0100 | [diff] [blame] | 108 | } |
David Drysdale | 0b3938d | 2022-09-28 16:49:16 +0100 | [diff] [blame] | 109 | |
Ivan Lozano | 1a91ffe | 2023-08-29 18:32:14 +0000 | [diff] [blame] | 110 | // The fuzzer target cannot be built for the device because some |
| 111 | // of the dependencies have restricted visibility. |
| 112 | rust_fuzz_host { |
| 113 | name: "libkmr_common_fuzz_keyblob", |
| 114 | srcs: ["fuzz/fuzz_targets/keyblob.rs"], |
| 115 | rustlibs: ["libkmr_common"], |
| 116 | fuzz_config: { |
| 117 | cc: ["drysdale@google.com", "hasinitg@google.com"], |
| 118 | componentid: 1084733, |
| 119 | hotlists: ["4271696"], |
| 120 | fuzz_on_haiku_device: false, |
| 121 | fuzz_on_haiku_host: true, |
| 122 | }, |
| 123 | } |