mirror of
https://github.com/rvtr/ctr_eFuse.git
synced 2025-11-02 00:11:04 -04:00
hsm_utils
git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-09-30%20-%20paladin.7z/paladin/ctr_eFuse@113 ff987cc8-cf2f-4642-8568-d52cce064691
This commit is contained in:
parent
915d377370
commit
4118586ac2
@ -109,7 +109,7 @@ 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)
|
||||
|
||||
import_ecc_keypair: import_ecc_keypair.c $(EXTRA_OBJECTS)
|
||||
$(CC) $(CFLAGS) $(CPPFLAGS) -o import_ecc_keypair import_ecc_keypair.c $(COMMON_OBJECTS) $(EXTRA_OBJECTS) $(LDLIBS)
|
||||
$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o import_ecc_keypair import_ecc_keypair.c $(COMMON_OBJECTS) $(EXTRA_OBJECTS) $(LDLIBS)
|
||||
|
||||
# All single-threaded targets
|
||||
|
||||
|
||||
@ -11,10 +11,11 @@
|
||||
#include "rqcard-applic.h"
|
||||
#include "rqcard-fips.h"
|
||||
|
||||
#include "ncthread-upcalls.h"
|
||||
//#include "ncthread-upcalls.h"
|
||||
//#include "picky-upcalls.h"
|
||||
|
||||
#include "mybignum.h"
|
||||
#include "my_hsm_bignum.h"
|
||||
#include "my_hsm_alloc.h"
|
||||
|
||||
#define MODULE_ID 1
|
||||
#define DATA_LEN 256 // bytes
|
||||
|
||||
@ -358,55 +358,13 @@ int main( int argc, char *argv[] )
|
||||
struct NFast_Bignum *dmq1Bn = NULL;
|
||||
struct NFast_Bignum *iqmpBn = NULL;
|
||||
struct NFast_Bignum *eBn = NULL;
|
||||
{
|
||||
// p
|
||||
result = sbn_bin2bignum( &pBn, handle, pPtr, pLen );
|
||||
if ( result != Status_OK )
|
||||
{
|
||||
printf( "error(%d) : sbn_bin2bignum( p )\n", result );
|
||||
return 0;
|
||||
}
|
||||
|
||||
// q
|
||||
result = sbn_bin2bignum( &qBn, handle, qPtr, qLen );
|
||||
if ( result != Status_OK )
|
||||
{
|
||||
printf( "error(%d) : sbn_bin2bignum( q )\n", result );
|
||||
return 0;
|
||||
}
|
||||
|
||||
// dmp1
|
||||
result = sbn_bin2bignum( &dmp1Bn, handle, dmp1Ptr, dmp1Len );
|
||||
if ( result != Status_OK )
|
||||
{
|
||||
printf( "error(%d) : sbn_bin2bignum( dmp1 )\n", result );
|
||||
return 0;
|
||||
}
|
||||
|
||||
// dmq1
|
||||
result = sbn_bin2bignum( &dmq1Bn, handle, dmq1Ptr, dmq1Len );
|
||||
if ( result != Status_OK )
|
||||
{
|
||||
printf( "error(%d) : sbn_bin2bignum( dmq1 )\n", result );
|
||||
return 0;
|
||||
}
|
||||
|
||||
// iqmp
|
||||
result = sbn_bin2bignum( &iqmpBn, handle, iqmpPtr, iqmpLen );
|
||||
if ( result != Status_OK )
|
||||
{
|
||||
printf( "error(%d) : sbn_bin2bignum( iqmp )\n", result );
|
||||
return 0;
|
||||
}
|
||||
|
||||
// e
|
||||
result = sbn_bin2bignum( &eBn, handle, ePtr, eLen );
|
||||
if ( result != Status_OK )
|
||||
{
|
||||
printf( "error(%d) : sbn_bin2bignum( e )\n", result );
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
my_bin2bignum( &pBn, handle, pPtr, pLen );
|
||||
my_bin2bignum( &qBn, handle, qPtr, qLen );
|
||||
my_bin2bignum( &dmp1Bn, handle, dmp1Ptr, dmp1Len );
|
||||
my_bin2bignum( &dmq1Bn, handle, dmq1Ptr, dmq1Len );
|
||||
my_bin2bignum( &iqmpBn, handle, iqmpPtr, iqmpLen );
|
||||
my_bin2bignum( &eBn, handle, ePtr, eLen );
|
||||
|
||||
printf( "import ...\n" );
|
||||
|
||||
|
||||
@ -15,25 +15,31 @@
|
||||
|
||||
/* --------------------- */
|
||||
|
||||
const NFast_MallocUpcalls my_malloc_upcalls =
|
||||
const NFast_MallocUpcalls my_hsm_malloc_upcalls =
|
||||
{
|
||||
my_malloc, my_realloc, my_free
|
||||
my_hsm_malloc, my_hsm_realloc, my_hsm_free
|
||||
};
|
||||
|
||||
static void *my_malloc( size_t nbytes,
|
||||
/* --------------------- */
|
||||
|
||||
void *my_hsm_malloc( size_t nbytes,
|
||||
struct NFast_Call_Context *cctx, struct NFast_Transaction_Context *tctx )
|
||||
{
|
||||
return malloc( nbytes );
|
||||
}
|
||||
|
||||
static void *my_realloc( void *ptr, size_t nbytes,
|
||||
/* --------------------- */
|
||||
|
||||
void *my_hsm_realloc( void *ptr, size_t nbytes,
|
||||
struct NFast_Call_Context *cctx, struct NFast_Transaction_Context *tctx )
|
||||
{
|
||||
return realloc( ptr, nbytes );
|
||||
}
|
||||
|
||||
static void my_free( void *ptr,
|
||||
/* --------------------- */
|
||||
|
||||
void my_hsm_free( void *ptr,
|
||||
struct NFast_Call_Context *cctx, struct NFast_Transaction_Context *tctx )
|
||||
{
|
||||
free( ptr );
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern NFast_MallocUpcalls my_hsm_malloc_upcalls;
|
||||
extern const NFast_MallocUpcalls my_hsm_malloc_upcalls;
|
||||
|
||||
void *my_hsm_malloc( size_t nbytes,
|
||||
struct NFast_Call_Context *cctx, struct NFast_Transaction_Context *tctx );
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
#include "nfastapp.h"
|
||||
#include "nfutil.h"
|
||||
#include "mybignum.h"
|
||||
#include "my_hsm_bignum.h"
|
||||
|
||||
/* --------------------- */
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user