From 6c32d16c72e329dfe4f9e8d4d5fcac9031a93053 Mon Sep 17 00:00:00 2001 From: "atul.jha" Date: Wed, 2 Sep 2020 14:01:09 +0200 Subject: [PATCH] experiemnt --- trial3/ECCtrial.c | 19 +++++++++++-------- trial3/layer1.c | 1 + 2 files changed, 12 insertions(+), 8 deletions(-) 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; }