Skip to content

Commit 8b87b82

Browse files
committed
bazel-registry: Add aws-lc-fips@1.66.2.envoy
Signed-off-by: Ryan Northey <ryan@synca.io>
1 parent 33842ce commit 8b87b82

File tree

5 files changed

+147
-0
lines changed

5 files changed

+147
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module(
2+
name = "aws-lc-fips",
3+
version = "1.66.2.envoy",
4+
bazel_compatibility = [">=7.2.1"],
5+
compatibility_level = 1,
6+
)
7+
8+
bazel_dep(name = "rules_foreign_cc", version = "0.15.1")
9+
bazel_dep(name = "go-fips", version = "1.24.12.envoy")
10+
bazel_dep(name = "rules_cc", version = "0.1.1")
11+
bazel_dep(name = "platforms", version = "0.0.11")
12+
bazel_dep(name = "bazel_skylib", version = "1.8.2")
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
load("@rules_cc//cc:defs.bzl", "cc_library")
2+
load("@rules_foreign_cc//foreign_cc:defs.bzl", "cmake")
3+
4+
licenses(["notice"]) # Apache 2 license
5+
6+
# AWS-LC FIPS build for use in Envoy on ppc64le where BoringSSL FIPS is not available
7+
# This is based on the boringssl-fips implementation but adapted for AWS-LC
8+
# Reference: https://github.com/aws/aws-lc/blob/main/crypto/fipsmodule/FIPS.md
9+
#
10+
# FIPS Validation Note:
11+
# Unlike BoringSSL which provides a 'bssl isfips' tool for validation, AWS-LC validates
12+
# FIPS compliance through automatic self-tests performed at library initialization.
13+
# The FIPS=1 CMake flag ensures the library is built in FIPS mode, and the module
14+
# performs all required self-tests when loaded. This is the standard FIPS 140-3 approach.
15+
# See: https://github.com/aws/aws-lc/blob/main/crypto/fipsmodule/FIPS.md
16+
17+
filegroup(
18+
name = "all_srcs",
19+
srcs = glob(
20+
["**"],
21+
),
22+
)
23+
24+
cmake(
25+
name = "_aws_lc_build",
26+
cache_entries = {
27+
"CMAKE_BUILD_TYPE": "Release",
28+
"FIPS": "1",
29+
"BUILD_SHARED_LIBS": "0",
30+
"CMAKE_C_FLAGS": "-fPIC",
31+
"CMAKE_CXX_FLAGS": "-fPIC",
32+
"GO_EXECUTABLE": "$$EXT_BUILD_ROOT/external/go-fips~/bin/go",
33+
"BUILD_TESTING": "OFF",
34+
},
35+
lib_source = ":all_srcs",
36+
out_static_libs = [
37+
"libcrypto.a",
38+
"libssl.a",
39+
],
40+
targets = [
41+
"crypto",
42+
"ssl",
43+
],
44+
env = {
45+
"GOCACHE": "$$EXT_BUILD_ROOT$$/gocache",
46+
"GOPATH": "$$EXT_BUILD_ROOT$$/gopath",
47+
},
48+
build_data = [
49+
"@go-fips//:go",
50+
"@go-fips//:go_sdk",
51+
],
52+
visibility = ["//visibility:private"],
53+
)
54+
55+
genrule(
56+
name = "_aws_lc_outputs",
57+
srcs = [":_aws_lc_build"],
58+
outs = [
59+
"lib/libcrypto.a",
60+
"lib/libssl.a",
61+
],
62+
cmd = """
63+
for f in $(locations :_aws_lc_build); do
64+
case "$$f" in
65+
*libcrypto.a)
66+
mkdir -p $$(dirname $(location lib/libcrypto.a))
67+
cp "$$f" $(location lib/libcrypto.a)
68+
;;
69+
*libssl.a)
70+
mkdir -p $$(dirname $(location lib/libssl.a))
71+
cp "$$f" $(location lib/libssl.a)
72+
;;
73+
esac
74+
done
75+
""",
76+
visibility = ["//visibility:private"],
77+
)
78+
79+
cc_library(
80+
name = "crypto",
81+
srcs = ["lib/libcrypto.a"],
82+
hdrs = glob(["include/**/*.h"]),
83+
includes = ["include"],
84+
linkstatic = 1,
85+
visibility = ["//visibility:public"],
86+
)
87+
88+
cc_library(
89+
name = "ssl",
90+
srcs = ["lib/libssl.a"],
91+
hdrs = glob(["include/**/*.h"]),
92+
includes = ["include"],
93+
linkstatic = 1,
94+
deps = [":crypto"],
95+
visibility = ["//visibility:public"],
96+
)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
matrix:
2+
platform:
3+
- ubuntu2204
4+
bazel:
5+
- 8.x
6+
- 7.x
7+
tasks:
8+
verify_targets:
9+
name: Verify build targets
10+
platform: ${{ platform }}
11+
bazel: ${{ bazel }}
12+
build_targets:
13+
- '@aws-lc-fips//:crypto'
14+
- '@aws-lc-fips//:ssl'
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"url": "https://github.com/aws/aws-lc/archive/v1.66.2.tar.gz",
3+
"integrity": "sha256-1kpGtPdfpTYtpBLx6W/1t37tdrOpVoVlH4GlWMXJ4SY=",
4+
"strip_prefix": "aws-lc-1.66.2",
5+
"overlay": {
6+
"BUILD.bazel": "sha256-oc4WAvMELWR9oFr8WDnC6SmBx/GIwtDFPWOzpjsoqxw="
7+
}
8+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"homepage": "https://github.com/aws/aws-lc",
3+
"maintainers": [
4+
{
5+
"email": "maintainers@envoyproxy.io",
6+
"github": "envoyproxy",
7+
"name": "Envoy Proxy Maintainers"
8+
}
9+
],
10+
"repository": [
11+
"github:aws/aws-lc"
12+
],
13+
"versions": [
14+
"1.66.2.envoy"
15+
],
16+
"yanked_versions": {}
17+
}

0 commit comments

Comments
 (0)