From dce424ec85723fa7467623d6f7d73992043cd854 Mon Sep 17 00:00:00 2001 From: Moinak Ghosh Date: Mon, 4 Mar 2013 22:35:33 +0530 Subject: [PATCH] Use 128-bit key length when decompressing older version archives. --- crypto/crypto_utils.h | 5 +++-- main.c | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/crypto/crypto_utils.h b/crypto/crypto_utils.h index 409df79..54d98c1 100644 --- a/crypto/crypto_utils.h +++ b/crypto/crypto_utils.h @@ -47,8 +47,9 @@ extern "C" { #define MAX_KEYLEN DEFAULT_KEYLEN #endif -#define ENCRYPT_FLAG 1 -#define DECRYPT_FLAG 0 +#define OLD_KEYLEN 16 +#define ENCRYPT_FLAG 1 +#define DECRYPT_FLAG 0 #define CRYPTO_ALG_AES 0x10 #define CRYPTO_ALG_SALSA20 0x20 #define MAX_SALTLEN 64 diff --git a/main.c b/main.c index 1e597f8..eacde6f 100644 --- a/main.c +++ b/main.c @@ -818,6 +818,8 @@ start_decompress(const char *filename, const char *to_filename) pw_len = -1; compressed_chunksize += mac_bytes; encrypt_type = flags & MASK_CRYPTO_ALG; + if (version < 7) + keylen = OLD_KEYLEN; if (encrypt_type == CRYPTO_ALG_AES) { noncelen = 8;