Skip to content

Commit

Permalink
fix(circl@1.3.7.bcr.1): support pure = "on"
Browse files Browse the repository at this point in the history
This switches the `purego` build tag to use the `cgo` tag which
allows the source files to be correctly conditionally included
in the build actions.

There is a second patch that adds a couple of unit tests
that have `pure = "on"` enabled to prevent regressions.
  • Loading branch information
mattyclarkson committed Mar 18, 2024
1 parent 13718a8 commit b3d72af
Show file tree
Hide file tree
Showing 9 changed files with 3,545 additions and 1 deletion.
16 changes: 16 additions & 0 deletions modules/circl/1.3.7.bcr.1/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module(
name = "circl",
version = "1.3.7.bcr.1",
)

bazel_dep(name = "rules_go", version = "0.39.1", repo_name = "io_bazel_rules_go")
bazel_dep(name = "gazelle", version = "0.31.0")

go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")
go_deps.from_file(go_mod = "//:go.mod")
use_repo(
go_deps,
"com_github_bwesterb_go_ristretto",
"org_golang_x_crypto",
"org_golang_x_sys",
)
28 changes: 28 additions & 0 deletions modules/circl/1.3.7.bcr.1/patches/add_module_file.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
commit f88c99d4b8d02731ede3fd7e3a5f01fe84336c31
Author: Fabian Meumertzheim <fabian@meumertzhe.im>
Date: Tue Jan 9 08:55:10 2024 +0100

Add MODULE.bazel

diff --git a/MODULE.bazel b/MODULE.bazel
new file mode 100644
index 0000000..9754824
--- /dev/null
+++ b/MODULE.bazel
@@ -0,0 +1,16 @@
+module(
+ name = "circl",
+ version = "1.3.7.bcr.1",
+)
+
+bazel_dep(name = "rules_go", version = "0.39.1", repo_name = "io_bazel_rules_go")
+bazel_dep(name = "gazelle", version = "0.31.0")
+
+go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")
+go_deps.from_file(go_mod = "//:go.mod")
+use_repo(
+ go_deps,
+ "com_github_bwesterb_go_ristretto",
+ "org_golang_x_crypto",
+ "org_golang_x_sys",
+)
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
From a8c4375a01c55eaef53e457a045e9874fc930d88 Mon Sep 17 00:00:00 2001
From: Matt Clarkson <mattyclarkson@gmail.com>
Date: Fri, 15 Mar 2024 12:10:45 +0000
Subject: [PATCH] Add pure tests for mathmatical libraries

The libraries have `noasm` support. These tests validate that support does not regress.
---
dh/x25519/BUILD.bazel | 16 ++++++++++++++++
dh/x448/BUILD.bazel | 16 ++++++++++++++++
2 files changed, 32 insertions(+)

diff --git a/dh/x25519/BUILD.bazel b/dh/x25519/BUILD.bazel
index cacfcf1..7464c66 100644
--- a/dh/x25519/BUILD.bazel
+++ b/dh/x25519/BUILD.bazel
@@ -41,3 +41,19 @@ go_test(
"//math/fp25519",
],
)
+
+go_test(
+ name = "x25519_pure_test",
+ srcs = [
+ "curve_test.go",
+ "key_test.go",
+ ],
+ data = glob(["testdata/**"]),
+ embed = [":x25519"],
+ pure = "on",
+ deps = [
+ "//internal/conv",
+ "//internal/test",
+ "//math/fp25519",
+ ],
+)
diff --git a/dh/x448/BUILD.bazel b/dh/x448/BUILD.bazel
index 94a7b2b..b96c160 100644
--- a/dh/x448/BUILD.bazel
+++ b/dh/x448/BUILD.bazel
@@ -41,3 +41,19 @@ go_test(
"//math/fp448",
],
)
+
+go_test(
+ name = "x448_pure_test",
+ srcs = [
+ "curve_test.go",
+ "key_test.go",
+ ],
+ data = glob(["testdata/**"]),
+ embed = [":x448"],
+ pure = "on",
+ deps = [
+ "//internal/conv",
+ "//internal/test",
+ "//math/fp448",
+ ],
+)

0 comments on commit b3d72af

Please sign in to comment.