r58のビルドを通す2

git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-09-30%20-%20paladin.7z/paladin/ctr_eFuse@60 ff987cc8-cf2f-4642-8568-d52cce064691
This commit is contained in:
kubodera_yuichi 2009-12-23 07:05:49 +00:00
parent 47f22d47f1
commit 3dc959e772
3 changed files with 10 additions and 12 deletions

View File

@ -171,9 +171,7 @@ int crypto_aes_enc_dec( unsigned char *dst_buf, unsigned char *org_buf, u8 bondi
{ {
int i; int i;
int ret_code = CR_GENID_SUCCESS; int ret_code = CR_GENID_SUCCESS;
// TODO: ボンディングオプションで鍵を切り替えるようにする。
// encrypt // encrypt
ret_code = hsm_aes_encrypt( local_buf_1, org_buf, CR_ID_BUF_SIZE, bondingOption ); ret_code = hsm_aes_encrypt( local_buf_1, org_buf, CR_ID_BUF_SIZE, bondingOption );
if ( ret_code != CR_GENID_SUCCESS ) 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; return ret_code;
} }
// ベリファイ
for ( i = 0 ; i < CR_ID_BUF_SIZE ; i++ ) for ( i = 0 ; i < CR_ID_BUF_SIZE ; i++ )
{ {
if( org_buf[i] != local_buf_2[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 i;
int ret_code = CR_GENID_SUCCESS; int ret_code = CR_GENID_SUCCESS;
// TODO: ボンディングオプションで鍵を切り替えるようにする。
// encrypt // 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 ) if ( ret_code != CR_GENID_SUCCESS )
{ {
printf( "error(%d) : hsm_rsa_encyrpt\n", ret_code ); 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 // 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 ) if ( ret_code != CR_GENID_SUCCESS )
{ {
printf( "error(%d) : hsm_rsa_decrypt\n", ret_code ); printf( "error(%d) : hsm_rsa_decrypt\n", ret_code );

View File

@ -619,7 +619,7 @@ int hsm_rsa_load_keypair( NFKM_KeyIdent keyident, M_KeyID *privKeyid, M_KeyID *p
return CR_GENID_SUCCESS; return CR_GENID_SUCCESS;
} // hsm_rsa_load_keypair } // 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; 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; return CR_GENID_SUCCESS;
} // hsm_rsa_encrypt } // 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; int ret_code = CR_GENID_SUCCESS;
M_KeyID keyid;
M_Command cmd; M_Command cmd;
M_Reply reply; M_Reply reply;

View File

@ -125,8 +125,8 @@ int hsm_generate_random( unsigned char *buf, int bytes );
int hsm_get_rtc( time_t *time ); 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_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_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_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 ); int hsm_rsa_decrypt( unsigned char *dst_buf, unsigned char *org_buf, int size, unsigned char bondingOption );
#ifdef __cplusplus #ifdef __cplusplus
} }