From 86b4ddc2937b272114218b44ec41ae8360d66dae Mon Sep 17 00:00:00 2001 From: kubodera_yuichi Date: Thu, 7 Jan 2010 08:11:07 +0000 Subject: [PATCH] =?UTF-8?q?NFastApp=5FMalloc,NFastApp=5FFree=E3=81=AF?= =?UTF-8?q?=E7=99=BB=E9=8C=B2=E3=81=97=E3=81=9F=E9=96=A2=E6=95=B0=E3=81=8C?= =?UTF-8?q?=E5=91=BC=E3=81=B3=E5=87=BA=E3=81=95=E3=82=8C=E3=82=8B=E3=81=93?= =?UTF-8?q?=E3=81=A8=E3=81=8C=E5=88=A4=E6=98=8E=E3=81=97=E3=81=9F=E3=81=AE?= =?UTF-8?q?=E3=81=A7=E3=82=AB=E3=82=A6=E3=83=B3=E3=82=BF=E3=81=AFcr=5Fhsm?= =?UTF-8?q?=5Falloc=E3=81=AB=E3=81=A6=E7=B5=B1=E5=90=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-09-30%20-%20paladin.7z/paladin/ctr_eFuse@153 ff987cc8-cf2f-4642-8568-d52cce064691 --- cr_hsm_bignum.c | 22 ++++------------------ cr_hsm_bignum.h | 2 -- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/cr_hsm_bignum.c b/cr_hsm_bignum.c index 234e68b..3df76da 100644 --- a/cr_hsm_bignum.c +++ b/cr_hsm_bignum.c @@ -30,12 +30,8 @@ /* --------------------- */ -static int alloc_counter = 0; - -/* --------------------- */ - // 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 ) { 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); if ( !pBN ) return NOMEM; - alloc_counter++; - - my_util_copybytes(pBN->bytes, (const unsigned char *)source, + + my_bignum_copybytes(pBN->bytes, (const unsigned char *)source, nbytes, 0, 0); pBN->msb_first = msbitfirst; @@ -148,7 +143,7 @@ int my_bignumsendupcall(struct NFast_Application *app, swapends = (!msbitfirst) ^ (!pBN->msb_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 ); return Status_OK; } @@ -162,7 +157,6 @@ void my_bignumfreeupcall(struct NFast_Application *app, { NFastApp_Free(app, (*bignum), cctx, tctx); *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); if ( !pBN ) return NOMEM; - alloc_counter++; pBN->msb_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 ); if ( !pBN ) return NOMEM; - alloc_counter++; pBN->msb_first = 0; pBN->msw_first = 0; @@ -374,7 +366,6 @@ int my_bignumCopy( struct NFast_Bignum **dst, struct NFast_Bignum *pBN; pBN = (struct NFast_Bignum *)NFastApp_Malloc( app, sizeof(struct NFast_Bignum), NULL, NULL ); if ( !pBN ) return NOMEM; - alloc_counter++; pBN->msb_first = src->msb_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 diff --git a/cr_hsm_bignum.h b/cr_hsm_bignum.h index 8d69cee..21b098a 100644 --- a/cr_hsm_bignum.h +++ b/cr_hsm_bignum.h @@ -170,8 +170,6 @@ extern void my_printbignum ( FILE *f, extern int my_compare ( const struct NFast_Bignum *pA, const struct NFast_Bignum *pB ); -extern int my_bignum_get_alloc_counter( void ); - #ifdef __cplusplus } #endif