Skip to content

metadata: adding sha256 integrity check support#116

Open
PThierry wants to merge 8 commits into
camelot-os:mainfrom
PThierry:sha256-integration
Open

metadata: adding sha256 integrity check support#116
PThierry wants to merge 8 commits into
camelot-os:mainfrom
PThierry:sha256-integration

Conversation

@PThierry

@PThierry PThierry commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Adding boot-time sha256 integrity check based on metadata_sha256 field of each task metadata.

This feature is based on two parts:

  • genmetadata that forge each task metadata blob with a zeroified metadata_sha256 field, and then calculate it and amend this field with correct value
  • kernel task manager initialization state automaton, that recalculate the sha256 value at boot time for each task and compare the calculate sha256 with the original one.

Note that this feature is a simple integrity check. metadata authenticity aim to be verified in a trusted boot model that validate cryptographic signature of both kernel and metadata before booting the kernel.
Tasks effective sha256 is not a part of this PR, meaning that the metadata field denoted "task_metadata" is kept to 0 by now. This part (checking effective integrity of user tasks against their sha256 hash at kernel boot time as a continuation of the trusted boot process) will be made in another, dedicated, pull request.

Closes #52

This PR has no impact on kernel ABI, metadata being a kernel internal manipulation through genmetadata tooling of this very same repository.

@PThierry PThierry added this to the v0.5.0 milestone Apr 29, 2026
@PThierry PThierry requested a review from a team April 29, 2026 16:52
@PThierry PThierry added the enhancement New feature or request label Apr 29, 2026
PThierry and others added 3 commits May 1, 2026 08:15
Use C++20 std::span and std::as_bytes to serialize reflactable metadata
to std::vector<std::byte>, remove duplicate code for vector and ofstream output.
Write to file is out of scope of serialization.
@fvalette fvalette force-pushed the sha256-integration branch from e29335a to ee3c096 Compare May 2, 2026 13:55
@PThierry

Copy link
Copy Markdown
Contributor Author

Modify the way the sha256 calculation is made in order to avoid sha256 field special case. sha256 should be made over metada upto (but not containing) the sha256 metadata integrity field.
task memory sha256 is, in this PR, kept to 0, and metadata sha256 if made over metadata fields excepting metadata_sha256. This field is append to the metadata blob afterward.
This avoid any reset to 0 fields and thus avoid any runtime copy.
Note that the task memory sha256 is not a part of this PR.

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

Labels

enhancement New feature or request

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Metadata: sha support for input

2 participants