VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common/libzip/zip_get_encryption_implementation.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/Common/libzip/zip_get_encryption_implementation.c')
-rw-r--r--src/Common/libzip/zip_get_encryption_implementation.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/Common/libzip/zip_get_encryption_implementation.c b/src/Common/libzip/zip_get_encryption_implementation.c
index e2f833b4..f8af7b02 100644
--- a/src/Common/libzip/zip_get_encryption_implementation.c
+++ b/src/Common/libzip/zip_get_encryption_implementation.c
@@ -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;
+ }
}