xref: /aosp_15_r20/external/open-dice/third_party/cose-c/BUILD.gn (revision 60b67249c2e226f42f35cc6cfe66c6048e0bae6b)
1# Copyright 2020 Google LLC
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may not
4# use this file except in compliance with the License. You may obtain a copy of
5# the License at
6#
7#     https://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, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations under
13# the License.
14
15import("//build_overrides/pigweed.gni")
16import("$dir_pw_build/target_types.gni")
17
18config("external_config_ed25519") {
19  include_dirs = [
20    "src/include",
21    "include/ed25519",
22  ]
23}
24
25config("external_config_p256") {
26  include_dirs = [
27    "src/include",
28    "include/p256",
29  ]
30}
31
32config("external_config_p384") {
33  include_dirs = [
34    "src/include",
35    "include/p384",
36  ]
37}
38
39config("external_config_multialg") {
40  include_dirs = [
41    "src/include",
42    "include/multialg",
43  ]
44}
45
46config("internal_config") {
47  visibility = [ ":*" ]  # Only targets in this file can depend on this.
48  include_dirs = [ "src/src" ]
49  cflags = [ "-Wno-cast-qual" ]
50}
51
52cose_c_sources = [
53  "cose_deps.cc",
54  "src/src/Cose.cpp",
55  "src/src/CoseKey.cpp",
56  "src/src/Sign1.cpp",
57  "src/src/cbor.cpp",
58]
59
60pw_static_library("cose-c_ed25519") {
61  public = [ "src/include/cose/cose.h" ]
62  sources = cose_c_sources
63  public_configs = [ ":external_config_ed25519" ]
64  configs = [ ":internal_config" ]
65  public_deps = [
66    "//third_party/boringssl:crypto",
67    "//third_party/cn-cbor:cn-cbor",
68  ]
69}
70
71pw_static_library("cose-c_p256") {
72  public = [ "src/include/cose/cose.h" ]
73  sources = cose_c_sources
74  public_configs = [ ":external_config_p256" ]
75  configs = [ ":internal_config" ]
76  public_deps = [
77    "//third_party/boringssl:crypto",
78    "//third_party/cn-cbor:cn-cbor",
79  ]
80}
81
82pw_static_library("cose-c_p384") {
83  public = [ "src/include/cose/cose.h" ]
84  sources = cose_c_sources
85  public_configs = [ ":external_config_p384" ]
86  configs = [ ":internal_config" ]
87  public_deps = [
88    "//third_party/boringssl:crypto",
89    "//third_party/cn-cbor:cn-cbor",
90  ]
91}
92
93pw_static_library("cose-c_multialg") {
94  public = [ "src/include/cose/cose.h" ]
95  sources = [
96    "cose_deps.cc",
97    "src/src/Cose.cpp",
98    "src/src/CoseKey.cpp",
99    "src/src/Sign1.cpp",
100    "src/src/cbor.cpp",
101  ]
102  public_configs = [ ":external_config_multialg" ]
103  configs = [ ":internal_config" ]
104  public_deps = [
105    "//third_party/boringssl:crypto",
106    "//third_party/cn-cbor:cn-cbor",
107  ]
108}
109