Repository navigation
Remove dead P-256 nistz asm under OPENSSL_SMALL and extend the size-check harness - #3350
Merged
justsmth merged 3 commits intoJul 20, 2026
Merged
Conversation
Contributor
|
๐ Security Review โ View Report Please review before merging. |
Codecov Reportโ
All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3350 +/- ##
==========================================
- Coverage 78.20% 78.19% -0.02%
==========================================
Files 695 695
Lines 124086 124086
Branches 17232 17231 -1
==========================================
- Hits 97044 97025 -19
- Misses 26121 26141 +20
+ Partials 921 920 -1 โ View full report in Codecov by Harness. ๐ New features to boost your workflow:
|
nebeid
reviewed
Jul 16, 2026
nebeid
left a comment
Contributor
There was a problem hiding this comment.
The commit message and the PR description are reporting delta sizes smaller than what the summary is showing.
nebeid
approved these changes
Jul 17, 2026
Under OPENSSL_SMALL, p256-nistz.c is compiled out entirely (ec.c
dispatches P-256 to the fiat-crypto implementation), leaving the nistz
assembly (p256-{x86_64,armv8}-asm, p256_beeu-{x86_64,armv8}-asm) fully
unreferenced on both x86_64 and aarch64. Remove it from the build using
the same conditional-exclusion pattern as the s2n-bignum removal
(aws#3320).
Verified on arm64 macOS: the shared-library OPENSSL_SMALL build links
cleanly, nm shows the 21 previously-dead ecp_nistz256_*/beeu_* symbols
are gone (~5.7 KB of __text), and the full crypto_test suite passes.
Non-OPENSSL_SMALL builds are unchanged. This mainly shrinks
shared-library artifacts; static consumers never pulled these
unreferenced objects.
Extend the binary-size CI harness from aws#3320 to measure what GC-enabled static consumers actually inherit, and to make the key-parsing reachability anchor visible in every run. - tests/binary-size/main.c gains an AWSLC_SIZE_CHECK_EVP_PARSE variant that marshals and parses an EVP public key. EVP_parse_public_key anchors asn1_evp_pkey_methods[] (crypto/evp_extra/p_methods.c), which transitively retains every key type's ASN.1 machinery -- currently including all of ML-KEM and ML-DSA -- even under full section GC. The default-compiled harness behavior is unchanged, so the existing calibrated thresholds remain valid. - openssl-small.yml adds libcrypto.a sizes to the report, plus an advisory step that builds the OPENSSL_SMALL library with -ffunction-sections/-fdata-sections (the aws-lc-rs CcBuilder-like configuration), links base and EVP-parse consumers with --gc-sections, and reports the key-parsing anchor cost and the largest retained symbols. The section-GC library build is required for this measurement: without it, any reference into bcm.c.o retains the whole object and masks the anchor. Measured locally: the single EVP_parse_public_key call grows the dead-stripped consumer by ~418 KB.
justsmth
force-pushed
the
openssl-small-nistz-asm-and-size-harness
branch
from
July 20, 2026 12:27
7ed868e to
d905ec1
Compare
torben-hansen
approved these changes
Jul 20, 2026
justsmth
enabled auto-merge (squash)
July 20, 2026 18:27
justsmth
added a commit
to justsmth/aws-lc
that referenced
this pull request
Aug 4, 2026
Two things were inaccurate, both found while auditing the OPENSSL_SMALL build after aws#3319, aws#3320, aws#3350 and aws#3368. MY_ASSEMBLER_IS_TOO_OLD_FOR_ADX_AVX2 was documented as gating the "ADX/AVX2/BMI2" code paths, but it does not gate BMI1/BMI2 at all. A mnemonic census of the generated x86_64 assembly shows the real dividing line is adcx/adox: every file this flag gates emits them, and the files left in the AVX tier emit only mulx, rorx and andn. Concretely, chacha20_poly1305_x86_64.S has mulx=92 with adcx=adox=0, sha1-x86_64.S has rorx=320/andn=40, and aesni-sha256-x86_64.S has rorx=288/andn=48 -- all AVX-tier-gated -- while x86_64-mont.S (mulx=31, adcx=35, adox=29) and p256-x86_64-asm.S (mulx=100, adcx=86, adox=90) are gated here. So the existing gating is correct; only the comment was wrong. MY_ASSEMBLER_IS_TOO_OLD_FOR_AVX is not fully effective without Perl, which was undocumented. The ADX and AVX-512 tiers are also expressed as #ifndef guards inside the pre-generated assembly, so they still apply with DISABLE_PERL=ON; the AVX tier is not. Measured with -DDISABLE_PERL=ON -DMY_ASSEMBLER_IS_TOO_OLD_FOR_AVX=ON, the objects for chacha-x86_64, chacha20_poly1305_x86_64, ghash-x86_64, sha1-x86_64, aesni-sha256-x86_64, rsaz-avx2 and aes128gcmsiv-x86_64 are byte-identical to a build without the flag, with identical ymm counts. Emitting those guards is a larger change (nine scripts, win64 SEH .rva tables, and a full generated-src regeneration) and is left as follow-up; document the current contract and warn at configure time instead. Also note in run_legacy_avx_tests.sh that its DISABLE_PERL=ON leg cannot detect this, since it only checks that the build succeeds, and record that chacha-x86_64.pl's unreachable $avx>2 AVX-512 blocks would need a 512AVX gate if ever enabled. No functional change beyond the new configure-time warning.
social4hyq
pushed a commit
to social4hyq/homebrew-core
that referenced
this pull request
Sep 20, 2026
aws-lc 5.4.0 Created-by: HarmonybrewBot Commit-by: HarmonybrewBot Merged-by: HarmonybrewBot Description: Created by `brew bump` --- Created with `brew bump-formula-pr`.<details> <summary>release notes</summary> <pre>## What's Changed * Add AArch64 NEON runtime fallback for ML-KEM and ML-DSA by @samuel40791765 in aws/aws-lc#3353 * Support for `EVP_AEAD_CTX_copy` by @justsmth in aws/aws-lc#3332 * ci:ctest timing summary for MacOS by @dougch in aws/aws-lc#3288 * Remove dead P-256 nistz asm under OPENSSL_SMALL and extend the size-check harness by @justsmth in aws/aws-lc#3350 * Use built-in Camellia in krb5 integration patch; fix CTS doc label by @WillChilds-Klein in aws/aws-lc#3349 * Bump to v5.4.0, add AES-KWP wrap/unwrap CASTs by @WillChilds-Klein in aws/aws-lc#3366 **Full Changelog**: https://github.com/aws/aws-lc/compare/v5.3.0...v5.4.0</pre> <p>View the full release notes at <a href="https://github.com/aws/aws-lc/releases/tag/v5.4.0">https://github.com/aws/aws-lc/releases/tag/v5.4.0</a>.</p> </details> <hr> See merge request: Harmonybrew/homebrew-core!14833
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issues:
Addresses: aws/aws-lc-rs#745, P353434599
Related: #3319, #3320
Description of changes:
Follow-up to the
OPENSSL_SMALLsize work in #3319/#3320. Two independent changes, one per commit:Drop P-256 nistz assembly under
OPENSSL_SMALL.p256-nistz.cis compiled out entirely in this configuration (ec.cdispatches P-256 to the fiat-crypto implementation), so the nistz assembly --p256-{x86_64,armv8}-asmandp256_beeu-{x86_64,armv8}-asm-- is fully unreferenced on both architectures. This removes it from the build using the sameif(OPENSSL_SMALL)list-removal pattern established for s2n-bignum in Gate s2n-bignum _alt variants under OPENSSL_SMALLย #3320. Like the EC removal there, this is pure dead-code elimination: it shrinks shared-library artifacts, but static consumers were already dropping these unreferenced objects at link time. The non-OPENSSL_SMALLbuild is unchanged.Extend the binary-size CI harness (from Gate s2n-bignum _alt variants under OPENSSL_SMALLย #3320) to measure GC-enabled consumers and the key-parsing anchor. The most important chunk a static consumer inherits from libcrypto is the ML-KEM/ML-DSA code retained by
asn1_evp_pkey_methods[]: any consumer that parses an EVP key pulls it in, and no linker orOPENSSL_SMALL-style change can drop it -- only a future API-reduction build option can. This adds a second, section-GC library build (matching how aws-lc-rs/CcBuilder compiles the library) and a variant of the consumer that callsEVP_parse_public_key, so CI reports the anchor cost on every run. This makes the motivation for that future work concrete and quantifiable, and gives subsequent size PRs a realistic consumer-impact number rather than just an archive-size delta.Call-outs:
-ffunction-sections -fdata-sections, any reference intobcm.c.oretains the whole object and masks the anchor.Testing:
openssl-small.ymlmatrix (full test suite, x86_64 + aarch64, gcc + clang) and the shared-library link (which proves no removed object is still referenced).OPENSSL_SMALLshared-lib links cleanly,nmconfirms the previously-deadecp_nistz256_*/beeu_*symbols are gone, and the fullcrypto_testsuite passes.EVP_parse_public_keycall pulls in ~574 KB (x86_64) / ~634 KB (aarch64), per the CI runs of this PR -- confirming the anchor the harness is meant to track.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.