crypt.h   crypt.h 
skipping to change at line 34 skipping to change at line 34
The new AES encryption added on Zip format by Winzip (see the page The new AES encryption added on Zip format by Winzip (see the page
http://www.winzip.com/aes_info.htm ) and PKWare PKZip 5.x Strong http://www.winzip.com/aes_info.htm ) and PKWare PKZip 5.x Strong
Encryption is not supported. Encryption is not supported.
*/ */
#define CRC32(c, b) ((*(pcrc_32_tab+(((int)(c) ^ (b)) & 0xff))) ^ ((c) >> 8 )) #define CRC32(c, b) ((*(pcrc_32_tab+(((int)(c) ^ (b)) & 0xff))) ^ ((c) >> 8 ))
/*********************************************************************** /***********************************************************************
* Return the next byte in the pseudo-random sequence * Return the next byte in the pseudo-random sequence
*/ */
static int decrypt_byte(unsigned long* pkeys, const unsigned long* pcrc_32_ tab) static int decrypt_byte(unsigned long* pkeys, const z_crc_t* pcrc_32_tab)
{ {
unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an
* unpredictable manner on 16-bit systems; not a proble m * unpredictable manner on 16-bit systems; not a proble m
* with any known compiler so far, though */ * with any known compiler so far, though */
temp = ((unsigned)(*(pkeys+2)) & 0xffff) | 2; temp = ((unsigned)(*(pkeys+2)) & 0xffff) | 2;
return (int)(((temp * (temp ^ 1)) >> 8) & 0xff); return (int)(((temp * (temp ^ 1)) >> 8) & 0xff);
} }
/*********************************************************************** /***********************************************************************
* Update the encryption keys with the next byte of plain text * Update the encryption keys with the next byte of plain text
*/ */
static int update_keys(unsigned long* pkeys,const unsigned long* pcrc_32_ta b,int c) static int update_keys(unsigned long* pkeys,const z_crc_t* pcrc_32_tab,int c)
{ {
(*(pkeys+0)) = CRC32((*(pkeys+0)), c); (*(pkeys+0)) = CRC32((*(pkeys+0)), c);
(*(pkeys+1)) += (*(pkeys+0)) & 0xff; (*(pkeys+1)) += (*(pkeys+0)) & 0xff;
(*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1; (*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1;
{ {
register int keyshift = (int)((*(pkeys+1)) >> 24); register int keyshift = (int)((*(pkeys+1)) >> 24);
(*(pkeys+2)) = CRC32((*(pkeys+2)), keyshift); (*(pkeys+2)) = CRC32((*(pkeys+2)), keyshift);
} }
return c; return c;
} }
/*********************************************************************** /***********************************************************************
* Initialize the encryption keys and the random header according to * Initialize the encryption keys and the random header according to
* the given password. * the given password.
*/ */
static void init_keys(const char* passwd,unsigned long* pkeys,const unsigne d long* pcrc_32_tab) static void init_keys(const char* passwd,unsigned long* pkeys,const z_crc_t * pcrc_32_tab)
{ {
*(pkeys+0) = 305419896L; *(pkeys+0) = 305419896L;
*(pkeys+1) = 591751049L; *(pkeys+1) = 591751049L;
*(pkeys+2) = 878082192L; *(pkeys+2) = 878082192L;
while (*passwd != '\0') { while (*passwd != '\0') {
update_keys(pkeys,pcrc_32_tab,(int)*passwd); update_keys(pkeys,pcrc_32_tab,(int)*passwd);
passwd++; passwd++;
} }
} }
skipping to change at line 92 skipping to change at line 92
#define RAND_HEAD_LEN 12 #define RAND_HEAD_LEN 12
/* "last resort" source for second part of crypt seed pattern */ /* "last resort" source for second part of crypt seed pattern */
# ifndef ZCR_SEED2 # ifndef ZCR_SEED2
# define ZCR_SEED2 3141592654UL /* use PI as default pattern */ # define ZCR_SEED2 3141592654UL /* use PI as default pattern */
# endif # endif
static int crypthead(const char* passwd, /* password string */ static int crypthead(const char* passwd, /* password string */
unsigned char* buf, /* where to write header */ unsigned char* buf, /* where to write header */
int bufSize, int bufSize,
unsigned long* pkeys, unsigned long* pkeys,
const unsigned long* pcrc_32_tab, const z_crc_t* pcrc_32_tab,
unsigned long crcForCrypting) unsigned long crcForCrypting)
{ {
int n; /* index in random header */ int n; /* index in random header */
int t; /* temporary */ int t; /* temporary */
int c; /* random byte */ int c; /* random byte */
unsigned char header[RAND_HEAD_LEN-2]; /* random header */ unsigned char header[RAND_HEAD_LEN-2]; /* random header */
static unsigned calls = 0; /* ensure different random header each tim e */ static unsigned calls = 0; /* ensure different random header each tim e */
if (bufSize<RAND_HEAD_LEN) if (bufSize<RAND_HEAD_LEN)
return 0; return 0;
 End of changes. 4 change blocks. 
4 lines changed or deleted 4 lines changed or added


 unzip.h   unzip.h 
skipping to change at line 197 skipping to change at line 197
extern unzFile ZEXPORT unzOpen2_64 OF((const void *path, extern unzFile ZEXPORT unzOpen2_64 OF((const void *path,
zlib_filefunc64_def* pzlib_filefunc_def )); zlib_filefunc64_def* pzlib_filefunc_def ));
/* /*
Open a Zip file, like unz64Open, but provide a set of file low level API Open a Zip file, like unz64Open, but provide a set of file low level API
for read/write the zip file (see ioapi.h) for read/write the zip file (see ioapi.h)
*/ */
extern int ZEXPORT unzClose OF((unzFile file)); extern int ZEXPORT unzClose OF((unzFile file));
/* /*
Close a ZipFile opened with unzipOpen. Close a ZipFile opened with unzOpen.
If there is files inside the .Zip opened with unzOpenCurrentFile (see lat er), If there is files inside the .Zip opened with unzOpenCurrentFile (see lat er),
these files MUST be closed with unzipCloseCurrentFile before call unzip Close. these files MUST be closed with unzCloseCurrentFile before call unzClos e.
return UNZ_OK if there is no problem. */ return UNZ_OK if there is no problem. */
extern int ZEXPORT unzGetGlobalInfo OF((unzFile file, extern int ZEXPORT unzGetGlobalInfo OF((unzFile file,
unz_global_info *pglobal_info)); unz_global_info *pglobal_info));
extern int ZEXPORT unzGetGlobalInfo64 OF((unzFile file, extern int ZEXPORT unzGetGlobalInfo64 OF((unzFile file,
unz_global_info64 *pglobal_info)); unz_global_info64 *pglobal_info));
/* /*
Write info about the ZipFile in the *pglobal_info structure. Write info about the ZipFile in the *pglobal_info structure.
No preparation of the structure is needed No preparation of the structure is needed
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/