pw_crypto: Get pw_crypto:ecdsa_uecc to bazel build
Small step towards getting all of pw_crypto building with bazel.
Bug: b/236321905
Tested: bazel build //pw_crypto:ecdsa_uecc
Change-Id: Ib88ac60f17fa70c94e111b3b839a66ec3be70329
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/98304
Reviewed-by: Ali Zhang <alizhang@google.com>
Commit-Queue: Ted Pudlik <tpudlik@google.com>
diff --git a/WORKSPACE b/WORKSPACE
index e2ac7ee..f213ae2 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -18,7 +18,7 @@
)
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
-load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
+load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository", "new_git_repository")
load("//pw_env_setup/bazel/cipd_setup:cipd_rules.bzl", "pigweed_deps")
# Setup CIPD client and packages.
@@ -376,3 +376,10 @@
"https://repo1.maven.org/maven2",
],
)
+
+new_git_repository(
+ name = "micro_ecc",
+ commit = "b335ee812bfcca4cd3fb0e2a436aab39553a555a",
+ remote = "https://github.com/kmackay/micro-ecc.git",
+ build_file = "//:third_party/micro_ecc/BUILD.bazel",
+)
diff --git a/pw_crypto/BUILD.bazel b/pw_crypto/BUILD.bazel
index d8fc6f3..6567d26 100644
--- a/pw_crypto/BUILD.bazel
+++ b/pw_crypto/BUILD.bazel
@@ -43,7 +43,7 @@
"public/pw_crypto/sha256_mbedtls.h",
"public_overrides/mbedtls/pw_crypto/sha256_backend.h",
],
- includes = ["public_overrides"],
+ includes = ["public_overrides/mbedtls"],
deps = [":sha256_facade"],
)
@@ -116,9 +116,12 @@
name = "ecdsa_uecc",
srcs = [
"ecdsa_uecc.cc",
- "micro-ecc/uEDD.c",
],
- deps = [":ecdsa_facade"],
+ deps = [
+ ":ecdsa_facade",
+ "//pw_log",
+ "@micro_ecc//:uecc",
+ ],
)
pw_cc_test(
diff --git a/third_party/micro_ecc/BUILD.bazel b/third_party/micro_ecc/BUILD.bazel
new file mode 100644
index 0000000..1ed01ae
--- /dev/null
+++ b/third_party/micro_ecc/BUILD.bazel
@@ -0,0 +1,28 @@
+# Copyright 2022 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.
+
+cc_library(
+ name = "uecc",
+ srcs = [
+ "curve-specific.inc",
+ "platform-specific.inc",
+ "uECC.c",
+ ],
+ hdrs = [
+ "types.h",
+ "uECC.h",
+ "uECC_vli.h",
+ ],
+ visibility = ["//visibility:public"],
+)