blob: dc5b7163be92e38a31eb37f2e82a70b81d6d104f [file] [log] [blame]
# Copyright (c) 2020-2021 Project CHIP 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
#
# http://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/chip.gni")
import("//build_overrides/nlassert.gni")
import("${chip_root}/src/crypto/crypto.gni")
import("${chip_root}/src/lib/core/core.gni")
import("${chip_root}/src/platform/device.gni")
declare_args() {
chip_build_example_creds = true
update_last_known_good_time = false
}
action("gen_build_time_header") {
script = "${chip_root}/build/chip/write_build_time_header.py"
header_file = "FirmwareBuildTime.h"
include_dir = "${root_gen_dir}/include"
outputs = [ "${include_dir}/${header_file}" ]
args = [
"--output",
header_file,
"--gen-dir",
rebase_path(include_dir, root_build_dir),
]
if (update_last_known_good_time) {
args += [ "--use-current-time" ]
}
visibility = [ ":build_time_header" ]
}
source_set("build_time_header") {
sources = get_target_outputs(":gen_build_time_header")
deps = [ ":gen_build_time_header" ]
}
source_set("credentials_header") {
sources = [
"CHIPCert.h",
"DeviceAttestationCredsProvider.h",
]
}
static_library("credentials") {
output_name = "libCredentials"
sources = [
"CHIPCert.cpp",
"CHIPCert.h",
"CHIPCertFromX509.cpp",
"CHIPCertToX509.cpp",
"CHIPCert_Internal.h",
"CHIPCertificateSet.h",
"CertificateValidityPolicy.h",
"CertificationDeclaration.cpp",
"CertificationDeclaration.h",
"DeviceAttestationConstructor.cpp",
"DeviceAttestationConstructor.h",
"DeviceAttestationCredsProvider.cpp",
"DeviceAttestationCredsProvider.h",
"DeviceAttestationVendorReserved.h",
"FabricTable.cpp",
"FabricTable.h",
"GenerateChipX509Cert.cpp",
"GroupDataProvider.h",
"GroupDataProviderImpl.cpp",
"GroupDataProviderImpl.h",
"LastKnownGoodTime.cpp",
"LastKnownGoodTime.h",
"OperationalCertificateStore.h",
"PersistentStorageOpCertStore.cpp",
"PersistentStorageOpCertStore.h",
"TestOnlyLocalCertificateAuthority.h",
"attestation_verifier/DeviceAttestationDelegate.h",
"attestation_verifier/DeviceAttestationVerifier.cpp",
"attestation_verifier/DeviceAttestationVerifier.h",
]
if (chip_build_example_creds) {
sources += [
"examples/DeviceAttestationCredsExample.cpp",
"examples/DeviceAttestationCredsExample.h",
"examples/ExampleDACs.cpp",
"examples/ExampleDACs.h",
"examples/ExamplePAI.cpp",
"examples/ExamplePAI.h",
"examples/LastKnownGoodTimeCertificateValidityPolicyExample.h",
"examples/StrictCertificateValidityPolicyExample.h",
]
}
# TODO: These tests files should be removed after the DeviceAttestationCredsExample implementation
# is changed to generate it's own credentials instead of using Test credentials.
# For some platforms test builds, which are bilding monolithic test library these files are not needed.
import("${chip_root}/build/chip/tests.gni")
if (!(chip_build_tests && (chip_device_platform == "mbed" ||
chip_device_platform == "openiotsdk" ||
chip_device_platform == "nrfconnect"))) {
sources += [
"tests/CHIPAttCert_test_vectors.cpp",
"tests/CHIPAttCert_test_vectors.h",
]
}
if (chip_device_platform == "esp32" || chip_device_platform == "nrfconnect" ||
chip_device_platform == "efr32" || chip_device_platform == "openiotsdk") {
defines = [ "CURRENT_TIME_NOT_IMPLEMENTED=1" ]
}
cflags = [ "-Wconversion" ]
public_deps = [
":build_time_header",
"${chip_root}/src/crypto",
"${chip_root}/src/lib/asn1",
"${chip_root}/src/lib/core",
"${chip_root}/src/lib/core:types",
"${chip_root}/src/lib/support",
"${chip_root}/src/platform",
"${chip_root}/src/protocols:type_definitions",
"${chip_root}/src/tracing",
"${chip_root}/src/tracing:macros",
"${nlassert_root}:nlassert",
]
}
source_set("test_paa_store") {
sources = [
"attestation_verifier/TestPAAStore.cpp",
"attestation_verifier/TestPAAStore.h",
]
public_deps = [ "${chip_root}/src/lib/support:span" ]
}
static_library("default_attestation_verifier") {
output_name = "libDefaultAttestationVerifier"
sources = [
"attestation_verifier/DacOnlyPartialAttestationVerifier.cpp",
"attestation_verifier/DacOnlyPartialAttestationVerifier.h",
"attestation_verifier/DefaultDeviceAttestationVerifier.cpp",
"attestation_verifier/DefaultDeviceAttestationVerifier.h",
"attestation_verifier/DeviceAttestationDelegate.h",
]
if (chip_device_platform == "esp32" || chip_device_platform == "nrfconnect" ||
chip_device_platform == "efr32" || chip_device_platform == "openiotsdk") {
defines = [ "CURRENT_TIME_NOT_IMPLEMENTED=1" ]
}
public_deps = [
":credentials",
":test_paa_store",
"${chip_root}/src/crypto",
"${nlassert_root}:nlassert",
]
}
static_library("file_attestation_trust_store") {
output_name = "libFileAttestationTrustStore"
sources = [
"attestation_verifier/FileAttestationTrustStore.cpp",
"attestation_verifier/FileAttestationTrustStore.h",
]
public_deps = [
":credentials",
"${nlassert_root}:nlassert",
]
}