blob: 2c9fea3d4c6d476e61b3e1e686c52d97161263da [file] [log] [blame]
# Copyright 2020 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/components.gni")
# micro-ecc library
source_set("micro-ecc") {
sources = [ "uECC.c" ]
public = [
"asm_arm.inc",
"asm_arm_mult_square.inc",
"asm_arm_mult_square_umaal.inc",
"asm_avr.inc",
"asm_avr_mult_square.inc",
"curve-specific.inc",
"platform-specific.inc",
"types.h",
"uECC.h",
"uECC_vli.h",
]
public_configs = [ ":micro-ecc_config" ]
deps = [
":micro-ecc-headers",
"//zircon/system/ulib/zx",
]
# TODO(fxb/58162): delete the below and fix compiler warnings
configs += [ "//build/config:Wno-conversion" ]
}
copy("micro-ecc-headers") {
sources = [
"types.h",
"uECC.h",
"uECC_vli.h",
]
outputs = [ "$target_gen_dir/include/micro-ecc/{{source_file_part}}" ]
}
config("micro-ecc_config") {
include_dirs = [
"$target_gen_dir/include",
"$target_gen_dir/include/micro-ecc",
]
# TODO(fxb/53953): Dependent libraries assume this word size, which should
# work for arm, arm64, x86, and x86_64 variants. After unwinding those
# assumptions, uECC_WORD_SIZE should be removed from this config.
defines = [
"uECC_ENABLE_VLI_API",
"uECC_WORD_SIZE=4",
]
}
# micro-ecc test binaries
template("micro_ecc_test") {
assert(defined(invoker.sources), "must specify sources")
executable("${target_name}_bin") {
testonly = true
visibility = [ ":*" ]
sources = invoker.sources
configs += [ ":micro-ecc-test_config" ]
deps = [
":micro-ecc",
"//src/sys/testing/elftest",
]
}
fuchsia_unittest_component(target_name) {
deps = [ ":${target_name}_bin" ]
}
}
micro_ecc_test("compress_test") {
sources = [ "test/test_compress.c" ]
}
micro_ecc_test("compute_test") {
sources = [ "test/test_compute.c" ]
}
micro_ecc_test("ecdh_test") {
sources = [ "test/test_ecdh.c" ]
}
micro_ecc_test("ecdsa_test") {
sources = [ "test/test_ecdsa.c" ]
}
config("micro-ecc-test_config") {
configs = [ ":micro-ecc_config" ]
}
# micro-ecc test package
fuchsia_test_package("micro-ecc-tests") {
test_components = [
":compress_test",
":compute_test",
":ecdh_test",
":ecdsa_test",
]
}