parallaxsecond / rust-tss-esapi

TSS 2.0 Enhanced System API (ESAPI) Rust wrapper
https://docs.rs/tss-esapi/
Apache License 2.0
85 stars 51 forks source link

20240604 506 create loaded #529

Open Firstyear opened 2 months ago

Firstyear commented 2 months ago

Fixes #506

Start on created loaded.

Create loaded appears to work in the base case, but when using it for key derivation, it appears to be failing with:

[2024-06-05T04:39:58Z ERROR tss_esapi::context::tpm_commands::object_commands] Error in creating derived key: 0x000002D2
thread 'context_tests::tpm_commands::object_commands_tests::test_create_loaded::test_create_loaded_tpm_alg_kdf1_sp800_108' panicked at tss-esapi/tests/integration_tests/context_tests/tpm_commands/object_commands_tests.rs:519:14:
Failed to create derivation parent.: TssError(Tpm(FormatOne(TpmFormatOneResponseCode { error_number: Scheme, argument_number: Parameter(2) })))

I'm pretty sure I'm making a mistake in the derive_parent_public PublicBuilder parameters that I'm setting. Per the spec, this does need to be keyed hash, but I think given the parameters I've set, I think that we need to set the KDF1SP800_108 as the scheme when we create this key - currently though I think that's not possible as KeyHashSchemes are just for Xor and Hmac, not derivation.

So any advice would be more than welcome on how to proceed next :)