Conflicting TPM2 engines and storage formats
David Woodhouse
Quoted 12 lines · James Bottomley
src/tpm2-tss-engine-common.h TSS2_RC init_tpm_key(ESYS_CONTEXT **ctx, ESYS_TR · line 59
Quoted 10 lines
src/tpm2-tss-engine-common.h +1
-2@@ -55,8 +55,7 @@ TSS2_RC init_tpm_key(ESYS_CONTEXT **ctx, ESYS_TR *keyHandle, .objectAttributes = (TPMA_OBJECT_USERWITHAUTH | \ TPMA_OBJECT_RESTRICTED | \ TPMA_OBJECT_DECRYPT | \ - TPMA_OBJECT_FIXEDTPM | \ - TPMA_OBJECT_FIXEDPARENT | \ + TPMA_OBJECT_NODA | \This is the only troubling change, the rest looks fine to me. The
Quoted 8 lines
template for a TPM created key *must* contain those two flags. NODA is one of those things which should be specified on the command line rather than hard coded as well. So to be exact, you need an extra command line flag for whether or not you want
TPMA_OBJECT_NODA(some keys would like DA protection, especially private VPN ones, but the creator of the key should ultimately decide) and if you have a TPM create key you needTPMA_OBJECT_FIXEDTPMandTPMA_OBJECT_FIXEDPARENTbut if you're wrapping an existing key they have to be clear.
This is for generating the primary key. It looks like your code always sets NODA, but *not* FIXEDTPM and FIXEDPARENT.
The tpm2-tss engine does set FIXEDTPM and FIXEDPARENT, but not NODA.
As noted, the above patch comes from blindly making tpm2-tss-engine look like your code, without even looking at what the flags mean :)
I don't see why you set NODA on the primary key which has no auth anyway, and you seem to be saying that the lack of FIXED{TPM,PARENT} on your side is also problematic? Does that mean we should be changing your code to match what's in tpm2-tss-engine?