Increase okm_hex buffer to contain null character

Add an additional byte for the `okm_hex` buffer, to assure
it is null-terminated in case `okm` is 128 bytes long.
This commit is contained in:
Ron Eldor 2019-01-28 15:18:15 +02:00
parent 57c2a301a3
commit da04b3b972

View File

@ -21,9 +21,9 @@ void test_hkdf( int md_alg, char *hex_ikm_string, char *hex_salt_string,
unsigned char okm[128] = { '\0' }; unsigned char okm[128] = { '\0' };
/* /*
* okm_hex is the string representation of okm, * okm_hex is the string representation of okm,
* so its size is twice the size of okm. * so its size is twice the size of okm, and an extra null-termination.
*/ */
unsigned char okm_hex[256] = { '\0' }; unsigned char okm_hex[257] = { '\0' };
const mbedtls_md_info_t *md = mbedtls_md_info_from_type( md_alg ); const mbedtls_md_info_t *md = mbedtls_md_info_from_type( md_alg );
TEST_ASSERT( md != NULL ); TEST_ASSERT( md != NULL );