本番鍵を読み出すよう変更、ECDSAにてHSMでも検証するのを復活

git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-09-30%20-%20paladin.7z/paladin/ctr_eFuse@147 ff987cc8-cf2f-4642-8568-d52cce064691
This commit is contained in:
kubodera_yuichi 2010-01-06 06:56:18 +00:00
parent f748831d4a
commit e4e240482b
2 changed files with 10 additions and 8 deletions

View File

@ -375,12 +375,15 @@ end:
#ifdef MY_CRYPTO_DEBUG
ERR_free_strings();
#endif /* MY_CRYPTO_DEBUG */
#if 0
if ( cr_print_flag )
{
printf( "hsm alloc counter : %d\n", my_hsm_get_alloc_counter() );
printf( "hsmbn alloc counter : %d\n", my_bignum_get_alloc_counter() );
printf( "miya alloc counter : %d\n", cr_mem_get_counter() );
}
#endif
return ret_code; /* success */
}

View File

@ -155,7 +155,9 @@ M_KeyID hsmEcdsaPrivkeyidDev, hsmEcdsaPubkeyidDev;
M_KeyID hsmEcdsaPrivkeyidProd, hsmEcdsaPubkeyidProd;
const NFKM_KeyIdent hsmEcdsaPrivkeyidentDev = { (char*)"simple", (char*)"nct2-priv-dev" };
const NFKM_KeyIdent hsmEcdsaPubkeyidentDev = { (char*)"simple", (char*)"nct2-pub-dev" };
const NFKM_KeyIdent hsmEcdsaPrivkeyidentProd = { (char*)"simple", (char*)"nct2-priv-prod" };
const NFKM_KeyIdent hsmEcdsaPubkeyidentProd = { (char*)"simple", (char*)"nct2-pub-prod" };
int hsm_ecdsa_load_keypair( NFKM_KeyIdent privKeyident, M_KeyID *privKeyid,
NFKM_KeyIdent pubKeyident, M_KeyID *pubKeyid );
@ -249,7 +251,7 @@ int hsm_initialize( void )
// load ecdsa dev keypair
ret_code = hsm_ecdsa_load_keypair( hsmEcdsaPrivkeyidentDev, &hsmEcdsaPrivkeyidDev,
*(NFKM_KeyIdent*)NULL, &hsmEcdsaPubkeyidDev );
hsmEcdsaPubkeyidentDev, &hsmEcdsaPubkeyidDev );
if ( ret_code != CR_GENID_SUCCESS )
{
SetErrorInfo( __FUNCTION__, __LINE__ );
@ -258,7 +260,7 @@ int hsm_initialize( void )
// load ecdsa prod keypair
ret_code = hsm_ecdsa_load_keypair( hsmEcdsaPrivkeyidentProd, &hsmEcdsaPrivkeyidProd,
*(NFKM_KeyIdent*)NULL, &hsmEcdsaPubkeyidProd );
hsmEcdsaPubkeyidentProd, &hsmEcdsaPubkeyidProd );
if ( ret_code != CR_GENID_SUCCESS )
{
SetErrorInfo( __FUNCTION__, __LINE__ );
@ -284,9 +286,6 @@ int hsm_finalize( void )
// void
NFastApp_Finish( hsmHandle, NULL );
printf( "final, hsm alloc counter : %d\n", my_hsm_get_alloc_counter() );
printf( "final, hsmbn alloc counter : %d\n", my_bignum_get_alloc_counter() );
return ret_code;
} // hsm_finalize
@ -888,7 +887,7 @@ int hsm_ecdsa_sign( unsigned char *sign_buf, unsigned char *data_buf, unsigned c
// verify
#if 0
#if 1
struct NFast_Bignum *rBn, *sBn;
my_bignumCopy( &rBn, reply.reply.sign.sig.data.ecdsa.r, hsmHandle );
my_bignumCopy( &sBn, reply.reply.sign.sig.data.ecdsa.s, hsmHandle );