Hello, everybody!
I am a newbie to the TPM programming, today I met a problem, and hopes
somebody can help me.
I am using the TPM 1.2 and trousers 0.3.7. The referenced book is <A
Practical Guide to Truested Computing> from IBM press. This is the only
book I have. when studying the chapter 8, in page 109, the function
MyFunc_WrapKey try to do this:
TSS_RESULT
MyFunc_WrapKey(char *path,TSS_HKEY hParentKey,TSS_FLAG initFlags,TSS_HPCRS
hPcrs,TSS_HKEY *hKey)
{
//read a key file like test.pem created by Openssl
if ((rsa = openssl_read_key(path)) == NULL) {
printf("Failed opening OpenSSL key file!\n");
return TSS_E_FAIL;
}
//actually I don't understand why this should be done.
result = Tspi_TPM_OwnerGetSRKPubKey(hTPM, &pubKeyLen, &pubKey);
Tspi_Context_FreeMemory(hContext, pubKey);
// get a key size. you can assume it TSS_KEY_SIZE_1024
keySize = get_tss_key_size(RSA_size(rsa) * 8));
//It create a key in proper size
result = Tspi_Context_CreateObject(hContext, TSS_OBJECT_TYPE_RSAKEY,
keySize | initFlags, hKey);
if(openssl_get_modulus_and_prime(rsa, &sizeN, n, &sizeP, p) != 0) {
.......
}
/* set the public key data in the TSS object */
result = Tspi_SetAttribData(*hKey, TSS_TSPATTRIB_KEY_BLOB,
TSS_TSPATTRIB_KEYBLOB_PUBLIC_KEY,
sizeN, n);
/* set the private key data in the TSS object */
result = Tspi_SetAttribData(*hKey, TSS_TSPATTRIB_KEY_BLOB,
TSS_TSPATTRIB_KEYBLOB_PRIVATE_KEY,
sizeP, p);
result = Tspi_Key_WrapKey(*hKey, hParentKey, hPcrs);
return result;
}
I list the core code of this function. Executing this,
the Tspi_SetAttribData function returns an error "TSS_E_OUTOFMEMORY". ! I'm
so confused, may anyone tell me why this happens? How can this problem be
solved?
I really need your help, sorry for my bad english. Thank you all!
Best regards!
Darcy.
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
TrouSerS-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/trousers-users