2025-05-26 Collin Funk <collin.funk1@gmail.com>
+ crypto/gc: Simplify the previous change.
+ Suggested by Bruno Haible in:
+ <https://lists.gnu.org/archive/html/bug-gnulib/2025-05/msg00249.html>.
+ * lib/gc-gnulib.c (gc_cipher_setkey, gc_cipher_setiv): Remove cast and
+ perform a bitwise AND with an unsigned constant.
+
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.
char keyMaterial[RIJNDAEL_MAX_KEY_SIZE + 1];
for (i = 0; i < keylen; i++)
- sprintf (&keyMaterial[2 * i], "%02x",
- (unsigned int) (key[i] & 0xFF));
+ sprintf (&keyMaterial[2 * i], "%02x", key[i] & 0xFFU);
rc = rijndaelMakeKey (&ctx->aesEncKey, RIJNDAEL_DIR_ENCRYPT,
keylen * 8, keyMaterial);
char ivMaterial[2 * RIJNDAEL_MAX_IV_SIZE + 1];
for (i = 0; i < ivlen; i++)
- sprintf (&ivMaterial[2 * i], "%02x",
- (unsigned int) (iv[i] & 0xFF));
+ sprintf (&ivMaterial[2 * i], "%02x", iv[i] & 0xFFU);
rc = rijndaelCipherInit (&ctx->aesContext, RIJNDAEL_MODE_CBC,
ivMaterial);