diff --git a/cr_hsm_code.c b/cr_hsm_code.c index 5d33717..e057f04 100644 --- a/cr_hsm_code.c +++ b/cr_hsm_code.c @@ -117,6 +117,8 @@ #include #include +#include "cr_generate_id.h" + #ifdef USE_HSM #include "cr_hsm_code.h" @@ -156,6 +158,8 @@ M_ByteBlock *hsmBlobptr = NULL; // init HSM int hsm_initialize( void ) { + int ret_code = 0; + // init HSM ret_code = NFastApp_InitEx( &hsmHandle, NULL, NULL ); if ( ret_code != CR_GENID_SUCCESS ) @@ -376,8 +380,8 @@ int hsm_aes_encrypt( unsigned char *dst_buf, unsigned char *org_buf, int size ) // iv set enc_iv.mech = Mech_RijndaelmCBCpNONE; - memset( enc_iv.iv.generic128.iv.bytes, 0, sizeof( enc_iv.generic128.iv.bytes ) ); - printf( "enc_iv.---.bytes : %d bytes\n", sizeof( enc_iv.generic128.iv.bytes ) ); + memset( enc_iv.iv.generic128.iv.bytes, 0, sizeof( enc_iv.iv.generic128.iv.bytes ) ); + printf( "enc_iv.---.bytes : %d bytes\n", sizeof( enc_iv.iv.generic128.iv.bytes ) ); // encrypt command set cmd.cmd = Cmd_Encrypt; @@ -425,8 +429,8 @@ int hsm_aes_decrypt( unsigned char *dst_buf, unsigned char *org_buf, int size ) // iv set dec_iv.mech = Mech_RijndaelmCBCpNONE; - memset( dec_iv.iv.generic128.iv.bytes, 0, sizeof( dec_iv.generic128.iv.bytes ) ); - printf( "dec_iv.---.bytes : %d bytes\n", sizeof( dec_iv.generic128.iv.bytes ) ); + memset( dec_iv.iv.generic128.iv.bytes, 0, sizeof( dec_iv.iv.generic128.iv.bytes ) ); + printf( "dec_iv.---.bytes : %d bytes\n", sizeof( dec_iv.iv.generic128.iv.bytes ) ); // decyrpt cmd.cmd = Cmd_Decrypt; diff --git a/cr_hsm_code.h b/cr_hsm_code.h index 7103bf9..28d25b6 100644 --- a/cr_hsm_code.h +++ b/cr_hsm_code.h @@ -116,6 +116,8 @@ extern "C" { #endif +#define HSM_MODULE_ID ( 1) + // functions int hsm_initialize( void ); void hsm_finalize( void );