diff --git a/cr_enc_id.c b/cr_enc_id.c index 9752392..f4db7c4 100644 --- a/cr_enc_id.c +++ b/cr_enc_id.c @@ -171,9 +171,7 @@ int crypto_aes_enc_dec( unsigned char *dst_buf, unsigned char *org_buf, u8 bondi { int i; int ret_code = CR_GENID_SUCCESS; - - // TODO: ボンディングオプションで鍵を切り替えるようにする。 - + // encrypt ret_code = hsm_aes_encrypt( local_buf_1, org_buf, CR_ID_BUF_SIZE, bondingOption ); if ( ret_code != CR_GENID_SUCCESS ) @@ -190,6 +188,7 @@ int crypto_aes_enc_dec( unsigned char *dst_buf, unsigned char *org_buf, u8 bondi return ret_code; } + // ベリファイ for ( i = 0 ; i < CR_ID_BUF_SIZE ; i++ ) { if( org_buf[i] != local_buf_2[i] ) @@ -261,11 +260,9 @@ int crypto_rsa_enc_dec( unsigned char *dst_buf,unsigned char *org_buf, u8 bondin { int i; int ret_code = CR_GENID_SUCCESS; - - // TODO: ボンディングオプションで鍵を切り替えるようにする。 - + // encrypt - ret_code = hsm_rsa_encrypt( local_buf_1, org_buf, CR_ID_BUF_SIZE ); + ret_code = hsm_rsa_encrypt( local_buf_1, org_buf, CR_ID_BUF_SIZE, bondingOption ); if ( ret_code != CR_GENID_SUCCESS ) { printf( "error(%d) : hsm_rsa_encyrpt\n", ret_code ); @@ -273,7 +270,7 @@ int crypto_rsa_enc_dec( unsigned char *dst_buf,unsigned char *org_buf, u8 bondin } // decyrpt - ret_code = hsm_rsa_decrypt( local_buf_2, local_buf_1, CR_ID_BUF_SIZE ); + ret_code = hsm_rsa_decrypt( local_buf_2, local_buf_1, CR_ID_BUF_SIZE, bondingOption ); if ( ret_code != CR_GENID_SUCCESS ) { printf( "error(%d) : hsm_rsa_decrypt\n", ret_code ); diff --git a/cr_hsm_code.c b/cr_hsm_code.c index 5f313d3..b7df60e 100644 --- a/cr_hsm_code.c +++ b/cr_hsm_code.c @@ -619,7 +619,7 @@ int hsm_rsa_load_keypair( NFKM_KeyIdent keyident, M_KeyID *privKeyid, M_KeyID *p return CR_GENID_SUCCESS; } // hsm_rsa_load_keypair -int hsm_rsa_encrypt( unsigned char *dst_buf, unsigned char *org_buf, int size ) +int hsm_rsa_encrypt( unsigned char *dst_buf, unsigned char *org_buf, int size, u8 bondingOption ) { int ret_code = CR_GENID_SUCCESS; @@ -665,10 +665,11 @@ int hsm_rsa_encrypt( unsigned char *dst_buf, unsigned char *org_buf, int size ) return CR_GENID_SUCCESS; } // hsm_rsa_encrypt -int hsm_rsa_decrypt( unsigned char *dst_buf, unsigned char *org_buf, int size ) +int hsm_rsa_decrypt( unsigned char *dst_buf, unsigned char *org_buf, int size, u8 bondingOption ) { int ret_code = CR_GENID_SUCCESS; + M_KeyID keyid; M_Command cmd; M_Reply reply; diff --git a/cr_hsm_code.h b/cr_hsm_code.h index e2c01de..ab5df96 100644 --- a/cr_hsm_code.h +++ b/cr_hsm_code.h @@ -125,8 +125,8 @@ int hsm_generate_random( unsigned char *buf, int bytes ); int hsm_get_rtc( time_t *time ); int hsm_aes_encrypt( unsigned char *dst_buf, unsigned char *org_buf, int size, unsigned char bondingOption ); int hsm_aes_decrypt( unsigned char *dst_buf, unsigned char *org_buf, int size, unsigned char bondingOption ); -int hsm_rsa_encrypt( unsigned char *dst_buf, unsigned char *org_buf, int size ); -int hsm_rsa_decrypt( unsigned char *dst_buf, unsigned char *org_buf, int size ); +int hsm_rsa_encrypt( unsigned char *dst_buf, unsigned char *org_buf, int size, unsigned char bondingOption ); +int hsm_rsa_decrypt( unsigned char *dst_buf, unsigned char *org_buf, int size, unsigned char bondingOption ); #ifdef __cplusplus }