Skip to content

Add support for V3 signatures for EVM & IMA for all supported key types#29

Open
stefanberger wants to merge 6 commits intolinux-integrity:next-testingfrom
stefanberger:v3-for-all-schemes
Open

Add support for V3 signatures for EVM & IMA for all supported key types#29
stefanberger wants to merge 6 commits intolinux-integrity:next-testingfrom
stefanberger:v3-for-all-schemes

Conversation

@stefanberger
Copy link
Contributor

@stefanberger stefanberger commented Feb 27, 2026

This PR adds support for the V3 signatures for EVM & IMA for all supported key types. It implements a imaevm_create_sigv3() library function that takes the file hash as input and creates the hash of the ima_file_id needed for V3 signatures.

Add a few test cases for V3 signature creation and verification to sign_verify.test.

Later on, inside this function, we will check whether the signing key is an ML-DSA key and pass the ima_file_id structure to ML-DSA pure-mode signing saving the cycles for hashing this structure. Avoiding the hashing here will also save cycles when being able to avoid the hashing upon signature verification in Linux IMA.

Signature verification of V3 signatures is already supported in imaevm_verify_hash() through fsverify's V3 signature support.

@stefanberger stefanberger force-pushed the v3-for-all-schemes branch 3 times, most recently from e72e058 to 7d62b78 Compare March 1, 2026 05:21
@stefanberger stefanberger changed the title Add support for V3 signatures for IMA for all supported key types Add support for V3 signatures for EVM & IMA for all supported key types Mar 1, 2026
xattr_type = EVM_IMA_XATTR_DIGSIG;

if (evm_immutable)
sig[1] = 3; /* immutable signature version */
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 am not sure why this was '3'.

Implement imaevm_create_sigv3 that creates v3 signatures. This function
will now also allocate a buffer if the caller did not provide one.
Further, it will write the full signature into the signature buffer,
including the leading xattr type byte.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Add support for signing IMA signatures with the V3 signing scheme.
Introduce a global variable that states which signing scheme to
use and for now set it to SIGNATURE_V2. Implement the SIGNATURE_V3
case where necessary for IMA.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Add support for signing EVM signatures with the V3 signing scheme.
Implement the SIGNATURE_v3 case where necessary for EVM.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Enable both IMA and EVM file signatures with a new --v3 option that sets
the previously introduced global variable that states which signature
version to use.

Similarly, introduce a --v2 option for users to (already) choose old V2
type of signatures.

Update the README with the dump of the evmctl help screen and mention
v3 signature format.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Add the new --v3 option to the sign_verify_ima test cases.

Adjust openssl signature verification to build ima_file_id structure in
a file that is then used for signature verification rather than the
plain file (as before).

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Convert the code that built the fsverity signature with V3 signing scheme
to use the new imaevm_create_sigv3 function.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
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