• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2021 The Pigweed Authors
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
15load(
16    "//pw_build:pigweed.bzl",
17    "pw_cc_facade",
18    "pw_cc_library",
19    "pw_cc_test",
20)
21
22package(default_visibility = ["//visibility:public"])
23
24licenses(["notice"])
25
26pw_cc_facade(
27    name = "sha256_facade",
28    hdrs = [
29        "public/pw_crypto/sha256.h",
30    ],
31    includes = ["public"],
32    deps = [
33        "//pw_assert",
34        "//pw_bytes",
35        "//pw_log",
36        "//pw_status",
37        "//pw_stream",
38    ],
39)
40
41pw_cc_library(
42    name = "sha256",
43    deps = [
44        ":sha256_facade",
45        "@pigweed_config//:pw_crypto_sha256_backend",
46    ],
47)
48
49pw_cc_library(
50    name = "sha256_mbedtls",
51    srcs = ["sha256_mbedtls.cc"],
52    hdrs = [
53        "public/pw_crypto/sha256_mbedtls.h",
54        "public_overrides/mbedtls/pw_crypto/sha256_backend.h",
55    ],
56    includes = ["public_overrides/mbedtls"],
57    # TODO(b/236321905): Requires BUILD.bazel files for mbedtls
58    tags = ["manual"],
59    deps = [":sha256_facade"],
60)
61
62pw_cc_library(
63    name = "sha256_boringssl",
64    srcs = ["sha256_boringssl.cc"],
65    hdrs = [
66        "public/pw_crypto/sha256_boringssl.h",
67        "public_overrides/boringssl/pw_crypto/sha256_backend.h",
68    ],
69    includes = [
70        "public",
71        "public_overrides/boringssl",
72    ],
73    deps = [
74        ":sha256_facade",
75        "//pw_log",
76        "@boringssl//:ssl",
77    ],
78)
79
80pw_cc_test(
81    name = "sha256_test",
82    srcs = ["sha256_test.cc"],
83    deps = [
84        ":sha256",
85        "//pw_unit_test",
86    ],
87)
88
89pw_cc_library(
90    name = "sha256_mock",
91    srcs = ["sha256_mock.cc"],
92    hdrs = [
93        "public/pw_crypto/sha256_mock.h",
94        "public_overrides/mock/pw_crypto/sha256_backend.h",
95    ],
96    includes = [
97        "public",
98        "public_overrides/mock",
99    ],
100    deps = [":sha256_facade"],
101)
102
103pw_cc_test(
104    name = "sha256_mock_test",
105    srcs = ["sha256_mock_test.cc"],
106    # TODO(b/236321905): Requires BUILD.bazel files for mbedtls
107    tags = ["manual"],
108    deps = [
109        ":sha256_mock",
110        "//pw_unit_test",
111    ],
112)
113
114pw_cc_facade(
115    name = "ecdsa_facade",
116    hdrs = [
117        "public/pw_crypto/ecdsa.h",
118    ],
119    includes = ["public"],
120    deps = [
121        "//pw_bytes",
122        "//pw_status",
123    ],
124)
125
126pw_cc_library(
127    name = "ecdsa",
128    deps = [
129        ":ecdsa_facade",
130        "@pigweed_config//:pw_crypto_ecdsa_backend",
131    ],
132)
133
134pw_cc_library(
135    name = "ecdsa_mbedtls",
136    srcs = ["ecdsa_mbedtls.cc"],
137    # TODO(b/236321905): Requires BUILD.bazel files for mbedtls
138    tags = ["manual"],
139    deps = [":ecdsa_facade"],
140)
141
142pw_cc_library(
143    name = "ecdsa_boringssl",
144    srcs = ["ecdsa_boringssl.cc"],
145    deps = [
146        ":ecdsa_facade",
147        "//pw_log",
148        "@boringssl//:ssl",
149    ],
150)
151
152pw_cc_library(
153    name = "ecdsa_uecc",
154    srcs = [
155        "ecdsa_uecc.cc",
156    ],
157    deps = [
158        ":ecdsa_facade",
159        "//pw_log",
160        "@micro_ecc//:uecc",
161    ],
162)
163
164pw_cc_test(
165    name = "ecdsa_test",
166    srcs = ["ecdsa_test.cc"],
167    deps = [
168        ":ecdsa",
169        "//pw_unit_test",
170    ],
171)
172