Esys primary key creation error
FIXED-TERM Schick Felix (CR/APA3)
Hello Everybody,
I am currently experimenting with the Esys-API and have encountered a problem during the primary key creation.
TPM2B_PUBLIC * primaryOutPublic;
TPM2B_CREATION_DATA * primaryCreationData;
TPM2B_DIGEST * primaryCreationHash;
TPMT_TK_CREATION * primaryCreationTicket;
ESYS_TR primaryObjectHandle;
// Create primary key
rc = Esys_CreatePrimary(esysContext, ESYS_TR_RH_OWNER, ESYS_TR_NONE, ESYS_TR_NONE, ESYS_TR_NONE,
&primaryInSensitive, &primaryInPublic, &outsideInfo, &creationPCR,
&primaryObjectHandle, &primaryOutPublic, &primaryCreationData, &primaryCreationHash, &primaryCreationTicket);
if( rc != TSS2_RC_SUCCESS){
std::cerr << "Creation of primary key failed with " <<
"response code: 0x"<< std::hex << rc << std::endl;
Esys_Finalize(&esysContext);
return EXIT_FAILURE;
}I get the following error:
ERROR:esys:src/tss2-esys/esys_iutil.c:1178:check_session_feasibility() Not enough sessions provided for the command. ERROR:esys:src/tss2-esys/api/Esys_CreatePrimary.c:208:Esys_CreatePrimary_Async() Check session usage ErrorCode (0x0007000b) ERROR:esys:src/tss2-esys/api/Esys_CreatePrimary.c:110:Esys_CreatePrimary() Error in async function ErrorCode (0x0007000b)
I hope this is enough context for the trained eye, I would be very grateful for help with this issue. Thank you very much
Felix Schick
Roberts
You have ESYS_TR_NONE for the 3 session handles, you need someway to authorize yourself to the hierarchy. This is accomplished via session handles. If you just need to use a password, set the first session parameter to ESYS_TR_PASSWORD. Then you will authorize to the hierarchy using the implicit password session and an empty or blank password. If you need a specific password, you can use Esys_TR_SetAuth, and use the hierarchy as parameter 2 and the auth structure populated as argument 3.
Something like this:
rc = Esys_CreatePrimary(esysContext, ESYS_TR_RH_OWNER,
ESYS_TR_PASSWORD, ESYS_TR_NONE, ESYS_TR_NONE, &primaryInSensitive, &primaryInPublic, &outsideInfo, &creationPCR, &primaryObjectHandle, &primaryOutPublic, &primaryCreationData, &primaryCreationHash, &primaryCreationTicket);
Quoted 82 lines
-----Original Message-----
From: FIXED-TERM Schick Felix (CR/APA3) <fixed-
term.Felix.Schick3(a)bosch.com>
Sent: Thursday, August 20, 2020 8:54 AM
To: tpm2(a)lists.01.org
Subject: [tpm2] Esys primary key creation errorHello Everybody,
I am currently experimenting with the Esys-API and have encountered a problem during the primary key creation.
TPM2B_PUBLIC * primaryOutPublic; TPM2B_CREATION_DATA * primaryCreationData; TPM2B_DIGEST * primaryCreationHash; TPMT_TK_CREATION * primaryCreationTicket; ESYS_TR primaryObjectHandle; // Create primary key rc = Esys_CreatePrimary(esysContext, ESYS_TR_RH_OWNER, ESYS_TR_NONE,
ESYS_TR_NONE,ESYS_TR_NONE,&primaryInSensitive, &primaryInPublic, &outsideInfo, &creationPCR,
&primaryObjectHandle, &primaryOutPublic, &primaryCreationData,
&primaryCreationHash, &primaryCreationTicket);if( rc != TSS2_RC_SUCCESS){ std::cerr << "Creation of primary key failed with " << "response code: 0x"<< std::hex << rc << std::endl; Esys_Finalize(&esysContext); return EXIT_FAILURE; }I get the following error:
ERROR:esys:src/tss2-esys/esys_iutil.c:1178:check_session_feasibility() Not enough sessions provided for the command.
ERROR:esys:src/tss2- esys/api/Esys_CreatePrimary.c:208:Esys_CreatePrimary_Async() Check session usage ErrorCode (
0x0007000b)ERROR:esys:src/tss2-esys/api/Esys_CreatePrimary.c:110:Esys_CreatePrimary() Error in async function ErrorCode (
0x0007000b)I hope this is enough context for the trained eye, I would be very grateful for help with this issue.
Thank you very much
Felix Schick