/* ERROR CODES TO BE USED IN RIOT */ #define RIOTSTATUS int #define RIOTSUCCESS 1 #define RIOTFAILURE 0 #define RIOTFILENOTFOUND -1 #define RIOTINPUTERROR -2 #define RIOTOUTPUTERROR -3 #define RIOTINVALIDSTATE -4 /* CONSTANTS TO BE USED IN RIOT */ /* ALL NUMBERS ARE IN BYTES */ #define SHA256_DGST_SIZE 32 #define UDS_SIZE 8 #define UDS_DGST_SIZE SHA256_DGST_SIZE #define FW_DGST_SIZE SHA256_DGST_SIZE #define CDI_DGST_SIZE SHA256_DGST_SIZE #define CDI_KEY_SIZE 32 #define HKDF_ALG MBEDTLS_MD_SHA256 #define ECC_CURVE MBEDTLS_ECP_DP_SECP256R1 //mbedtls_ecp_group_id #define RSA_HASH_ID MBEDTLS_MD_SHA256 /* CONFIGURATIONS */ #define USE_ECC 1 #define USE_HW_TRNG 0 #define SW_PRNG 0 #define HW_TRNG 1 #define DETERM 2 /* SPECIFIC AND SPECIAL VALUES */ /* DO NOT CHANGE THIS BLOCK */ #define ACCUM_BUFF_OFFSET 2 #define ENTROPY_LEN 32 /* typedes */ typedef struct { /* Use this typedef to define settings and vlaues to be passed to deriveECCKeyPair() To be used or exchanging data between ROM and FW */ mbedtls_mpi secret; //Private key holder mbedtls_ecp_point Public; //Public key holder int ENT_MODE; //0 - SW_PRNG, 1 - HW_TRNG, 2 - DETERM, int PKC_MODE; // isECC, 1 = ECC, 0= RSA const uint8_t * seed; //To seed const char * phrase; //Session string } KeyDrv_context;