Skip to content

Commit

Permalink
update to libarchive 3.6.2
Browse files Browse the repository at this point in the history
  • Loading branch information
srirangav committed Dec 10, 2022
1 parent d224f4a commit f2eaf6d
Show file tree
Hide file tree
Showing 26 changed files with 180 additions and 52 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

PROJNAME = qlZipInfo
PROJEXT = qlgenerator
PROJVERS = 1.2.0
PROJVERS = 1.2.1
BUNDLEID = "org.calalum.ranga.$(PROJNAME)"

# extra files to include in the package
Expand Down
5 changes: 3 additions & 2 deletions README.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
README
------

qlZipInfo v1.2.0
qlZipInfo v1.2.1

Homepage:

Expand Down Expand Up @@ -85,7 +85,8 @@ Known Issues:

History:

v1.2.0 - Updates for Xcode 14.1, add instructions for
v1.2.1 - update to libarchive v.3.6.2
v1.2.0 - updates for Xcode 14.1, add instructions for
installation through Homebrew
v1.1.11 - add support for some Stuffit files
v1.1.10 - update to libarchive v.3.6.1 and lzma headers from
Expand Down
4 changes: 2 additions & 2 deletions qlZipInfo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@
INFOPLIST_FILE = qlZipInfo/Info.plist;
INSTALL_PATH = /Library/QuickLook;
MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 1.2.0;
MARKETING_VERSION = 1.2.1;
PRODUCT_BUNDLE_IDENTIFIER = "org.calalum.ranga.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -895,7 +895,7 @@
INFOPLIST_FILE = qlZipInfo/Info.plist;
INSTALL_PATH = /Library/QuickLook;
MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 1.2.0;
MARKETING_VERSION = 1.2.1;
PRODUCT_BUNDLE_IDENTIFIER = "org.calalum.ranga.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
6 changes: 4 additions & 2 deletions qlZipInfo/libarchive/archive.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
* assert that ARCHIVE_VERSION_NUMBER >= 2012108.
*/
/* Note: Compiler will complain if this does not match archive_entry.h! */
#define ARCHIVE_VERSION_NUMBER 3006001
#define ARCHIVE_VERSION_NUMBER 3006002

#include <sys/stat.h>
#include <stddef.h> /* for wchar_t */
Expand Down Expand Up @@ -120,6 +120,8 @@ typedef ssize_t la_ssize_t;
# define __LA_DECL __declspec(dllimport)
# endif
# endif
#elif defined __LIBARCHIVE_ENABLE_VISIBILITY
# define __LA_DECL __attribute__((visibility("default")))
#else
/* Static libraries or non-Windows needs no special declaration. */
# define __LA_DECL
Expand Down Expand Up @@ -155,7 +157,7 @@ __LA_DECL int archive_version_number(void);
/*
* Textual name/version of the library, useful for version displays.
*/
#define ARCHIVE_VERSION_ONLY_STRING "3.6.1"
#define ARCHIVE_VERSION_ONLY_STRING "3.6.2"
#define ARCHIVE_VERSION_STRING "libarchive " ARCHIVE_VERSION_ONLY_STRING
__LA_DECL const char * archive_version_string(void);

Expand Down
16 changes: 8 additions & 8 deletions qlZipInfo/libarchive/archive_digest.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,16 @@
* Initialize a Message digest.
*/
static int
win_crypto_init(Digest_CTX *ctx, ALG_ID algId)
win_crypto_init(Digest_CTX *ctx, DWORD prov, ALG_ID algId)
{

ctx->valid = 0;
if (!CryptAcquireContext(&ctx->cryptProv, NULL, NULL,
PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) {
prov, CRYPT_VERIFYCONTEXT)) {
if (GetLastError() != (DWORD)NTE_BAD_KEYSET)
return (ARCHIVE_FAILED);
if (!CryptAcquireContext(&ctx->cryptProv, NULL, NULL,
PROV_RSA_FULL, CRYPT_NEWKEYSET))
prov, CRYPT_NEWKEYSET))
return (ARCHIVE_FAILED);
}

Expand Down Expand Up @@ -276,7 +276,7 @@ __archive_md5final(archive_md5_ctx *ctx, void *md)
static int
__archive_md5init(archive_md5_ctx *ctx)
{
return (win_crypto_init(ctx, CALG_MD5));
return (win_crypto_init(ctx, PROV_RSA_FULL, CALG_MD5));
}

static int
Expand Down Expand Up @@ -659,7 +659,7 @@ __archive_sha1final(archive_sha1_ctx *ctx, void *md)
static int
__archive_sha1init(archive_sha1_ctx *ctx)
{
return (win_crypto_init(ctx, CALG_SHA1));
return (win_crypto_init(ctx, PROV_RSA_FULL, CALG_SHA1));
}

static int
Expand Down Expand Up @@ -919,7 +919,7 @@ __archive_sha256final(archive_sha256_ctx *ctx, void *md)
static int
__archive_sha256init(archive_sha256_ctx *ctx)
{
return (win_crypto_init(ctx, CALG_SHA_256));
return (win_crypto_init(ctx, PROV_RSA_AES, CALG_SHA_256));
}

static int
Expand Down Expand Up @@ -1155,7 +1155,7 @@ __archive_sha384final(archive_sha384_ctx *ctx, void *md)
static int
__archive_sha384init(archive_sha384_ctx *ctx)
{
return (win_crypto_init(ctx, CALG_SHA_384));
return (win_crypto_init(ctx, PROV_RSA_AES, CALG_SHA_384));
}

static int
Expand Down Expand Up @@ -1415,7 +1415,7 @@ __archive_sha512final(archive_sha512_ctx *ctx, void *md)
static int
__archive_sha512init(archive_sha512_ctx *ctx)
{
return (win_crypto_init(ctx, CALG_SHA_512));
return (win_crypto_init(ctx, PROV_RSA_AES, CALG_SHA_512));
}

static int
Expand Down
22 changes: 18 additions & 4 deletions qlZipInfo/libarchive/archive_entry.c
Original file line number Diff line number Diff line change
Expand Up @@ -568,13 +568,27 @@ archive_entry_nlink(struct archive_entry *entry)
return (entry->ae_stat.aest_nlink);
}

/* Instead, our caller could have chosen a specific encoding
* (archive_mstring_get_mbs, archive_mstring_get_utf8,
* archive_mstring_get_wcs). So we should try multiple
* encodings. Try mbs first because of history, even though
* utf8 might be better for pathname portability.
* Also omit wcs because of type mismatch (char * versus wchar *)
*/
const char *
archive_entry_pathname(struct archive_entry *entry)
{
const char *p;
if (archive_mstring_get_mbs(
entry->archive, &entry->ae_pathname, &p) == 0)
return (p);
#if HAVE_EILSEQ /*{*/
if (errno == EILSEQ) {
if (archive_mstring_get_utf8(
entry->archive, &entry->ae_pathname, &p) == 0)
return (p);
}
#endif /*}*/
if (errno == ENOMEM)
__archive_errx(1, "No memory");
return (NULL);
Expand Down Expand Up @@ -984,7 +998,7 @@ archive_entry_set_atime(struct archive_entry *entry, time_t t, long ns)
entry->stat_valid = 0;
entry->ae_set |= AE_SET_ATIME;
entry->ae_stat.aest_atime = t;
entry->ae_stat.aest_atime_nsec = (unsigned int)ns;
entry->ae_stat.aest_atime_nsec = (uint32_t)ns;
}

void
Expand All @@ -1001,7 +1015,7 @@ archive_entry_set_birthtime(struct archive_entry *entry, time_t t, long ns)
entry->stat_valid = 0;
entry->ae_set |= AE_SET_BIRTHTIME;
entry->ae_stat.aest_birthtime = t;
entry->ae_stat.aest_birthtime_nsec = (unsigned int)ns;
entry->ae_stat.aest_birthtime_nsec = (uint32_t)ns;
}

void
Expand All @@ -1018,7 +1032,7 @@ archive_entry_set_ctime(struct archive_entry *entry, time_t t, long ns)
entry->stat_valid = 0;
entry->ae_set |= AE_SET_CTIME;
entry->ae_stat.aest_ctime = t;
entry->ae_stat.aest_ctime_nsec = (unsigned int)ns;
entry->ae_stat.aest_ctime_nsec = (uint32_t)ns;
}

void
Expand Down Expand Up @@ -1140,7 +1154,7 @@ archive_entry_set_mtime(struct archive_entry *entry, time_t t, long ns)
entry->stat_valid = 0;
entry->ae_set |= AE_SET_MTIME;
entry->ae_stat.aest_mtime = t;
entry->ae_stat.aest_mtime_nsec = (unsigned int)ns;
entry->ae_stat.aest_mtime_nsec = (uint32_t)ns;
}

void
Expand Down
4 changes: 3 additions & 1 deletion qlZipInfo/libarchive/archive_entry.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#define ARCHIVE_ENTRY_H_INCLUDED

/* Note: Compiler will complain if this does not match archive.h! */
#define ARCHIVE_VERSION_NUMBER 3006001
#define ARCHIVE_VERSION_NUMBER 3006002

/*
* Note: archive_entry.h is for use outside of libarchive; the
Expand Down Expand Up @@ -122,6 +122,8 @@ typedef ssize_t la_ssize_t;
# define __LA_DECL __declspec(dllimport)
# endif
# endif
#elif defined __LIBARCHIVE_ENABLE_VISIBILITY
# define __LA_DECL __attribute__((visibility("default")))
#else
/* Static libraries on all platforms and shared libraries on non-Windows. */
# define __LA_DECL
Expand Down
29 changes: 29 additions & 0 deletions qlZipInfo/libarchive/archive_hmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,33 +230,62 @@ __hmac_sha1_cleanup(archive_hmac_sha1_ctx *ctx)
static int
__hmac_sha1_init(archive_hmac_sha1_ctx *ctx, const uint8_t *key, size_t key_len)
{
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
OSSL_PARAM params[2];

EVP_MAC *mac = EVP_MAC_fetch(NULL, "HMAC", NULL);
*ctx = EVP_MAC_CTX_new(mac);
if (*ctx == NULL)
return -1;
EVP_MAC_free(mac);
params[0] = OSSL_PARAM_construct_utf8_string("digest", "SHA1", 0);
params[1] = OSSL_PARAM_construct_end();
EVP_MAC_init(*ctx, key, key_len, params);
#else
*ctx = HMAC_CTX_new();
if (*ctx == NULL)
return -1;
HMAC_Init_ex(*ctx, key, key_len, EVP_sha1(), NULL);
#endif
return 0;
}

static void
__hmac_sha1_update(archive_hmac_sha1_ctx *ctx, const uint8_t *data,
size_t data_len)
{
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
EVP_MAC_update(*ctx, data, data_len);
#else
HMAC_Update(*ctx, data, data_len);
#endif
}

static void
__hmac_sha1_final(archive_hmac_sha1_ctx *ctx, uint8_t *out, size_t *out_len)
{
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
size_t len = *out_len;
#else
unsigned int len = (unsigned int)*out_len;
#endif

#if OPENSSL_VERSION_NUMBER >= 0x30000000L
EVP_MAC_final(*ctx, out, &len, *out_len);
#else
HMAC_Final(*ctx, out, &len);
#endif
*out_len = len;
}

static void
__hmac_sha1_cleanup(archive_hmac_sha1_ctx *ctx)
{
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
EVP_MAC_CTX_free(*ctx);
#else
HMAC_CTX_free(*ctx);
#endif
*ctx = NULL;
}

Expand Down
7 changes: 7 additions & 0 deletions qlZipInfo/libarchive/archive_hmac_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,16 @@ typedef mbedtls_md_context_t archive_hmac_sha1_ctx;
typedef struct hmac_sha1_ctx archive_hmac_sha1_ctx;

#elif defined(HAVE_LIBCRYPTO)
#include <openssl/opensslv.h>
#include <openssl/hmac.h>
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
typedef EVP_MAC_CTX *archive_hmac_sha1_ctx;

#else
#include "archive_openssl_hmac_private.h"

typedef HMAC_CTX* archive_hmac_sha1_ctx;
#endif

#else

Expand Down
3 changes: 2 additions & 1 deletion qlZipInfo/libarchive/archive_platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,9 @@

/*
* glibc 2.24 deprecates readdir_r
* bionic c deprecates readdir_r too
*/
#if defined(HAVE_READDIR_R) && (!defined(__GLIBC__) || !defined(__GLIBC_MINOR__) || __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 24))
#if defined(HAVE_READDIR_R) && (!defined(__GLIBC__) || !defined(__GLIBC_MINOR__) || __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 24)) && (!defined(__ANDROID__))
#define USE_READDIR_R 1
#else
#undef USE_READDIR_R
Expand Down
2 changes: 1 addition & 1 deletion qlZipInfo/libarchive/archive_ppmd8.c
Original file line number Diff line number Diff line change
Expand Up @@ -1145,7 +1145,7 @@ static void RangeDec_Decode(CPpmd8 *p, UInt32 start, UInt32 size)
p->Range *= size;

while ((p->Low ^ (p->Low + p->Range)) < kTop ||
(p->Range < kBot && ((void)((p->Range = (0 - p->Low) & (kBot - 1))), 1)))
(p->Range < kBot && ((void)((p->Range = (0 - p->Low) & (kBot - 1))), 1)))
{
p->Code = (p->Code << 8) | p->Stream.In->Read(p->Stream.In);
p->Range <<= 8;
Expand Down
11 changes: 6 additions & 5 deletions qlZipInfo/libarchive/archive_read_disk_posix.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ __FBSDID("$FreeBSD$");
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#ifdef HAVE_SYS_MOUNT_H
#include <sys/mount.h>
#endif
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
Expand All @@ -54,6 +51,8 @@ __FBSDID("$FreeBSD$");
#endif
#ifdef HAVE_LINUX_FS_H
#include <linux/fs.h>
#elif HAVE_SYS_MOUNT_H
#include <sys/mount.h>
#endif
/*
* Some Linux distributions have both linux/ext2_fs.h and ext2fs/ext2_fs.h.
Expand Down Expand Up @@ -2035,10 +2034,10 @@ close_and_restore_time(int fd, struct tree *t, struct restore_time *rt)
#endif

times[1].tv_sec = rt->mtime;
times[1].tv_usec = (int)(rt->mtime_nsec / 1000);
times[1].tv_usec = (__darwin_suseconds_t)(rt->mtime_nsec / 1000);

times[0].tv_sec = rt->atime;
times[0].tv_usec = (int)(rt->atime_nsec / 1000);
times[0].tv_usec = (__darwin_suseconds_t)(rt->atime_nsec / 1000);

#if !defined(HAVE_FUTIMENS) && defined(HAVE_FUTIMES) && !defined(__CYGWIN__)
if (futimes(fd, times) == 0)
Expand Down Expand Up @@ -2103,6 +2102,8 @@ tree_push(struct tree *t, const char *path, int filesystem_id,
struct tree_entry *te;

te = calloc(1, sizeof(*te));
if (te == NULL)
__archive_errx(1, "Out of memory");
te->next = t->stack;
te->parent = t->current;
if (te->parent)
Expand Down
6 changes: 6 additions & 0 deletions qlZipInfo/libarchive/archive_read_support_filter_lz4.c
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,9 @@ lz4_filter_read_descriptor(struct archive_read_filter *self)
chsum = (chsum >> 8) & 0xff;
chsum_verifier = read_buf[descriptor_bytes-1] & 0xff;
if (chsum != chsum_verifier)
#ifndef DONT_FAIL_ON_CRC_ERROR
goto malformed_error;
#endif

__archive_read_filter_consume(self->upstream, descriptor_bytes);

Expand Down Expand Up @@ -521,7 +523,9 @@ lz4_filter_read_data_block(struct archive_read_filter *self, const void **p)
unsigned int chsum_block =
archive_le32dec(read_buf + 4 + compressed_size);
if (chsum != chsum_block)
#ifndef DONT_FAIL_ON_CRC_ERROR
goto malformed_error;
#endif
}


Expand Down Expand Up @@ -652,10 +656,12 @@ lz4_filter_read_default_stream(struct archive_read_filter *self, const void **p)
state->xxh32_state);
state->xxh32_state = NULL;
if (checksum != checksum_stream) {
#ifndef DONT_FAIL_ON_CRC_ERROR
archive_set_error(&self->archive->archive,
ARCHIVE_ERRNO_MISC,
"lz4 stream checksum error");
return (ARCHIVE_FATAL);
#endif
}
} else if (ret > 0)
__archive_xxhash.XXH32_update(state->xxh32_state,
Expand Down
Loading

0 comments on commit f2eaf6d

Please sign in to comment.