summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2014-09-16 16:26:31 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2014-09-16 16:26:31 +0200
commit1788de0cc13f4fe451ee6ae2e138533c0eea3dde (patch)
tree934f64cae6e1bdf486b7c11558464407e619b25d
parent18e13778e5bfd4609804f37140613208ea620b23 (diff)
downloadfastd-1788de0cc13f4fe451ee6ae2e138533c0eea3dde.tar
fastd-1788de0cc13f4fe451ee6ae2e138533c0eea3dde.zip
More fixes for zero-length VLAs
-rw-r--r--src/methods/cipher_test/cipher_test.c4
-rw-r--r--src/protocols/ec25519_fhmqvc/handshake.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/methods/cipher_test/cipher_test.c b/src/methods/cipher_test/cipher_test.c
index 34f0f13..e07ab9b 100644
--- a/src/methods/cipher_test/cipher_test.c
+++ b/src/methods/cipher_test/cipher_test.c
@@ -139,7 +139,7 @@ static bool method_encrypt(UNUSED fastd_peer_t *peer, fastd_method_session_state
if (tail_len)
memset(in.data+in.len, 0, tail_len);
- uint8_t nonce[session->method->cipher_info->iv_length] __attribute__((aligned(8)));
+ uint8_t nonce[session->method->cipher_info->iv_length ?: 1] __attribute__((aligned(8)));
fastd_method_expand_nonce(nonce, session->common.send_nonce, sizeof(nonce));
int n_blocks = block_count(in.len, sizeof(fastd_block128_t));
@@ -179,7 +179,7 @@ static bool method_decrypt(fastd_peer_t *peer, fastd_method_session_state_t *ses
if (flags)
return false;
- uint8_t nonce[session->method->cipher_info->iv_length] __attribute__((aligned(8)));
+ uint8_t nonce[session->method->cipher_info->iv_length ?: 1] __attribute__((aligned(8)));
fastd_method_expand_nonce(nonce, in_nonce, sizeof(nonce));
size_t tail_len = alignto(in.len, sizeof(fastd_block128_t))-in.len;
diff --git a/src/protocols/ec25519_fhmqvc/handshake.c b/src/protocols/ec25519_fhmqvc/handshake.c
index 54c9f02..50fc594 100644
--- a/src/protocols/ec25519_fhmqvc/handshake.c
+++ b/src/protocols/ec25519_fhmqvc/handshake.c
@@ -127,7 +127,7 @@ static inline bool new_session(fastd_peer_t *peer, const fastd_method_info_t *me
if (salt) {
size_t blocks = block_count(method->provider->key_length(method->method), sizeof(fastd_sha256_t));
- fastd_sha256_t secret[blocks];
+ fastd_sha256_t secret[blocks ?: 1];
derive_key(secret, blocks, salt, method->name, A, B, X, Y, sigma);
peer->protocol_state->session.method_state = method->provider->session_init(method->method, (const uint8_t *)secret, initiator);