Skip to content

Conversation

@stefanberger
Copy link
Contributor

This series adds support for ML-DSA PQC key support to the library and evmctl and adds test cases for signing and verifying to the sign_verfiy.test. It requires availability of OpenSSL 3.5.

@stefanberger stefanberger changed the base branch from next to next-testing June 27, 2025 15:12
@stefanberger stefanberger force-pushed the mldsa branch 7 times, most recently from 1a1ad73 to b04726b Compare June 30, 2025 19:51
@stefanberger stefanberger marked this pull request as draft July 1, 2025 21:19
@stefanberger stefanberger force-pushed the mldsa branch 8 times, most recently from 80459bf to 37929f9 Compare July 2, 2025 23:56
Disable the following warning to be able to keep the name in a printf
string as other functions already do.

WARNING: Prefer using '"%s...", __func__' to using 'sign_hash_v1', this function's name, in a string

Signed-off-by: Stefan Berger <[email protected]>
In the imaevm_signhash API, replace the unsized sig parameter array
with an expected pointer to an array sig[MAX_SIGNATURE_SIZE - 1]. This
conversion at least enforces the correct size for the array for
the imaevm_signhash call inside evmctl.c as well as another known user
of the library, namely the rpmsign tool.

Signed-off-by: Stefan Berger <[email protected]>
To overcome the limitations of imaevm_signhash API call, implement
imaevm_signhash2 that takes a pointer to a buffer pointer for the
signature and therefore allows the called function to allocate a buffer.
Allocate a buffer if the user provided no buffer or a buffer that
is smaller than MAX_SIGNATURE_SIZE - 1.

Signed-off-by: Stefan Berger <[email protected]>
OpenSSL >= v3.5.0 supports signing with ML-DSA-44/65/87. Add support for
it to the library. Since the ML-DSA signatures require a lot more space
for the signature now, increase the size of the array where the signatures
are stored. The following are the sizes of ML-DSA signatures by key type:

- ML-DSA-44: 2420
- ML-DSA-65: 3309
- ML-DSA-87: 4627

The size of extended attributes may be smaller than what is required by the
ML-DSA signature size, and therefore may not be possible to store
for example ML-DSA-87 signatures. Nevertheless, extend the
MAX_SIGNATURE_SIZE to the required size of ML-DSA-87 and display an error
if writing the signature of a size larger than 4k did not work.

Since IMA in the kernel hashes all files before verifying the signature
against the hash, we have to use ML-DSA in pre-hash mode. For this, support
the sha-2 family of hashes that are also supported on the evcmtl command
line using '-a'.

Signed-off-by: Stefan Berger <[email protected]>
Create mldsa-44 & mldsa-65 keys if mldsa44 can be created with the
installed version of OpenSSL. Add test cases for signing and verifying with
these types of keys.

Do not test with mldsa-87 keys since the signatures they create may be
too large for some filesystems' xattrs. On btrfs, however, it is possible
to store their large signatures.

Signed-off-by: Stefan Berger <[email protected]>
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