summaryrefslogtreecommitdiffstats
path: root/SoftHSMv2/src/lib/HwInfra/hwpluginif.h
diff options
context:
space:
mode:
authorRitu Sood <ritu.sood@intel.com>2018-04-26 01:50:05 +0000
committerRitu Sood <ritu.sood@intel.com>2018-05-24 05:55:20 +0000
commit57c7ad1aa0e485b5594f27f1ab501ff0306fe2fc (patch)
treef47b764bda303958051dae4f3e4f0222c338ac3e /SoftHSMv2/src/lib/HwInfra/hwpluginif.h
parentc1c9bfcabc4a5e4147d19c599de7d9bf925fa98b (diff)
Added a new Attribute to store TPM key handle
Includes changes to detect existing instances of key and also some bug fixes. Also added new functionality for RSA_SignUpdate, RSA_SignFinal and RSA_Cleanup Issue-ID: AAF-260 Change-Id: Ib064e86b8f112784ed6d352ab1557ab9a13c5978 Signed-off-by: Ritu Sood <ritu.sood@intel.com>
Diffstat (limited to 'SoftHSMv2/src/lib/HwInfra/hwpluginif.h')
-rwxr-xr-xSoftHSMv2/src/lib/HwInfra/hwpluginif.h60
1 files changed, 51 insertions, 9 deletions
diff --git a/SoftHSMv2/src/lib/HwInfra/hwpluginif.h b/SoftHSMv2/src/lib/HwInfra/hwpluginif.h
index b078be3..a8ade2a 100755
--- a/SoftHSMv2/src/lib/HwInfra/hwpluginif.h
+++ b/SoftHSMv2/src/lib/HwInfra/hwpluginif.h
@@ -94,6 +94,20 @@ typedef int (*sshsm_hw_plugin_activate)(
);
+/***
+ * Import Public Key
+ * Description: This is called by HWPluginInfra after load key to get the public
+ * key modulus and exponent. Plugin to allocate memory for modulus and exponent
+ * based on size. HwInfra will release the buffers after using them.
+ */
+
+typedef struct sshsm_hw_plugin_import_public_key_info_s {
+ unsigned long modulus_size;
+ unsigned char *modulus;
+ unsigned long exponent_size;
+ unsigned char *exponent;
+}SSHSM_HW_PLUGIN_IMPORT_PUBLIC_KEY_INFO_t;
+
/***
* Load Key Callback
@@ -141,32 +155,30 @@ typedef struct sshsm_hw_plugin_load_key_in_info_s {
typedef int (*sshsm_hw_plugin_load_key)(
SSHSM_HW_PLUGIN_ACTIVATE_LOAD_IN_INFO_t *loadkey_in_info,
- void **keyHandle
+ void **keyHandle,
+ SSHSM_HW_PLUGIN_IMPORT_PUBLIC_KEY_INFO_t *import_public_key
);
typedef int (*sshsm_hw_plugin_unload_key)(
void **keyHandle
);
-
-
-
/***
* Callback: RSA Sign Init
* Description: This is called by HWPluginInfra as part of C_SignInit function
- * for RSA keys
+ * for RSA keys. Plugin can allocate memory for any state and can add its reference to
+ * pluginOutDataRef. This pointer is passed to sign, signupdate and signfinal.
*/
typedef int (*sshsm_hw_plugin_rsa_sign_init)(
void *keyHandle,
unsigned long mechanism,
void *param,
- int len
+ int len,
+ void **pluginOutDataRef
);
-
-
/***
- * Callback: RSA Sign Init
+ * Callback: RSA Sign
* Description: This is called by HWPluginInfra as part of C_Sign function
* for RSA keys. HWPluginInfra get the keyHandle from the key object.
*
@@ -181,10 +193,37 @@ typedef int (*sshsm_hw_plugin_rsa_sign)(
unsigned long mechanism,
unsigned char *msg,
int msg_len,
+ void *pluginDataRef,
unsigned char *outsig,
int *outsiglen
);
+typedef int (*sshsm_hw_plugin_rsa_sign_update)(
+ void *keyHandle,
+ unsigned long mechanism,
+ unsigned char *msg,
+ int msg_len,
+ void *pluginDataRef
+ );
+
+typedef int (*sshsm_hw_plugin_rsa_sign_final)(
+ void *keyHandle,
+ unsigned long mechanism,
+ void *pluginDataRef,
+ unsigned char *outsig,
+ int *outsiglen
+ );
+
+/** This function is called by SSHSM only if there sign_final function is not called.
+If sign_final function is called, it is assumed that plugin would have cleaned this up.
+***/
+
+typedef int (*sshsm_hw_plugin_rsa_sign_cleanup)(
+ void *keyHandle,
+ unsigned long mechanism,
+ void *pluginDataRef
+ );
+
/***
* Function Name: sshsm_hw_plugin_get_plugin_functions
* Descrpiton: Every HW plugin is expected to define this function.
@@ -208,6 +247,9 @@ typedef struct sshsm_hw_functions_s
sshsm_hw_plugin_unload_key xxx_unload_key;
sshsm_hw_plugin_rsa_sign_init xxx_rsa_sign_init;
sshsm_hw_plugin_rsa_sign xxx_rsa_sign;
+ sshsm_hw_plugin_rsa_sign_update xxx_rsa_sign_update;
+ sshsm_hw_plugin_rsa_sign_final xxx_rsa_sign_final;
+ sshsm_hw_plugin_rsa_sign_cleanup xxx_rsa_sign_cleanup;
}SSHSM_HW_FUNCTIONS_t;