Skip to content

Commit b57461e

Browse files
Merge branch 'main' into quote-libcrypto-path
2 parents 1378a1a + de73c3a commit b57461e

53 files changed

Lines changed: 1438 additions & 157 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/cross-test.yml

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
sudo apt-get -y install qemu-user qemu-user-binfmt
5555
- uses: actions/checkout@v6
5656
- name: PPC64LE Build/Test
57-
run: tests/ci/run_cross_tests.sh ppc64le powerpc64le-unknown-linux-gnu "-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_BUILD_TYPE=Release -DFIPS=1 -DBUILD_SHARED_LIBS=1"
57+
run: tests/ci/run_cross_tests.sh ppc64le powerpc64le-unknown-linux-gnu "-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_BUILD_TYPE=Release -DFIPS=1 -DBUILD_SHARED_LIBS=1" "-DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS=-DOPENSSL_GETAUXVAL_FORCE_PROC_FALLBACK"
5858
riscv64-non-fips-build-test:
5959
if: github.repository_owner == 'aws'
6060
runs-on: ubuntu-24.04
@@ -84,6 +84,35 @@ jobs:
8484
- uses: actions/checkout@v6
8585
- name: armv6 Build/Test
8686
run: tests/ci/run_cross_tests.sh armv6 armv6-unknown-linux-gnueabi "-DCMAKE_BUILD_TYPE=Release"
87+
armv7-uclibc-build-test:
88+
# Bootlin 2022.08-1 ships uclibc-ng 1.0.42, which predates uclibc-ng's
89+
# own <sys/auxv.h> (added in 1.0.43). On this sysroot,
90+
# __has_include(<sys/auxv.h>) in cpu_getauxval_linux.h evaluates false,
91+
# so natural detection lands on the /proc/self/auxv fallback -- exactly
92+
# the scenario from https://github.com/aws/aws-lc/issues/3188. A single
93+
# job thus covers both the non-glibc detection path and the fallback
94+
# code path end-to-end. If this toolchain is ever bumped to a release
95+
# that does ship <sys/auxv.h>, the "INFO:" line in
96+
# run_cross_tests_bootlin.sh will make the coverage loss visible in the
97+
# CI log.
98+
if: github.repository_owner == 'aws'
99+
runs-on: ubuntu-24.04
100+
steps:
101+
- name: Install qemu
102+
run: |
103+
sudo apt-get update -o Acquire::Languages=none -o Acquire::Translation=none
104+
sudo apt-get -y install qemu-user qemu-user-binfmt
105+
- uses: actions/checkout@v6
106+
- name: armv7 uclibc Build/Test
107+
run: |
108+
tests/ci/run_cross_tests_bootlin.sh \
109+
armv7 \
110+
armv7-eabihf--uclibc--stable-2022.08-1 \
111+
arm-buildroot-linux-uclibcgnueabihf \
112+
tar.bz2 \
113+
9e4191ab996fdf5f4e8de7e4617c67cbf46127ca2754fca0ad45d60e393ace05 \
114+
arm \
115+
"-DCMAKE_BUILD_TYPE=Release"
87116
loongarch64-non-fips-build-test:
88117
runs-on: ubuntu-24.04
89118
steps:
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: security-review
2+
3+
on:
4+
pull_request_target:
5+
branches: ["*"]
6+
concurrency:
7+
group: ${{ github.workflow }}-${{ github.ref_name }}
8+
cancel-in-progress: true
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
authorize:
14+
runs-on: ubuntu-latest
15+
outputs:
16+
approval-env: ${{ steps.authorization.outputs.approval-env }}
17+
steps:
18+
- uses: actions/checkout@v6
19+
- name: Check authorization
20+
id: authorization
21+
uses: ./.github/actions/check-authorization
22+
23+
execute:
24+
needs: authorize
25+
runs-on: ubuntu-latest
26+
environment: ${{ needs.authorize.outputs.approval-env }}
27+
permissions:
28+
id-token: write
29+
contents: read
30+
statuses: write
31+
steps:
32+
- uses: actions/checkout@v6
33+
with:
34+
ref: ${{ github.event.pull_request.head.sha }}
35+
36+
- name: Get AWS credentials
37+
uses: aws-actions/configure-aws-credentials@v6
38+
with:
39+
role-to-assume: arn:aws:iam::547182295936:role/SecurityReview-GitHubOIDCRole #TODO: migrate to production account
40+
role-session-name: ${{ github.run_id }}-${{ github.run_attempt }}
41+
aws-region: us-west-2
42+
43+
- name: Start CodeBuild and wait for completion
44+
id: codebuild
45+
shell: bash
46+
env:
47+
PROJECT_NAME: SecurityReview-${{ github.event.repository.name }}
48+
SOURCE_VERSION: "pr/${{ github.event.pull_request.number }}"
49+
PR_NUMBER: ${{ github.event.pull_request.number }}
50+
run: |
51+
# Start the build
52+
BUILD_ID=$(aws codebuild start-build \
53+
--project-name "${PROJECT_NAME}" \
54+
--source-version "${SOURCE_VERSION}" \
55+
--environment-variables-override "name=PR_NUMBER,value=${PR_NUMBER},type=PLAINTEXT" \
56+
--query 'build.id' --output text)
57+
58+
# Wait for completion
59+
while STATUS=$(aws codebuild batch-get-builds --ids "${BUILD_ID}" --query 'builds[0].buildStatus' --output text); [[ "$STATUS" == "IN_PROGRESS" ]]; do
60+
sleep 30
61+
done
62+
63+
if [[ "$STATUS" != "SUCCEEDED" ]]; then
64+
echo "blocking=skip" >> "$GITHUB_OUTPUT"
65+
exit 1
66+
fi
67+
68+
REVIEW_STATUS=$(aws codebuild batch-get-builds --ids "${BUILD_ID}" --query 'builds[0].exportedEnvironmentVariables[?name==`REVIEW_STATUS`].value' --output text)
69+
echo "blocking=$([[ "$REVIEW_STATUS" == "FAIL" ]] && echo true || echo false)" >> "$GITHUB_OUTPUT"
70+
71+
- name: Update commit status
72+
if: always() && steps.codebuild.outputs.blocking != 'skip'
73+
shell: bash
74+
env:
75+
GH_TOKEN: ${{ github.token }}
76+
STATUS_URL: ${{ github.api_url }}/repos/${{ github.repository }}/statuses/${{ github.event.pull_request.head.sha }}
77+
REPORT_URL: https://d28bfvmis1skm5.cloudfront.net/${{ github.event.repository.name }}/pr-${{ github.event.pull_request.number }}/${{ github.event.pull_request.head.sha }}.html
78+
BLOCKING: ${{ steps.codebuild.outputs.blocking }}
79+
run: |
80+
STATE=$([[ "$BLOCKING" == "true" ]] && echo "failure" || echo "success")
81+
curl -sS -X POST \
82+
-H "Authorization: token ${GH_TOKEN}" \
83+
"${STATUS_URL}" \
84+
-d "{\"state\":\"${STATE}\",\"context\":\"security-review / report\",\"target_url\":\"${REPORT_URL}\"}"

.github/workflows/zig.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ on:
77
concurrency:
88
group: ${{ github.workflow }}-${{ github.ref_name }}
99
cancel-in-progress: true
10+
11+
permissions:
12+
contents: read
13+
1014
jobs:
1115
zig:
1216
if: github.repository_owner == 'aws'

CMakeLists.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ cmake_policy(SET CMP0091 NEW)
55
endif()
66

77
set(SOFTWARE_NAME "awslc")
8-
set(SOFTWARE_VERSION "1.73.0")
8+
set(SOFTWARE_VERSION "5.0.0")
9+
set(AWSLC_FIPS_VERSION 4)
910
set(ABI_VERSION 0)
1011
set(CRYPTO_LIB_NAME "crypto")
1112
set(SSL_LIB_NAME "ssl")
@@ -49,6 +50,13 @@ include(sources.cmake)
4950
include(TestBigEndian)
5051
include(CheckCCompilerFlag)
5152

53+
message(STATUS "Versioning name:${SOFTWARE_NAME} version:${SOFTWARE_VERSION} abi:${ABI_VERSION}")
54+
if(BUILD_LIBSSL)
55+
message(STATUS "Libraries crypto:${CRYPTO_LIB_NAME} ssl:${SSL_LIB_NAME}")
56+
else()
57+
message(STATUS "Libraries crypto:${CRYPTO_LIB_NAME}")
58+
endif()
59+
5260
macro(add_flag_if_supported VARIABLE FLAG)
5361
# Create a safe, unique variable name to cache the result of the check
5462
string(MAKE_C_IDENTIFIER "HAVE_C_FLAG_${FLAG}" _CHECK_VAR_NAME)

SANDBOXING.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,12 @@ On Linux ARM platforms, BoringSSL depends on OS APIs to query CPU capabilities.
9393
work around bugs in older Android devices, may additionally read
9494
`/proc/cpuinfo`.
9595

96+
On Linux targets whose libc does not provide `getauxval` (e.g. older uclibc),
97+
AWS-LC falls back to reading `/proc/self/auxv` directly. This applies to the
98+
ARM, AArch64, and PPC64LE CPU capability paths as well as the `urandom`
99+
entropy path's debug lookup. Sandbox policies should permit opening
100+
`/proc/self/auxv` on such targets.
101+
96102
On 64-bit Apple ARM platforms, BoringSSL needs to query `hw.optional.*` sysctls.
97103

98104
If querying CPU capabilities fails, BoringSSL will still function, but may not

VERSIONING.md

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
# AWS-LC Versioning
2+
3+
This document describes how AWS-LC is versioned and released, and how consumers should choose between the release types we offer.
4+
5+
## Overview
6+
7+
AWS-LC offers two release types:
8+
9+
* **Rolling mainline releases** are the primary release for most consumers. Rolling mainline receives the latest features, performance improvements, and security fixes as they are developed.
10+
* **Long-term support (LTS) releases** are intended for consumers that require a stable ABI over a multi-year support window.
11+
12+
Rolling mainline is periodically submitted for FIPS 140-3 validation, though changes may land between submissions. LTS branches are fixed FIPS submissions; they are not modified after they are cut, except for the backports permitted by the [LTS release policy](#lts-release-policy). The FIPS version number a given build corresponds to is tracked independently of the AWS-LC version number (see [FIPS version number](#fips-version-number)).
13+
14+
AWS-LC is committed to providing a stable public API across both release types. LTS releases additionally guarantee ABI stability for the duration of the support window.
15+
16+
## AWS-LC version numbers
17+
18+
AWS-LC releases follow a `MAJOR.MINOR.PATCH` scheme. Mainline uses only major and minor; FIPS branches (LTS and non-LTS snapshot) use only minor and patch.
19+
20+
* **Major** (`X.0.0`):
21+
* Bumped on mainline when a new LTS branch is cut (see [LTS version evolution](#lts-version-evolution)).
22+
* Signals that the previous major line now belongs to an LTS branch and mainline has moved to a new major line.
23+
* **Minor** (`X.Y.0`):
24+
* The only increment used on mainline. Every mainline release bumps minor, regardless of the size or kind of change (features, security fixes, performance improvements, bug fixes, platform compatibility fixes, etc.).
25+
* Also used on LTS branches for backwards compatible features that do not break API/ABI compatibility.
26+
* **Patch** (`X.Y.Z`):
27+
* Used only on FIPS branches (LTS or non-LTS snapshot) for non-additive changes — security fixes, bug fixes, and platform compatibility fixes.
28+
* Mainline never produces patch versions, so patch increments on FIPS branches cannot collide with mainline.
29+
30+
AWS-LC version numbers do not follow Semantic Versioning. Major version bumps on mainline are tied to LTS branch cuts (see [LTS version evolution](#lts-version-evolution)) and do not necessarily indicate API or ABI breaking changes. Consumers needing to detect public API surface changes can use the `AWSLC_API_VERSION` macro defined in `openssl/base.h`, which increments when the API surface changes.
31+
32+
A build's AWS-LC version can be queried at runtime via the `awslc_version_string` API:
33+
34+
```c
35+
OPENSSL_EXPORT const char *awslc_version_string(void);
36+
```
37+
38+
AWS-LC version numbers are independent of the FIPS version number. A bump in either does not imply a bump in the other. To identify the FIPS submission a build corresponds to, use `FIPS_version` (see [FIPS version number](#fips-version-number)).
39+
40+
## FIPS version number
41+
42+
The FIPS version number is an integer that identifies a specific FIPS validation submission. It is incremented each time a new FIPS branch is cut from mainline and corresponds to the value used in our submissions to the NIST Cryptographic Module Validation Program (CMVP). Mainline tracks the most recent FIPS version number that has been cut from it.
43+
44+
The FIPS version number is decoupled from the AWS-LC version number. A build's FIPS version number can be queried at runtime via the `FIPS_version` API:
45+
46+
```c
47+
OPENSSL_EXPORT uint32_t FIPS_version(void);
48+
```
49+
50+
Prior to this scheme, AWS-LC version numbers and FIPS version numbers were coupled (for example, AWS-LC FIPS 3.0 corresponded to the third FIPS submission). That coupling has been removed. Earlier FIPS branches still carry version numbers matching their FIPS version number, and their FIPS version number is documented in the security policy published alongside each validation.
51+
52+
## Release types
53+
54+
### Rolling mainline
55+
56+
Mainline is the primary release for AWS-LC consumers. It receives all new features, performance improvements, and security fixes as they are developed.
57+
58+
Rolling mainline characteristics:
59+
60+
* Latest features, performance improvements, and security fixes.
61+
* Submitted for FIPS validation approximately every 6 months.
62+
63+
### LTS releases
64+
65+
LTS releases are intended for consumers that require a stable ABI. An LTS branch is cut from mainline and then receives only the changes permitted by the [LTS release policy](#lts-release-policy).
66+
67+
LTS release characteristics:
68+
69+
* Cut from mainline every 2 years and supported for 5 years from the date the branch is cut.
70+
* Each LTS branch is submitted for FIPS validation.
71+
72+
Both rolling mainline releases and LTS releases are tagged in the public repository; non-LTS FIPS branches are not.
73+
74+
## LTS release policy
75+
76+
### LTS version evolution
77+
78+
Each LTS branch inherits mainline's major version at the time it is cut. In the next commit, mainline bumps to the next major version. This guarantees that mainline and every LTS branch have distinct major version numbers.
79+
80+
For example, when mainline is at `4.13.0` and an LTS branch is cut, the `4.x` version prefix is reserved exclusively for the LTS branch. The `4.x` line receives only the changes permitted below, as patch (`4.13.1`, `4.13.2`, ...) or minor (`4.14.0`, `4.15.0`, ...) increments. Mainline advances to `5.0.0` and continues normal development with minor increments only (`5.1.0`, `5.2.0`, ...). Because mainline never returns to the `4.x` line, version numbers on the LTS cannot collide with mainline. When the next LTS is cut approximately two years later, it takes ownership of whatever major version line mainline is on at that moment, and mainline bumps again.
81+
82+
### Permitted changes on LTS branches
83+
84+
The following are permitted on LTS branches, mapped to version increments:
85+
86+
* Minor increments:
87+
* Additive changes that preserve existing function signatures.
88+
* Patch increments:
89+
* Security fixes for CVEs and critical vulnerabilities. These may alter the FIPS module integrity hash when necessary.
90+
* Bug fixes that do not alter public API behavior, ABI compatibility, or the FIPS module integrity hash.
91+
* Platform compatibility fixes for supported operating environments that do not alter the FIPS module integrity hash.
92+
93+
See [AWS-LC version numbers](#aws-lc-version-numbers) for the full scheme.
94+
95+
### Not permitted on LTS branches
96+
97+
The following are not permitted on LTS branches:
98+
99+
* API or ABI breaking changes.
100+
* Changes within the FIPS module boundary that alter the integrity hash, unless required for a security fix.
101+
* New features or algorithms that alter the FIPS module.
102+
* Performance improvements that alter the FIPS module or change behavioral characteristics.
103+
104+
### Support window
105+
106+
Each LTS branch is supported for 5 years from the date the branch is cut. End of support (EOS) means security fixes and other changes are no longer backported to the branch. EOS applies regardless of the status of any FIPS certificate associated with the branch; once an LTS reaches EOS, consumers should migrate to mainline or to a newer LTS.
107+
108+
At any given time, at least one LTS branch is within its support window. Consecutive LTS branches overlap so that consumers always have a supported migration target.
109+
110+
## Non-LTS FIPS branches
111+
112+
FIPS validation requires a fixed snapshot of the cryptographic module's source code. Each time AWS-LC is submitted for FIPS validation, a branch is cut from mainline that preserves the exact code submitted. Most of these branches are not designated as LTS. LTS designation is decided at branch-cut time; existing non-LTS branches are never promoted to LTS.
113+
114+
Non-LTS FIPS branches exist solely to preserve the validated snapshot. They do not receive release tags, and consumers should not depend on them.
115+
116+
We may apply critical security fixes to a non-LTS FIPS branch from the time it is cut until a newer FIPS branch (LTS or non-LTS) receives NIST certification and supersedes it. This is a maintenance concession; these branches are not supported for consumption. Once superseded, the previous non-LTS branch is frozen and receives no further updates.
117+
118+
A non-LTS FIPS branch inherits its version from mainline at cut time and only ever issues patch-level increments (e.g., a branch cut at `5.6.0` becomes `5.6.1` after a security fix). Because mainline only produces minor increments (`5.6.0``5.7.0`), patch versions on a non-LTS branch cannot collide with mainline.
119+
120+
At branch-cut time, the non-LTS branch and mainline are the same build; `awslc_version_string()` and `FIPS_version()` return identical values on both. They diverge afterward — mainline through its next minor release, the non-LTS branch through any patch-level security fixes.
121+
122+
## Branch naming conventions
123+
124+
Going forward, FIPS branches use a suffix to indicate their release type:
125+
126+
* `fips-YYYY-MM-DD-lts` — LTS branch. Receives security fixes and other permitted changes throughout its support window.
127+
* `fips-YYYY-MM-DD-snapshot` — Non-LTS validation snapshot. Frozen once it is no longer the most recently NIST-certified FIPS branch.
128+
129+
The date in the branch name corresponds to the date the branch was cut for FIPS submission. Branches cut before this convention was adopted retain their original names.
130+
131+
## Deprecation of legacy FIPS branches
132+
133+
`fips-2025-09-12-lts` (AWS-LC FIPS 4.x) is the first branch designated as LTS under this versioning scheme. It is supported for 5 years from its cut date (approximate EOS: September 2030).
134+
135+
FIPS branches published before this scheme have the following deprecation timelines:
136+
137+
| Branch | End of support |
138+
|-------------------|--------------------|
139+
| AWS-LC FIPS 1.0 | October 2026 |
140+
| AWS-LC FIPS 2.0 | April 2027 |
141+
| AWS-LC FIPS 3.0 | April 2028 |
142+
143+
After a branch reaches end of support, security fixes will no longer be backported. Consumers on these branches should migrate to mainline or to the FIPS 4.x LTS branch before the listed date.

crypto/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,15 @@ function(build_libcrypto)
607607
endif()
608608
if(WIN32)
609609
target_link_libraries(${arg_NAME} PUBLIC ws2_32)
610+
# MinGW (non-Clang) builds target Windows 7 (see the top-level
611+
# CMakeLists.txt, which adds -D_WIN32_WINNT=_WIN32_WINNT_WIN7), so
612+
# `crypto/rand_extra/windows.c` compiles under the AWSLC_WINDOWS_7_COMPAT
613+
# branch and calls BCryptGenRandom from bcrypt.dll. On MSVC this is
614+
# handled by `#pragma comment(lib, "bcrypt.lib")` in that file, but
615+
# MinGW ignores that pragma so we need to add the link explicitly.
616+
if(MINGW)
617+
target_link_libraries(${arg_NAME} PUBLIC bcrypt)
618+
endif()
610619
endif()
611620

612621
if(AWSLC_LINK_THREADS)

crypto/bio/bio.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,9 @@ int BIO_write(BIO *bio, const void *in, int inl) {
305305
}
306306

307307
int BIO_write_ex(BIO *bio, const void *data, size_t data_len, size_t *written_bytes) {
308+
if (written_bytes != NULL) {
309+
*written_bytes = 0;
310+
}
308311
if (bio == NULL) {
309312
OPENSSL_PUT_ERROR(BIO, BIO_R_NULL_PARAMETER);
310313
return 0;
@@ -322,9 +325,6 @@ int BIO_write_ex(BIO *bio, const void *data, size_t data_len, size_t *written_by
322325
}
323326
return 1;
324327
} else {
325-
if (written_bytes != NULL) {
326-
*written_bytes = 0;
327-
}
328328
return 0;
329329
}
330330
}

crypto/bio/bio_addr.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,10 @@ int BIO_ADDR_rawaddress(const BIO_ADDR *ap, void *p, size_t *l) {
151151
return 0;
152152
}
153153
if (l != NULL) {
154-
*l = len;
154+
// AF_UNIX includes the trailing NUL written below so |*l| matches the
155+
// bytes written to |p| and reflects sockaddr_un's NUL-terminated path.
156+
// OpenSSL does not write this NUL; aws-lc intentionally does.
157+
*l = (ap->sa.sa_family == AF_UNIX) ? len + 1 : len;
155158
}
156159

157160
if (p != NULL) {

0 commit comments

Comments
 (0)