diff --git a/hsm_utils/Makefile b/hsm_utils/Makefile index bbdfc78..16e8193 100644 --- a/hsm_utils/Makefile +++ b/hsm_utils/Makefile @@ -82,9 +82,11 @@ XLDLIBS= $(LIBPATH_SWORLD)/librqcard.a \ $(LIBPATH_NFLOG)/libnflog.a \ $(LIBPATH_CUTILS)/libcutils.a -lm -COMMON_OBJECTS = $(REFPATH)/simplecmd.o $(REFPATH)/simplebignum.o $(REFPATH)/nfutil.o $(REFPATH)/nfopt.o $(REFPATH)/getdate.o $(REFPATH)/report.o $(REFPATH)/report-usage.o $(REFPATH)/nftypes.o $(REFPATH)/tokenise.o mybignum.o +COMMON_OBJECTS = $(REFPATH)/nfutil.o $(REFPATH)/nfopt.o $(REFPATH)/getdate.o $(REFPATH)/report.o $(REFPATH)/report-usage.o $(REFPATH)/nftypes.o $(REFPATH)/tokenise.o -COMMON_HEADERS= $(REFPATH)/simplecmd.h $(REFPATH)/simplebignum.h $(REFPATH)/nfutil.h $(REFPATH)/nfopt.h $(REFPATH)/nftypes.h $(REFPATH)/tokenise.h +EXTRA_OBJECTS = mybignum.o + +COMMON_HEADERS= $(REFPATH)/nfutil.h $(REFPATH)/nfopt.h $(REFPATH)/nftypes.h $(REFPATH)/tokenise.h # We supply an up-to-date getdate.c in the cutils component. Prevent it # from being automatically rebuilt in the case where getdate.y's mtime @@ -97,11 +99,11 @@ $(SRCPATH)/getdate.c: ; mybignum.o: mybignum.c $(CC) $(CFLAGS) $(CPPFLAGS) -o mybignum.o -c mybignum.c -import_common_key: import_common_key.c - $(CC) $(CFLAGS) $(CPPFLAGS) -o import_common_key import_common_key.c $(COMMON_OBJECTS) $(LDLIBS) +import_common_key: import_common_key.c $(EXTRA_OBJECTS) + $(CC) $(CFLAGS) $(CPPFLAGS) -o import_common_key import_common_key.c $(COMMON_OBJECTS) $(EXTRA_OBJECTS) $(LDLIBS) -import_rsa_keypair: import_rsa_keypair.c - $(CC) $(CFLAGS) $(CPPFLAGS) -o import_rsa_keypair import_rsa_keypair.c $(COMMON_OBJECTS) $(LDLIBS) +import_rsa_keypair: import_rsa_keypair.c $(EXTRA_OBJECTS) + $(CC) $(CFLAGS) $(CPPFLAGS) -o import_rsa_keypair import_rsa_keypair.c $(COMMON_OBJECTS) $(EXTRA_OBJECTS) $(LDLIBS) # All single-threaded targets diff --git a/hsm_utils/import_common_key.c b/hsm_utils/import_common_key.c index ceca68f..53869bf 100644 --- a/hsm_utils/import_common_key.c +++ b/hsm_utils/import_common_key.c @@ -11,11 +11,10 @@ #include "rqcard-applic.h" #include "rqcard-fips.h" -#include "simplebignum.h" #include "ncthread-upcalls.h" //#include "picky-upcalls.h" -#include "simplecmd.h" +#include "mybignum.h" #define MODULE_ID 1 #define DATA_LEN 256 // bytes @@ -94,7 +93,7 @@ int main( int argc, char *argv[] ) memset( &app_init_args, 0, sizeof( app_init_args ) ); app_init_args.flags = NFAPP_IF_MALLOC | NFAPP_IF_BIGNUM; app_init_args.mallocupcalls = &my_malloc_upcalls; - app_init_args.bignumupcalls = &sbn_upcalls; + app_init_args.bignumupcalls = &my_upcalls; //app_init_args.newthreadupcalls = &newthread_upcalls; result = NFastApp_InitEx( &handle, &app_init_args, NULL ); if ( result != Status_OK ) @@ -108,15 +107,15 @@ int main( int argc, char *argv[] ) { printf( "error(%d) : NFastApp_Connect\n", result ); } - + // set bignum upcalls setting result = NFastApp_SetBignumUpcalls( handle, - sbn_bignumreceiveupcall, - sbn_bignumsendlenupcall, - sbn_bignumsendupcall, - sbn_bignumfreeupcall, - sbn_bignumformatupcall, + my_bignumreceiveupcall, + my_bignumsendlenupcall, + my_bignumsendupcall, + my_bignumfreeupcall, + my_bignumformatupcall, NULL ); // NFKM getinfo diff --git a/hsm_utils/import_rsa_keypair.c b/hsm_utils/import_rsa_keypair.c index 558f8b1..aefea3a 100644 --- a/hsm_utils/import_rsa_keypair.c +++ b/hsm_utils/import_rsa_keypair.c @@ -20,10 +20,8 @@ #include "rqcard-applic.h" #include "rqcard-fips.h" -#include "simplebignum.h" #include "ncthread-upcalls.h" //#include "picky-upcalls.h" -//#include "simplecmd.h" #include "mybignum.h" diff --git a/hsm_utils/mybignum.c b/hsm_utils/mybignum.c index a7cbff1..16d35c7 100644 --- a/hsm_utils/mybignum.c +++ b/hsm_utils/mybignum.c @@ -118,12 +118,12 @@ int my_bignumformatupcall(struct NFast_Application *app, return Status_OK; } -NFast_BignumUpcalls sbn_upcalls = { - sbn_bignumreceiveupcall, - sbn_bignumsendlenupcall, - sbn_bignumsendupcall, - sbn_bignumfreeupcall, - sbn_bignumformatupcall +NFast_BignumUpcalls my_upcalls = { + my_bignumreceiveupcall, + my_bignumsendlenupcall, + my_bignumsendupcall, + my_bignumfreeupcall, + my_bignumformatupcall }; /* --------------------- */ @@ -253,7 +253,7 @@ void my_printbignum ( FILE *f, const char *prefix, const struct NFast_Bignum *pB char buf[MAXBIGNUMBITS/4+1]; int rc; - rc=sbn_bignum2char(buf, sizeof(buf), pBN, NULL, NULL, NULL); + rc = my_bignum2char(buf, sizeof(buf), pBN, NULL, NULL, NULL); if ( rc != Status_OK ) strcpy(buf, ""); fprintf( f, "%s=\n %s\n", prefix, buf ); }