mirror of
https://github.com/GrapheneOS/hardened_malloc.git
synced 2025-04-17 05:00:18 +02:00
support GCC15
GCC 15 starts warning about non NUL-terminated string literals: chacha.c:44:31: error: initializer-string for array of ‘char’ truncates NUL terminator but destination lacks ‘nonstring’ attribute (17 chars into 16 available) [-Werror=unterminated-string-initialization] 44 | static const char sigma[16] = "expand 32-byte k"; | ^~~~~~~~~~~~~~~~~~
This commit is contained in:
parent
4fe9018b6f
commit
1d7fc7ffe0
2 changed files with 8 additions and 1 deletions
2
chacha.c
2
chacha.c
|
@ -41,7 +41,7 @@ static const unsigned rounds = 8;
|
|||
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 sigma[16] NONSTRING = "expand 32-byte k";
|
||||
|
||||
void chacha_keysetup(chacha_ctx *x, const u8 *k) {
|
||||
x->input[0] = U8TO32_LITTLE(sigma + 0);
|
||||
|
|
7
util.h
7
util.h
|
@ -32,6 +32,13 @@
|
|||
#define STRINGIFY(s) #s
|
||||
#define ALIAS(f) __attribute__((alias(STRINGIFY(f))))
|
||||
|
||||
// supported since GCC 15
|
||||
#if __has_attribute (nonstring)
|
||||
# define NONSTRING __attribute__ ((nonstring))
|
||||
#else
|
||||
# define NONSTRING
|
||||
#endif
|
||||
|
||||
typedef uint8_t u8;
|
||||
typedef uint16_t u16;
|
||||
typedef uint32_t u32;
|
||||
|
|
Loading…
Add table
Reference in a new issue