Skip to content

Support additional binary measurement lists#44

Closed
stefanberger wants to merge 0 commit into
linux-integrity:next-testingfrom
stefanberger:support_other_hashes
Closed

Support additional binary measurement lists#44
stefanberger wants to merge 0 commit into
linux-integrity:next-testingfrom
stefanberger:support_other_hashes

Conversation

@stefanberger

Copy link
Copy Markdown
Contributor

This PR extends evmctl ima_measurement to also allow reading of the sha256, sha384, and sha512 binary logs. So far only the sha1 log was supported.

@stefanberger stefanberger force-pushed the support_other_hashes branch 2 times, most recently from 604a3d9 to 994ef16 Compare May 27, 2026 18:34

@mimizohar mimizohar left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ima_show() is used for displaying the original "ima" template. Changing the template_entry structure unfortunately affects ima_show().

@mimizohar mimizohar left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Update the Subject line to "evmctl: support additional binary measurement lists".

For each enabled TPM bank, the Linux kernel creates an associated securityfs ascii and binary measurement list. "evmctl ima_measurement" calculates and verifies each enabled TPM PCR value, based on the SHA1 binary measurement list. Extend "evmctl ima_measurement" support to calculate and verify the TPM PCR value based on the specific hash algorithm binary measurement list.

  1. Please use checkpatch.pl

WARNING: 'accomodating' may be misspelled - perhaps 'accommodating'?

  1. checkpatch.pl

WARNING: break is not useful after a return
107: FILE: src/evmctl.c:2362:
return EVP_get_digestbyname(default_algos[i]);
break;

@stefanberger stefanberger force-pushed the support_other_hashes branch 4 times, most recently from 6c7bcfa to ffd9432 Compare June 2, 2026 12:23
@stefanberger

Copy link
Copy Markdown
Contributor Author

strlcpy is not available in older distros ...

@stefanberger stefanberger changed the title Add support for reading sha256, sha384, and sha512 binary logs in ima_measurement Support additional binary measurement lists Jun 2, 2026
@stefanberger stefanberger force-pushed the support_other_hashes branch from ffd9432 to 3de7c4a Compare June 2, 2026 13:49
@mimizohar

Copy link
Copy Markdown
Collaborator

strlcpy is not available in older distros ...

Instead of removing strlcpy from checkpatch.pl, add STRLCPY to the checkpatch --ignore list.

@stefanberger stefanberger force-pushed the support_other_hashes branch from 3de7c4a to ff52c88 Compare June 2, 2026 13:57
@stefanberger

Copy link
Copy Markdown
Contributor Author

strlcpy is not available in older distros ...

Instead of removing strlcpy from checkpatch.pl, add STRLCPY to the checkpatch --ignore list.

Using snprintf now. Dropped the checklist modification.

@mimizohar mimizohar left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The subject line must describe both what the patch changes, as well as why the patch is necessary. Update the subject line to "Extend "evmctl ima_measurement" to support sha256 binary measurement logs".

The patch description is a bit off as well. Please prefix the patch description with:

For each enabled TPM bank, the Linux kernel creates an associated securityfs ascii and binary measurement list in "<securityfs>/integrity/ima". In addition, even if the TPM sha1 bank is not configured, the Linux kernel for the time being creates sha1 securityfs ascii and binary measurement lists.

"evmctl ima_measurement" currently only supports the sha1 binary
measurement log as input. Therefore, extend the support for ima_measurement to also support sha256 and other binary measurement logs as input.

Both the binary measurement list and the TPM PCRs may be saved and provided as options to "evmctl ima_measurement". Derive the hash algorithm to use for calculations based on the binary measurement log name [...]

@mimizohar mimizohar left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed comment.

@stefanberger

Copy link
Copy Markdown
Contributor Author

Since the binary measurement lists stored in <securityfs>/integrity/ima/ are dependent on the TPM banks configured, there's no difference between the binary_runtime_measurements_sha256 and other binary_runtime_measurement logs.

That's not true, they are different and that's the reason why this patch series is needed.

@stefanberger stefanberger force-pushed the support_other_hashes branch from ff52c88 to e946f61 Compare June 2, 2026 18:37
@mimizohar

mimizohar commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator

Since the binary measurement lists stored in <securityfs>/integrity/ima/ are dependent on the TPM banks configured, there's no difference between the binary_runtime_measurements_sha256 and other binary_runtime_measurement logs.

That's not true, they are different and that's the reason why this patch series is needed.

The binary_runtime_measurement logs are created based on the TPM enabled PCR banks. There's no difference between adding sha256 and other binary_runtime_measurement logs. (The last patch updates the default_algos[] and algorithm_map[].)

Updated: true, this patch adds the additional sha384 and sha612 TPM banks.

@stefanberger stefanberger force-pushed the support_other_hashes branch from e946f61 to 6a19a1b Compare June 4, 2026 12:59
@stefanberger stefanberger force-pushed the support_other_hashes branch from 6a19a1b to 5cbc335 Compare June 8, 2026 18:44
@stefanberger stefanberger deleted the support_other_hashes branch June 8, 2026 18:45
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.

2 participants