Fix compatibility with 7-zip/WinRAR (regression in SSZipArchive 2.0.0)

This commit is contained in:
Antoine Cœur
2017-07-24 19:40:49 +08:00
parent 9562f0a48e
commit c84f6e84e2
9 changed files with 25 additions and 53 deletions
+4 -4
View File
@@ -129,8 +129,8 @@ int cryptrand(unsigned char *buf, unsigned int len)
return rlen;
}
int crypthead(const char *passwd, uint8_t *buf, int buf_size,
uint32_t *pkeys, const z_crc_t *pcrc_32_tab, uint32_t crc_for_crypting)
int crypthead(const char *passwd, uint8_t *buf, int buf_size, uint32_t *pkeys,
const z_crc_t *pcrc_32_tab, uint8_t verify1, uint8_t verify2)
{
uint8_t n = 0; /* index in random header */
uint8_t header[RAND_HEAD_LEN-2]; /* random header */
@@ -150,8 +150,8 @@ int crypthead(const char *passwd, uint8_t *buf, int buf_size,
for (n = 0; n < RAND_HEAD_LEN-2; n++)
buf[n] = (uint8_t)zencode(pkeys, pcrc_32_tab, header[n], t);
buf[n++] = (uint8_t)zencode(pkeys, pcrc_32_tab, (uint8_t)((crc_for_crypting >> 16) & 0xff), t);
buf[n++] = (uint8_t)zencode(pkeys, pcrc_32_tab, (uint8_t)((crc_for_crypting >> 24) & 0xff), t);
buf[n++] = (uint8_t)zencode(pkeys, pcrc_32_tab, verify1, t);
buf[n++] = (uint8_t)zencode(pkeys, pcrc_32_tab, verify2, t);
return n;
}