From 3dc959e7727dcff8057384dff1b029587f9c9c2c Mon Sep 17 00:00:00 2001 From: kubodera_yuichi Date: Wed, 23 Dec 2009 07:05:49 +0000 Subject: [PATCH] =?UTF-8?q?r58=E3=81=AE=E3=83=93=E3=83=AB=E3=83=89?= =?UTF-8?q?=E3=82=92=E9=80=9A=E3=81=992?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-09-30%20-%20paladin.7z/paladin/ctr_eFuse@60 ff987cc8-cf2f-4642-8568-d52cce064691 --- cr_enc_id.c | 13 +++++-------- cr_hsm_code.c | 5 +++-- cr_hsm_code.h | 4 ++-- 3 files changed, 10 insertions(+), 12 deletions(-) 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 }