Mercurial > embed
diff libzip/lib/zip_get_encryption_implementation.c @ 56:056ee6b5913e
libzip: update to 1.3.0, closes #654
author | David Demelier <markand@malikania.fr> |
---|---|
date | Tue, 10 Oct 2017 20:43:12 +0200 |
parents | 2306f4b04790 |
children |
line wrap: on
line diff
--- a/libzip/lib/zip_get_encryption_implementation.c Fri Sep 22 14:07:40 2017 +0200 +++ b/libzip/lib/zip_get_encryption_implementation.c Tue Oct 10 20:43:12 2017 +0200 @@ -1,6 +1,6 @@ /* zip_get_encryption_implementation.c -- get encryption implementation - Copyright (C) 2009-2014 Dieter Baron and Thomas Klausner + Copyright (C) 2009-2016 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at <libzip@nih.at> @@ -36,9 +36,21 @@ zip_encryption_implementation -_zip_get_encryption_implementation(zip_uint16_t em) +_zip_get_encryption_implementation(zip_uint16_t em, int operation) { - if (em == ZIP_EM_TRAD_PKWARE) + switch (em) { + case ZIP_EM_TRAD_PKWARE: + if (operation == ZIP_CODEC_ENCODE) { + return NULL; + } return zip_source_pkware; - return NULL; + + case ZIP_EM_AES_128: + case ZIP_EM_AES_192: + case ZIP_EM_AES_256: + return operation == ZIP_CODEC_DECODE ? zip_source_winzip_aes_decode : zip_source_winzip_aes_encode; + + default: + return NULL; + } }