diff --git a/trial3/ECCtrial.c b/trial3/ECCtrial.c index 2956f3a..2a1aff5 100644 --- a/trial3/ECCtrial.c +++ b/trial3/ECCtrial.c @@ -59,22 +59,25 @@ void main() - mbedtls_sha256_context * sha_ctx; - mbedtls_sha256_init(sha_ctx); + mbedtls_sha256_context sha_ctx; + mbedtls_sha256_init(&sha_ctx); + + mbedtls_sha256_starts_ret(&sha_ctx,0); + mbedtls_sha256_update_ret(&sha_ctx, UDS_ID, 32); + mbedtls_sha256_update_ret(&sha_ctx, FW_ID, 32); + mbedtls_sha256_finish_ret(&sha_ctx,CD_ID); - mbedtls_sha256_starts_ret(sha_ctx,0); - mbedtls_sha256_update_ret(sha_ctx, UDS_ID, 32); - mbedtls_sha256_update_ret(sha_ctx, FW_ID, 32); - mbedtls_sha256_finish_ret(sha_ctx,CD_ID); - - mbedtls_sha256_free(sha_ctx); + mbedtls_sha256_free(&sha_ctx); + free(UDS_ID); + free(FW_ID); for(int i = 0; i < 32; i++) printf("%hhx",CD_ID[i]); printf(" : CDI digest\n"); + printf("SUCCESSUL EXIT\n"); } diff --git a/trial3/layer1.c b/trial3/layer1.c index c839a57..b0e4b7c 100644 --- a/trial3/layer1.c +++ b/trial3/layer1.c @@ -136,6 +136,7 @@ int _calcCDID(uint8_t * CDID) free(UDS_ID); free(FW_ID); + mbedtls_sha256_free(sha_ctx); return RIOTSUCCESS; }