Skip to content

[2] [WIP] Certify TPM-created EdDSA keys - #1135

Draft
stefanberger wants to merge 13 commits into
masterfrom
stefanberger/swtpm_setup_pqc+eddsa
Draft

stefanberger wants to merge 13 commits into
masterfrom
stefanberger/swtpm_setup_pqc+eddsa

Conversation

@stefanberger

Copy link
Copy Markdown
Owner

No description provided.

Add a regular expression parser that can parse the following type of
string passed as description of a public key:

 pubkey=65ac32,algo=ml-kem-1024

If parsing it succeeds, then build the command line parameter for
swtpm_cert with the extracted parameters, otherwise fall back to trying
to parse for EC and RSA keys.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Extend the EK parameters table with parameters for an ML-KEM primary key
and implement functions for creating an ML-KEM primary key and also an
ML-KEM storage primary key (SPK).

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Extend the EK key algo table with options for ML-KEM keys as 1st and 2nd
EK keys. Since we are now depending on libtpms v0.11 with ML-KEM support,
it may not be necessary to test whether the key types are supported.
The user has to choose a profile that supports the requested key type,
though. A user currently has to used the 'default-v2' or a custom profile
where ML-KEM keys are enabled.

Print an error if IAK and IDevID keys are supposed to be ML-KEM keys.

Mention the new key algorithms in the the man pages for swtpm_setup.conf and
swtpm_setup.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Extend the EK, IAK, and IDevID tables with parameters for an ML-DSA
primary key and implement functions for creating an ML-DSA primary key.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Extend the EK key algo table with options for ML-DSA keys as 1st and 2nd
EK keys. Since we are now depending on libtpms v0.11 with ML-DSA support,
it may not be necessary to test whether the key types are supported.
The user has to choose a profile that supports the requested key type,
though. A user currently has to use the 'default-v2' or a custom profile
where ML-KEM keys are enabled.

Mention the new key algorithms in the the man pages for
swtpm_setup.conf and swtpm_setup.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Run TPM2_GetCapability(TPM_PROPERTIES) to query the TPM 2 for the maximum
NV buffer size that can be used for writing data to an NV space. With
the larger certificates it now makes sense to query when the number of
bytes to write is beyond 1kb.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Display the the type of storage primary key that was created and mention
in the help screen and man page that an ML-KEM key will be used instead of
a ML-DSA key.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
…setup

Add some test case for having swtpm_setup create ML-KEM and ML-DSA EK
keys.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Extend the test that is checking created EK certificates to now also
create ML-KEM and ML-DSA certificates. Don't try to use use tpm2_createek
with these key algorithms, since they are not supported by the tool, yet.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Add a test case that starts the TPM 2 with the default-v2 profile which
enables ML-KEM and ML-DSA and check that the TPM 2 cannot be initialized
when the buffer size is set to 5kb and that it can be initialized once
the buffer size is at 8kb.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
@stefanberger
stefanberger marked this pull request as draft June 4, 2026 15:07
@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: af3f3939-2506-4638-af43-c281b2792648

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch stefanberger/swtpm_setup_pqc+eddsa

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant