This is an automated email from the ASF dual-hosted git repository.
acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 0cb794570cd crypto: fix chacha constants under GCC 15.
0cb794570cd is described below
commit 0cb794570cdd9d943424ae6b15c88edfd4cae7e1
Author: Royyan Zahir <[email protected]>
AuthorDate: Sun Sep 20 06:38:31 2026 +0400
crypto: fix chacha constants under GCC 15.
GCC 15 added -Wunterminated-string-initialization, and both constants fill
their array exactly, leaving no room for the terminator. Every build with
that compiler fails, since crypto/Makefile treats warnings as errors.
Neither is used as a string: they are read as sixteen bytes through
U8TO32_LITTLE(). Letting the array size follow the literal keeps them
readable, costs one byte each, and needs no attribute that only some
compilers have.
The cipher state is unchanged for both key sizes.
Signed-off-by: Royyan Zahir <[email protected]>
---
crypto/chacha_private.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/crypto/chacha_private.h b/crypto/chacha_private.h
index 5829cfbee66..37ea58d270b 100644
--- a/crypto/chacha_private.h
+++ b/crypto/chacha_private.h
@@ -58,8 +58,8 @@ chacha_ctx;
} \
while (0)
-static const char sigma[16] = "expand 32-byte k";
-static const char tau[16] = "expand 16-byte k";
+static const char sigma[] = "expand 32-byte k";
+static const char tau[] = "expand 16-byte k";
static inline void hchacha20(FAR uint32_t *derived_key,
FAR const uint8_t *nonce,