From: Guillem Jover Date: Sat, 26 Jul 2025 10:41:23 +0000 (+0200) Subject: Mark tau and sigma Chacha variables as nonstring X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=HEAD;p=thirdparty%2Flibbsd.git Mark tau and sigma Chacha variables as nonstring These contain a sequence of bytes, and are not a NUL-terminated string. Help the compiler understand the intent of the code. --- diff --git a/src/chacha_private.h b/src/chacha_private.h index ef1b931..97e9020 100644 --- a/src/chacha_private.h +++ b/src/chacha_private.h @@ -48,8 +48,16 @@ typedef struct a = PLUS(a,b); d = ROTATE(XOR(d,a), 8); \ c = PLUS(c,d); b = ROTATE(XOR(b,c), 7); -static const char sigma[16] = "expand 32-byte k"; -static const char tau[16] = "expand 16-byte k"; +#if defined(__has_attribute) +#if __has_attribute(__nonstring__) +#define ATTRIBUTE_NONSTRING __attribute__((__nonstring__)) +#else +#define ATTRIBUTE_NONSTRING +#endif +#endif + +static const char sigma[16] ATTRIBUTE_NONSTRING = "expand 32-byte k"; +static const char tau[16] ATTRIBUTE_NONSTRING = "expand 16-byte k"; static void chacha_keysetup(chacha_ctx *x,const u8 *k,u32 kbits)