```shell $ curl -LO https://github.com/nmoinvaz/minizip/archive/2.7.0.tar.gz $ tar -xvf 2.7.0.tar.gz $ cd minizip-2.7.0 $ cmake . $ make $ clang test-crypt.c -I. -L. -lminizip -lbz2 -lz ``` `test-crypt.c`: ```c #include <string.h> #include <stdio.h> #include <stdlib.h> #include "mz.h" #include "mz_zip.h" #include "mz_compat.h" int main(void) { zip_fileinfo zfi; const unsigned char content[] = "abcdefghijklmnopqrstuvvvwwwxxx"; zipFile hZip; // create .zip printf("zcreat: %p\n", (void *)(hZip = zipOpen2_64("test.zip", APPEND_STATUS_CREATE, NULL, NULL))); memset(&zfi, 0, sizeof(zfi)); printf("zaddfi: %d\n", zipOpenNewFileInZip4_64(hZip, "test.txt", &zfi, NULL, 0, NULL, 0, NULL, MZ_COMPRESS_METHOD_LZMA, 6, 0, -MAX_WBITS, DEF_MEM_LEVEL, 0, "password", 0x4c72ad0a /* crc of 'content' */, 0, 0, 0)); printf("zwrite: %d\n", zipWriteInFileInZip(hZip, content, sizeof(content))); printf("zfclos: %d\n", zipCloseFileInZip(hZip)); printf("zclose: %d\n", zipClose(hZip, NULL)); return 0; } ``` actual output: ``` zcreat: 0x7fbdf2c02cc0 zaddfi: -102 zwrite: -1 zfclos: -102 zclose: 0 ``` expected (and actual result with 2.6.0): ``` zcreat: 0x7fd15ac02cc0 zaddfi: 0 zwrite: 0 zfclos: 0 zclose: 0 ``` (Tested on macOS 10.14)
Activity
[-]Encryption fails with 2.7.0[/-][+]LZMA encryption fails with 2.7.0[/+]vszakats commentedon Nov 1, 2018
Used crypto module is
mz_crypt_brg.c.nmoinvaz commentedon Nov 1, 2018
I am very surprised by this. I worked on Travis CI to test all the possible cases.
nmoinvaz commentedon Nov 1, 2018
I would at some point like to make a native version for macOS of the mz_crypt file.
Fixed hmac implementation in brg library. #334
nmoinvaz commentedon Nov 1, 2018
I think I got it. Thanks.
vszakats commentedon Nov 1, 2018
Thanks! Though in latest
dev, the above sample no longer compiles, with these errors:vszakats commentedon Nov 1, 2018
Ref this comment: f79ec42#commitcomment-31132281