basic ECC functional
This commit is contained in:
BIN
trial2/src/debug
BIN
trial2/src/debug
Binary file not shown.
@@ -38,5 +38,81 @@ void ROMprotocol(void)
|
||||
printf("%x",CDIKEY[i]);
|
||||
printf(" : CDIKEY main\n");
|
||||
|
||||
printf("USE_ECC %d\n", USE_ECC);
|
||||
deriveDeviceIDKeyPair(CDIKEY, USE_ECC);
|
||||
|
||||
|
||||
printf("pass 100\n");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void seedRNGSource(uint8_t * CDIKEY)
|
||||
{
|
||||
//srand(); lib fun call //https://stackoverflow.com/questions/55927662/generate-every-time-same-rsa-key-with-c
|
||||
//ctr_drbg //programs/test/benchmark.c:705
|
||||
//hmac_drbg
|
||||
|
||||
//seed rng with CDIKEY
|
||||
//init
|
||||
//drbg seed
|
||||
|
||||
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void deriveDeviceIDKeyPair(uint8_t * CDIKEY, int isECC)
|
||||
{
|
||||
|
||||
//firt generate ECC/RA key.
|
||||
//check for deterministic consistency
|
||||
//seed RNGs with CDI
|
||||
//let's see how it goes
|
||||
|
||||
//add entropy source?
|
||||
//seed RNG
|
||||
//create ctx
|
||||
//init
|
||||
//gen keypair
|
||||
|
||||
if(isECC)
|
||||
{
|
||||
//mbedtls_ecp_group_id grpID = ECC_CURVE;
|
||||
printf("pass 1\n");
|
||||
const mbedtls_ecp_curve_info *crvInfo;
|
||||
crvInfo = mbedtls_ecp_curve_info_from_grp_id(ECC_CURVE);
|
||||
printf("pass 2\n");
|
||||
|
||||
mbedtls_ecp_group *ecpGrp;
|
||||
printf("pass 3\n");
|
||||
//mbedtls_ecp_group_init(ecpGrp);
|
||||
//mbedtls_ecp_group_load(ecpGrp,ECC_CURVE);
|
||||
printf("pass 4\n");
|
||||
//mbedtls_ecp_keypair *keyPair = {0};
|
||||
printf("pass 5\n");
|
||||
//mbedtls_ecp_keypair_init(keyPair);
|
||||
|
||||
printf("pass 6\n");
|
||||
|
||||
|
||||
printf("ECC is not yet implemented\n");
|
||||
|
||||
//mbedtls_ecp_keypair_free(keyPair);
|
||||
//mbedtls_ecp_group_free(ecpGrp);
|
||||
printf("pass 7\n");
|
||||
return;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
|
||||
printf("RSA is not yet implemented\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
BIN
trial2/src/main
BIN
trial2/src/main
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user