mirror of
https://github.com/rvtr/ctr_eFuse.git
synced 2025-11-02 00:11:04 -04:00
アロケータの設定前にOPENSSL_mallocが呼び出されると以後、設定不可になる不具合を修正
git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-09-30%20-%20paladin.7z/paladin/ctr_eFuse@167 ff987cc8-cf2f-4642-8568-d52cce064691
This commit is contained in:
parent
b15633a4e4
commit
4c033494c2
@ -210,21 +210,21 @@ int cr_generate_id( u32 device_id[CR_NUM_OF_DEVICEID], u8 id_buf[CR_ID_BUF_SIZE]
|
||||
}
|
||||
#endif
|
||||
|
||||
// ダイジェストアルゴリズムを追加する
|
||||
OpenSSL_add_all_digests();
|
||||
|
||||
//--------------------------------------------------------------
|
||||
// 暗号処理初期化
|
||||
//--------------------------------------------------------------
|
||||
|
||||
// メモリリーク防止のため、オリジナルのアロケータを使用。
|
||||
CRYPTO_set_mem_functions(cr_mem_malloc, cr_mem_realloc, cr_mem_free);
|
||||
CRYPTO_set_mem_functions(cr_mem_malloc, cr_mem_realloc, cr_mem_free);
|
||||
cr_mem_bufmgr_initialize();
|
||||
|
||||
#ifdef MY_CRYPTO_DEBUG
|
||||
ERR_load_crypto_strings();
|
||||
#endif /* MY_CRYPTO_DEBUG */
|
||||
|
||||
// ダイジェストアルゴリズムを追加する
|
||||
OpenSSL_add_all_digests();
|
||||
|
||||
//--------------------------------------------------------------
|
||||
// FuseIDバッファに固定データセット
|
||||
//--------------------------------------------------------------
|
||||
|
||||
@ -944,7 +944,7 @@ int hsm_ecdsa_sign( unsigned char *sign_buf, unsigned char *data_buf, unsigned c
|
||||
my_bignumCopy( &rBn, reply.reply.sign.sig.data.ecdsa.r, hsmHandle );
|
||||
my_bignumCopy( &sBn, reply.reply.sign.sig.data.ecdsa.s, hsmHandle );
|
||||
|
||||
//NFastApp_Free_Command( handle, NULL, NULL, &cmd );
|
||||
NFastApp_Free_Command( hsmHandle, NULL, NULL, &cmd );
|
||||
NFastApp_Free_Reply( hsmHandle, NULL, NULL, &reply );
|
||||
memset( &cmd, 0, sizeof( cmd ) );
|
||||
memset( &reply, 0, sizeof( reply ) );
|
||||
@ -979,7 +979,10 @@ int hsm_ecdsa_sign( unsigned char *sign_buf, unsigned char *data_buf, unsigned c
|
||||
|
||||
NFastApp_Free( hsmHandle, rBn, NULL, NULL );
|
||||
NFastApp_Free( hsmHandle, sBn, NULL, NULL );
|
||||
#else // !verify
|
||||
NFastApp_Free_Command( hsmHandle, NULL, NULL, &cmd );
|
||||
#endif // verify
|
||||
NFastApp_Free_Reply( hsmHandle, NULL, NULL, &reply );
|
||||
|
||||
// copy sign
|
||||
int i;
|
||||
@ -1000,8 +1003,6 @@ int hsm_ecdsa_sign( unsigned char *sign_buf, unsigned char *data_buf, unsigned c
|
||||
sign_buf[ 60 - i - 1 ] = sPtr[ sLen - i - 1 ];
|
||||
}
|
||||
|
||||
//NFastApp_Free_Command( hsmHandle, NULL, NULL, &cmd ); // 何故かアボートする
|
||||
NFastApp_Free_Reply( hsmHandle, NULL, NULL, &reply );
|
||||
cr_mem_free( rPtr );
|
||||
cr_mem_free( sPtr );
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user