Add read-only support for AES encryption (Winzip version).
Use Dr Brian Gladman's AES implemention, modified to avoid
namespace pollution.
diff --git a/lib/zip.h b/lib/zip.h
index 7a87e28..61195cf 100644
--- a/lib/zip.h
+++ b/lib/zip.h
@@ -20,7 +20,7 @@
3. The names of the authors may not be used to endorse or promote
products derived from this software without specific prior
written permission.
-
+
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -127,7 +127,7 @@
#define ZIP_ER_REMOVE 22 /* S Can't remove file */
#define ZIP_ER_DELETED 23 /* N Entry has been deleted */
#define ZIP_ER_ENCRNOTSUPP 24 /* N Encryption method not supported */
-#define ZIP_ER_RDONLY 25 /* N Read-only archive */
+#define ZIP_ER_RDONLY 25 /* N Read-only archive */
#define ZIP_ER_NOPASSWD 26 /* N No password provided */
#define ZIP_ER_WRONGPASSWD 27 /* N Wrong password provided */
#define ZIP_ER_OPNOTSUPP 28 /* N Operation not supported */
@@ -173,12 +173,15 @@
#define ZIP_EM_RC2_OLD 0x6602 /* strong encryption: RC2, version < 5.2 */
#define ZIP_EM_3DES_168 0x6603
#define ZIP_EM_3DES_112 0x6609
-#define ZIP_EM_AES_128 0x660e
-#define ZIP_EM_AES_192 0x660f
-#define ZIP_EM_AES_256 0x6610
+#define ZIP_EM_PKZIP_AES_128 0x660e
+#define ZIP_EM_PKZIP_AES_192 0x660f
+#define ZIP_EM_PKZIP_AES_256 0x6610
#define ZIP_EM_RC2 0x6702 /* strong encryption: RC2, version >= 5.2 */
#define ZIP_EM_RC4 0x6801
#endif
+#define ZIP_EM_AES_128 0x0101 /* Winzip AES encryption */
+#define ZIP_EM_AES_192 0x0102
+#define ZIP_EM_AES_256 0x0103
#define ZIP_EM_UNKNOWN 0xffff /* unknown algorithm */
#define ZIP_OPSYS_DOS 0x00u
@@ -299,7 +302,7 @@
typedef struct zip_source zip_source_t;
typedef struct zip_stat zip_stat_t;
-typedef zip_uint32_t zip_flags_t;
+typedef zip_uint32_t zip_flags_t;
typedef zip_int64_t (*zip_source_callback)(void *, void *, zip_uint64_t, zip_source_cmd_t);