Skip to content

OP-TEE TA unique key derivation#780

Open
sangho2 wants to merge 2 commits intomainfrom
sanghle/optee/takey
Open

OP-TEE TA unique key derivation#780
sangho2 wants to merge 2 commits intomainfrom
sanghle/optee/takey

Conversation

@sangho2
Copy link
Copy Markdown
Contributor

@sangho2 sangho2 commented Apr 15, 2026

This PR implements OP-TEE's PTA_SYSTEM_DERIVE_TA_UNIQUE_KEY (https://github.com/OP-TEE/optee_os/blob/06c4e95e469c9c89e9ba4a6915d1be7bb8ea6fbc/core/pta/system.c#L62) for the OP-TEE shim.

@sangho2 sangho2 added the must-not-merge:blocked-on-other-changes Other changes/PRs to be handled first. Label not needed for non-main changes. label Apr 16, 2026
@sangho2 sangho2 changed the base branch from sanghle/prk to main April 17, 2026 02:07
@sangho2 sangho2 changed the base branch from main to sanghle/prk April 17, 2026 02:08
@sangho2 sangho2 force-pushed the sanghle/optee/takey branch from 00958ed to 0848e41 Compare April 17, 2026 02:58
@sangho2 sangho2 changed the title DRAFT: derive TA unique key OP-TEE TA unique key derivation Apr 17, 2026
@sangho2 sangho2 removed the must-not-merge:blocked-on-other-changes Other changes/PRs to be handled first. Label not needed for non-main changes. label Apr 17, 2026
@sangho2 sangho2 marked this pull request as ready for review April 17, 2026 03:19
@sangho2 sangho2 force-pushed the sanghle/optee/takey branch from ab718a2 to 3381d56 Compare May 1, 2026 03:47
Base automatically changed from sanghle/prk to main May 4, 2026 16:43
@sangho2 sangho2 added the must-not-merge:undergoing-restructuring Known deeper set of changes are happening on this PR before it is mergeable again label May 4, 2026
@sangho2 sangho2 force-pushed the sanghle/optee/takey branch from 3381d56 to 851eae4 Compare May 4, 2026 17:23
@sangho2 sangho2 removed the must-not-merge:undergoing-restructuring Known deeper set of changes are happening on this PR before it is mergeable again label May 4, 2026
@sangho2 sangho2 requested a review from Copilot May 4, 2026 21:23
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds OP-TEE-compatible support for PTA_SYSTEM_DERIVE_TA_UNIQUE_KEY in the OP-TEE shim by deriving a TA-unique key from a platform-provided root key using an HMAC-SHA256-based KDF, and wiring up the necessary platform-side derived-key plumbing.

Changes:

  • Implement TA-unique key derivation in litebox_shim_optee using DerivedKeyProvider + an HMAC-SHA256 shim-KDF callback.
  • Add common helpers/types needed by the derivation path (UteeParams::has_types, TeeUuid::to_le_bytes, HukSubkeyUsage, HUK_SUBKEY_MAX_LEN).
  • Enable derived-key support across platforms/runners (LVBS DerivedKeyProvider impl; Linux userland runner boot-id initialization) and add required crypto dependencies.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
litebox_shim_optee/src/syscalls/pta.rs Implements DeriveTaUniqueKey using HUK-derived subkeys via DerivedKeyProvider and HMAC-SHA256.
litebox_shim_optee/Cargo.toml Adds crypto deps (hmac/sha2/zeroize) and a new dev-dependency entry.
litebox_runner_optee_on_linux_userland/src/lib.rs Initializes boot-specific KDF support on the Linux userland platform before running TAs.
litebox_platform_lvbs/src/host/lvbs_impl.rs Implements DerivedKeyProvider for LVBS using the platform root key (PRK).
litebox_common_optee/src/lib.rs Adds UteeParams::has_types, TeeUuid::to_le_bytes, and OP-TEE HUK subkey usage identifiers/constants.
Cargo.lock Locks new dependency graph entries for added crypto crates.

Comment thread litebox_shim_optee/src/syscalls/pta.rs
Comment thread litebox_shim_optee/src/syscalls/pta.rs Outdated
Comment thread litebox_shim_optee/src/syscalls/pta.rs
Comment thread litebox_common_optee/src/lib.rs
Comment thread litebox_shim_optee/Cargo.toml Outdated
@sangho2 sangho2 added the must-not-merge:blocked-on-other-changes Other changes/PRs to be handled first. Label not needed for non-main changes. label May 5, 2026
@sangho2
Copy link
Copy Markdown
Contributor Author

sangho2 commented May 5, 2026

This PR and #828 do have some common code. Minor fix is needed once both (or one of these) are approved.

@sangho2 sangho2 removed must-not-merge:blocked-on-other-changes Other changes/PRs to be handled first. Label not needed for non-main changes. labels May 5, 2026
@sangho2 sangho2 force-pushed the sanghle/optee/takey branch from 4db8629 to 5dd298f Compare May 5, 2026 22:51
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 5, 2026

🤖 SemverChecks 🤖 No breaking API changes detected

Note: this does not mean API is unchanged, or even that there are no breaking changes; simply, none of the detections triggered.

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