commit a0f79813e63a52eec8d8b843df2d7c76b0993851
parent bd7c7548fe172deec0ea1894a02b2bb5b33f5ee2
Author: Jacki <jacki@thejackimonster.de>
Date: Tue, 12 Nov 2024 00:01:08 +0100
Derive IV for file encryption/decryption properly
Signed-off-by: Jacki <jacki@thejackimonster.de>
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/gnunet_chat_util.c b/src/gnunet_chat_util.c
@@ -193,7 +193,7 @@ util_encrypt_file (const char *filename,
if (index > 0)
memcpy(&iv, ((uint8_t*) data) + (block_size * (index - 1)), sizeof(iv));
else
- memcpy(&iv, hash, sizeof(iv));
+ GNUNET_CRYPTO_symmetric_derive_iv(&iv, key, hash, sizeof(hash), NULL);
result = GNUNET_CRYPTO_symmetric_encrypt(
location,
@@ -274,7 +274,7 @@ util_decrypt_file (const char *filename,
if (index > 0)
memcpy(&iv, ((uint8_t*) data) + (block_size * (index - 1)), sizeof(iv));
else
- memcpy(&iv, hash, sizeof(iv));
+ GNUNET_CRYPTO_symmetric_derive_iv(&iv, key, hash, sizeof(hash), NULL);
result = GNUNET_CRYPTO_symmetric_decrypt(
location,