updated on Sat Jan 14 12:12:45 UTC 2012
[aur-mirror.git] / tpm-tools / add-nvcommon.patch
blob9cb5a05c9a48261bb4ae4957c68c92de695219d4
1 diff -Naur tpm-tools-1.3.7/src/tpm_mgmt/tpm_nvcommon.h tpm-tools-1.3.7_NEW/src/tpm_mgmt/tpm_nvcommon.h
2 --- tpm-tools-1.3.7/src/tpm_mgmt/tpm_nvcommon.h 1970-01-01 01:00:00.000000000 +0100
3 +++ tpm-tools-1.3.7_NEW/src/tpm_mgmt/tpm_nvcommon.h 2012-01-06 14:59:52.973469694 +0100
4 @@ -0,0 +1,66 @@
5 +/*
6 + * The Initial Developer of the Original Code is International
7 + * Business Machines Corporation. Portions created by IBM
8 + * Corporation are Copyright (C) 2005 International Business
9 + * Machines Corporation. All Rights Reserved.
10 + *
11 + * This program is free software; you can redistribute it and/or modify
12 + * it under the terms of the Common Public License as published by
13 + * IBM Corporation; either version 1 of the License, or (at your option)
14 + * any later version.
15 + *
16 + * This program is distributed in the hope that it will be useful,
17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 + * Common Public License for more details.
20 + *
21 + * You should have received a copy of the Common Public License
22 + * along with this program; if not, a copy can be viewed at
23 + * http://www.opensource.org/licenses/cpl1.0.php.
24 + */
25 +#ifndef TPM_NVCOMMON_H
26 +#define TPM_NVCOMMON_H
28 +#include "tpm_tspi.h"
31 +struct strings_with_values
33 + const char *name;
34 + UINT32 value;
35 + const char *desc;
36 +};
38 +extern const struct strings_with_values permvalues[];
40 +int parseStringWithValues(const char *aArg,
41 + const struct strings_with_values *svals,
42 + unsigned int *x, unsigned int maximum,
43 + const char *name);
45 +char *printValueAsStrings(unsigned int value,
46 + const struct strings_with_values *svals);
48 +int parseHexOrDecimal(const char *aArg, unsigned int *x,
49 + unsigned int minimum, unsigned int maximum,
50 + const char *name);
52 +void displayStringsAndValues(const struct strings_with_values *svals, const char *indent);
54 +TSS_RESULT getNVDataPublic(TSS_HTPM hTpm, TPM_NV_INDEX nvindex, TPM_NV_DATA_PUBLIC **pub);
55 +void freeNVDataPublic(TPM_NV_DATA_PUBLIC *pub);
57 +static inline UINT32
58 +Decode_UINT32(BYTE * y)
60 + UINT32 x = 0;
62 + x = y[0];
63 + x = ((x << 8) | (y[1] & 0xFF));
64 + x = ((x << 8) | (y[2] & 0xFF));
65 + x = ((x << 8) | (y[3] & 0xFF));
67 + return x;
70 +#endif /* TPM_NVCOMMON_H */