mirror of
https://github.com/rvtr/ctr_eFuse.git
synced 2025-11-02 00:11:04 -04:00
NFastApp_Malloc,NFastApp_Freeは登録した関数が呼び出されることが判明したのでカウンタはcr_hsm_allocにて統合
git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-09-30%20-%20paladin.7z/paladin/ctr_eFuse@153 ff987cc8-cf2f-4642-8568-d52cce064691
This commit is contained in:
parent
ce715d19ca
commit
86b4ddc293
@ -30,12 +30,8 @@
|
|||||||
|
|
||||||
/* --------------------- */
|
/* --------------------- */
|
||||||
|
|
||||||
static int alloc_counter = 0;
|
|
||||||
|
|
||||||
/* --------------------- */
|
|
||||||
|
|
||||||
// original : nfutil_copybytes ( nfutil.c )
|
// original : nfutil_copybytes ( nfutil.c )
|
||||||
static void my_util_copybytes ( unsigned char *dst, const unsigned char *src,
|
static void my_bignum_copybytes ( unsigned char *dst, const unsigned char *src,
|
||||||
unsigned nbytes, int swapends, int swapwords )
|
unsigned nbytes, int swapends, int swapwords )
|
||||||
{
|
{
|
||||||
int inc;
|
int inc;
|
||||||
@ -103,9 +99,8 @@ int my_bignumreceiveupcall(struct NFast_Application *app,
|
|||||||
|
|
||||||
pBN = (struct NFast_Bignum *)NFastApp_Malloc(app, sizeof(struct NFast_Bignum), cctx, tctx);
|
pBN = (struct NFast_Bignum *)NFastApp_Malloc(app, sizeof(struct NFast_Bignum), cctx, tctx);
|
||||||
if ( !pBN ) return NOMEM;
|
if ( !pBN ) return NOMEM;
|
||||||
alloc_counter++;
|
|
||||||
|
my_bignum_copybytes(pBN->bytes, (const unsigned char *)source,
|
||||||
my_util_copybytes(pBN->bytes, (const unsigned char *)source,
|
|
||||||
nbytes, 0, 0);
|
nbytes, 0, 0);
|
||||||
|
|
||||||
pBN->msb_first = msbitfirst;
|
pBN->msb_first = msbitfirst;
|
||||||
@ -148,7 +143,7 @@ int my_bignumsendupcall(struct NFast_Application *app,
|
|||||||
|
|
||||||
swapends = (!msbitfirst) ^ (!pBN->msb_first);
|
swapends = (!msbitfirst) ^ (!pBN->msb_first);
|
||||||
swapwords = (!mswordfirst) ^ (!pBN->msw_first);
|
swapwords = (!mswordfirst) ^ (!pBN->msw_first);
|
||||||
my_util_copybytes( (unsigned char *)dest, (*bignum)->bytes, nbytes,
|
my_bignum_copybytes( (unsigned char *)dest, (*bignum)->bytes, nbytes,
|
||||||
swapends, swapwords );
|
swapends, swapwords );
|
||||||
return Status_OK;
|
return Status_OK;
|
||||||
}
|
}
|
||||||
@ -162,7 +157,6 @@ void my_bignumfreeupcall(struct NFast_Application *app,
|
|||||||
{
|
{
|
||||||
NFastApp_Free(app, (*bignum), cctx, tctx);
|
NFastApp_Free(app, (*bignum), cctx, tctx);
|
||||||
*bignum=NULL;
|
*bignum=NULL;
|
||||||
alloc_counter--;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------- */
|
/* --------------------- */
|
||||||
@ -225,7 +219,6 @@ int my_char2bignum ( struct NFast_Bignum **ppBN_out,
|
|||||||
|
|
||||||
pBN = (struct NFast_Bignum *)NFastApp_Malloc(app, sizeof(struct NFast_Bignum), cctx, tctx);
|
pBN = (struct NFast_Bignum *)NFastApp_Malloc(app, sizeof(struct NFast_Bignum), cctx, tctx);
|
||||||
if ( !pBN ) return NOMEM;
|
if ( !pBN ) return NOMEM;
|
||||||
alloc_counter++;
|
|
||||||
|
|
||||||
pBN->msb_first = 0;
|
pBN->msb_first = 0;
|
||||||
pBN->msw_first = 0;
|
pBN->msw_first = 0;
|
||||||
@ -268,7 +261,6 @@ int my_bin2bignum ( struct NFast_Bignum **ppBN_out,
|
|||||||
|
|
||||||
pBN = (struct NFast_Bignum *)NFastApp_Malloc( app, sizeof(struct NFast_Bignum), NULL, NULL );
|
pBN = (struct NFast_Bignum *)NFastApp_Malloc( app, sizeof(struct NFast_Bignum), NULL, NULL );
|
||||||
if ( !pBN ) return NOMEM;
|
if ( !pBN ) return NOMEM;
|
||||||
alloc_counter++;
|
|
||||||
|
|
||||||
pBN->msb_first = 0;
|
pBN->msb_first = 0;
|
||||||
pBN->msw_first = 0;
|
pBN->msw_first = 0;
|
||||||
@ -374,7 +366,6 @@ int my_bignumCopy( struct NFast_Bignum **dst,
|
|||||||
struct NFast_Bignum *pBN;
|
struct NFast_Bignum *pBN;
|
||||||
pBN = (struct NFast_Bignum *)NFastApp_Malloc( app, sizeof(struct NFast_Bignum), NULL, NULL );
|
pBN = (struct NFast_Bignum *)NFastApp_Malloc( app, sizeof(struct NFast_Bignum), NULL, NULL );
|
||||||
if ( !pBN ) return NOMEM;
|
if ( !pBN ) return NOMEM;
|
||||||
alloc_counter++;
|
|
||||||
|
|
||||||
pBN->msb_first = src->msb_first;
|
pBN->msb_first = src->msb_first;
|
||||||
pBN->msw_first = src->msw_first;
|
pBN->msw_first = src->msw_first;
|
||||||
@ -422,9 +413,4 @@ int my_compare ( const struct NFast_Bignum *pA,
|
|||||||
|
|
||||||
/* --------------------- */
|
/* --------------------- */
|
||||||
|
|
||||||
int my_bignum_get_alloc_counter( void )
|
|
||||||
{
|
|
||||||
return alloc_counter;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // HSM
|
#endif // HSM
|
||||||
|
|||||||
@ -170,8 +170,6 @@ extern void my_printbignum ( FILE *f,
|
|||||||
extern int my_compare ( const struct NFast_Bignum *pA,
|
extern int my_compare ( const struct NFast_Bignum *pA,
|
||||||
const struct NFast_Bignum *pB );
|
const struct NFast_Bignum *pB );
|
||||||
|
|
||||||
extern int my_bignum_get_alloc_counter( void );
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user