This commit is contained in:
atul.jha 2020-08-13 15:58:23 +02:00
parent 90f9e7f5b7
commit 1ecaf19e8c
5 changed files with 25 additions and 21 deletions

View File

@ -46,7 +46,8 @@
/* SPECIFIC AND SPECIAL VALUES */
/* DO NOT CHANGE THIS BLOCK */
#define IDENTITY "Identity"
#define ALIAS "Alias"
#define ACCUM_BUFF_OFFSET 2
#define ENTROPY_LEN 32

View File

@ -1,8 +1,6 @@
#include "layer1.h"
#define IDENTITY "identity"
int readUDS(uint8_t* UDSdigest)
{
//Read 8 bytes from RANDFILE
@ -245,7 +243,6 @@ int seedRNGSource(void *data, unsigned char *output, size_t len)
mbedtls_entropy_context * p_ent = data;
printf("manual update entropy with CDI\n");
printf("%d : len of buffer\n", (int)sizeof(p_ent -> accumulator.buffer) );
if(memcpy(output, p_ent -> accumulator.buffer + ACCUM_BUFF_OFFSET , ENTROPY_LEN) < 0)
return( MBEDTLS_ERR_ENTROPY_SOURCE_FAILED );
@ -308,11 +305,8 @@ int deriveECCKeyPair(KeyDrv_context * KD_ctx)
mbedtls_entropy_add_source( &entropyCtx, use_dev_random,
NULL, ENTROPY_LEN, MBEDTLS_ENTROPY_SOURCE_STRONG );
mbedtls_ctr_drbg_seed(&drbgCtx, mbedtls_entropy_func,
&entropyCtx,
(const unsigned char *) KD_ctx->phrase ,
strlen(KD_ctx->phrase)
);
mbedtls_ctr_drbg_seed(&drbgCtx, mbedtls_entropy_func, &entropyCtx,
(const unsigned char *) KD_ctx->phrase, strlen(KD_ctx->phrase) );
}
else if (KD_ctx->ENT_MODE == DETERM) // Deterministic derviation with seed
@ -337,9 +331,7 @@ int deriveECCKeyPair(KeyDrv_context * KD_ctx)
printf("Accumulating entropy ...\n");
mbedtls_entropy_update_manual(&entropyCtx, KD_ctx->seed, ENTROPY_LEN);
mbedtls_ctr_drbg_seed(&drbgCtx, mbedtls_entropy_func, &entropyCtx,
(const unsigned char *) KD_ctx->phrase ,
strlen(KD_ctx->phrase)
);
(const unsigned char *) KD_ctx->phrase, strlen(KD_ctx->phrase) );
}
if(mbedtls_ecp_gen_keypair(&ecpGrp, &secret, &Public,

View File

@ -19,9 +19,6 @@
//#include "defines.h"
#define IDENTITY "Identity"
#define ALIAS "ALIAS"
void ROMprotocol(void);

View File

@ -24,3 +24,17 @@ https://forums.mbed.com/t/mbedtls-porting-into-new-environment-help-with-network
https://os.mbed.com/docs/mbed-os/v6.2/porting/entropy-sources.html
https://tls.mbed.org/discussions/crypto-and-ssl/deterministic-random-bit-generator-help
removing sensitive data rom RAM
https://stackoverflow.com/questions/42771298/explicitly-removing-sensitive-data-from-memory
compiler removes memset(,0,) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=8537

Binary file not shown.