Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Side by Side Diff: third_party/zlib/contrib/minizip/crypt.h

Issue 8806004: Update zlib to 1.2.5. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « third_party/zlib/compress.c ('k') | third_party/zlib/contrib/minizip/ioapi.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* crypt.h -- base code for crypt/uncrypt ZIPfile 1 /* crypt.h -- base code for crypt/uncrypt ZIPfile
2 2
3 3
4 Version 1.01e, February 12th, 2005 4 Version 1.01e, February 12th, 2005
5 5
6 Copyright (C) 1998-2005 Gilles Vollant 6 Copyright (C) 1998-2005 Gilles Vollant
7 7
8 This code is a modified version of crypting code in Infozip distribution 8 This code is a modified version of crypting code in Infozip distribution
9 9
10 The encryption/decryption parts of this source code (as opposed to the 10 The encryption/decryption parts of this source code (as opposed to the
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 (t=decrypt_byte(pkeys,pcrc_32_tab), update_keys(pkeys,pcrc_32_tab,c), t^(c)) 80 (t=decrypt_byte(pkeys,pcrc_32_tab), update_keys(pkeys,pcrc_32_tab,c), t^(c))
81 81
82 #ifdef INCLUDECRYPTINGCODE_IFCRYPTALLOWED 82 #ifdef INCLUDECRYPTINGCODE_IFCRYPTALLOWED
83 83
84 #define RAND_HEAD_LEN 12 84 #define RAND_HEAD_LEN 12
85 /* "last resort" source for second part of crypt seed pattern */ 85 /* "last resort" source for second part of crypt seed pattern */
86 # ifndef ZCR_SEED2 86 # ifndef ZCR_SEED2
87 # define ZCR_SEED2 3141592654UL /* use PI as default pattern */ 87 # define ZCR_SEED2 3141592654UL /* use PI as default pattern */
88 # endif 88 # endif
89 89
90 static int crypthead(passwd, buf, bufSize, pkeys, pcrc_32_tab, crcForCrypting) 90 static int crypthead(const char* passwd, /* password string */
91 const char *passwd; /* password string */ 91 unsigned char* buf, /* where to write header */
92 unsigned char *buf; /* where to write header */ 92 int bufSize,
93 int bufSize; 93 unsigned long* pkeys,
94 unsigned long* pkeys; 94 const unsigned long* pcrc_32_tab,
95 const unsigned long* pcrc_32_tab; 95 unsigned long crcForCrypting)
96 unsigned long crcForCrypting;
97 { 96 {
98 int n; /* index in random header */ 97 int n; /* index in random header */
99 int t; /* temporary */ 98 int t; /* temporary */
100 int c; /* random byte */ 99 int c; /* random byte */
101 unsigned char header[RAND_HEAD_LEN-2]; /* random header */ 100 unsigned char header[RAND_HEAD_LEN-2]; /* random header */
102 static unsigned calls = 0; /* ensure different random header each time */ 101 static unsigned calls = 0; /* ensure different random header each time */
103 102
104 if (bufSize<RAND_HEAD_LEN) 103 if (bufSize<RAND_HEAD_LEN)
105 return 0; 104 return 0;
106 105
(...skipping 10 matching lines...) Expand all
117 { 116 {
118 c = (rand() >> 7) & 0xff; 117 c = (rand() >> 7) & 0xff;
119 header[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, c, t); 118 header[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, c, t);
120 } 119 }
121 /* Encrypt random header (last two bytes is high word of crc) */ 120 /* Encrypt random header (last two bytes is high word of crc) */
122 init_keys(passwd, pkeys, pcrc_32_tab); 121 init_keys(passwd, pkeys, pcrc_32_tab);
123 for (n = 0; n < RAND_HEAD_LEN-2; n++) 122 for (n = 0; n < RAND_HEAD_LEN-2; n++)
124 { 123 {
125 buf[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, header[n], t); 124 buf[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, header[n], t);
126 } 125 }
127 buf[n++] = zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 16) & 0xff, t ); 126 buf[n++] = (unsigned char)zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting > > 16) & 0xff, t);
128 buf[n++] = zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 24) & 0xff, t ); 127 buf[n++] = (unsigned char)zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting > > 24) & 0xff, t);
129 return n; 128 return n;
130 } 129 }
131 130
132 #endif 131 #endif
OLDNEW
« no previous file with comments | « third_party/zlib/compress.c ('k') | third_party/zlib/contrib/minizip/ioapi.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698