From 9c426ba3f8f77c61898514cb73234085738d88a0 Mon Sep 17 00:00:00 2001 From: Flavio Santes Date: Wed, 16 Nov 2016 13:20:05 -0600 Subject: [PATCH] test/tinycrypt: Solve style issues in test_hmac_prng Style issues fixed by this commit: - Comments - Variable declaration/definition - Space between cast Change-Id: Ia6eb7718c55b976cd0899ede742d89483db191b3 Signed-off-by: Flavio Santes --- .../test_hmac_prng/src/test_hmac_prng.c | 39 +++++++++---------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/tests/crypto/test_hmac_prng/src/test_hmac_prng.c b/tests/crypto/test_hmac_prng/src/test_hmac_prng.c index 6b99332aa0b..1fd28fc1468 100644 --- a/tests/crypto/test_hmac_prng/src/test_hmac_prng.c +++ b/tests/crypto/test_hmac_prng/src/test_hmac_prng.c @@ -31,14 +31,14 @@ */ /* - DESCRIPTION - This module tests the following PRNG routines: - - Scenarios tested include: - - HMAC-PRNG init - - HMAC-PRNG reseed - - HMAC-PRNG generate) -*/ + * DESCRIPTION + * This module tests the following PRNG routines: + * + * Scenarios tested include: + * - HMAC-PRNG init + * - HMAC-PRNG reseed + * - HMAC-PRNG generate) + */ #include #include @@ -53,27 +53,27 @@ void main(void) { - uint8_t seed[128]; - struct tc_hmac_prng_struct h; + /* Fake personalization and additional_input + * (replace by appropriate values) + * e.g.: hostname+timestamp + */ + uint8_t additional_input[] = "additional input"; + uint8_t personalization[] = "HOSTNAME"; uint32_t size = (1 << 15); - uint8_t random[size]; - uint32_t i; uint32_t result = TC_PASS; + struct tc_hmac_prng_struct h; + uint8_t random[size]; + uint8_t seed[128]; + uint32_t i; TC_START("Performing HMAC-PRNG tests:"); TC_PRINT("HMAC-PRNG test#1 (init, reseed, generate):\n"); /* Fake seed (replace by a a truly random seed): */ - for (i = 0; i < (uint32_t) sizeof(seed); ++i) { + for (i = 0; i < (uint32_t)sizeof(seed); ++i) { seed[i] = i; } - /* Fake personalization and additional_input (replace by appropriate - * values): */ - /* e.g.: hostname+timestamp */ - uint8_t personalization[] = "HOSTNAME"; - uint8_t additional_input[] = "additional input"; - TC_PRINT("HMAC-PRNG test#1 (init):\n"); if (tc_hmac_prng_init(&h, personalization, sizeof(personalization)) == 0) { @@ -90,7 +90,6 @@ void main(void) result = TC_FAIL; goto exitTest; } - TC_END_RESULT(result); TC_PRINT("HMAC-PRNG test#1 (generate):\n");