You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add vtpm_util for provisioning of file-backed vtpm for disk-unlock workflows. - #4475
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds cvmutil support for vTPM provisioning, sealed-key workflows, TPM import/export, and socket-based TPM simulation.
Changes:
Extends TPM protocol and library helpers.
Adds sealing, unsealing, SRK, and import/export workflows.
Adds persistent vTPM socket simulator support.
Registers the new workspace package and dependencies.
File summaries
File
Description
vm/devices/tpm/tpm_protocol/src/tpm20proto.rs
TPM compatibility parsing and structure updates
vm/devices/tpm/tpm_protocol/Cargo.toml
Adds tracing dependency
vm/devices/tpm/tpm_lib/src/lib.rs
TPM helpers, SRK templates, and tests
vm/devices/tpm/tpm_device/src/lib.rs
TPM handle and index constants
vm/cvmutil/src/vtpm_sock_server.rs
Socket-based TPM simulator
vm/cvmutil/src/vtpm_helper.rs
vTPM engine and state callbacks
vm/cvmutil/src/marshal.rs
Sealed-key and AF-split serialization
vm/cvmutil/src/main.rs
CLI workflows and TPM operations
vm/cvmutil/Cargo.toml
New utility package dependencies
Cargo.toml
Workspace membership
Cargo.lock
Dependency lock updates
Review details
Suppressed comments (5)
vm/cvmutil/Cargo.toml:7
The newly added cvmutil exposes multiple user-facing provisioning, sealing, import/export, and socket-server commands, but there is no corresponding Guide developer-tool page or SUMMARY/mapping entry. This leaves the documented command contract and security-sensitive workflow out of the repository documentation.
[package]
name = "cvmutil"
edition.workspace = true
rust-version.workspace = true
vm/cvmutil/src/main.rs:35
The new cvmutil command-line tool introduces multiple user-facing commands, but it has no corresponding Guide documentation or entry. Please add a developer-tool/reference page covering the flags, argument order, blob formats, and socket ports, and link it from Guide/src/SUMMARY.md; this is needed to keep the user-facing interface discoverable and synchronized.
#[derive(Parser, Debug)]
#[clap(name = "cvmutil", about = "Tool to interact with vTPM blobs.")]
vm/cvmutil/src/vtpm_sock_server.rs:315
The Stop command only returns success and breaks the control-client loop; it never changes running, so the server and data listener continue accepting connections. A simulator client requesting Stop cannot actually stop this server.
The documented bind address accepts port 65535, but adding one for the control listener overflows u16 and panics. Reject the maximum data port (or choose a separately validated control port) before performing this addition.
// Parse the bind address to extract host and port
let (host, data_port) = parse_bind_address(bind_addr);
let ctrl_port = data_port + 1; // Control port is typically data_port + 1
tracing::info!("Data port: {}, Control port: {}", data_port, ctrl_port);
vm/cvmutil/src/vtpm_sock_server.rs:355
The TPM simulator acknowledges MS_SIM_NV_ON with success without changing any TPM state. Clients use this control command to enable NV access before issuing commands; reporting success while leaving NV disabled can make subsequent provisioning fail or behave differently from the advertised simulator protocol. Implement the state transition or return an unsupported/error response.
ControlCommand::NvOn => {
tracing::info!("MS_SIM_NV_ON (TPM NV Enable) requested");
// This is the command that was failing
// Enable NV storage in the TPM
// The ms-tpm-20-ref might have specific methods for this
// For now, acknowledge success
vec![0x00, 0x00, 0x00, 0x00] // Success
Tpm2bPublic::deserialize accepts any encoded unique length, but this loop unconditionally indexes 256 bytes. A validly parsed SHA-256 public-area file with a short or empty unique field therefore panics instead of returning an error. Validate that this is an RSA-2048 public area (and its modulus length) before indexing, or iterate over the stored slice.
The validation section names -p cvmutil, but this new workspace package is vtpm_util (and there is no cvmutil package). Please correct the validation commands and rerun clippy, docs, and tests for vtpm_util; otherwise the stated validation does not cover this crate.
let import_blob = get_key_in_tpm2_import_format_rsa(&private_components)?;
write_key_files(
public_key_file,
&public_key_der,
private_key_tpm2b_file,
&import_blob,
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
Validation
cargo clippy --all-targets -p cvmutilcargo doc --no-deps -p cvmutilcargo test -p cvmutilcargo xtask fmt --fix