From 6ae33c16cf9e37fda85d70c78b3c2779eb8ca21a Mon Sep 17 00:00:00 2001 From: iphydf Date: Fri, 20 Jan 2017 21:16:55 +0000 Subject: Add VLA compatibility macro for C89-ish compilers. --- toxcore/crypto_core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'toxcore/crypto_core.c') diff --git a/toxcore/crypto_core.c b/toxcore/crypto_core.c index e114b44f..03150396 100644 --- a/toxcore/crypto_core.c +++ b/toxcore/crypto_core.c @@ -127,8 +127,8 @@ int32_t encrypt_data_symmetric(const uint8_t *secret_key, const uint8_t *nonce, return -1; } - uint8_t temp_plain[length + crypto_box_ZEROBYTES]; - uint8_t temp_encrypted[length + crypto_box_MACBYTES + crypto_box_BOXZEROBYTES]; + VLA(uint8_t, temp_plain, length + crypto_box_ZEROBYTES); + VLA(uint8_t, temp_encrypted, length + crypto_box_MACBYTES + crypto_box_BOXZEROBYTES); memset(temp_plain, 0, crypto_box_ZEROBYTES); memcpy(temp_plain + crypto_box_ZEROBYTES, plain, length); // Pad the message with 32 0 bytes. @@ -149,8 +149,8 @@ int32_t decrypt_data_symmetric(const uint8_t *secret_key, const uint8_t *nonce, return -1; } - uint8_t temp_plain[length + crypto_box_ZEROBYTES]; - uint8_t temp_encrypted[length + crypto_box_BOXZEROBYTES]; + VLA(uint8_t, temp_plain, length + crypto_box_ZEROBYTES); + VLA(uint8_t, temp_encrypted, length + crypto_box_BOXZEROBYTES); memset(temp_encrypted, 0, crypto_box_BOXZEROBYTES); memcpy(temp_encrypted + crypto_box_BOXZEROBYTES, encrypted, length); // Pad the message with 16 0 bytes. -- cgit v1.2.3