Repository navigation
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the ML-KEM feature-switch alignment.
No open issues 🎉
What changed in this PR
Aligns fwTPM’s ML-KEM parameter-set handling with wolfCrypt’s feature switches so subset builds report and validate the available sets and size buffers accordingly.
Changes:
- Adds shared availability macros used by buffer sizing, capability reporting, and
TestParms. - Adapts ML-KEM tests to enabled parameter sets and adds checks for accepting supported sets and rejecting unsupported ones.
- Updates English and Japanese build documentation to name the ML-KEM switches.
| File | Description |
|---|---|
wolftpm/fwtpm/fwtpm.h |
Defines parameter-set availability macros and applies them to buffer sizing. |
tests/fwtpm_unit_tests.c |
Adapts tests for subset builds and adds TestParms coverage. |
src/fwtpm/fwtpm_command.c |
Uses shared availability gates for capabilities and parameter validation. |
docs/ja/fwtpm/building.md |
Corrects ML-KEM switch names in Japanese documentation. |
docs/fwtpm/building.md |
Corrects ML-KEM switch names in English documentation. |
Review effort: Balanced
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.
The fwTPM decided which ML-KEM parameter sets it supports from
WOLFSSL_NO_KYBER512/768/1024. In wolfCrypt those switches only apply to the pre-standard Kyber variant (WOLFSSL_MLKEM_KYBER); FIPS 203 ML-KEM, which TPM 2.0 v1.85 uses, is controlled byWOLFSSL_NO_ML_KEM_512/768/1024, and that is what./configure --enable-mlkem=768sets. A wolfCrypt build with a subset of ML-KEM sets therefore produced a fwTPM that advertised all three inTPM_PT_ML_PARAMETER_SETS, accepted all three in theTPMI_MLKEM_PARMScheck, and sized its buffers for ML-KEM-1024, while key operations for the missing sets failed inside wolfCrypt. With every set enabled, as in the default build, the two name families agree, which is why it went unnoticed.Changes
wolftpm/fwtpm/fwtpm.h,src/fwtpm/fwtpm_command.c- the buffer sizing, theTPM_PT_ML_PARAMETER_SETSbits and the parameter-set check useFWTPM_NO_MLKEM_512/768/1024, which resolve a set's availability the waywc_mlkem.hdoes: present from FIPS 203 ML-KEM (WOLFSSL_NO_ML_KEM,WOLFSSL_NO_ML_KEM_*) or from original Kyber withWOLFSSL_MLKEM_KYBER(WOLFSSL_NO_KYBER*). Advertising,TestParms, buffer sizing and key creation now agree in every wolfCrypt ML-KEM mode.tests/fwtpm_unit_tests.c- the expectedTPM_PT_ML_PARAMETER_SETSvalue follows the enabled sets; generic ML-KEM tests use an enabled parameter set and set-specific ones (the ML-KEM-512 KATs, the ML-KEM-768 EK credential profile, the ML-KEM-1024 max buffer) are gated like the ML-DSA ones, so the suite runs on subset builds. A newTestParmstest checks that enabled ML-KEM sets are accepted and missing ones rejected withTPM_RC_PARMS.docs/fwtpm/building.md,docs/ja/fwtpm/building.md- name the switches the buffer sizing follows.Testing
fwtpm_serverbuilt against wolfSSL--enable-mlkem=768:TPM_PT_ML_PARAMETER_SETSwas0x3f(ML-KEM-512/768/1024 plus ML-DSA) before and is0x3a(ML-KEM-768 plus ML-DSA) after.make checkpasses on the default build.Scope
With original Kyber (
--enable-mlkem=original), the fwTPM now advertises the sets wolfCrypt provides, but ML-KEM key creation in that mode already fails withTPM_RC_FAILUREon master; that is unchanged here.Found while building a TPM 2.0 v1.85 fwTPM limited to ML-KEM-768 for the PolarFire SoC example in wolftpm-examples.