Skip to content

Commit

Permalink
Merge pull request #613 from ZipArchive/minizip-ng-3.0.2
Browse files Browse the repository at this point in the history
Upgrade minizip to minizip-ng 3.0.2
  • Loading branch information
jhudsonWA committed May 29, 2021
2 parents b3b671c + 7196b7e commit 414a56b
Show file tree
Hide file tree
Showing 30 changed files with 1,409 additions and 2,066 deletions.
4 changes: 2 additions & 2 deletions Example/Podfile.lock
@@ -1,5 +1,5 @@
PODS:
- SSZipArchive (2.3.0)
- SSZipArchive (2.4.0)

DEPENDENCIES:
- SSZipArchive (from `..`)
Expand All @@ -9,7 +9,7 @@ EXTERNAL SOURCES:
:path: ".."

SPEC CHECKSUMS:
SSZipArchive: bd011dff453b63190558d39803b1ecddb061b8bb
SSZipArchive: fc3955f860f5f222095cd6a3547d407534c03a88

PODFILE CHECKSUM: d64f92b7d189c903da3c73a5a6841f4d9a98bde7

Expand Down
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -75,13 +75,13 @@ SSZipArchive.unzipFileAtPath(zipPath, toDestination: unzipPath)

## License

SSZipArchive is protected under the [MIT license](https://github.com/samsoffes/ssziparchive/raw/master/LICENSE) and our slightly modified version of [Minizip](https://github.com/nmoinvaz/minizip) 1.2 is licensed under the [Zlib license](https://www.zlib.net/zlib_license.html).
SSZipArchive is protected under the [MIT license](https://github.com/samsoffes/ssziparchive/raw/master/LICENSE) and our slightly modified version of [minizip-ng (formally minizip)](https://github.com/zlib-ng/minizip-ng) 3.0.2 is licensed under the [Zlib license](https://www.zlib.net/zlib_license.html).

## Acknowledgments

* Big thanks to *aish* for creating [ZipArchive](https://code.google.com/archive/p/ziparchive/). The project that inspired SSZipArchive.
* Thank you [@soffes](https://github.com/soffes) for the actual name of SSZipArchive.
* Thank you [@randomsequence](https://github.com/randomsequence) for implementing the creation support tech.
* Thank you [@johnezang](https://github.com/johnezang) for all his amazing help along the way.
* Thank you [@nmoinvaz](https://github.com/nmoinvaz) for minizip, the core of ZipArchive.
* Thank you [@nmoinvaz](https://github.com/nmoinvaz) for minizip-ng (formally minizip), the core of ZipArchive.
* Thank you to [all the contributors](https://github.com/ZipArchive/ZipArchive/graphs/contributors).
2 changes: 1 addition & 1 deletion SSZipArchive.podspec
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'SSZipArchive'
s.version = '2.3.0'
s.version = '2.4.0'
s.summary = 'Utility class for zipping and unzipping files on iOS, tvOS, watchOS, and macOS.'
s.description = 'SSZipArchive is a simple utility class for zipping and unzipping files on iOS, tvOS, watchOS, and macOS. It supports AES and PKWARE encryption.'
s.homepage = 'https://github.com/ZipArchive/ZipArchive'
Expand Down
54 changes: 38 additions & 16 deletions SSZipArchive/minizip/mz.h
@@ -1,9 +1,8 @@
/* mz.h -- Errors codes, zip flags and magic
Version 2.9.2, February 12, 2020
part of the MiniZip project
part of the minizip-ng project
Copyright (C) 2010-2020 Nathan Moinvaziri
https://github.com/nmoinvaz/minizip
Copyright (C) 2010-2021 Nathan Moinvaziri
https://github.com/zlib-ng/minizip-ng
This program is distributed under the terms of the same license as zlib.
See the accompanying LICENSE file for the full text of the license.
Expand All @@ -15,7 +14,8 @@
/***************************************************************************/

/* MZ_VERSION */
#define MZ_VERSION ("2.9.2")
#define MZ_VERSION ("3.0.2")
#define MZ_VERSION_BUILD (030002)

/* MZ_ERROR */
#define MZ_OK (0) /* zlib */
Expand Down Expand Up @@ -64,6 +64,8 @@
#define MZ_COMPRESS_METHOD_DEFLATE (8)
#define MZ_COMPRESS_METHOD_BZIP2 (12)
#define MZ_COMPRESS_METHOD_LZMA (14)
#define MZ_COMPRESS_METHOD_ZSTD (93)
#define MZ_COMPRESS_METHOD_XZ (95)
#define MZ_COMPRESS_METHOD_AES (99)

#define MZ_COMPRESS_LEVEL_DEFAULT (-1)
Expand Down Expand Up @@ -139,13 +141,13 @@
#define MZ_UNUSED(SYMBOL) ((void)SYMBOL)

#ifndef MZ_CUSTOM_ALLOC
#define MZ_ALLOC(SIZE) (malloc(SIZE))
#define MZ_ALLOC(SIZE) (malloc((SIZE)))
#endif
#ifndef MZ_CUSTOM_FREE
#define MZ_FREE(PTR) (free(PTR))
#endif

#if defined(_WINDOWS) && defined(MZ_EXPORTS)
#if defined(_WIN32) && defined(MZ_EXPORTS)
#define MZ_EXPORT __declspec(dllexport)
#else
#define MZ_EXPORT
Expand All @@ -158,8 +160,12 @@
#include <string.h> /* memset, strncpy, strlen */
#include <limits.h>

#ifdef HAVE_STDINT_H
#if defined(HAVE_STDINT_H)
# include <stdint.h>
#elif defined(__has_include)
# if __has_include(<stdint.h>)
# include <stdint.h>
# endif
#endif

#ifndef __INT8_TYPE__
Expand Down Expand Up @@ -187,16 +193,32 @@ typedef unsigned int uint32_t;
typedef unsigned long long uint64_t;
#endif

#ifdef HAVE_INTTYPES_H
#if defined(HAVE_INTTYPES_H)
# include <inttypes.h>
#elif defined(__has_include)
# if __has_include(<inttypes.h>)
# include <inttypes.h>
# endif
#endif

#ifndef PRId8
# define PRId8 "hhd"
#endif
#ifndef PRIu8
# define PRIu8 "hhu"
#endif
#ifndef PRIx8
# define PRIx8 "hhx"
#endif
#ifndef PRId16
# define PRId16 "hd"
#endif
#ifndef PRIu16
# define PRIu16 "hu"
#endif
#ifndef PRIx16
# define PRIx16 "hx"
#endif
#ifndef PRId32
# define PRId32 "d"
#endif
Expand All @@ -206,25 +228,25 @@ typedef unsigned long long uint64_t;
#ifndef PRIx32
# define PRIx32 "x"
#endif
#if ULONG_MAX == 4294967295UL
#if ULONG_MAX == 0xfffffffful
# ifndef PRId64
# define PRId64 "lld"
# define PRId64 "ld"
# endif
# ifndef PRIu64
# define PRIu64 "llu"
# define PRIu64 "lu"
# endif
# ifndef PRIx64
# define PRIx64 "llx"
# define PRIx64 "lx"
# endif
#else
# ifndef PRId64
# define PRId64 "ld"
# define PRId64 "lld"
# endif
# ifndef PRIu64
# define PRIu64 "lu"
# define PRIu64 "llu"
# endif
# ifndef PRIx64
# define PRIx64 "lx"
# define PRIx64 "llx"
# endif
#endif

Expand Down
31 changes: 16 additions & 15 deletions SSZipArchive/minizip/mz_crypt.c
@@ -1,16 +1,16 @@
/* mz_crypt.c -- Crypto/hash functions
Version 2.9.2, February 12, 2020
part of the MiniZip project
part of the minizip-ng project
Copyright (C) 2010-2020 Nathan Moinvaziri
https://github.com/nmoinvaz/minizip
Copyright (C) 2010-2021 Nathan Moinvaziri
https://github.com/zlib-ng/minizip-ng
This program is distributed under the terms of the same license as zlib.
See the accompanying LICENSE file for the full text of the license.
*/


#include "mz.h"
#include "mz_os.h"
#include "mz_crypt.h"

#if defined(HAVE_ZLIB)
Expand Down Expand Up @@ -41,8 +41,13 @@

/***************************************************************************/

uint32_t mz_crypt_crc32_update(uint32_t value, const uint8_t *buf, int32_t size)
{
#if defined(MZ_ZIP_NO_CRYPTO)
int32_t mz_crypt_rand(uint8_t *buf, int32_t size) {
return mz_os_rand(buf, size);
}
#endif

uint32_t mz_crypt_crc32_update(uint32_t value, const uint8_t *buf, int32_t size) {
#if defined(HAVE_ZLIB)
return (uint32_t)ZLIB_PREFIX(crc32)((z_crc_t)value, buf, (uInt)size);
#elif defined(HAVE_LZMA)
Expand Down Expand Up @@ -95,8 +100,7 @@ uint32_t mz_crypt_crc32_update(uint32_t value, const uint8_t *buf, int32_t size)
};
value = ~value;

while (size > 0)
{
while (size > 0) {
value = (value >> 8) ^ crc32_table[(value ^ *buf) & 0xFF];

buf += 1;
Expand All @@ -107,10 +111,9 @@ uint32_t mz_crypt_crc32_update(uint32_t value, const uint8_t *buf, int32_t size)
#endif
}

#ifndef MZ_ZIP_NO_ENCRYPTION
#if defined(HAVE_WZAES)
int32_t mz_crypt_pbkdf2(uint8_t *password, int32_t password_length, uint8_t *salt,
int32_t salt_length, int32_t iteration_count, uint8_t *key, int32_t key_length)
{
int32_t salt_length, int32_t iteration_count, uint8_t *key, int32_t key_length) {
void *hmac1 = NULL;
void *hmac2 = NULL;
void *hmac3 = NULL;
Expand Down Expand Up @@ -143,8 +146,7 @@ int32_t mz_crypt_pbkdf2(uint8_t *password, int32_t password_length, uint8_t *sa

block_count = 1 + ((uint16_t)key_length - 1) / MZ_HASH_SHA1_SIZE;

for (i = 0; (err == MZ_OK) && (i < block_count); i += 1)
{
for (i = 0; (err == MZ_OK) && (i < block_count); i += 1) {
memset(ux, 0, sizeof(ux));

err = mz_crypt_hmac_copy(hmac2, hmac3);
Expand All @@ -156,8 +158,7 @@ int32_t mz_crypt_pbkdf2(uint8_t *password, int32_t password_length, uint8_t *sa
uu[2] = (uint8_t)((i + 1) >> 8);
uu[3] = (uint8_t)(i + 1);

for (j = 0, k = 4; j < iteration_count; j += 1)
{
for (j = 0, k = 4; j < iteration_count; j += 1) {
err = mz_crypt_hmac_update(hmac3, uu, k);
if (err == MZ_OK)
err = mz_crypt_hmac_end(hmac3, uu, sizeof(uu));
Expand Down
7 changes: 3 additions & 4 deletions SSZipArchive/minizip/mz_crypt.h
@@ -1,9 +1,8 @@
/* mz_crypt.h -- Crypto/hash functions
Version 2.9.2, February 12, 2020
part of the MiniZip project
part of the minizip-ng project
Copyright (C) 2010-2020 Nathan Moinvaziri
https://github.com/nmoinvaz/minizip
Copyright (C) 2010-2021 Nathan Moinvaziri
https://github.com/zlib-ng/minizip-ng
This program is distributed under the terms of the same license as zlib.
See the accompanying LICENSE file for the full text of the license.
Expand Down

0 comments on commit 414a56b

Please sign in to comment.