Hi Collin,
> In a testdir of all crypto modules:
>
> CC gc-gnulib.o
Please take the habit to show the compiler command line, not only the
summary line. It's important in cases like this because ...
> This is harmless, but I like having -Wformat enabled sometimes.
... the option that caused the warning is not -Wformat. See:
$ cat foo.c
#include <stdio.h>
void foo (const char *p)
{
printf ("%02x", *p & 0xFF);
}
$ gcc -Wall -Wformat=2 -Wformat-security -S foo.c
$ gcc -Wall -Wformat=2 -Wformat-security -Wformat-signedness -S foo.c
foo.c: In function ‘foo’:
foo.c:4:15: warning: format ‘%x’ expects argument of type ‘unsigned int’, but
argument 2 has type ‘int’ [-Wformat=]
It's the option -Wformat-signedness which produces the warning, not
the option -Wformat nor the option -Wformat-security. See also
https://gcc.gnu.org/onlinedocs/gcc-15.1.0/gcc/Warning-Options.html
> Therefore I have pushed the attached patch to add casts to silence this.
It's also possible to silence the warning without adding a cast:
sprintf (&keyMaterial[2 * i], "%02x", key[i] & 0xFFU);
Casts can do so many unwanted things (such as converting from a pointer type
or truncating some bits) that here I would prefer a code without a cast.
Bruno