Add KeyStack PTA - #1104
Conversation
|
Replace #831 with this PR to maintain the compatibility with the mainline OP-TEE OS. |
6c43996 to
8ab855f
Compare
| // TODO: Replace this placeholder with the UUID agreed upon with the | ||
| // consuming TA before this PTA is treated as a stable interface. | ||
| pub(crate) const UUID: TeeUuid = TeeUuid { | ||
| time_low: 0x978a_f7a7, | ||
| time_mid: 0x074f, | ||
| time_hi_and_version: 0x4f59, | ||
| clock_seq_and_node: [0xb3, 0xae, 0x33, 0xa5, 0x93, 0xc1, 0xd4, 0x88], | ||
| }; |
d575fc8 to
a3a7ee0
Compare
|
|
||
| /// Open a session to a PTA that carries no per-session state and takes no | ||
| /// parameters at session-open time. | ||
| pub(crate) fn open_default_pta_session(params: &UteeParams) -> Result<u32, TeeResult> { |
There was a problem hiding this comment.
default_pta is a bit confusing. This implies a Default PTA that would be invoked.
Looking at the definition, this seems like some setup/validation.
| )?; | ||
|
|
||
| // Derive keys from max SVN down to 0 | ||
| for svn_idx in (0..svn_key_stack_size).rev() { |
There was a problem hiding this comment.
If the input parameter has 2047, this section will create all the keys, but only send keys with svns <= ta_svn.
Does it make sense to only generate min(svm_key_stack_size, ta_svn) keys instead?
There was a problem hiding this comment.
We can't do that because this key derivation is based on a sequential hash chain. It should compute a key with the maximum SVN first. That is, Key_v10 can be derived from Key_v11, but not from Key_v9.
a3a7ee0 to
9c84927
Compare
8024775 to
dda3c8d
Compare
|
🤖 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. |
This PR introduces a KeyStack PTA which derives a stack of keys based on a requesting TA's UUID, Secure Version Number (SVN), and extra data, enabling anti-rollback key derivation.