From: Kent Y. <shp...@gm...> - 2007-09-24 18:39:53
|
Hi Hal, On 9/23/07, Hal Finney <hal...@gm...> wrote: > Having switched to using TSS_SECRET_MODE_POPUP in some of my tests, I > decided to try the TSS_TSPATTRIB_POLICY_POPUPSTRING feature which lets > you modify the prompt string that gets displayed in the popup. However > it is not working. The test program below pops up a dialog whose > prompt string is just "a" when it should be "abc". If I change to > using 8 bit chars instead of 16 bit, then the prompt string is > completely blank. But I think from reading the spec it is stupposed to > be 16 bit chars. > > Hal > > > > /* Demo bug that TSS_TSPATTRIB_POLICY_POPUPSTRING doesn't display right */ > > #include <stdio.h> > #include <trousers/tss.h> > > #define CKERR if (result != TSS_SUCCESS) goto error > > int > main () > { > TSS_HCONTEXT hContext; > TSS_HTPM hTPM; > TSS_HPOLICY hTpmPolicy; > TSS_HKEY hKey; > wchar_t popupString[] = L"abc"; wchar_t is 4 bytes wide for me... Changing the above line to: TSS_UNICODE popupString[] = { 'a', 'b', 'c', 0 }; works though. I don't know of a simpler way to specify a 2-byte wide string at this point, please post if you find a way... Kent > int result; > > result = Tspi_Context_Create(&hContext); CKERR; > result = Tspi_Context_Connect(hContext, NULL); CKERR; > result = Tspi_Context_GetTpmObject(hContext, &hTPM); CKERR; > result = Tspi_Context_CreateObject (hContext, TSS_OBJECT_TYPE_POLICY, > TSS_POLICY_USAGE, &hTpmPolicy); CKERR; > result = Tspi_Policy_SetSecret(hTpmPolicy, > TSS_SECRET_MODE_POPUP, 0, NULL); CKERR; > result = Tspi_SetAttribData(hTpmPolicy, > TSS_TSPATTRIB_POLICY_POPUPSTRING, 0, > sizeof(popupString), (BYTE > *)popupString); CKERR; > result = Tspi_Policy_AssignToObject(hTpmPolicy, hTPM); CKERR; > result = Tspi_TPM_GetPubEndorsementKey (hTPM, TRUE, NULL, &hKey); CKERR; > > printf ("Success!\n"); > return 0; > > error: > printf ("Failure, error code: 0x%x\n", result); > return 1; > } > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > TrouSerS-users mailing list > Tro...@li... > https://lists.sourceforge.net/lists/listinfo/trousers-users > -- Kent Yoder IBM LTC Security Dev. |