tpm2-tss icon indicating copy to clipboard operation
tpm2-tss copied to clipboard

Creating a primary key with the FAPI with an empty "unique" field

Open ahllamas opened this issue 1 year ago • 4 comments

I'm trying to create the keys based on the TCG specification: https://trustedcomputinggroup.org/wp-content/uploads/TPM-2p0-Keys-for-Device-Identity-and-Attestation_v1_r12_pub10082021.pdf

When creating a primary signing key under the endorsement hierarchy the unique field gets populated automatically. Is there any way to disable this behavior?

ahllamas avatar Nov 16 '23 23:11 ahllamas

If you use the tpm2 tool command tpm2_createprimary you can disable the output with the quiet option -Q.

JuergenReppSIT avatar Nov 17 '23 16:11 JuergenReppSIT

Sorry I was to fast and didn't read your question correctly. The unique field is initialized according to EK credential profile for the EK (/HE/EK). If you create a primary signing key in the endorsement hierarchy (e.g. /HE/mykey) with the attributes "user,sign" this initialization is not done.

JuergenReppSIT avatar Nov 17 '23 17:11 JuergenReppSIT

I tried doing this and still the unique field being populated for both "restricted, sign, user" and "user, sign". So, the FAPI assumes that any primary key under HE is an EK?

ahllamas avatar Nov 20 '23 17:11 ahllamas

I have created a primary signing key with FAPI: tss2_createkey -p /P_RSA2048SHA256/HE/mykey -t "user,sign" and with the tpm tools: tpm2_createprimary -Grsa2048 -C e -c prim.ctx -a "fixedtpm|fixedparent|sensitivedataorigin|userwithauth|sign In both cases the same public key is produced. The unique field is empty when Esys_CreatPrimary is called. But if the key has to be recreated (e.g. for tss2_sign) the key is incorrectly created under the storage hierarchy. I will create a PR to fix this problem.

JuergenReppSIT avatar Nov 21 '23 09:11 JuergenReppSIT