如何解决TPM编码中的“常规故障”错误

时间:2019-05-03 15:30:22

标签: tpm

我想使用tpm nvstore进行读写。程序运行到“ Tspi_NV_Definespace”时,出现“一般故障”。我想找到解决方法。

Tspi_Context_Create(&hContext);

Tspi_Context_Connect(hContext, NULL);//connect to local host

Tspi_Context_GetTPMObject(hContext, &hTPM);//get handle 

Tspi_GetPolicyObject(hTPM, TSS_POLICY_USAGE, &hOwnerPolicy);
Tspi_Policy_SetSecret(hOwnerPolicy, TSS_SECRET_MODE_PLAIN, strlen(secret), secret);//set secret

Tspi_Context_CreateObject(hContext, TSS_OBJECT_TYPE_NV, 0, &hNvStore);//create nvram object
Tspi_SetAttribUint32(hNvStore, TSS_TSPATTRIB_NV_INDEX, 0, 1);
Tspi_SetAttribUint32(hNvStore, TSS_TSPATTRIB_NV_PERMISSIONS, 0, TPM_NV_PER_AUTHWRITE);//permit to write


Tspi_SetAttribUint32(hNvStore, TSS_TSPATTRIB_NV_DATASIZE, 0, dataLen);

result = Tspi_NV_DefineSpace(hNvStore, 0, 0);

0 个答案:

没有答案