]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
crypto/gc: Pacify -Wformat warnings.
authorCollin Funk <collin.funk1@gmail.com>
Mon, 26 May 2025 18:27:34 +0000 (11:27 -0700)
committerCollin Funk <collin.funk1@gmail.com>
Mon, 26 May 2025 18:43:39 +0000 (11:43 -0700)
* lib/gc-gnulib.c (gc_cipher_setkey, gc_cipher_setiv): Cast the argument
since "%02x" expects the argument to be unsigned.

ChangeLog
lib/gc-gnulib.c

index 9e566bb5c37bc0774de35f4bd6b1723556639d5f..a6728386acedc166c06134d60abbf2c334bbd78b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2025-05-26  Collin Funk  <collin.funk1@gmail.com>
+
+       crypto/gc: Pacify -Wformat warnings.
+       * lib/gc-gnulib.c (gc_cipher_setkey, gc_cipher_setiv): Cast the argument
+       since "%02x" expects the argument to be unsigned.
+
 2025-05-26  Bruno Haible  <bruno@clisp.org>
 
        gnulib-tool: Remove build-aux/test-driver.orig from testdirs.
index 4eaf9a7656f2a3295b34e7d0d4e86bd783649f22..85b7a62b741218b0450d1958f513798ad117b71e 100644 (file)
@@ -290,7 +290,8 @@ gc_cipher_setkey (gc_cipher_handle handle, size_t keylen, const char *key)
         char keyMaterial[RIJNDAEL_MAX_KEY_SIZE + 1];
 
         for (i = 0; i < keylen; i++)
-          sprintf (&keyMaterial[2 * i], "%02x", key[i] & 0xFF);
+          sprintf (&keyMaterial[2 * i], "%02x",
+                   (unsigned int) (key[i] & 0xFF));
 
         rc = rijndaelMakeKey (&ctx->aesEncKey, RIJNDAEL_DIR_ENCRYPT,
                               keylen * 8, keyMaterial);
@@ -348,7 +349,8 @@ gc_cipher_setiv (gc_cipher_handle handle, size_t ivlen, const char *iv)
             char ivMaterial[2 * RIJNDAEL_MAX_IV_SIZE + 1];
 
             for (i = 0; i < ivlen; i++)
-              sprintf (&ivMaterial[2 * i], "%02x", iv[i] & 0xFF);
+              sprintf (&ivMaterial[2 * i], "%02x",
+                       (unsigned int) (iv[i] & 0xFF));
 
             rc = rijndaelCipherInit (&ctx->aesContext, RIJNDAEL_MODE_CBC,
                                      ivMaterial);