8000 LZMA encryption fails with 2.7.0 · Issue #334 · zlib-ng/minizip-ng · GitHub
[go: up one dir, main page]

Skip to content

LZMA encryption fails with 2.7.0 #334

Closed

Description

@vszakats
$ curl -LO https://github.com/nmoinvaz/minizip/arch
8000
ive/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:

#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

  1. changed the title [-]Encryption fails with 2.7.0[/-] [+]LZMA encryption fails with 2.7.0[/+] on Oct 31, 2018
  2. vszakats commented on Nov 1, 2018

    @vszakats
    ContributorAuthor

    Used crypto module is mz_crypt_brg.c.

  3. nmoinvaz commented on Nov 1, 2018

    @nmoinvaz
    Member

    I am very surprised by this. I worked on Travis CI to test all the possible cases.

  4. nmoinvaz commented on Nov 1, 2018

    @nmoinvaz
    Member

    I would at some point like to make a native version for macOS of the mz_crypt file.

  5. nmoinvaz commented on Nov 1, 2018

    @nmoinvaz
    Member

    I think I got it. Thanks.

  6. vszakats commented on Nov 1, 2018

    @vszakats
    ContributorAuthor

    Thanks! Though in latest dev, the above sample no longer compiles, with these errors:

    test-crypt.c:22:53: error: use of undeclared identifier 'MAX_WBITS'
                                                       -MAX_WBITS, DEF_MEM_LEVEL, 0,
                                                        ^
    test-crypt.c:22:64: error: use of undeclared identifier 'DEF_MEM_LEVEL'
                                                       -MAX_WBITS, DEF_MEM_LEVEL, 0,
                                                                   ^
    2 errors generated.
    
  7. vszakats commented on Nov 1, 2018

    @vszakats
    ContributorAuthor
  8. added
    encryptionEncryption/decryption issue
    fixedIssue or bug has been fixed
    lzmaXZ compression format
    on Apr 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    encryptionEncryption/decryption issuefixedIssue or bug has been fixedlzmaXZ compression format

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0