sync.
This commit is contained in:
parent
90f9e7f5b7
commit
1ecaf19e8c
@ -46,7 +46,8 @@
|
|||||||
|
|
||||||
/* SPECIFIC AND SPECIAL VALUES */
|
/* SPECIFIC AND SPECIAL VALUES */
|
||||||
/* DO NOT CHANGE THIS BLOCK */
|
/* DO NOT CHANGE THIS BLOCK */
|
||||||
|
#define IDENTITY "Identity"
|
||||||
|
#define ALIAS "Alias"
|
||||||
#define ACCUM_BUFF_OFFSET 2
|
#define ACCUM_BUFF_OFFSET 2
|
||||||
#define ENTROPY_LEN 32
|
#define ENTROPY_LEN 32
|
||||||
|
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
#include "layer1.h"
|
#include "layer1.h"
|
||||||
|
|
||||||
|
|
||||||
#define IDENTITY "identity"
|
|
||||||
|
|
||||||
int readUDS(uint8_t* UDSdigest)
|
int readUDS(uint8_t* UDSdigest)
|
||||||
{
|
{
|
||||||
//Read 8 bytes from RANDFILE
|
//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;
|
mbedtls_entropy_context * p_ent = data;
|
||||||
printf("manual update entropy with CDI\n");
|
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)
|
if(memcpy(output, p_ent -> accumulator.buffer + ACCUM_BUFF_OFFSET , ENTROPY_LEN) < 0)
|
||||||
return( MBEDTLS_ERR_ENTROPY_SOURCE_FAILED );
|
return( MBEDTLS_ERR_ENTROPY_SOURCE_FAILED );
|
||||||
@ -308,11 +305,8 @@ int deriveECCKeyPair(KeyDrv_context * KD_ctx)
|
|||||||
mbedtls_entropy_add_source( &entropyCtx, use_dev_random,
|
mbedtls_entropy_add_source( &entropyCtx, use_dev_random,
|
||||||
NULL, ENTROPY_LEN, MBEDTLS_ENTROPY_SOURCE_STRONG );
|
NULL, ENTROPY_LEN, MBEDTLS_ENTROPY_SOURCE_STRONG );
|
||||||
|
|
||||||
mbedtls_ctr_drbg_seed(&drbgCtx, mbedtls_entropy_func,
|
mbedtls_ctr_drbg_seed(&drbgCtx, mbedtls_entropy_func, &entropyCtx,
|
||||||
&entropyCtx,
|
(const unsigned char *) KD_ctx->phrase, strlen(KD_ctx->phrase) );
|
||||||
(const unsigned char *) KD_ctx->phrase ,
|
|
||||||
strlen(KD_ctx->phrase)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (KD_ctx->ENT_MODE == DETERM) // Deterministic derviation with seed
|
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");
|
printf("Accumulating entropy ...\n");
|
||||||
mbedtls_entropy_update_manual(&entropyCtx, KD_ctx->seed, ENTROPY_LEN);
|
mbedtls_entropy_update_manual(&entropyCtx, KD_ctx->seed, ENTROPY_LEN);
|
||||||
mbedtls_ctr_drbg_seed(&drbgCtx, mbedtls_entropy_func, &entropyCtx,
|
mbedtls_ctr_drbg_seed(&drbgCtx, mbedtls_entropy_func, &entropyCtx,
|
||||||
(const unsigned char *) KD_ctx->phrase ,
|
(const unsigned char *) KD_ctx->phrase, strlen(KD_ctx->phrase) );
|
||||||
strlen(KD_ctx->phrase)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mbedtls_ecp_gen_keypair(&ecpGrp, &secret, &Public,
|
if(mbedtls_ecp_gen_keypair(&ecpGrp, &secret, &Public,
|
||||||
|
@ -19,9 +19,6 @@
|
|||||||
//#include "defines.h"
|
//#include "defines.h"
|
||||||
|
|
||||||
|
|
||||||
#define IDENTITY "Identity"
|
|
||||||
#define ALIAS "ALIAS"
|
|
||||||
|
|
||||||
|
|
||||||
void ROMprotocol(void);
|
void ROMprotocol(void);
|
||||||
|
|
||||||
|
@ -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://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
|
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
|
BIN
trial3/out/main
BIN
trial3/out/main
Binary file not shown.
Loading…
Reference in New Issue
Block a user