Skip to content

gh-135401: Test AWS-LC as a cryptography library in CI #135402

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 27 commits into
base: main
Choose a base branch
from

Conversation

WillChilds-Klein
Copy link
Contributor

@WillChilds-Klein WillChilds-Klein commented Jun 11, 2025

Notes

This PR extends multissltests.py's AbstractBuilder class to fetch AWS-LC v1.55.0 and build it using CMake and GNU make. To do this, we add cmake as a GitHub Runner dependency in .github/workflows/posix-deps-apt.sh. We also update CPython's configure and configure.ac scripts to swap out BLAKE2 (not tracked for standardization) in favor of SHA-512 when detecting libcrypto compilation compatibility for hashlib.

Finally, a new CI workflow uses this update to dynamically link AWS-LC against CPython, perform a linkage check, and run CPython's ssltests.py in CPython's public CI. This differs from AWS-LC's own CPython integration test where we statically link the CPython executable to AWS-LC.

The new CI check is not marked as "required", but if the community wants to make it "required" for future PRs that can be done by adding a list item for build-ubuntu-ssltests-awslc here.

Please feel free to file an issue with the AWS-LC team here for assistance in troubleshooting any CI failures of the new check.

Testing


@AA-Turner AA-Turner changed the title gh-135401 Add AWS-LC-backed ssl module CI job gh-135401: Test AWS-LC SSL in CI Jun 11, 2025
with:
path: ./multissl/aws-lc/${{ matrix.awslc_ver }}
key: ${{ matrix.os }}-multissl-aws-lc-${{ matrix.awslc_ver }}
# TODO [childw] can we use env.* instead of env vars here?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest for the initial version, keep as similar to the OpenSSL job/workflow, and then perhaps update both at once afterwards?

Copy link
Contributor Author

@WillChilds-Klein WillChilds-Klein Jun 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough. I'll remove the TODOs. Perhaps we can leave this comment unresolved as a reminder for me to clean up both (if tenable) if/after this PR has been merged.

@WillChilds-Klein WillChilds-Klein changed the title gh-135401: Test AWS-LC SSL in CI gh-135401: Test AWS-LC as a cryptography library in CI Jun 11, 2025
@picnixz
Copy link
Member

picnixz commented Jun 13, 2025

Can you cherry-pick 8f4a0eb and make a separate PR please? TiA.

@WillChilds-Klein WillChilds-Klein requested a review from picnixz June 16, 2025 19:27
@picnixz
Copy link
Member

picnixz commented Jun 27, 2025

Ok, the failure is because HMAC-SHA3 isn't supported in AWS-LC. I don't know if the ValueError is actually on my side or fired from OpenSSL and I'm just converting the message, but improving that message would be nice.

@WillChilds-Klein
Copy link
Contributor Author

Looks like it's coming from python. This ValueError will be fixed once PR 2484 has been merged.

@picnixz
Copy link
Member

picnixz commented Jun 27, 2025

Ok so it fell back to the default error message (i.e. there was no reason we could extract)

WillChilds-Klein added a commit to aws/aws-lc that referenced this pull request Jun 30, 2025
This PR implements HMAC over truncated SHA3 variants as specified in
[NIST SP
800-224](https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-224.ipd.pdf#section.3).
We do so without externalizing any SHA3/keccak internals, including its
context struct. This is done intentionally, as OpenSSL [has not yet
externalized its SHA3/keccak context
struct](https://github.com/openssl/openssl/blob/be7467f5a0aa098531597b95a71be6d7c2a463c7/include/internal/sha3.h#L40)
and we want to leave the door open to future interoperability. To work
around this in `hmac.h`'s `md_ctx_union`, we hard-code the context
struct size and add a compile-time assertion that it does not grow
larger than the hard-coded value.

SHA3 is unique in supported HMAC digests in that, due to differences
between its sponge construction and others' Merkle-Dåmgard
constructions, it does not support pre-computed keys. To accommodate
this difference, we refactor the relevant code generation macros and
relevant unit tests.

The HMAC-SHA3 feature gap was discovered in a somewhat roundabout way.
While preparing a [pull
request](python/cpython#135402) to add AWS-LC to
upstream CPython's CI, I discovered that CPython's `./configure`
script's compile probe failed to detect `libcrypto` support for linking
`hashlib`. The compile probe
[referenced](https://github.com/python/cpython/blob/59963e866a1bb8128a50cd53d1b13eeab03df06e/configure#L30869)
`NID_blake2b512`, which AWS-LC does not support. The consequence of this
was that CPython used its HACL implementations for `hashlib` instead of
linking AWS-LC. This did not affect our `ssl` integration, as AWS-LC
always uses its own hash functions for TLS.
@picnixz
Copy link
Member

picnixz commented Jul 1, 2025

Ah yes the error is due to multissltests. We only use tags but the script could be extended to support exact commits maybe?

@WillChilds-Klein
Copy link
Contributor Author

Ah yes the error is due to multissltests. We only use tags but the script could be extended to support exact commits maybe?

I suppose it could, but that would require taking a test container dependency on git. I followed the pattern set by OpenSSL -- download a source zip for a specific release. AWS-LC should release v1.55 ~soon containing the HMAC-SHA3 implementation that this CR needs.

@@ -628,7 +703,7 @@ jobs:
- build-windows-msi
- build-macos
- build-ubuntu
- build-ubuntu-ssltests
- build-ubuntu-ssltests-openssl
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ISTM we should include the new AWS-LC variant in each of these three places as well. Being included in allowed-failures and allowed-skips it can't block a merge, but it will ensure that there's a result before a PR is merged.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. For allowed-failures and allowed-skips, I agree. But what about all-required-green? It looks like that job is "required" to pass, and will fail if any of its members do not pass.

Screenshot 2025-07-04 at 12 28 10 PM

So, it looks like including -awslc there would effectively make it a "required" check. I'm open to this, but @gpshead expressed a preference for making this test non-required at first, which seems reasonable.

Copy link
Contributor Author

@WillChilds-Klein WillChilds-Klein Jul 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see! needs here does not mean "needs to have succeeded", just "needs to have completed". From GitHub's docs:

Use jobs.<job_id>.needs to identify any jobs that must complete successfully before this job will run ... If a job fails or is skipped, all jobs that need it are skipped unless the jobs use a conditional expression that causes the job to continue.

Your proposal makes sense. I'll add -awslc in those 3 places.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants