ifapi_policy_callbacks.h
/* SPDX-License-Identifier: BSD-2-Clause */
/*******************************************************************************
* Copyright 2018-2019, Fraunhofer SIT sponsored by Infineon Technologies AG
* All rights reserved.
*******************************************************************************/
#ifndef FAPI_POLICY_CALLBACKS_H
#define FAPI_POLICY_CALLBACKS_H
enum IFAPI_STATE_POL_CB_EXCECUTE {
POL_CB_EXECUTE_INIT = 0,
POL_CB_LOAD_KEY,
POL_CB_LOAD_KEY_FINISH,
POL_CB_SEARCH_POLICY,
POL_CB_EXECUTE_SUB_POLICY,
POL_CB_NV_READ,
POL_CB_READ_NV_POLICY,
POL_CB_READ_OBJECT,
POL_CB_AUTHORIZE_OBJECT,
POL_CB_AUTHORIZE_KEY
};
typedef struct {
enum IFAPI_STATE_POL_CB_EXCECUTE cb_state;
char*object_path;
IFAPI_OBJECT object;
ESYS_TR key_handle;
ESYS_TR nv_index;
ESYS_TR auth_index;
ESYS_TR flush_handle;
IFAPI_OBJECT auth_object;
ESYS_TR *enc_session;
IFAPI_LoadKey load_ctx_sav;
IFAPI_LoadKey load_ctx;
IFAPI_CreatePrimary create_primary_ctx_sav;
IFAPI_CreatePrimary create_primary_ctx;
IFAPI_OBJECT *key_object_ptr;
IFAPI_OBJECT *auth_object_ptr;
IFAPI_NV_Cmds nv_cmd_state;
IFAPI_NV_Cmds nv_cmd_state_sav;
TPM2B_DIGEST policy_digest;
ESYS_TR session;
TPMS_POLICY *policy;
} IFAPI_POLICY_EXEC_CB_CTX;
TSS2_RC
ifapi_get_key_public(
const char *path,
TPMT_PUBLIC *public,
void *context);
TSS2_RC
ifapi_get_object_name(
const char *path,
TPM2B_NAME *name,
void *context);
TSS2_RC
ifapi_get_nv_public(
const char *path,
TPMI_RH_NV_INDEX nv_index,
TPMS_NV_PUBLIC *nv_public,
void *context);
TSS2_RC
ifapi_read_pcr(
TSS2_POLICY_PCR_SELECTION *pcr_selection,
TPML_PCR_SELECTION *out_pcr_selection,
TPML_DIGEST *out_pcr_digests,
void *ctx);
TSS2_RC
ifapi_policyeval_cbauth(
TPM2B_NAME *name,
ESYS_TR *object_handle,
ESYS_TR *auth_handle,
ESYS_TR *authSession,
void *userdata);
TSS2_RC
ifapi_policyeval_cbload_key(
TPM2B_NAME *name,
ESYS_TR *object_handle,
void *userdata);
TSS2_RC
ifapi_branch_selection(
TSS2_OBJECT *auth_object,
const char *branch_names[8],
size_t branch_count,
size_t *branch_idx,
void *userdata);
TSS2_RC
ifapi_sign_buffer(
char *key_pem,
char *public_key_hint,
TPMI_ALG_HASH key_pem_hash_alg,
uint8_t *buffer,
size_t buffer_size,
const uint8_t **signature,
size_t *signature_size,
void *userdata);
TSS2_RC
ifapi_exec_auth_policy(
TPMT_PUBLIC *key_public,
TPMI_ALG_HASH hash_alg,
TPM2B_DIGEST *digest,
TPM2B_NONCE *policyRef,
TPMT_SIGNATURE *signature,
void *userdata);
TSS2_RC
ifapi_exec_auth_nv_policy(
TPMS_NV_PUBLIC *nv_public,
TPMI_ALG_HASH hash_alg,
void *userdata);
TSS2_RC
ifapi_get_duplicate_name(
TPM2B_NAME *name,
void *userdata);
TSS2_RC
ifapi_policy_action(
const char *action,
void *userdata);
#endif /* FAPI_POLICY_CALLBACKS_H */
ESYS_TR
uint32_t ESYS_TR
Definition tss2_esys.h:16
ifapi_policyeval_cbauth
TSS2_RC ifapi_policyeval_cbauth(TPM2B_NAME *name, ESYS_TR *object_handle, ESYS_TR *auth_handle, ESYS_TR *authSession, void *userdata)
Definition ifapi_policy_callbacks.c:457
ifapi_get_key_public
TSS2_RC ifapi_get_key_public(const char *path, TPMT_PUBLIC *public, void *context)
Definition ifapi_policy_callbacks.c:87
ifapi_get_object_name
TSS2_RC ifapi_get_object_name(const char *path, TPM2B_NAME *name, void *context)
Definition ifapi_policy_callbacks.c:160
ifapi_policy_action
TSS2_RC ifapi_policy_action(const char *action, void *userdata)
Definition ifapi_policy_callbacks.c:812
ifapi_get_duplicate_name
TSS2_RC ifapi_get_duplicate_name(TPM2B_NAME *name, void *userdata)
Definition ifapi_policy_callbacks.c:1651
IFAPI_CreatePrimary
Definition fapi_int.h:572
IFAPI_LoadKey
Definition fapi_int.h:725
IFAPI_NV_Cmds
Definition fapi_int.h:224
IFAPI_POLICY_EXEC_CB_CTX
Definition ifapi_policy_callbacks.h:25
IFAPI_POLICY_EXEC_CB_CTX::flush_handle
ESYS_TR flush_handle
Definition ifapi_policy_callbacks.h:33
IFAPI_POLICY_EXEC_CB_CTX::object_path
char * object_path
Definition ifapi_policy_callbacks.h:28
IFAPI_POLICY_EXEC_CB_CTX::key_handle
ESYS_TR key_handle
Definition ifapi_policy_callbacks.h:30
IFAPI_POLICY_EXEC_CB_CTX::object
IFAPI_OBJECT object
Definition ifapi_policy_callbacks.h:29
IFAPI_POLICY_EXEC_CB_CTX::nv_index
ESYS_TR nv_index
Definition ifapi_policy_callbacks.h:31
IFAPI_POLICY_EXEC_CB_CTX::auth_object
IFAPI_OBJECT auth_object
Definition ifapi_policy_callbacks.h:34
IFAPI_POLICY_EXEC_CB_CTX::cb_state
enum IFAPI_STATE_POL_CB_EXCECUTE cb_state
Definition ifapi_policy_callbacks.h:26
IFAPI_POLICY_EXEC_CB_CTX::enc_session
ESYS_TR * enc_session
Definition ifapi_policy_callbacks.h:35
IFAPI_POLICY_EXEC_CB_CTX::nv_cmd_state_sav
IFAPI_NV_Cmds nv_cmd_state_sav
Definition ifapi_policy_callbacks.h:43
IFAPI_POLICY_EXEC_CB_CTX::auth_index
ESYS_TR auth_index
Definition ifapi_policy_callbacks.h:32
TPMS_POLICY
Definition ifapi_policy_types.h:275