123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515 |
- .sensitive = { \
- .data = { \
- .size = 0 \
- }, \
- .userAuth = { \
- .size = 0 \
- } \
- } \
- }
- .tag = 0, \
- .hierarchy = 0, \
- .digest = TPM2B_EMPTY_INIT \
- }
- .count = 0, \
- }
- .capability = 0, \
- }
- .tag = 0, \
- .hierarchy = 0, \
- .digest = TPM2B_EMPTY_INIT \
- }
- .count = cnt, \
- .auths = array, \
- }
- ({ \
- TSS2_RC __result = 0; \
- do { \
- __result = (expression); \
- } while (tpm2_error_get(__result) == TPM2_RC_RETRY); \
- __result; \
- })
- typedef struct {
- UINT16 size;
- BYTE buffer[0];
- } TPM2B;
- int tpm2_util_hex_to_byte_structure(const char *in_str, UINT16 *byte_length,
- BYTE *byte_buffer);
- bool tpm2_util_verify_digests(TPM2B_DIGEST *quote_digest,
- TPM2B_DIGEST *pcr_digest);
- bool tpm2_util_concat_buffer(TPM2B_MAX_BUFFER *result, TPM2B *append);
- bool tpm2_util_string_to_int32(const char *str, int32_t *value);
- bool tpm2_util_string_to_uint32(const char *str, uint32_t *value);
- bool tpm2_util_string_to_uint64(const char *str, uint64_t *value);
- bool tpm2_util_string_to_uint16(const char *str, uint16_t *value);
- bool tpm2_util_string_to_uint8(const char *str, uint8_t *value);
- void tpm2_util_hexdump(const BYTE *data, size_t len);
- void tpm2_util_hexdump2(FILE *f, const BYTE *data, size_t len);
- bool tpm2_util_bin_from_hex_or_file(const char *input, UINT16 *len, BYTE *buffer);
- static inline void _tpm2_util_print_tpm2b(TPM2B *buffer) {
- return tpm2_util_hexdump(buffer->buffer, buffer->size);
- }
- static inline void _tpm2_util_print_tpm2b2(FILE *out, const TPM2B *buffer) {
- return tpm2_util_hexdump2(out, buffer->buffer, buffer->size);
- }
- static inline bool tpm2_util_is_pcr_select_bit_set(
- const TPMS_PCR_SELECTION *pcr_selection, UINT32 pcr) {
- return (pcr_selection->pcrSelect[((pcr) / 8)] & (1 << ((pcr) % 8)));
- }
- bool tpm2_util_is_big_endian(void);
- UINT16 tpm2_util_endian_swap_16(UINT16 data);
- UINT32 tpm2_util_endian_swap_32(UINT32 data);
- UINT64 tpm2_util_endian_swap_64(UINT64 data);
- UINT16 tpm2_util_hton_16(UINT16 data);
- UINT32 tpm2_util_hton_32(UINT32 data);
- UINT64 tpm2_util_hton_64(UINT64 data);
- UINT16 tpm2_util_ntoh_16(UINT16 data);
- UINT32 tpm2_util_ntoh_32(UINT32 data);
- UINT64 tpm2_util_ntoh_64(UINT64 data);
- UINT32 tpm2_util_pop_count(UINT32 data);
- void print_yaml_indent(size_t indent_count);
- void tpm2_util_public_to_yaml(TPM2B_PUBLIC *public, char *indent);
- void tpm2_util_tpmt_public_to_yaml(TPMT_PUBLIC *public, char *indent);
- void tpm2_util_tpma_object_to_yaml(TPMA_OBJECT obj, char *indent);
- bool tpm2_util_calc_unique(TPMI_ALG_HASH name_alg,
- TPM2B_PRIVATE_VENDOR_SPECIFIC *key, TPM2B_DIGEST *seed,
- TPM2B_DIGEST *unique);
- tool_rc tpm2_util_sys_handle_to_esys_handle(ESYS_CONTEXT *context,
- TPM2_HANDLE sys_handle, ESYS_TR *esys_handle);
- ESYS_TR tpm2_tpmi_hierarchy_to_esys_tr(TPMI_RH_PROVISION inh);
- char *tpm2_util_getenv(const char *name);
- typedef enum tpm2_handle_flags tpm2_handle_flags;
- enum tpm2_handle_flags {
- TPM2_HANDLE_FLAGS_NONE = 0,
- TPM2_HANDLE_FLAGS_O = 1 << 0,
- TPM2_HANDLE_FLAGS_P = 1 << 1,
- TPM2_HANDLE_FLAGS_E = 1 << 2,
- TPM2_HANDLE_FLAGS_N = 1 << 3,
- TPM2_HANDLE_FLAGS_L = 1 << 4,
- TPM2_HANDLE_FLAGS_ALL_HIERACHIES = 0x1F,
- TPM2_HANDLES_FLAGS_TRANSIENT = 1 << 5,
- TPM2_HANDLES_FLAGS_PERSISTENT = 1 << 6,
-
- TPM2_HANDLE_FLAGS_NV = 1 << 7,
- TPM2_HANDLE_ALL_W_NV = 0xFF,
- TPM2_HANDLE_FLAGS_PCR = 1 << 8,
- TPM2_HANDLE_ALL_W_PCR = 0x17F,
- };
- bool tpm2_util_handle_from_optarg(const char *value,
- TPMI_RH_PROVISION *hierarchy, tpm2_handle_flags flags);
- bool tpm2_util_get_label(const char *value, TPM2B_DATA *label);
- void tpm2_util_print_time(const TPMS_TIME_INFO *current_time);
- bool tpm2_calq_qname(TPM2B_NAME *pqname,
- TPMI_ALG_HASH halg, TPM2B_NAME *name, TPM2B_NAME *qname);
- bool tpm2_safe_read_from_stdin(int length, char *data);
- bool tpm2_pem_encoded_key_to_fingerprint(const char* pem_encoded_key, char*
- fingerprint);
- tool_rc tpm2_util_aux_sessions_setup( ESYS_CONTEXT *ectx,
- uint8_t session_cnt, const char **session_path, ESYS_TR *session_handle,
- tpm2_session **session);
- TPMI_ALG_HASH tpm2_util_calculate_phash_algorithm(ESYS_CONTEXT *ectx,
- const char **cphash_path, TPM2B_DIGEST *cp_hash, const char **rphash_path,
- TPM2B_DIGEST *rp_hash, tpm2_session **sessions);
|