Debian Codegraph @

mz_strm_pkcrypt.c

raw symbols SCIP
1 /* mz_strm_pkcrypt.c -- Code for traditional PKWARE encryption
2 part of the minizip-ng project
3
4 Copyright (C) Nathan Moinvaziri
5 https://github.com/zlib-ng/minizip-ng
6 Copyright (C) 1998-2005 Gilles Vollant
7 Modifications for Info-ZIP crypting
8 https://www.winimage.com/zLibDll/minizip.html
9 Copyright (C) 2003 Terry Thorsen
10
11 This code is a modified version of crypting code in Info-ZIP distribution
12
13 Copyright (C) 1990-2000 Info-ZIP. All rights reserved.
14
15 This program is distributed under the terms of the same license as zlib.
16 See the accompanying LICENSE file for the full text of the license.
17
18 This encryption code is a direct transcription of the algorithm from
19 Roger Schlafly, described by Phil Katz in the file appnote.txt. This
20 file (appnote.txt) is distributed with the PKZIP program (even in the
21 version without encryption capabilities).
22 */
23
24 #include "mz.h"cxx . . $ `<file>/mz.h`/
25 #include "mz_crypt.h"cxx . . $ `<file>/mz_crypt.h`/
26 #include "mz_strm.h"cxx . . $ `<file>/mz_strm.h`/
27 #include "mz_strm_pkcrypt.h"cxx . . $ `<file>/mz_strm_pkcrypt.h`/
28
29 /***************************************************************************/
30
31 static mz_stream_vtblcxx . . $ mz_stream_vtbl# mz_stream_pkcrypt_vtblcxx . . $ mz_stream_pkcrypt_vtbl. = {
32 mz_stream_pkcrypt_opencxx . . $ mz_stream_pkcrypt_open(7083a8984c0735e8)., mz_stream_pkcrypt_is_opencxx . . $ mz_stream_pkcrypt_is_open(dedf1e9b1c614a07)., mz_stream_pkcrypt_readcxx . . $ mz_stream_pkcrypt_read(8bc41909eac9e5d8).,
33 mz_stream_pkcrypt_writecxx . . $ mz_stream_pkcrypt_write(91e54fd90adbb21)., mz_stream_pkcrypt_tellcxx . . $ mz_stream_pkcrypt_tell(72c1818a5177f981)., mz_stream_pkcrypt_seekcxx . . $ mz_stream_pkcrypt_seek(8bc0ff128761c75d).,
34 mz_stream_pkcrypt_closecxx . . $ mz_stream_pkcrypt_close(dedf1e9b1c614a07)., mz_stream_pkcrypt_errorcxx . . $ mz_stream_pkcrypt_error(dedf1e9b1c614a07)., mz_stream_pkcrypt_createcxx . . $ mz_stream_pkcrypt_create(50c7df7de5344ebb).,
35 mz_stream_pkcrypt_deletecxx . . $ mz_stream_pkcrypt_delete(539e082cf00e1f43)., mz_stream_pkcrypt_get_prop_int64cxx . . $ mz_stream_pkcrypt_get_prop_int64(280df70541557ec8)., mz_stream_pkcrypt_set_prop_int64cxx . . $ mz_stream_pkcrypt_set_prop_int64(5f4b2ff0df22ef2b).};
36
37 /***************************************************************************/
38
39 typedef struct mz_stream_pkcrypt_scxx . . $ mz_stream_pkcrypt_s# {
40 mz_streamcxx . . $ mz_stream# streamcxx . . $ mz_stream_pkcrypt_s#stream.;
41 int32_tcxx . . $ int32_t# errorcxx . . $ mz_stream_pkcrypt_s#error.;
42 int16_tcxx . . $ int16_t# initializedcxx . . $ mz_stream_pkcrypt_s#initialized.;
43 uint8_tcxx . . $ uint8_t# buffercxx . . $ mz_stream_pkcrypt_s#buffer.[UINT16_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:117:10`!];
44 int64_tcxx . . $ int64_t# total_incxx . . $ mz_stream_pkcrypt_s#total_in.;
45 int64_tcxx . . $ int64_t# max_total_incxx . . $ mz_stream_pkcrypt_s#max_total_in.;
46 int64_tcxx . . $ int64_t# total_outcxx . . $ mz_stream_pkcrypt_s#total_out.;
47 uint32_tcxx . . $ uint32_t# keyscxx . . $ mz_stream_pkcrypt_s#keys.[3]; /* keys defining the pseudo-random sequence */
48 uint8_tcxx . . $ uint8_t# verify1cxx . . $ mz_stream_pkcrypt_s#verify1.;
49 uint8_tcxx . . $ uint8_t# verify2cxx . . $ mz_stream_pkcrypt_s#verify2.;
50 uint16_tcxx . . $ uint16_t# verify_versioncxx . . $ mz_stream_pkcrypt_s#verify_version.;
51 const char *passwordcxx . . $ mz_stream_pkcrypt_s#password.;
52 } mz_stream_pkcryptcxx . . $ mz_stream_pkcrypt#;
53
54 /***************************************************************************/
55
56 #define mz_stream_pkcrypt_decodecxx . . $ `mz_strm_pkcrypt.c:56:9`!(strm, c) \
57 (mz_stream_pkcrypt_update_keys(strm, c ^= mz_stream_pkcrypt_decrypt_byte(strm)))
58
59 #define mz_stream_pkcrypt_encodecxx . . $ `mz_strm_pkcrypt.c:59:9`!(strm, c, t) \
60 (t = mz_stream_pkcrypt_decrypt_byte(strm), mz_stream_pkcrypt_update_keys(strm, (uint8_t)c), (uint8_t)(t ^ (c)))
61
62 /***************************************************************************/
63
64 static uint8_tcxx . . $ uint8_t# mz_stream_pkcrypt_decrypt_bytecxx . . $ mz_stream_pkcrypt_decrypt_byte(66f908488be5605c).(void *stream) {
65 mz_stream_pkcryptcxx . . $ mz_stream_pkcrypt# *pkcrypt = (mz_stream_pkcryptcxx . . $ mz_stream_pkcrypt# *)stream;
66
67 unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an */
68 /* unpredictable manner on 16-bit systems; not a problem */
69 /* with any known compiler so far, though. */
70
71 temp = pkcrypt->keyscxx . . $ mz_stream_pkcrypt_s#keys.[2] | 2;
72 return (uint8_tcxx . . $ uint8_t#)(((temp * (temp ^ 1)) >> 8) & 0xff);
73 }
74
75 static uint8_tcxx . . $ uint8_t# mz_stream_pkcrypt_update_keyscxx . . $ mz_stream_pkcrypt_update_keys(45b57bf93427817e).(void *stream, uint8_tcxx . . $ uint8_t# c) {
76 mz_stream_pkcryptcxx . . $ mz_stream_pkcrypt# *pkcrypt = (mz_stream_pkcryptcxx . . $ mz_stream_pkcrypt# *)stream;
77 uint8_tcxx . . $ uint8_t# buf = c;
78
79 pkcrypt->keyscxx . . $ mz_stream_pkcrypt_s#keys.[0] = (uint32_tcxx . . $ uint32_t#)~mz_crypt_crc32_updatecxx . . $ mz_crypt_crc32_update(c72eefe6f8c9ad5).(~pkcrypt->keyscxx . . $ mz_stream_pkcrypt_s#keys.[0], &buf, 1);
80
81 pkcrypt->keyscxx . . $ mz_stream_pkcrypt_s#keys.[1] += pkcrypt->keyscxx . . $ mz_stream_pkcrypt_s#keys.[0] & 0xff;
82 pkcrypt->keyscxx . . $ mz_stream_pkcrypt_s#keys.[1] *= 134775813L;
83 pkcrypt->keyscxx . . $ mz_stream_pkcrypt_s#keys.[1] += 1;
84
85 buf = (uint8_tcxx . . $ uint8_t#)(pkcrypt->keyscxx . . $ mz_stream_pkcrypt_s#keys.[1] >> 24);
86 pkcrypt->keyscxx . . $ mz_stream_pkcrypt_s#keys.[2] = (uint32_tcxx . . $ uint32_t#)~mz_crypt_crc32_updatecxx . . $ mz_crypt_crc32_update(c72eefe6f8c9ad5).(~pkcrypt->keyscxx . . $ mz_stream_pkcrypt_s#keys.[2], &buf, 1);
87
88 return (uint8_tcxx . . $ uint8_t#)c;
89 }
90
91 static void mz_stream_pkcrypt_init_keyscxx . . $ mz_stream_pkcrypt_init_keys(e7c9eaecdb7c5ce7).(void *stream, const char *password) {
92 mz_stream_pkcryptcxx . . $ mz_stream_pkcrypt# *pkcrypt = (mz_stream_pkcryptcxx . . $ mz_stream_pkcrypt# *)stream;
93
94 pkcrypt->keyscxx . . $ mz_stream_pkcrypt_s#keys.[0] = 305419896L;
95 pkcrypt->keyscxx . . $ mz_stream_pkcrypt_s#keys.[1] = 591751049L;
96 pkcrypt->keyscxx . . $ mz_stream_pkcrypt_s#keys.[2] = 878082192L;
97
98 while (*password != 0) {
99 mz_stream_pkcrypt_update_keyscxx . . $ mz_stream_pkcrypt_update_keys(45b57bf93427817e).(stream, (uint8_tcxx . . $ uint8_t#)*password);
100 password += 1;
101 }
102 }
103
104 /***************************************************************************/
105
106 int32_tcxx . . $ int32_t# mz_stream_pkcrypt_opencxx . . $ mz_stream_pkcrypt_open(7083a8984c0735e8).(void *stream, const char *path, int32_tcxx . . $ int32_t# mode) {
107 mz_stream_pkcryptcxx . . $ mz_stream_pkcrypt# *pkcrypt = (mz_stream_pkcryptcxx . . $ mz_stream_pkcrypt# *)stream;
108 uint16_tcxx . . $ uint16_t# t = 0;
109 int16_tcxx . . $ int16_t# i = 0;
110 uint8_tcxx . . $ uint8_t# verify1 = 0;
111 uint8_tcxx . . $ uint8_t# verify2 = 0;
112 uint8_tcxx . . $ uint8_t# header[MZ_PKCRYPT_HEADER_SIZEcxx . . $ `mz.h:110:9`!];
113 const char *password = path;
114
115 pkcrypt->total_incxx . . $ mz_stream_pkcrypt_s#total_in. = 0;
116 pkcrypt->total_outcxx . . $ mz_stream_pkcrypt_s#total_out. = 0;
117 pkcrypt->initializedcxx . . $ mz_stream_pkcrypt_s#initialized. = 0;
118
119 if (mz_stream_is_opencxx . . $ mz_stream_is_open(dedf1e9b1c614a07).(pkcrypt->streamcxx . . $ mz_stream_pkcrypt_s#stream..basecxx . . $ mz_stream_s#base.) != MZ_OKcxx . . $ `mz.h:21:9`!)
120 return MZ_OPEN_ERRORcxx . . $ `mz.h:40:9`!;
121
122 if (!password)
123 password = pkcrypt->passwordcxx . . $ mz_stream_pkcrypt_s#password.;
124 if (!password)
125 return MZ_PARAM_ERRORcxx . . $ `mz.h:31:9`!;
126
127 mz_stream_pkcrypt_init_keyscxx . . $ mz_stream_pkcrypt_init_keys(e7c9eaecdb7c5ce7).(stream, password);
128
129 if (mode & MZ_OPEN_MODE_WRITEcxx . . $ `mz.h:51:9`!) {
130 /* First generate RAND_HEAD_LEN - 2 random bytes. */
131 mz_crypt_randcxx . . $ mz_crypt_rand(7405b416d0535413).(header, MZ_PKCRYPT_HEADER_SIZEcxx . . $ `mz.h:110:9`! - 2);
132
133 /* Encrypt random header (last two bytes is high word of crc) */
134 for (i = 0; i < MZ_PKCRYPT_HEADER_SIZEcxx . . $ `mz.h:110:9`! - 2; i++)
135 header[i] = mz_stream_pkcrypt_encodecxx . . $ `mz_strm_pkcrypt.c:59:9`!(stream, header[i], t);
136
137 header[i++] = mz_stream_pkcrypt_encodecxx . . $ `mz_strm_pkcrypt.c:59:9`!(stream, pkcrypt->verify1, t);
138 header[i++] = mz_stream_pkcrypt_encodecxx . . $ `mz_strm_pkcrypt.c:59:9`!(stream, pkcrypt->verify2, t);
139
140 if (mz_stream_writecxx . . $ mz_stream_write(91e54fd90adbb21).(pkcrypt->streamcxx . . $ mz_stream_pkcrypt_s#stream..basecxx . . $ mz_stream_s#base., header, sizeof(header)) != sizeof(header))
141 return MZ_WRITE_ERRORcxx . . $ `mz.h:45:9`!;
142
143 pkcrypt->total_outcxx . . $ mz_stream_pkcrypt_s#total_out. += MZ_PKCRYPT_HEADER_SIZEcxx . . $ `mz.h:110:9`!;
144 } else if (mode & MZ_OPEN_MODE_READcxx . . $ `mz.h:50:9`!) {
145 if (mz_stream_readcxx . . $ mz_stream_read(8bc41909eac9e5d8).(pkcrypt->streamcxx . . $ mz_stream_pkcrypt_s#stream..basecxx . . $ mz_stream_s#base., header, sizeof(header)) != sizeof(header))
146 return MZ_READ_ERRORcxx . . $ `mz.h:44:9`!;
147
148 for (i = 0; i < MZ_PKCRYPT_HEADER_SIZEcxx . . $ `mz.h:110:9`! - 2; i++)
149 header[i] = mz_stream_pkcrypt_decodecxx . . $ `mz_strm_pkcrypt.c:56:9`!(stream, header[i]);
150
151 verify1 = mz_stream_pkcrypt_decodecxx . . $ `mz_strm_pkcrypt.c:56:9`!(stream, header[i++]);
152 verify2 = mz_stream_pkcrypt_decodecxx . . $ `mz_strm_pkcrypt.c:56:9`!(stream, header[i++]);
153
154 /* PKZIP 2.0 and higher use 1 byte check, older versions used 2 byte check.
155 See app note section 6.1.6. */
156 if (verify2 != pkcrypt->verify2cxx . . $ mz_stream_pkcrypt_s#verify2.)
157 return MZ_PASSWORD_ERRORcxx . . $ `mz.h:37:9`!;
158 if (pkcrypt->verify_versioncxx . . $ mz_stream_pkcrypt_s#verify_version. < 2) {
159 if (verify1 != pkcrypt->verify1cxx . . $ mz_stream_pkcrypt_s#verify1.)
160 return MZ_PASSWORD_ERRORcxx . . $ `mz.h:37:9`!;
161 }
162
163 pkcrypt->total_incxx . . $ mz_stream_pkcrypt_s#total_in. += MZ_PKCRYPT_HEADER_SIZEcxx . . $ `mz.h:110:9`!;
164 }
165
166 pkcrypt->initializedcxx . . $ mz_stream_pkcrypt_s#initialized. = 1;
167 return MZ_OKcxx . . $ `mz.h:21:9`!;
168 }
169
170 int32_tcxx . . $ int32_t# mz_stream_pkcrypt_is_opencxx . . $ mz_stream_pkcrypt_is_open(dedf1e9b1c614a07).(void *stream) {
171 mz_stream_pkcryptcxx . . $ mz_stream_pkcrypt# *pkcrypt = (mz_stream_pkcryptcxx . . $ mz_stream_pkcrypt# *)stream;
172 if (!pkcrypt->initializedcxx . . $ mz_stream_pkcrypt_s#initialized.)
173 return MZ_OPEN_ERRORcxx . . $ `mz.h:40:9`!;
174 return MZ_OKcxx . . $ `mz.h:21:9`!;
175 }
176
177 int32_tcxx . . $ int32_t# mz_stream_pkcrypt_readcxx . . $ mz_stream_pkcrypt_read(8bc41909eac9e5d8).(void *stream, void *buf, int32_tcxx . . $ int32_t# size) {
178 mz_stream_pkcryptcxx . . $ mz_stream_pkcrypt# *pkcrypt = (mz_stream_pkcryptcxx . . $ mz_stream_pkcrypt# *)stream;
179 uint8_tcxx . . $ uint8_t# *buf_ptr = (uint8_tcxx . . $ uint8_t# *)buf;
180 int32_tcxx . . $ int32_t# bytes_to_read = size;
181 int32_tcxx . . $ int32_t# read = 0;
182 int32_tcxx . . $ int32_t# i = 0;
183
184 if ((int64_tcxx . . $ int64_t#)bytes_to_read > (pkcrypt->max_total_incxx . . $ mz_stream_pkcrypt_s#max_total_in. - pkcrypt->total_incxx . . $ mz_stream_pkcrypt_s#total_in.))
185 bytes_to_read = (int32_tcxx . . $ int32_t#)(pkcrypt->max_total_incxx . . $ mz_stream_pkcrypt_s#max_total_in. - pkcrypt->total_incxx . . $ mz_stream_pkcrypt_s#total_in.);
186
187 read = mz_stream_readcxx . . $ mz_stream_read(8bc41909eac9e5d8).(pkcrypt->streamcxx . . $ mz_stream_pkcrypt_s#stream..basecxx . . $ mz_stream_s#base., buf, bytes_to_read);
188
189 for (i = 0; i < read; i++)
190 buf_ptr[i] = mz_stream_pkcrypt_decodecxx . . $ `mz_strm_pkcrypt.c:56:9`!(stream, buf_ptr[i]);
191
192 if (read > 0)
193 pkcrypt->total_incxx . . $ mz_stream_pkcrypt_s#total_in. += read;
194
195 return read;
196 }
197
198 int32_tcxx . . $ int32_t# mz_stream_pkcrypt_writecxx . . $ mz_stream_pkcrypt_write(91e54fd90adbb21).(void *stream, const void *buf, int32_tcxx . . $ int32_t# size) {
199 mz_stream_pkcryptcxx . . $ mz_stream_pkcrypt# *pkcrypt = (mz_stream_pkcryptcxx . . $ mz_stream_pkcrypt# *)stream;
200 const uint8_tcxx . . $ uint8_t# *buf_ptr = (const uint8_tcxx . . $ uint8_t# *)buf;
201 int32_tcxx . . $ int32_t# bytes_to_write = sizeof(pkcrypt->buffercxx . . $ mz_stream_pkcrypt_s#buffer.);
202 int32_tcxx . . $ int32_t# total_written = 0;
203 int32_tcxx . . $ int32_t# written = 0;
204 int32_tcxx . . $ int32_t# i = 0;
205 uint16_tcxx . . $ uint16_t# t = 0;
206
207 if (size < 0)
208 return MZ_PARAM_ERRORcxx . . $ `mz.h:31:9`!;
209
210 do {
211 if (bytes_to_write > (size - total_written))
212 bytes_to_write = (size - total_written);
213
214 for (i = 0; i < bytes_to_write; i += 1) {
215 pkcrypt->buffercxx . . $ mz_stream_pkcrypt_s#buffer.[i] = mz_stream_pkcrypt_encodecxx . . $ `mz_strm_pkcrypt.c:59:9`!(stream, *buf_ptr, t);
216 buf_ptr += 1;
217 }
218
219 written = mz_stream_writecxx . . $ mz_stream_write(91e54fd90adbb21).(pkcrypt->streamcxx . . $ mz_stream_pkcrypt_s#stream..basecxx . . $ mz_stream_s#base., pkcrypt->buffercxx . . $ mz_stream_pkcrypt_s#buffer., bytes_to_write);
220 if (written < 0)
221 return written;
222
223 total_written += written;
224 } while (total_written < size && written > 0);
225
226 pkcrypt->total_outcxx . . $ mz_stream_pkcrypt_s#total_out. += total_written;
227 return total_written;
228 }
229
230 int64_tcxx . . $ int64_t# mz_stream_pkcrypt_tellcxx . . $ mz_stream_pkcrypt_tell(72c1818a5177f981).(void *stream) {
231 mz_stream_pkcryptcxx . . $ mz_stream_pkcrypt# *pkcrypt = (mz_stream_pkcryptcxx . . $ mz_stream_pkcrypt# *)stream;
232 return mz_stream_tellcxx . . $ mz_stream_tell(72c1818a5177f981).(pkcrypt->streamcxx . . $ mz_stream_pkcrypt_s#stream..basecxx . . $ mz_stream_s#base.);
233 }
234
235 int32_tcxx . . $ int32_t# mz_stream_pkcrypt_seekcxx . . $ mz_stream_pkcrypt_seek(8bc0ff128761c75d).(void *stream, int64_tcxx . . $ int64_t# offset, int32_tcxx . . $ int32_t# origin) {
236 mz_stream_pkcryptcxx . . $ mz_stream_pkcrypt# *pkcrypt = (mz_stream_pkcryptcxx . . $ mz_stream_pkcrypt# *)stream;
237 return mz_stream_seekcxx . . $ mz_stream_seek(8bc0ff128761c75d).(pkcrypt->streamcxx . . $ mz_stream_pkcrypt_s#stream..basecxx . . $ mz_stream_s#base., offset, origin);
238 }
239
240 int32_tcxx . . $ int32_t# mz_stream_pkcrypt_closecxx . . $ mz_stream_pkcrypt_close(dedf1e9b1c614a07).(void *stream) {
241 mz_stream_pkcryptcxx . . $ mz_stream_pkcrypt# *pkcrypt = (mz_stream_pkcryptcxx . . $ mz_stream_pkcrypt# *)stream;
242 pkcrypt->initializedcxx . . $ mz_stream_pkcrypt_s#initialized. = 0;
243 return MZ_OKcxx . . $ `mz.h:21:9`!;
244 }
245
246 int32_tcxx . . $ int32_t# mz_stream_pkcrypt_errorcxx . . $ mz_stream_pkcrypt_error(dedf1e9b1c614a07).(void *stream) {
247 mz_stream_pkcryptcxx . . $ mz_stream_pkcrypt# *pkcrypt = (mz_stream_pkcryptcxx . . $ mz_stream_pkcrypt# *)stream;
248 return pkcrypt->errorcxx . . $ mz_stream_pkcrypt_s#error.;
249 }
250
251 void mz_stream_pkcrypt_set_passwordcxx . . $ mz_stream_pkcrypt_set_password(e7c9eaecdb7c5ce7).(void *stream, const char *password) {
252 mz_stream_pkcryptcxx . . $ mz_stream_pkcrypt# *pkcrypt = (mz_stream_pkcryptcxx . . $ mz_stream_pkcrypt# *)stream;
253 pkcrypt->passwordcxx . . $ mz_stream_pkcrypt_s#password. = password;
254 }
255
256 void mz_stream_pkcrypt_set_verifycxx . . $ mz_stream_pkcrypt_set_verify(1dee36ffbd7c6497).(void *stream, uint8_tcxx . . $ uint8_t# verify1, uint8_tcxx . . $ uint8_t# verify2, uint16_tcxx . . $ uint16_t# version) {
257 mz_stream_pkcryptcxx . . $ mz_stream_pkcrypt# *pkcrypt = (mz_stream_pkcryptcxx . . $ mz_stream_pkcrypt# *)stream;
258 pkcrypt->verify1cxx . . $ mz_stream_pkcrypt_s#verify1. = verify1;
259 pkcrypt->verify2cxx . . $ mz_stream_pkcrypt_s#verify2. = verify2;
260 pkcrypt->verify_versioncxx . . $ mz_stream_pkcrypt_s#verify_version. = version;
261 }
262
263 void mz_stream_pkcrypt_get_verifycxx . . $ mz_stream_pkcrypt_get_verify(8e9cba8c9d292622).(void *stream, uint8_tcxx . . $ uint8_t# *verify1, uint8_tcxx . . $ uint8_t# *verify2, uint16_tcxx . . $ uint16_t# *version) {
264 mz_stream_pkcryptcxx . . $ mz_stream_pkcrypt# *pkcrypt = (mz_stream_pkcryptcxx . . $ mz_stream_pkcrypt# *)stream;
265 *verify1 = pkcrypt->verify1cxx . . $ mz_stream_pkcrypt_s#verify1.;
266 *verify2 = pkcrypt->verify2cxx . . $ mz_stream_pkcrypt_s#verify2.;
267 *version = pkcrypt->verify_versioncxx . . $ mz_stream_pkcrypt_s#verify_version.;
268 }
269
270 int32_tcxx . . $ int32_t# mz_stream_pkcrypt_get_prop_int64cxx . . $ mz_stream_pkcrypt_get_prop_int64(280df70541557ec8).(void *stream, int32_tcxx . . $ int32_t# prop, int64_tcxx . . $ int64_t# *value) {
271 mz_stream_pkcryptcxx . . $ mz_stream_pkcrypt# *pkcrypt = (mz_stream_pkcryptcxx . . $ mz_stream_pkcrypt# *)stream;
272 switch (prop) {
273 case MZ_STREAM_PROP_TOTAL_INcxx . . $ `mz_strm.h:20:9`!:
274 *value = pkcrypt->total_incxx . . $ mz_stream_pkcrypt_s#total_in.;
275 break;
276 case MZ_STREAM_PROP_TOTAL_OUTcxx . . $ `mz_strm.h:22:9`!:
277 *value = pkcrypt->total_outcxx . . $ mz_stream_pkcrypt_s#total_out.;
278 break;
279 case MZ_STREAM_PROP_TOTAL_IN_MAXcxx . . $ `mz_strm.h:21:9`!:
280 *value = pkcrypt->max_total_incxx . . $ mz_stream_pkcrypt_s#max_total_in.;
281 break;
282 case MZ_STREAM_PROP_HEADER_SIZEcxx . . $ `mz_strm.h:24:9`!:
283 *value = MZ_PKCRYPT_HEADER_SIZEcxx . . $ `mz.h:110:9`!;
284 break;
285 case MZ_STREAM_PROP_FOOTER_SIZEcxx . . $ `mz_strm.h:25:9`!:
286 *value = 0;
287 break;
288 default:
289 return MZ_EXIST_ERRORcxx . . $ `mz.h:36:9`!;
290 }
291 return MZ_OKcxx . . $ `mz.h:21:9`!;
292 }
293
294 int32_tcxx . . $ int32_t# mz_stream_pkcrypt_set_prop_int64cxx . . $ mz_stream_pkcrypt_set_prop_int64(5f4b2ff0df22ef2b).(void *stream, int32_tcxx . . $ int32_t# prop, int64_tcxx . . $ int64_t# value) {
295 mz_stream_pkcryptcxx . . $ mz_stream_pkcrypt# *pkcrypt = (mz_stream_pkcryptcxx . . $ mz_stream_pkcrypt# *)stream;
296 switch (prop) {
297 case MZ_STREAM_PROP_TOTAL_IN_MAXcxx . . $ `mz_strm.h:21:9`!:
298 pkcrypt->max_total_incxx . . $ mz_stream_pkcrypt_s#max_total_in. = value;
299 break;
300 default:
301 return MZ_EXIST_ERRORcxx . . $ `mz.h:36:9`!;
302 }
303 return MZ_OKcxx . . $ `mz.h:21:9`!;
304 }
305
306 void *mz_stream_pkcrypt_createcxx . . $ mz_stream_pkcrypt_create(50c7df7de5344ebb).(void) {
307 mz_stream_pkcryptcxx . . $ mz_stream_pkcrypt# *pkcrypt = (mz_stream_pkcryptcxx . . $ mz_stream_pkcrypt# *)calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, sizeof(mz_stream_pkcryptcxx . . $ mz_stream_pkcrypt#));
308 if (pkcrypt)
309 pkcrypt->streamcxx . . $ mz_stream_pkcrypt_s#stream..vtblcxx . . $ mz_stream_s#vtbl. = &mz_stream_pkcrypt_vtblcxx . . $ mz_stream_pkcrypt_vtbl.;
310 return pkcrypt;
311 }
312
313 void mz_stream_pkcrypt_deletecxx . . $ mz_stream_pkcrypt_delete(539e082cf00e1f43).(void **stream) {
314 mz_stream_pkcryptcxx . . $ mz_stream_pkcrypt# *pkcrypt = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
315 if (!stream)
316 return;
317 pkcrypt = (mz_stream_pkcryptcxx . . $ mz_stream_pkcrypt# *)*stream;
318 freecxx . . $ free(5d22bdacc48458e8).(pkcrypt);
319 *stream = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
320 }
321
322 void *mz_stream_pkcrypt_get_interfacecxx . . $ mz_stream_pkcrypt_get_interface(50c7df7de5344ebb).(void) {
323 return (void *)&mz_stream_pkcrypt_vtblcxx . . $ mz_stream_pkcrypt_vtbl.;
324 }