aboutsummaryrefslogtreecommitdiff
path: root/contrib/minizip/crypt.h
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2023-04-15 11:16:17 -0700
committerMark Adler <madler@alumni.caltech.edu>2023-04-15 22:56:37 -0700
commitbf2578be2d0566dc3ee47655d56b62063fe6bae6 (patch)
treebcd69242c3cda836d7f146d44008be4f1b99fe56 /contrib/minizip/crypt.h
parentc4aa356742e03af6670c043905cd2c96f515ad72 (diff)
downloadzlib-bf2578be2d0566dc3ee47655d56b62063fe6bae6.tar.gz
zlib-bf2578be2d0566dc3ee47655d56b62063fe6bae6.tar.bz2
zlib-bf2578be2d0566dc3ee47655d56b62063fe6bae6.zip
Remove K&R function definitions from contrib/minizip.
Diffstat (limited to 'contrib/minizip/crypt.h')
-rw-r--r--contrib/minizip/crypt.h12
1 files changed, 4 insertions, 8 deletions
diff --git a/contrib/minizip/crypt.h b/contrib/minizip/crypt.h
index 1cc41f1..f4b93b7 100644
--- a/contrib/minizip/crypt.h
+++ b/contrib/minizip/crypt.h
@@ -32,8 +32,7 @@
32/*********************************************************************** 32/***********************************************************************
33 * Return the next byte in the pseudo-random sequence 33 * Return the next byte in the pseudo-random sequence
34 */ 34 */
35static int decrypt_byte(unsigned long* pkeys, const z_crc_t* pcrc_32_tab) 35static int decrypt_byte(unsigned long* pkeys, const z_crc_t* pcrc_32_tab) {
36{
37 unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an 36 unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an
38 * unpredictable manner on 16-bit systems; not a problem 37 * unpredictable manner on 16-bit systems; not a problem
39 * with any known compiler so far, though */ 38 * with any known compiler so far, though */
@@ -46,8 +45,7 @@ static int decrypt_byte(unsigned long* pkeys, const z_crc_t* pcrc_32_tab)
46/*********************************************************************** 45/***********************************************************************
47 * Update the encryption keys with the next byte of plain text 46 * Update the encryption keys with the next byte of plain text
48 */ 47 */
49static int update_keys(unsigned long* pkeys,const z_crc_t* pcrc_32_tab,int c) 48static int update_keys(unsigned long* pkeys, const z_crc_t* pcrc_32_tab, int c) {
50{
51 (*(pkeys+0)) = CRC32((*(pkeys+0)), c); 49 (*(pkeys+0)) = CRC32((*(pkeys+0)), c);
52 (*(pkeys+1)) += (*(pkeys+0)) & 0xff; 50 (*(pkeys+1)) += (*(pkeys+0)) & 0xff;
53 (*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1; 51 (*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1;
@@ -63,8 +61,7 @@ static int update_keys(unsigned long* pkeys,const z_crc_t* pcrc_32_tab,int c)
63 * Initialize the encryption keys and the random header according to 61 * Initialize the encryption keys and the random header according to
64 * the given password. 62 * the given password.
65 */ 63 */
66static void init_keys(const char* passwd,unsigned long* pkeys,const z_crc_t* pcrc_32_tab) 64static void init_keys(const char* passwd, unsigned long* pkeys, const z_crc_t* pcrc_32_tab) {
67{
68 *(pkeys+0) = 305419896L; 65 *(pkeys+0) = 305419896L;
69 *(pkeys+1) = 591751049L; 66 *(pkeys+1) = 591751049L;
70 *(pkeys+2) = 878082192L; 67 *(pkeys+2) = 878082192L;
@@ -93,8 +90,7 @@ static unsigned crypthead(const char* passwd, /* password string */
93 int bufSize, 90 int bufSize,
94 unsigned long* pkeys, 91 unsigned long* pkeys,
95 const z_crc_t* pcrc_32_tab, 92 const z_crc_t* pcrc_32_tab,
96 unsigned long crcForCrypting) 93 unsigned long crcForCrypting) {
97{
98 unsigned n; /* index in random header */ 94 unsigned n; /* index in random header */
99 int t; /* temporary */ 95 int t; /* temporary */
100 int c; /* random byte */ 96 int c; /* random byte */