blob: 2bb0b30ad3e2a42b320a3b7e343d36da5cf5703e [file] [log] [blame]
# Copyright 2021 The Pigweed Authors
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
import("//build_overrides/pigweed.gni")
import("$dir_pw_build/facade.gni")
import("$dir_pw_build/target_types.gni")
import("$dir_pw_docgen/docs.gni")
import("$dir_pw_unit_test/test.gni")
declare_args() {
pw_crypto_SHA256_BACKEND = ""
pw_crypto_ECDSA_BACKEND = ""
}
config("default_config") {
include_dirs = [ "public" ]
visibility = [ ":*" ]
}
config("backend_config") {
include_dirs = [ "public_overrides" ]
visibility = [ ":*" ]
}
pw_facade("sha256") {
backend = pw_crypto_SHA256_BACKEND
public_configs = [ ":default_config" ]
public = [ "public/pw_crypto/sha256.h" ]
public_deps = [
"$dir_pw_bytes",
"$dir_pw_status",
]
deps = [ "$dir_pw_assert" ]
}
pw_doc_group("docs") {
sources = [ "docs.rst" ]
}
pw_test_group("tests") {
tests = [
":sha256_test",
":ecdsa_test",
]
}
pw_test("sha256_test") {
enable_if = pw_crypto_SHA256_BACKEND != ""
deps = [ ":sha256" ]
sources = [ "sha256_test.cc" ]
}
pw_source_set("sha256_mbedtls") {
public_configs = [ ":backend_config" ]
public = [
"public/pw_crypto/sha256_mbedtls.h",
"public_overrides/pw_crypto/sha256_backend.h",
]
sources = [ "sha256_mbedtls.cc" ]
public_deps = [
":sha256.facade",
"//third_party/mbedtls",
]
}
pw_facade("ecdsa") {
backend = pw_crypto_ECDSA_BACKEND
public_configs = [ ":default_config" ]
public = [ "public/pw_crypto/ecdsa.h" ]
public_deps = [
"$dir_pw_bytes",
"$dir_pw_status",
]
}
pw_source_set("ecdsa_mbedtls") {
sources = [ "ecdsa_mbedtls.cc" ]
deps = [
"$dir_pw_function",
"$dir_pw_log",
"//third_party/mbedtls",
]
public_deps = [ ":ecdsa.facade" ]
}
pw_test("ecdsa_test") {
enable_if = pw_crypto_ECDSA_BACKEND != ""
deps = [ ":ecdsa" ]
sources = [ "ecdsa_test.cc" ]
}