pw_package: Add "micro-ecc"

No-Docs-Update-Reason: this is self documenting by `pw package list`.
Change-Id: I5face84e1c94a73ce1a7e3d7dda110b36203174e
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/54708
Commit-Queue: Ali Zhang <alizhang@google.com>
Reviewed-by: Rob Mohr <mohrr@google.com>
diff --git a/pw_package/py/BUILD.gn b/pw_package/py/BUILD.gn
index 6cbcdb6..f81979e 100644
--- a/pw_package/py/BUILD.gn
+++ b/pw_package/py/BUILD.gn
@@ -28,6 +28,7 @@
     "pw_package/packages/chromium_verifier.py",
     "pw_package/packages/crlset.py",
     "pw_package/packages/mbedtls.py",
+    "pw_package/packages/micro_ecc.py",
     "pw_package/packages/nanopb.py",
     "pw_package/packages/stm32cube.py",
     "pw_package/pigweed_packages.py",
diff --git a/pw_package/py/pw_package/packages/micro_ecc.py b/pw_package/py/pw_package/packages/micro_ecc.py
new file mode 100644
index 0000000..9a52003
--- /dev/null
+++ b/pw_package/py/pw_package/packages/micro_ecc.py
@@ -0,0 +1,43 @@
+# 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.
+"""Install and check the status of the Micro-ECC cryptography library."""
+
+import pathlib
+from typing import Sequence
+
+import pw_package.git_repo
+import pw_package.package_manager
+
+
+class MicroECC(pw_package.git_repo.GitRepo):
+    """Install and check the status of the Micro-ECC cryptography library."""
+    def __init__(self, *args, **kwargs):
+        super().__init__(*args,
+                         name='micro-ecc',
+                         url="".join([
+                             "https://github.com",
+                             "/kmackay/micro-ecc.git",
+                         ]),
+                         commit='24c60e243580c7868f4334a1ba3123481fe1aa48',
+                         **kwargs)
+
+    def info(self, path: pathlib.Path) -> Sequence[str]:
+        return (
+            f'{self.name} installed in: {path}',
+            "Enable by running 'gn args out' and adding this line:",
+            f'  dir_pw_third_party_micro_ecc = "{path}"',
+        )
+
+
+pw_package.package_manager.register(MicroECC)
diff --git a/pw_package/py/pw_package/pigweed_packages.py b/pw_package/py/pw_package/pigweed_packages.py
index d4ec09d..b7e20c0 100644
--- a/pw_package/py/pw_package/pigweed_packages.py
+++ b/pw_package/py/pw_package/pigweed_packages.py
@@ -22,6 +22,7 @@
 from pw_package.packages import boringssl  # pylint: disable=unused-import
 from pw_package.packages import chromium_verifier  # pylint: disable=unused-import
 from pw_package.packages import mbedtls  # pylint: disable=unused-import
+from pw_package.packages import micro_ecc  # pylint: disable=unused-import
 from pw_package.packages import crlset  # pylint: disable=unused-import
 
 
diff --git a/third_party/micro_ecc/BUILD.gn b/third_party/micro_ecc/BUILD.gn
new file mode 100644
index 0000000..e0de9fa
--- /dev/null
+++ b/third_party/micro_ecc/BUILD.gn
@@ -0,0 +1,37 @@
+# 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/target_types.gni")
+import("micro_ecc.gni")
+
+if (dir_pw_third_party_micro_ecc != "") {
+  config("default") {
+    # Suppress all upstream introduced warnings.
+    cflags = [ "-w" ]
+
+    include_dirs = [ "$dir_pw_third_party_micro_ecc/" ]
+
+    # Disabling point compression saves 200 bytes.
+    defines = [ "uECC_SUPPORT_COMPRESSED_POINT=0" ]
+  }
+
+  pw_source_set("micro_ecc") {
+    public_configs = [ ":default" ]
+    sources = [ "$dir_pw_third_party_micro_ecc/uECC.c" ]
+  }
+} else {
+  group("micro_ecc") {
+  }
+}
diff --git a/third_party/micro_ecc/micro_ecc.gni b/third_party/micro_ecc/micro_ecc.gni
new file mode 100644
index 0000000..8b523c7
--- /dev/null
+++ b/third_party/micro_ecc/micro_ecc.gni
@@ -0,0 +1,18 @@
+# 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.
+
+declare_args() {
+  # Points to where the upstream code resides.
+  dir_pw_third_party_micro_ecc = ""
+}