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