40 lines
730 B
C
40 lines
730 B
C
#include "layer2.h"
|
|
|
|
|
|
|
|
void startProtocol()
|
|
{
|
|
|
|
//step 1 : Derive Device ID
|
|
uint8_t* UDS_ID = calloc(1,sizeof(uint8_t)*SHA256_dig_t);
|
|
readUDS(UDS_ID);
|
|
|
|
// for(int i = 0; i < SHA256_dig_t; i++)
|
|
// printf("%x",UDS_ID[i]);
|
|
// printf("\n");
|
|
|
|
//step 2 : Derive Firmware ID
|
|
uint8_t* FW_ID = calloc(1,sizeof(uint8_t)*SHA256_dig_t);
|
|
readFWID(FW_ID);
|
|
|
|
// for(int i = 0; i < SHA256_dig_t; i++)
|
|
// printf("%x",FW_ID[i]);
|
|
// printf("\n");
|
|
|
|
|
|
//setp 3 : Derive Composite Device ID
|
|
uint8_t* CD_ID = calloc(1,sizeof(uint8_t)*SHA256_dig_t);
|
|
calcCDID(UDS_ID,FW_ID,CD_ID);
|
|
|
|
|
|
uint8_t* _CD_ID = calloc(1,sizeof(uint8_t)*SHA256_dig_t);
|
|
_calcCDID(_CD_ID);
|
|
|
|
//End block
|
|
free(UDS_ID);
|
|
free(FW_ID);
|
|
free(CD_ID);
|
|
free(_CD_ID);
|
|
}
|
|
|