Backup 1
This commit is contained in:
parent
c202d01c40
commit
a3af41a78e
@ -53,7 +53,7 @@ int readUDS(uint8_t* UDS_M)
|
||||
if(!fp)
|
||||
perror("Opening seed file to read failed\n");
|
||||
|
||||
if (BIO_read(fp,UDSbuf,UDSsize) < 0)
|
||||
if (BIO_read(fp,UDSbuf,UDSsize) < 0) //Suspecting a ENDian issue in reading. data is half byte reversed
|
||||
perror("BIO read failed\n");
|
||||
|
||||
//Compute hash of UDS
|
||||
@ -171,6 +171,15 @@ int calcCDID(uint8_t * UDS_M, uint8_t * FW_M, uint8_t * CDID)
|
||||
int _calcCDID(uint8_t * _CDID)
|
||||
{
|
||||
|
||||
/*
|
||||
***BUG*** :
|
||||
CDI hash value returned is not correct or consistent.
|
||||
hash generated by readUDS() and readFWID() are correct and consistent but
|
||||
caclCDID() is broken.
|
||||
|
||||
Do not use this wrapper function unless fixed
|
||||
*/
|
||||
|
||||
BIO * out = BIO_new_fp(stdout, BIO_NOCLOSE);
|
||||
BIO_printf(out, "\n");BIO_printf(out, "\n");BIO_printf(out, "\n");
|
||||
|
||||
@ -203,4 +212,4 @@ int _calcCDID(uint8_t * _CDID)
|
||||
BIO_free(out);
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -4,12 +4,18 @@
|
||||
#include <openssl/bio.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/sha.h>
|
||||
#include <openssl/ec.h>
|
||||
#include <openssl/pem.h>
|
||||
#include <openssl/kdf.h>
|
||||
|
||||
|
||||
#define SHA256_dig_t 32 //bytes
|
||||
#define ECC_curve
|
||||
|
||||
int readUDS(uint8_t* UDSdigest);
|
||||
int createUDS();
|
||||
int readFWID(uint8_t * FW_M);
|
||||
int calcCDID(uint8_t * UDS_M, uint8_t * FW_M, uint8_t * CDID);
|
||||
int _calcCDID(uint8_t * CDID);
|
||||
int _calcCDID(uint8_t * CDID); //wrapper function broken, do not use
|
||||
|
||||
|
||||
|
@ -25,16 +25,19 @@ void startProtocol()
|
||||
//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);
|
||||
|
||||
// uint8_t* _CD_ID = calloc(1,sizeof(uint8_t)*SHA256_dig_t);
|
||||
// _calcCDID(_CD_ID);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//End block
|
||||
|
||||
free(CD_ID);
|
||||
free(_CD_ID);
|
||||
// free(_CD_ID);
|
||||
}
|
||||
|
||||
|
@ -10,4 +10,7 @@
|
||||
|
||||
#define SHA256_dig_t 32 //bytes
|
||||
|
||||
void startProtocol();
|
||||
void startProtocol();
|
||||
|
||||
int deriveKDF();
|
||||
int deriveECC_Key();
|
BIN
trial1/out/main2
BIN
trial1/out/main2
Binary file not shown.
Loading…
Reference in New Issue
Block a user