mirror of
https://github.com/zlib-ng/minizip-ng
synced 2025-03-28 21:13:18 +00:00
allowing AES to be optional at runtime
This commit is contained in:
parent
5c4567ef32
commit
46695d2c00
50
zip.c
50
zip.c
@ -910,10 +910,25 @@ extern zipFile ZEXPORT zipOpen64(const void *path, int append)
|
||||
return zipOpen3(path, append, 0, NULL, NULL);
|
||||
}
|
||||
|
||||
extern int ZEXPORT zipOpenNewFileInZip4_64(zipFile file, const char *filename, const zip_fileinfo *zipfi,
|
||||
const void *extrafield_local, uint16_t size_extrafield_local, const void *extrafield_global,
|
||||
uint16_t size_extrafield_global, const char *comment, uint16_t method, int level, int raw, int windowBits, int memLevel,
|
||||
int strategy, const char *password, ZIP_UNUSED uint32_t crc_for_crypting, uint16_t version_madeby, uint16_t flag_base, int zip64)
|
||||
extern int ZEXPORT zipOpenNewFileInZip_internal(zipFile file,
|
||||
const char *filename,
|
||||
const zip_fileinfo *zipfi,
|
||||
const void *extrafield_local,
|
||||
uint16_t size_extrafield_local,
|
||||
const void *extrafield_global,
|
||||
uint16_t size_extrafield_global,
|
||||
const char *comment,
|
||||
uint16_t flag_base,
|
||||
int zip64,
|
||||
uint16_t method,
|
||||
int level,
|
||||
int raw,
|
||||
int windowBits,
|
||||
int memLevel,
|
||||
int strategy,
|
||||
const char *password,
|
||||
int aes,
|
||||
uint16_t version_madeby)
|
||||
{
|
||||
zip64_internal *zi = NULL;
|
||||
uint64_t size_available = 0;
|
||||
@ -978,7 +993,8 @@ extern int ZEXPORT zipOpenNewFileInZip4_64(zipFile file, const char *filename, c
|
||||
{
|
||||
zi->ci.flag |= 1;
|
||||
#ifdef HAVE_AES
|
||||
zi->ci.method = AES_METHOD;
|
||||
if (aes)
|
||||
zi->ci.method = AES_METHOD;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
@ -1255,6 +1271,30 @@ extern int ZEXPORT zipOpenNewFileInZip4_64(zipFile file, const char *filename, c
|
||||
return err;
|
||||
}
|
||||
|
||||
extern int ZEXPORT zipOpenNewFileInZip5(zipFile file, const char *filename, const zip_fileinfo *zipfi,
|
||||
const void *extrafield_local, uint16_t size_extrafield_local, const void *extrafield_global,
|
||||
uint16_t size_extrafield_global, const char *comment, uint16_t flag_base, int zip64, uint16_t method, int level, int raw,
|
||||
int windowBits, int memLevel, int strategy, const char *password, int aes)
|
||||
{
|
||||
return zipOpenNewFileInZip_internal(file, filename, zipfi, extrafield_local, size_extrafield_local, extrafield_global,
|
||||
size_extrafield_global, comment, flag_base, zip64, method, level, raw, windowBits, memLevel, strategy, password, aes,
|
||||
VERSIONMADEBY);
|
||||
}
|
||||
|
||||
extern int ZEXPORT zipOpenNewFileInZip4_64(zipFile file, const char *filename, const zip_fileinfo *zipfi,
|
||||
const void *extrafield_local, uint16_t size_extrafield_local, const void *extrafield_global,
|
||||
uint16_t size_extrafield_global, const char *comment, uint16_t method, int level, int raw, int windowBits, int memLevel,
|
||||
int strategy, const char *password, ZIP_UNUSED uint32_t crc_for_crypting, uint16_t version_madeby, uint16_t flag_base, int zip64)
|
||||
{
|
||||
uint8_t aes = 0;
|
||||
#ifdef HAVE_AES
|
||||
aes = 1;
|
||||
#endif
|
||||
return zipOpenNewFileInZip_internal(file, filename, zipfi, extrafield_local, size_extrafield_local, extrafield_global,
|
||||
size_extrafield_global, comment, flag_base, zip64, method, level, raw, windowBits, memLevel, strategy, password, aes,
|
||||
version_madeby);
|
||||
}
|
||||
|
||||
extern int ZEXPORT zipOpenNewFileInZip4(zipFile file, const char *filename, const zip_fileinfo *zipfi,
|
||||
const void *extrafield_local, uint16_t size_extrafield_local, const void *extrafield_global,
|
||||
uint16_t size_extrafield_global, const char *comment, uint16_t method, int level, int raw, int windowBits,
|
||||
|
20
zip.h
20
zip.h
@ -164,6 +164,26 @@ extern int ZEXPORT zipOpenNewFileInZip4_64(zipFile file, const char *filename, c
|
||||
int strategy, const char *password, ZIP_UNUSED uint32_t crc_for_crypting, uint16_t version_madeby, uint16_t flag_base, int zip64);
|
||||
/* Same as zipOpenNewFileInZip4 with zip64 support */
|
||||
|
||||
extern int ZEXPORT zipOpenNewFileInZip5(zipFile file,
|
||||
const char *filename,
|
||||
const zip_fileinfo *zipfi,
|
||||
const void *extrafield_local,
|
||||
uint16_t size_extrafield_local,
|
||||
const void *extrafield_global,
|
||||
uint16_t size_extrafield_global,
|
||||
const char *comment,
|
||||
uint16_t flag_base,
|
||||
int zip64,
|
||||
uint16_t method,
|
||||
int level,
|
||||
int raw,
|
||||
int windowBits,
|
||||
int memLevel,
|
||||
int strategy,
|
||||
const char *password,
|
||||
int aes);
|
||||
/* Allowing optional aes */
|
||||
|
||||
extern int ZEXPORT zipWriteInFileInZip(zipFile file, const void *buf, uint32_t len);
|
||||
/* Write data in the zipfile */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user