On 07/06/2011 04:11 PM, Kent Yoder wrote:
> Hi Stefan,
>
>> +static int parse(const int aOpt, const char *aArg)
>> +{
>> +       switch (aOpt) {
>> +       case 'i':
>> +               if (parseHexOrDecimal(aArg,&nvindex, UINT_MAX,
>> +                                     "NVRAM index") != 0)
>> +                       return -1;
>> +               break;
>> +
>> +       case 'p':
>> +               if (!strcmp(aArg, "?")) {
>> +                       displayStringsAndValues(permvalues, "");
>> +                       end = 1;
>> +                       return 0;
>> +               }
>> +               if (parseHexOrDecimal(aArg,&nvperm, UINT_MAX,
>> +                                     "NVRAM permission") != 0&&
>> +                   parseStringWithValues(aArg, permvalues,&nvperm, UINT_MAX,
>> +                                     "NVRAM permission") != 0)
>> +                       return -1;
>> +               break;
>> +
>> +       case 's':
>> +               if (parseHexOrDecimal(aArg,&nvsize, UINT_MAX,
>> +                                     "NVRAM index size") != 0)
>> +                       return -1;
>> +               break;
>> +
>> +       case 'o':
>> +               ownerpass = aArg;
>> +               if (!ownerpass)
>> +                       askOwnerPass = TRUE;
>> +               else
>> +                       askOwnerPass = FALSE;
>> +               ownerWellKnown = FALSE;
>> +               break;
>> +
>> +       case 'y':
>> +               ownerWellKnown = TRUE;
>> +               ownerpass = NULL;
>> +               askOwnerPass = FALSE;
>> +               break;
>> +
>> +       case 'a':
>> +               datapass = aArg;
>> +               if (!datapass)
>> +                       askDataPass = TRUE;
>> +               else
>> +                       askDataPass = FALSE;
>> +               dataWellKnown = FALSE;
>> +               break;
>> +
>> +       case 'z':
>> +               dataWellKnown = TRUE;
>> +               datapass = NULL;
>> +               askDataPass = FALSE;
>> +               break;
>> +
>> +       case 'u':
>> +               useUnicode = TRUE;
>> +               break;
>> +
>> +       default:
>> +               return -1;
>> +       }
>> +       return 0;
>> +}
>> +
>> +static void help(const char* aCmd)
>> +{
>> +       logCmdHelp(aCmd);
>> +       logUnicodeCmdOption();
>> +       logCmdOption("-y, --owner-well-known",
>> +                    _("Use 20 bytes of zeros (TSS_WELL_KNOWN_SECRET) as the 
>> TPM owner secret"));
>> +       logCmdOption("-z, --data-well-known",
>> +                    _("Use 20 bytes of zeros (TSS_WELL_KNOWN_SECRET) as the 
>> NVRAM area's secret"));
>> +       logOwnerPassCmdOption();
>> +       logCmdOption("-a, --pwda",
>> +                    _("NVRAM area password"));
>> +       logNVIndexCmdOption();
>> +       logCmdOption("-s, --size",
>> +                    _("Size of the NVRAM area"));
>> +       logCmdOption("-p, --permissions",
>> +                    _("Permissions of the NVRAM area"));
>> +
>> +        displayStringsAndValues(permvalues, "                ");
>> +}
>> +
>> +int main(int argc, char **argv)
>> +{
>> +       TSS_HTPM hTpm;
>> +       TSS_HNVSTORE nvObject;
>> +       TSS_FLAG fNvAttrs;
>> +       TSS_HPOLICY hTpmPolicy, hDataPolicy;
>> +       int iRc = -1;
>> +       BYTE well_known_secret[] = TSS_WELL_KNOWN_SECRET;
>> +       int opswd_len = -1;
>> +       int dpswd_len = -1;
>> +       struct option hOpts[] = {
>> +               {"index"         , required_argument, NULL, 'i'},
>> +               {"size"          , required_argument, NULL, 's'},
>> +               {"permissions"   , required_argument, NULL, 'p'},
>> +               {"pwdo"          , optional_argument, NULL, 'o'},
>> +               {"pwda"          , optional_argument, NULL, 'a'},
>> +               {"use-unicode"   ,       no_argument, NULL, 'u'},
>> +               {NULL            ,       no_argument, NULL, 0},
>> +       };
>> +
>> +       initIntlSys();
>> +
>> +       if (genericOptHandler
>> +                   (argc, argv, "i:s:p:o:d:yzu", hOpts,
>    It looks like 'a' should be in this list?
Indeed, the 'd' should be changed to 'a'.
>    When compiling with your patch, I get this:
>
> tpm_tspi.c: In function ‘unloadNVDataPublic’:
> tpm_tspi.c:706: error: implicit declaration of function
> ‘Trspi_UnloadBlob_NV_DATA_PUBLIC’
>
>    Do you have a patch to trousers, or maybe one I missed that's not
> upstream yet?
It's part of one of the two patches I posted before the NVRAM tools support:

http://sourceforge.net/mailarchive/forum.php?thread_name=4E0DF1F2.8000404%40linux.vnet.ibm.com&forum_name=trousers-tech

    Stefan

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
TrouSerS-tech mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/trousers-tech

Reply via email to