]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Fix incompatibility with Nettle 4.x 2858/head
authorFooIbar <118464521+FooIbar@users.noreply.github.com>
Fri, 6 Feb 2026 12:52:25 +0000 (20:52 +0800)
committerFooIbar <118464521+FooIbar@users.noreply.github.com>
Fri, 6 Feb 2026 14:26:19 +0000 (22:26 +0800)
libarchive/archive_cryptor_private.h
libarchive/archive_hmac.c

index 367d7c3bc9909b979db356cea51caab50c7c2539..069eccd994bfb069d232e9dc7616816caf7cb03d 100644 (file)
@@ -109,6 +109,10 @@ typedef struct {
 #include <nettle/version.h>
 #define        ARCHIVE_CRYPTOR_USE_NETTLE 1
 
+#ifndef AES_MAX_KEY_SIZE
+#define AES_MAX_KEY_SIZE AES256_KEY_SIZE
+#endif
+
 typedef struct {
 #if NETTLE_VERSION_MAJOR < 3
        struct aes_ctx  ctx;
index edb3bf5abd42102f4de40a79451e43a2654196ae..e1e8f05ff0d3a04ba7f4231d324e493c0272c2f5 100644 (file)
@@ -198,6 +198,7 @@ static void __hmac_sha1_cleanup(archive_hmac_sha1_ctx *ctx)
 }
 
 #elif defined(HAVE_LIBNETTLE) && defined(HAVE_NETTLE_HMAC_H)
+#include <nettle/version.h>
 
 static int
 __hmac_sha1_init(archive_hmac_sha1_ctx *ctx, const uint8_t *key, size_t key_len)
@@ -216,7 +217,12 @@ __hmac_sha1_update(archive_hmac_sha1_ctx *ctx, const uint8_t *data,
 static void
 __hmac_sha1_final(archive_hmac_sha1_ctx *ctx, uint8_t *out, size_t *out_len)
 {
+#if NETTLE_VERSION_MAJOR < 4
        hmac_sha1_digest(ctx, (unsigned)*out_len, out);
+#else
+       hmac_sha1_digest(ctx, out);
+       *out_len = SHA1_DIGEST_SIZE;
+#endif
 }
 
 static void