From 8a5b33a9ba846d785d244e29bc29a46f7be34928 Mon Sep 17 00:00:00 2001 From: NingSun Date: Tue, 27 Mar 2018 10:42:51 -0700 Subject: Add more codes in tpm2-plugin Implement tpm2_plugin_load_key() and tpm2_plugin_rsa_sign() APIs Issue-ID: AAF-94 Change-Id: I5f4329fdf973e52264d9e0e8aabc864c5fbdeebf Signed-off-by: NingSun --- TPM2-Plugin/lib/include/plugin_register.h | 45 ++++++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 4 deletions(-) (limited to 'TPM2-Plugin/lib/include/plugin_register.h') diff --git a/TPM2-Plugin/lib/include/plugin_register.h b/TPM2-Plugin/lib/include/plugin_register.h index a154a24..2bb118d 100644 --- a/TPM2-Plugin/lib/include/plugin_register.h +++ b/TPM2-Plugin/lib/include/plugin_register.h @@ -36,17 +36,51 @@ extern "C" { #endif +#define MAX_ID_LENGTH (32) + +typedef struct buffer_info_s{ + char id[MAX_ID_LENGTH+1]; + int length_of_buffer; + unsigned char *buffer; +}buffer_info_t; + + +typedef struct sshsm_hw_plugin_activate_in_info_s { + int num_buffers; + buffer_info_t *buffer_info; +}SSHSM_HW_PLUGIN_ACTIVATE_IN_INFO_t; + +typedef struct sshsm_hw_plugin_load_key_in_info_s { + int num_buffers; + buffer_info_t buffer_info[]; +}SSHSM_HW_PLUGIN_LOAD_KEY_IN_INFO_t; + + +//typedef int (*sshsm_hw_plugin_load_key)(SSHSM_HW_PLUGIN_LOAD_KEY_IN_INFO_t *loadkey_in_info, void **keyHandle); + +//typedef int (*sshsm_hw_plugin_activate)(SSHSM_HW_PLUGIN_ACTIVATE_IN_INFO_t *activate_in_info); + /* * Callback function definitions */ +typedef int (*fp_crypto_hw_plugin_init) ( ); +typedef int (*fp_crypto_hw_plugin_uninit) ( ); +typedef int (*fp_crypto_hw_plugin_activate)( + SSHSM_HW_PLUGIN_ACTIVATE_IN_INFO_t *activate_in_info + ); + +typedef int (*fp_crypto_hw_plugin_load_key)( + SSHSM_HW_PLUGIN_LOAD_KEY_IN_INFO_t *loadkey_in_info, + void **keyHandle + ); typedef int (*fp_crypto_rsa_decrypt_init) ( /* IN */ unsigned long mechanism, /* PKCS#11 Mechanism */ void *param, /* PKCS#11 Paramter */ unsigned long param_len, /* PKCS#11 Parameter len */ /* OUT */ - void *cb /* Address of pointer to store context block */ + void *cb /* Address of pointer to store context block */ ); typedef int (*fp_crypto_rsa_decrypt) ( @@ -167,10 +201,13 @@ typedef int (*fp_crypto_ecdsa_delete_object) ( ); -typedef struct +typedef struct { - fp_crypto_rsa_decrypt_init cb_crypto_rsa_decrypt_init; - fp_crypto_rsa_decrypt cb_crypto_rsa_decrypt; + fp_crypto_hw_plugin_init cb_crypto_hw_plugin_init; + fp_crypto_hw_plugin_uninit cb_crypto_hw_plugin_uninit; + fp_crypto_hw_plugin_activate cb_crypto_hw_plugin_activate; + fp_crypto_hw_plugin_load_key cb_crypto_hw_plugin_load_key; + fp_crypto_rsa_decrypt cb_crypto_rsa_decrypt; fp_crypto_rsa_sign_init cb_crypto_rsa_sign_init; fp_crypto_rsa_sign_update cb_crypto_rsa_sign_update; fp_crypto_rsa_sign_final cb_crypto_rsa_sign_final; -- cgit 1.2.3-korg