diff --git a/cr_deviceCert.c b/cr_deviceCert.c index ac8179c..b15dc05 100644 --- a/cr_deviceCert.c +++ b/cr_deviceCert.c @@ -166,9 +166,7 @@ int GenerateCTRDeviceCert( EC_KEY *pECkey, u32 deviceId, u8 bondingOption, u8 *p if ( sizeof( CR_DeviceCert ) > 384 ) { - printf( "err.\n" ); - //ret_code = CR_GENID_ERROR_CERT_BUF_SIZE; // ATODE - ret_code = 255; + ret_code = CR_GENID_ERROR_CERT_BUF_SIZE; goto end; } @@ -221,8 +219,7 @@ int GenerateCTRDeviceCert( EC_KEY *pECkey, u32 deviceId, u8 bondingOption, u8 *p // ECCは、秘密鍵のみで公開鍵成分もセットされるようなので、公開鍵は読み込まない。 NintendoCTR2 = d2i_ECPrivateKey( NULL, &der_priv, priv_len ); if( NintendoCTR2 == NULL ) { -// ret_code = CR_GENID_ERROR_ECC_READ_PRIVATE_KEY; // TODO: - ret_code = 255; + ret_code = CR_GENID_ERROR_ECC_READ_PRIVATE_KEY; goto end; } #if 0 diff --git a/cr_generate_id.c b/cr_generate_id.c index d98cde8..8d6e70a 100644 --- a/cr_generate_id.c +++ b/cr_generate_id.c @@ -160,8 +160,7 @@ int cr_generate_id_initialize( void ) ret_code = hsm_initialize(); if ( ret_code != CR_GENID_SUCCESS ) { - printf( "error(%d) : NFastApp_InitEx\n", ret_code ); - return ret_code; + return 0; } #endif @@ -264,8 +263,7 @@ int cr_generate_id( u32 serial[CR_NUM_OF_SERIAL], u8 id_buf[CR_ID_BUF_SIZE], u8 cr_id_buf->serial[i] = serial[i]; /* serial[0] => ec priv key */ } -//#ifdef DEBUG_PRINT -#if 1 +#ifdef DEBUG_PRINT if( cr_print_flag ) { printf("serialNo:\n"); printf(" 0x%08x\n", (unsigned int)serial[0] ); diff --git a/cr_generate_id.h b/cr_generate_id.h index 00ef0e6..eac35e3 100644 --- a/cr_generate_id.h +++ b/cr_generate_id.h @@ -143,6 +143,8 @@ #define CR_GENID_ERROR_AES_ENC (-22) #define CR_GENID_ERROR_AES_DEC (-23) #define CR_GENID_ERROR_AES_VERIFY (-24) +#define CR_GENID_ERROR_CERT_BUF_SIZE (-25) +#define CR_GENID_ERROR_ECC_READ_PRIVATE_KEY (-26) //--------------------------------------------------- // HSM̏ʂɂG[R[h