Debian Codegraph @

mz_crypt_openssl.c

raw symbols SCIP
1 /* mz_crypt_openssl.c -- Crypto/hash functions for OpenSSL
2 part of the minizip-ng project
3
4 Copyright (C) Nathan Moinvaziri
5 https://github.com/zlib-ng/minizip-ng
6
7 This program is distributed under the terms of the same license as zlib.
8 See the accompanying LICENSE file for the full text of the license.
9 */
10
11 #include "mz.h"cxx . . $ `<file>/mz.h`/
12 #include "mz_crypt.h"cxx . . $ `<file>/mz_crypt.h`/
13
14 #include <openssl/err.h>
15 #include <openssl/engine.h>
16 #include <openssl/rand.h>
17 #include <openssl/sha.h>
18 #include <openssl/aes.h>
19 #include <openssl/crypto.h>
20 #include <openssl/evp.h>
21 #include <openssl/hmac.h>
22
23 #if OPENSSL_VERSION_NUMBERcxx . . $ `<external>/4166512202731279593/opensslv.h:115:10`! >= 0x30000000L
24 # include <openssl/core_names.h>
25 #endif
26
27 /***************************************************************************/
28
29 static void mz_crypt_initcxx . . $ mz_crypt_init(49f6e7a06ebc5aa8).(void) {
30 static int32_tcxx . . $ int32_t# openssl_initialized = 0;
31 if (!openssl_initialized) {
32 #if OPENSSL_VERSION_NUMBERcxx . . $ `<external>/4166512202731279593/opensslv.h:115:10`! < 0x10100000L
33 OpenSSL_add_all_algorithms();
34
35 ERR_load_BIO_strings();
36 ERR_load_crypto_strings();
37
38 ENGINE_load_builtin_engines();
39 ENGINE_register_all_complete();
40 #else
41 OPENSSL_init_cryptocxx . . $ OPENSSL_init_crypto(a380d284833b636).(OPENSSL_INIT_ENGINE_ALL_BUILTINcxx . . $ `<external>/8711174516434588327/crypto.h:534:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
42 #endif
43
44 openssl_initialized = 1;
45 }
46 }
47
48 int32_tcxx . . $ int32_t# mz_crypt_randcxx . . $ mz_crypt_rand(7405b416d0535413).(uint8_tcxx . . $ uint8_t# *buf, int32_tcxx . . $ int32_t# size) {
49 if (!RAND_bytescxx . . $ RAND_bytes(7405b416d0535413).(buf, size))
50 return MZ_CRYPT_ERRORcxx . . $ `mz.h:35:9`!;
51
52 return size;
53 }
54
55 /***************************************************************************/
56
57 typedef struct mz_crypt_sha_scxx . . $ mz_crypt_sha_s# {
58 #if OPENSSL_VERSION_NUMBERcxx . . $ `<external>/4166512202731279593/opensslv.h:115:10`! < 0x10100000L
59 union {
60 SHA512_CTX ctx512;
61 SHA256_CTX ctx256;
62 SHA_CTX ctx1;
63 };
64 #else
65 EVP_MD_CTXcxx . . $ EVP_MD_CTX# *ctxcxx . . $ mz_crypt_sha_s#ctx.;
66 #endif
67 unsigned long errorcxx . . $ mz_crypt_sha_s#error.;
68 int32_tcxx . . $ int32_t# initializedcxx . . $ mz_crypt_sha_s#initialized.;
69 uint16_tcxx . . $ uint16_t# algorithmcxx . . $ mz_crypt_sha_s#algorithm.;
70 } mz_crypt_shacxx . . $ mz_crypt_sha#;
71
72 /***************************************************************************/
73
74 static const uint8_tcxx . . $ uint8_t# mz_crypt_sha_digest_sizecxx . . $ mz_crypt_sha_digest_size.[] = {
75 MZ_HASH_SHA1_SIZEcxx . . $ `mz.h:128:9`!, 0, MZ_HASH_SHA224_SIZEcxx . . $ `mz.h:130:9`!, MZ_HASH_SHA256_SIZEcxx . . $ `mz.h:132:9`!, MZ_HASH_SHA384_SIZEcxx . . $ `mz.h:134:9`!, MZ_HASH_SHA512_SIZEcxx . . $ `mz.h:136:9`!};
76
77 /***************************************************************************/
78
79 static void mz_crypt_sha_freecxx . . $ mz_crypt_sha_free(5d22bdacc48458e8).(void *handle) {
80 #if OPENSSL_VERSION_NUMBERcxx . . $ `<external>/4166512202731279593/opensslv.h:115:10`! >= 0x10100000L
81 mz_crypt_shacxx . . $ mz_crypt_sha# *sha = (mz_crypt_shacxx . . $ mz_crypt_sha# *)handle;
82 if (sha->ctxcxx . . $ mz_crypt_sha_s#ctx.)
83 EVP_MD_CTX_freecxx . . $ EVP_MD_CTX_free(8d074dd1d53079e3).(sha->ctxcxx . . $ mz_crypt_sha_s#ctx.);
84 sha->ctxcxx . . $ mz_crypt_sha_s#ctx. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
85 #else
86 MZ_UNUSED(handle);
87 #endif
88 }
89
90 void mz_crypt_sha_resetcxx . . $ mz_crypt_sha_reset(5d22bdacc48458e8).(void *handle) {
91 mz_crypt_shacxx . . $ mz_crypt_sha# *sha = (mz_crypt_shacxx . . $ mz_crypt_sha# *)handle;
92
93 mz_crypt_initcxx . . $ mz_crypt_init(49f6e7a06ebc5aa8).();
94 mz_crypt_sha_freecxx . . $ mz_crypt_sha_free(5d22bdacc48458e8).(handle);
95
96 sha->errorcxx . . $ mz_crypt_sha_s#error. = 0;
97 sha->initializedcxx . . $ mz_crypt_sha_s#initialized. = 0;
98 }
99
100 int32_tcxx . . $ int32_t# mz_crypt_sha_begincxx . . $ mz_crypt_sha_begin(dedf1e9b1c614a07).(void *handle) {
101 mz_crypt_shacxx . . $ mz_crypt_sha# *sha = (mz_crypt_shacxx . . $ mz_crypt_sha# *)handle;
102 int32_tcxx . . $ int32_t# result = 0;
103
104 if (!sha)
105 return MZ_PARAM_ERRORcxx . . $ `mz.h:31:9`!;
106
107 mz_crypt_sha_resetcxx . . $ mz_crypt_sha_reset(5d22bdacc48458e8).(handle);
108
109 #if OPENSSL_VERSION_NUMBERcxx . . $ `<external>/4166512202731279593/opensslv.h:115:10`! < 0x10100000L
110 switch (sha->algorithm) {
111 case MZ_HASH_SHA1:
112 result = SHA1_Init(&sha->ctx1);
113 break;
114 case MZ_HASH_SHA224:
115 result = SHA224_Init(&sha->ctx256);
116 break;
117 case MZ_HASH_SHA256:
118 result = SHA256_Init(&sha->ctx256);
119 break;
120 case MZ_HASH_SHA384:
121 result = SHA384_Init(&sha->ctx512);
122 break;
123 case MZ_HASH_SHA512:
124 result = SHA512_Init(&sha->ctx512);
125 break;
126 }
127 #else
128 const EVP_MDcxx . . $ EVP_MD# *md = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
129 switch (sha->algorithmcxx . . $ mz_crypt_sha_s#algorithm.) {
130 case MZ_HASH_SHA1cxx . . $ `mz.h:127:9`!:
131 md = EVP_sha1cxx . . $ EVP_sha1(5215674ec9154785).();
132 break;
133 case MZ_HASH_SHA224cxx . . $ `mz.h:129:9`!:
134 md = EVP_sha224cxx . . $ EVP_sha224(5215674ec9154785).();
135 break;
136 case MZ_HASH_SHA256cxx . . $ `mz.h:131:9`!:
137 md = EVP_sha256cxx . . $ EVP_sha256(5215674ec9154785).();
138 break;
139 case MZ_HASH_SHA384cxx . . $ `mz.h:133:9`!:
140 md = EVP_sha384cxx . . $ EVP_sha384(5215674ec9154785).();
141 break;
142 case MZ_HASH_SHA512cxx . . $ `mz.h:135:9`!:
143 md = EVP_sha512cxx . . $ EVP_sha512(5215674ec9154785).();
144 break;
145 }
146 if (!md)
147 return MZ_PARAM_ERRORcxx . . $ `mz.h:31:9`!;
148
149 sha->ctxcxx . . $ mz_crypt_sha_s#ctx. = EVP_MD_CTX_newcxx . . $ EVP_MD_CTX_new(d06ebfccc985fbe4).();
150 if (!sha->ctxcxx . . $ mz_crypt_sha_s#ctx.)
151 return MZ_MEM_ERRORcxx . . $ `mz.h:24:9`!;
152 result = EVP_DigestInit_excxx . . $ EVP_DigestInit_ex(cd3b2d7431382c1b).(sha->ctxcxx . . $ mz_crypt_sha_s#ctx., md, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
153 #endif
154
155 if (!result) {
156 sha->errorcxx . . $ mz_crypt_sha_s#error. = ERR_get_errorcxx . . $ ERR_get_error(f708dce9a8856c70).();
157 return MZ_HASH_ERRORcxx . . $ `mz.h:39:9`!;
158 }
159
160 sha->initializedcxx . . $ mz_crypt_sha_s#initialized. = 1;
161 return MZ_OKcxx . . $ `mz.h:21:9`!;
162 }
163
164 int32_tcxx . . $ int32_t# mz_crypt_sha_updatecxx . . $ mz_crypt_sha_update(91e54fd90adbb21).(void *handle, const void *buf, int32_tcxx . . $ int32_t# size) {
165 mz_crypt_shacxx . . $ mz_crypt_sha# *sha = (mz_crypt_shacxx . . $ mz_crypt_sha# *)handle;
166 int32_tcxx . . $ int32_t# result = 0;
167
168 if (!sha || !buf || !sha->initializedcxx . . $ mz_crypt_sha_s#initialized.)
169 return MZ_PARAM_ERRORcxx . . $ `mz.h:31:9`!;
170
171 #if OPENSSL_VERSION_NUMBERcxx . . $ `<external>/4166512202731279593/opensslv.h:115:10`! < 0x10100000L
172 switch (sha->algorithm) {
173 case MZ_HASH_SHA1:
174 result = SHA1_Update(&sha->ctx1, buf, size);
175 break;
176 case MZ_HASH_SHA224:
177 result = SHA224_Update(&sha->ctx256, buf, size);
178 break;
179 case MZ_HASH_SHA256:
180 result = SHA256_Update(&sha->ctx256, buf, size);
181 break;
182 case MZ_HASH_SHA384:
183 result = SHA384_Update(&sha->ctx512, buf, size);
184 break;
185 case MZ_HASH_SHA512:
186 result = SHA512_Update(&sha->ctx512, buf, size);
187 break;
188 }
189 #else
190 result = EVP_DigestUpdatecxx . . $ EVP_DigestUpdate(573ff5895d3ecd6e).(sha->ctxcxx . . $ mz_crypt_sha_s#ctx., buf, size);
191 #endif
192
193 if (!result) {
194 sha->errorcxx . . $ mz_crypt_sha_s#error. = ERR_get_errorcxx . . $ ERR_get_error(f708dce9a8856c70).();
195 return MZ_HASH_ERRORcxx . . $ `mz.h:39:9`!;
196 }
197
198 return size;
199 }
200
201 int32_tcxx . . $ int32_t# mz_crypt_sha_endcxx . . $ mz_crypt_sha_end(78b1a2a92e9cffd0).(void *handle, uint8_tcxx . . $ uint8_t# *digest, int32_tcxx . . $ int32_t# digest_size) {
202 mz_crypt_shacxx . . $ mz_crypt_sha# *sha = (mz_crypt_shacxx . . $ mz_crypt_sha# *)handle;
203 int32_tcxx . . $ int32_t# result = 0;
204
205 if (!sha || !digest || !sha->initializedcxx . . $ mz_crypt_sha_s#initialized.)
206 return MZ_PARAM_ERRORcxx . . $ `mz.h:31:9`!;
207 if (digest_size < mz_crypt_sha_digest_sizecxx . . $ mz_crypt_sha_digest_size.[sha->algorithmcxx . . $ mz_crypt_sha_s#algorithm. - MZ_HASH_SHA1cxx . . $ `mz.h:127:9`!])
208 return MZ_PARAM_ERRORcxx . . $ `mz.h:31:9`!;
209
210 #if OPENSSL_VERSION_NUMBERcxx . . $ `<external>/4166512202731279593/opensslv.h:115:10`! < 0x10100000L
211 switch (sha->algorithm) {
212 case MZ_HASH_SHA1:
213 result = SHA1_Final(digest, &sha->ctx1);
214 break;
215 case MZ_HASH_SHA224:
216 result = SHA224_Final(digest, &sha->ctx256);
217 break;
218 case MZ_HASH_SHA256:
219 result = SHA256_Final(digest, &sha->ctx256);
220 break;
221 case MZ_HASH_SHA384:
222 result = SHA384_Final(digest, &sha->ctx512);
223 break;
224 case MZ_HASH_SHA512:
225 result = SHA512_Final(digest, &sha->ctx512);
226 break;
227 }
228 #else
229 result = EVP_DigestFinal_excxx . . $ EVP_DigestFinal_ex(e61c9491f8eb35a8).(sha->ctxcxx . . $ mz_crypt_sha_s#ctx., digest, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
230 #endif
231
232 if (!result) {
233 sha->errorcxx . . $ mz_crypt_sha_s#error. = ERR_get_errorcxx . . $ ERR_get_error(f708dce9a8856c70).();
234 return MZ_HASH_ERRORcxx . . $ `mz.h:39:9`!;
235 }
236
237 return MZ_OKcxx . . $ `mz.h:21:9`!;
238 }
239
240 int32_tcxx . . $ int32_t# mz_crypt_sha_set_algorithmcxx . . $ mz_crypt_sha_set_algorithm(f805ef7ae580f896).(void *handle, uint16_tcxx . . $ uint16_t# algorithm) {
241 mz_crypt_shacxx . . $ mz_crypt_sha# *sha = (mz_crypt_shacxx . . $ mz_crypt_sha# *)handle;
242 if (algorithm < MZ_HASH_SHA1cxx . . $ `mz.h:127:9`! || algorithm > MZ_HASH_SHA512cxx . . $ `mz.h:135:9`!)
243 return MZ_PARAM_ERRORcxx . . $ `mz.h:31:9`!;
244 sha->algorithmcxx . . $ mz_crypt_sha_s#algorithm. = algorithm;
245 return MZ_OKcxx . . $ `mz.h:21:9`!;
246 }
247
248 void *mz_crypt_sha_createcxx . . $ mz_crypt_sha_create(50c7df7de5344ebb).(void) {
249 mz_crypt_shacxx . . $ mz_crypt_sha# *sha = (mz_crypt_shacxx . . $ mz_crypt_sha# *)calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, sizeof(mz_crypt_shacxx . . $ mz_crypt_sha#));
250 if (sha)
251 sha->algorithmcxx . . $ mz_crypt_sha_s#algorithm. = MZ_HASH_SHA256cxx . . $ `mz.h:131:9`!;
252 return sha;
253 }
254
255 void mz_crypt_sha_deletecxx . . $ mz_crypt_sha_delete(539e082cf00e1f43).(void **handle) {
256 mz_crypt_shacxx . . $ mz_crypt_sha# *sha = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
257 if (!handle)
258 return;
259 sha = (mz_crypt_shacxx . . $ mz_crypt_sha# *)*handle;
260 if (sha) {
261 mz_crypt_sha_freecxx . . $ mz_crypt_sha_free(5d22bdacc48458e8).(*handle);
262 freecxx . . $ free(5d22bdacc48458e8).(sha);
263 }
264 *handle = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
265 }
266
267 /***************************************************************************/
268
269 typedef struct mz_crypt_aes_scxx . . $ mz_crypt_aes_s# {
270 int32_tcxx . . $ int32_t# modecxx . . $ mz_crypt_aes_s#mode.;
271 unsigned long errorcxx . . $ mz_crypt_aes_s#error.;
272 EVP_CIPHER_CTXcxx . . $ EVP_CIPHER_CTX# *ctxcxx . . $ mz_crypt_aes_s#ctx.;
273 } mz_crypt_aescxx . . $ mz_crypt_aes#;
274
275 /***************************************************************************/
276
277 static void mz_crypt_aes_freecxx . . $ mz_crypt_aes_free(5d22bdacc48458e8).(void *handle) {
278 mz_crypt_aescxx . . $ mz_crypt_aes# *aes = (mz_crypt_aescxx . . $ mz_crypt_aes# *)handle;
279 if (aes->ctxcxx . . $ mz_crypt_aes_s#ctx.)
280 EVP_CIPHER_CTX_freecxx . . $ EVP_CIPHER_CTX_free(2ce94ba550a584ce).(aes->ctxcxx . . $ mz_crypt_aes_s#ctx.);
281 aes->ctxcxx . . $ mz_crypt_aes_s#ctx. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
282 }
283
284 void mz_crypt_aes_resetcxx . . $ mz_crypt_aes_reset(5d22bdacc48458e8).(void *handle) {
285 mz_crypt_initcxx . . $ mz_crypt_init(49f6e7a06ebc5aa8).();
286 mz_crypt_aes_freecxx . . $ mz_crypt_aes_free(5d22bdacc48458e8).(handle);
287 }
288
289 int32_tcxx . . $ int32_t# mz_crypt_aes_encryptcxx . . $ mz_crypt_aes_encrypt(fd2b9c01f5c5ae7c).(void *handle, const void *aad, int32_tcxx . . $ int32_t# aad_size, uint8_tcxx . . $ uint8_t# *buf, int32_tcxx . . $ int32_t# size) {
290 mz_crypt_aescxx . . $ mz_crypt_aes# *aes = (mz_crypt_aescxx . . $ mz_crypt_aes# *)handle;
291
292 if (!aes || !buf || size % MZ_AES_BLOCK_SIZEcxx . . $ `mz.h:121:9`! != 0 || !aes->ctxcxx . . $ mz_crypt_aes_s#ctx.)
293 return MZ_PARAM_ERRORcxx . . $ `mz.h:31:9`!;
294 if (aes->modecxx . . $ mz_crypt_aes_s#mode. != MZ_AES_MODE_GCMcxx . . $ `mz.h:116:9`! && aad && aad_size > 0)
295 return MZ_PARAM_ERRORcxx . . $ `mz.h:31:9`!;
296
297 if (aad && aad_size > 0) {
298 int32_tcxx . . $ int32_t# how_many = 0;
299 if (!EVP_EncryptUpdatecxx . . $ EVP_EncryptUpdate(e1042dfa3e10b205).(aes->ctxcxx . . $ mz_crypt_aes_s#ctx., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, &how_many, aad, aad_size))
300 return MZ_CRYPT_ERRORcxx . . $ `mz.h:35:9`!;
301 }
302
303 if (!EVP_EncryptUpdatecxx . . $ EVP_EncryptUpdate(e1042dfa3e10b205).(aes->ctxcxx . . $ mz_crypt_aes_s#ctx., buf, &size, buf, size))
304 return MZ_CRYPT_ERRORcxx . . $ `mz.h:35:9`!;
305
306 return size;
307 }
308
309 int32_tcxx . . $ int32_t# mz_crypt_aes_encrypt_finalcxx . . $ mz_crypt_aes_encrypt_final(c04366ac26fafd79).(void *handle, uint8_tcxx . . $ uint8_t# *buf, int32_tcxx . . $ int32_t# size, uint8_tcxx . . $ uint8_t# *tag, int32_tcxx . . $ int32_t# tag_size) {
310 mz_crypt_aescxx . . $ mz_crypt_aes# *aes = (mz_crypt_aescxx . . $ mz_crypt_aes# *)handle;
311 int result = 0;
312 int out_len = 0;
313
314 if (!aes || !tag || !tag_size || !aes->ctxcxx . . $ mz_crypt_aes_s#ctx. || aes->modecxx . . $ mz_crypt_aes_s#mode. != MZ_AES_MODE_GCMcxx . . $ `mz.h:116:9`!)
315 return MZ_PARAM_ERRORcxx . . $ `mz.h:31:9`!;
316
317 if (buf && size) {
318 if (!EVP_EncryptUpdatecxx . . $ EVP_EncryptUpdate(e1042dfa3e10b205).(aes->ctxcxx . . $ mz_crypt_aes_s#ctx., buf, &size, buf, size))
319 return MZ_CRYPT_ERRORcxx . . $ `mz.h:35:9`!;
320 }
321
322 /* Must call EncryptFinal for tag to be calculated */
323 result = EVP_EncryptFinal_excxx . . $ EVP_EncryptFinal_ex(3738cdfa157dd9db).(aes->ctxcxx . . $ mz_crypt_aes_s#ctx., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, &out_len);
324
325 if (result)
326 result = EVP_CIPHER_CTX_ctrlcxx . . $ EVP_CIPHER_CTX_ctrl(ca35871cd3111608).(aes->ctxcxx . . $ mz_crypt_aes_s#ctx., EVP_CTRL_GCM_GET_TAGcxx . . $ `<external>/2497497914425334111/evp.h:393:9`!, tag_size, tag);
327
328 if (!result) {
329 aes->errorcxx . . $ mz_crypt_aes_s#error. = ERR_get_errorcxx . . $ ERR_get_error(f708dce9a8856c70).();
330 return MZ_CRYPT_ERRORcxx . . $ `mz.h:35:9`!;
331 }
332
333 return size;
334 }
335
336 int32_tcxx . . $ int32_t# mz_crypt_aes_decryptcxx . . $ mz_crypt_aes_decrypt(fd2b9c01f5c5ae7c).(void *handle, const void *aad, int32_tcxx . . $ int32_t# aad_size, uint8_tcxx . . $ uint8_t# *buf, int32_tcxx . . $ int32_t# size) {
337 mz_crypt_aescxx . . $ mz_crypt_aes# *aes = (mz_crypt_aescxx . . $ mz_crypt_aes# *)handle;
338
339 if (!aes || !buf || size % MZ_AES_BLOCK_SIZEcxx . . $ `mz.h:121:9`! != 0 || !aes->ctxcxx . . $ mz_crypt_aes_s#ctx.)
340 return MZ_PARAM_ERRORcxx . . $ `mz.h:31:9`!;
341 if (aes->modecxx . . $ mz_crypt_aes_s#mode. != MZ_AES_MODE_GCMcxx . . $ `mz.h:116:9`! && aad && aad_size > 0)
342 return MZ_PARAM_ERRORcxx . . $ `mz.h:31:9`!;
343
344 if (aad && aad_size > 0) {
345 int32_tcxx . . $ int32_t# how_many = 0;
346 if (!EVP_DecryptUpdatecxx . . $ EVP_DecryptUpdate(e1042dfa3e10b205).(aes->ctxcxx . . $ mz_crypt_aes_s#ctx., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, &how_many, aad, aad_size))
347 return MZ_CRYPT_ERRORcxx . . $ `mz.h:35:9`!;
348 }
349
350 if (!EVP_DecryptUpdatecxx . . $ EVP_DecryptUpdate(e1042dfa3e10b205).(aes->ctxcxx . . $ mz_crypt_aes_s#ctx., buf, &size, buf, size))
351 return MZ_CRYPT_ERRORcxx . . $ `mz.h:35:9`!;
352
353 return size;
354 }
355
356 int32_tcxx . . $ int32_t# mz_crypt_aes_decrypt_finalcxx . . $ mz_crypt_aes_decrypt_final(fa83899873e546be).(void *handle, uint8_tcxx . . $ uint8_t# *buf, int32_tcxx . . $ int32_t# size, const uint8_tcxx . . $ uint8_t# *tag, int32_tcxx . . $ int32_t# tag_length) {
357 mz_crypt_aescxx . . $ mz_crypt_aes# *aes = (mz_crypt_aescxx . . $ mz_crypt_aes# *)handle;
358 int out_len = 0;
359
360 if (!aes || !tag || !tag_length || !aes->ctxcxx . . $ mz_crypt_aes_s#ctx. || aes->modecxx . . $ mz_crypt_aes_s#mode. != MZ_AES_MODE_GCMcxx . . $ `mz.h:116:9`!)
361 return MZ_PARAM_ERRORcxx . . $ `mz.h:31:9`!;
362
363 if (buf && size) {
364 if (!EVP_DecryptUpdatecxx . . $ EVP_DecryptUpdate(e1042dfa3e10b205).(aes->ctxcxx . . $ mz_crypt_aes_s#ctx., buf, &size, buf, size))
365 return MZ_CRYPT_ERRORcxx . . $ `mz.h:35:9`!;
366 }
367
368 /* Set expected tag */
369 if (!EVP_CIPHER_CTX_ctrlcxx . . $ EVP_CIPHER_CTX_ctrl(ca35871cd3111608).(aes->ctxcxx . . $ mz_crypt_aes_s#ctx., EVP_CTRL_GCM_SET_TAGcxx . . $ `<external>/2497497914425334111/evp.h:394:9`!, tag_length, (void *)tag)) {
370 aes->errorcxx . . $ mz_crypt_aes_s#error. = ERR_get_errorcxx . . $ ERR_get_error(f708dce9a8856c70).();
371 return MZ_CRYPT_ERRORcxx . . $ `mz.h:35:9`!;
372 }
373
374 /* Must call DecryptFinal for tag verification */
375 if (!EVP_DecryptFinal_excxx . . $ EVP_DecryptFinal_ex(3738cdfa157dd9db).(aes->ctxcxx . . $ mz_crypt_aes_s#ctx., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, &out_len)) {
376 aes->errorcxx . . $ mz_crypt_aes_s#error. = ERR_get_errorcxx . . $ ERR_get_error(f708dce9a8856c70).();
377 return MZ_CRYPT_ERRORcxx . . $ `mz.h:35:9`!;
378 }
379
380 return size;
381 }
382
383 static int32_tcxx . . $ int32_t# mz_crypt_aes_set_keycxx . . $ mz_crypt_aes_set_key(d3133e230232eeb6).(void *handle, const void *key, int32_tcxx . . $ int32_t# key_length, const void *iv,
384 int32_tcxx . . $ int32_t# iv_length, int32_tcxx . . $ int32_t# encrypt) {
385 mz_crypt_aescxx . . $ mz_crypt_aes# *aes = (mz_crypt_aescxx . . $ mz_crypt_aes# *)handle;
386 const EVP_CIPHERcxx . . $ EVP_CIPHER# *type = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
387
388 switch (aes->modecxx . . $ mz_crypt_aes_s#mode.) {
389 case MZ_AES_MODE_CBCcxx . . $ `mz.h:115:9`!:
390 if (key_length == 16)
391 type = EVP_aes_128_cbccxx . . $ EVP_aes_128_cbc(6cafa972844685d4).();
392 else if (key_length == 24)
393 type = EVP_aes_192_cbccxx . . $ EVP_aes_192_cbc(6cafa972844685d4).();
394 else if (key_length == 32)
395 type = EVP_aes_256_cbccxx . . $ EVP_aes_256_cbc(6cafa972844685d4).();
396 break;
397 case MZ_AES_MODE_ECBcxx . . $ `mz.h:114:9`!:
398 if (key_length == 16)
399 type = EVP_aes_128_ecbcxx . . $ EVP_aes_128_ecb(6cafa972844685d4).();
400 else if (key_length == 24)
401 type = EVP_aes_192_ecbcxx . . $ EVP_aes_192_ecb(6cafa972844685d4).();
402 else if (key_length == 32)
403 type = EVP_aes_256_ecbcxx . . $ EVP_aes_256_ecb(6cafa972844685d4).();
404 break;
405 case MZ_AES_MODE_GCMcxx . . $ `mz.h:116:9`!:
406 if (key_length == 16)
407 type = EVP_aes_128_gcmcxx . . $ EVP_aes_128_gcm(6cafa972844685d4).();
408 else if (key_length == 24)
409 type = EVP_aes_192_gcmcxx . . $ EVP_aes_192_gcm(6cafa972844685d4).();
410 else if (key_length == 32)
411 type = EVP_aes_256_gcmcxx . . $ EVP_aes_256_gcm(6cafa972844685d4).();
412 break;
413 }
414 if (!type)
415 return MZ_PARAM_ERRORcxx . . $ `mz.h:31:9`!;
416
417 aes->ctxcxx . . $ mz_crypt_aes_s#ctx. = EVP_CIPHER_CTX_newcxx . . $ EVP_CIPHER_CTX_new(ff07bd900d21220).();
418 if (!aes->ctxcxx . . $ mz_crypt_aes_s#ctx.)
419 return MZ_MEM_ERRORcxx . . $ `mz.h:24:9`!;
420
421 if (!EVP_CipherInit_excxx . . $ EVP_CipherInit_ex(5f2bbdb3058e38ec).(aes->ctxcxx . . $ mz_crypt_aes_s#ctx., type, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, key, iv, encrypt)) {
422 aes->errorcxx . . $ mz_crypt_aes_s#error. = ERR_get_errorcxx . . $ ERR_get_error(f708dce9a8856c70).();
423 return MZ_HASH_ERRORcxx . . $ `mz.h:39:9`!;
424 }
425
426 EVP_CIPHER_CTX_set_paddingcxx . . $ EVP_CIPHER_CTX_set_padding(6d47ced6bc0e439).(aes->ctxcxx . . $ mz_crypt_aes_s#ctx., aes->modecxx . . $ mz_crypt_aes_s#mode. == MZ_AES_MODE_GCMcxx . . $ `mz.h:116:9`!);
427
428 return MZ_OKcxx . . $ `mz.h:21:9`!;
429 }
430
431 int32_tcxx . . $ int32_t# mz_crypt_aes_set_encrypt_keycxx . . $ mz_crypt_aes_set_encrypt_key(73c51336f91d9328).(void *handle, const void *key, int32_tcxx . . $ int32_t# key_length, const void *iv,
432 int32_tcxx . . $ int32_t# iv_length) {
433 mz_crypt_aescxx . . $ mz_crypt_aes# *aes = (mz_crypt_aescxx . . $ mz_crypt_aes# *)handle;
434
435 if (!aes || !key || !key_length)
436 return MZ_PARAM_ERRORcxx . . $ `mz.h:31:9`!;
437 if (key_length != 16 && key_length != 24 && key_length != 32)
438 return MZ_PARAM_ERRORcxx . . $ `mz.h:31:9`!;
439 if (iv && iv_length != MZ_AES_BLOCK_SIZEcxx . . $ `mz.h:121:9`!)
440 return MZ_PARAM_ERRORcxx . . $ `mz.h:31:9`!;
441
442 mz_crypt_aes_resetcxx . . $ mz_crypt_aes_reset(5d22bdacc48458e8).(handle);
443
444 return mz_crypt_aes_set_keycxx . . $ mz_crypt_aes_set_key(d3133e230232eeb6).(handle, key, key_length, iv, iv_length, 1);
445 }
446
447 int32_tcxx . . $ int32_t# mz_crypt_aes_set_decrypt_keycxx . . $ mz_crypt_aes_set_decrypt_key(73c51336f91d9328).(void *handle, const void *key, int32_tcxx . . $ int32_t# key_length, const void *iv,
448 int32_tcxx . . $ int32_t# iv_length) {
449 mz_crypt_aescxx . . $ mz_crypt_aes# *aes = (mz_crypt_aescxx . . $ mz_crypt_aes# *)handle;
450
451 if (!aes || !key || !key_length)
452 return MZ_PARAM_ERRORcxx . . $ `mz.h:31:9`!;
453 if (key_length != 16 && key_length != 24 && key_length != 32)
454 return MZ_PARAM_ERRORcxx . . $ `mz.h:31:9`!;
455 if (iv && iv_length > MZ_AES_BLOCK_SIZEcxx . . $ `mz.h:121:9`!)
456 return MZ_PARAM_ERRORcxx . . $ `mz.h:31:9`!;
457
458 mz_crypt_aes_resetcxx . . $ mz_crypt_aes_reset(5d22bdacc48458e8).(handle);
459
460 return mz_crypt_aes_set_keycxx . . $ mz_crypt_aes_set_key(d3133e230232eeb6).(handle, key, key_length, iv, iv_length, 0);
461 }
462
463 void mz_crypt_aes_set_modecxx . . $ mz_crypt_aes_set_mode(d0320739773070f2).(void *handle, int32_tcxx . . $ int32_t# mode) {
464 mz_crypt_aescxx . . $ mz_crypt_aes# *aes = (mz_crypt_aescxx . . $ mz_crypt_aes# *)handle;
465 aes->modecxx . . $ mz_crypt_aes_s#mode. = mode;
466 }
467
468 void *mz_crypt_aes_createcxx . . $ mz_crypt_aes_create(50c7df7de5344ebb).(void) {
469 mz_crypt_aescxx . . $ mz_crypt_aes# *aes = (mz_crypt_aescxx . . $ mz_crypt_aes# *)calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, sizeof(mz_crypt_aescxx . . $ mz_crypt_aes#));
470 return aes;
471 }
472
473 void mz_crypt_aes_deletecxx . . $ mz_crypt_aes_delete(539e082cf00e1f43).(void **handle) {
474 mz_crypt_aescxx . . $ mz_crypt_aes# *aes = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
475 if (!handle)
476 return;
477 aes = (mz_crypt_aescxx . . $ mz_crypt_aes# *)*handle;
478 if (aes) {
479 mz_crypt_aes_freecxx . . $ mz_crypt_aes_free(5d22bdacc48458e8).(*handle);
480 freecxx . . $ free(5d22bdacc48458e8).(aes);
481 }
482 *handle = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
483 }
484
485 /***************************************************************************/
486
487 typedef struct mz_crypt_hmac_scxx . . $ mz_crypt_hmac_s# {
488 #if OPENSSL_VERSION_NUMBERcxx . . $ `<external>/4166512202731279593/opensslv.h:115:10`! < 0x30000000L
489 HMAC_CTX *ctx;
490 #else
491 EVP_MACcxx . . $ EVP_MAC# *maccxx . . $ mz_crypt_hmac_s#mac.;
492 EVP_MAC_CTXcxx . . $ EVP_MAC_CTX# *ctxcxx . . $ mz_crypt_hmac_s#ctx.;
493 #endif
494 unsigned long errorcxx . . $ mz_crypt_hmac_s#error.;
495 int32_tcxx . . $ int32_t# initializedcxx . . $ mz_crypt_hmac_s#initialized.;
496 uint16_tcxx . . $ uint16_t# algorithmcxx . . $ mz_crypt_hmac_s#algorithm.;
497 } mz_crypt_hmaccxx . . $ mz_crypt_hmac#;
498
499 /***************************************************************************/
500
501 #if (OPENSSL_VERSION_NUMBERcxx . . $ `<external>/4166512202731279593/opensslv.h:115:10`! < 0x10100000L) || \
502 (defined(LIBRESSL_VERSION_NUMBER) && (LIBRESSL_VERSION_NUMBER < 0x2070000fL))
503 static HMAC_CTX *HMAC_CTX_new(void) {
504 HMAC_CTX *ctx = OPENSSL_malloc(sizeof(HMAC_CTX));
505 if (ctx)
506 HMAC_CTX_init(ctx);
507 return ctx;
508 }
509
510 static void HMAC_CTX_free(HMAC_CTX *ctx) {
511 if (ctx) {
512 HMAC_CTX_cleanup(ctx);
513 OPENSSL_free(ctx);
514 }
515 }
516 #endif
517
518 /***************************************************************************/
519
520 static void mz_crypt_hmac_freecxx . . $ mz_crypt_hmac_free(5d22bdacc48458e8).(void *handle) {
521 mz_crypt_hmaccxx . . $ mz_crypt_hmac# *hmac = (mz_crypt_hmaccxx . . $ mz_crypt_hmac# *)handle;
522
523 #if OPENSSL_VERSION_NUMBERcxx . . $ `<external>/4166512202731279593/opensslv.h:115:10`! < 0x30000000L
524 HMAC_CTX_free(hmac->ctx);
525 #else
526 if (hmac->ctxcxx . . $ mz_crypt_hmac_s#ctx.)
527 EVP_MAC_CTX_freecxx . . $ EVP_MAC_CTX_free(14ae7b6e5f7c72cf).(hmac->ctxcxx . . $ mz_crypt_hmac_s#ctx.);
528 if (hmac->maccxx . . $ mz_crypt_hmac_s#mac.)
529 EVP_MAC_freecxx . . $ EVP_MAC_free(dde995a1f512cbab).(hmac->maccxx . . $ mz_crypt_hmac_s#mac.);
530 hmac->maccxx . . $ mz_crypt_hmac_s#mac. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
531 #endif
532
533 hmac->ctxcxx . . $ mz_crypt_hmac_s#ctx. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
534 }
535
536 void mz_crypt_hmac_resetcxx . . $ mz_crypt_hmac_reset(5d22bdacc48458e8).(void *handle) {
537 mz_crypt_hmaccxx . . $ mz_crypt_hmac# *hmac = (mz_crypt_hmaccxx . . $ mz_crypt_hmac# *)handle;
538
539 mz_crypt_initcxx . . $ mz_crypt_init(49f6e7a06ebc5aa8).();
540 mz_crypt_hmac_freecxx . . $ mz_crypt_hmac_free(5d22bdacc48458e8).(handle);
541
542 hmac->errorcxx . . $ mz_crypt_hmac_s#error. = 0;
543 }
544
545 int32_tcxx . . $ int32_t# mz_crypt_hmac_initcxx . . $ mz_crypt_hmac_init(91e54fd90adbb21).(void *handle, const void *key, int32_tcxx . . $ int32_t# key_length) {
546 mz_crypt_hmaccxx . . $ mz_crypt_hmac# *hmac = (mz_crypt_hmaccxx . . $ mz_crypt_hmac# *)handle;
547 int32_tcxx . . $ int32_t# result = 0;
548
549 if (!hmac || !key)
550 return MZ_PARAM_ERRORcxx . . $ `mz.h:31:9`!;
551
552 mz_crypt_hmac_resetcxx . . $ mz_crypt_hmac_reset(5d22bdacc48458e8).(handle);
553
554 #if OPENSSL_VERSION_NUMBERcxx . . $ `<external>/4166512202731279593/opensslv.h:115:10`! < 0x30000000L
555 const EVP_MD *evp_md = NULL;
556
557 if (hmac->algorithm == MZ_HASH_SHA1)
558 evp_md = EVP_sha1();
559 else
560 evp_md = EVP_sha256();
561
562 hmac->ctx = HMAC_CTX_new();
563 if (!hmac->ctx)
564 return MZ_MEM_ERROR;
565
566 result = HMAC_Init_ex(hmac->ctx, key, key_length, evp_md, NULL);
567 #else
568 char *digest_algorithm = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
569 OSSL_PARAMcxx . . $ OSSL_PARAM# params[2];
570
571 if (hmac->algorithmcxx . . $ mz_crypt_hmac_s#algorithm. == MZ_HASH_SHA1cxx . . $ `mz.h:127:9`!)
572 digest_algorithm = "sha1";
573 else
574 digest_algorithm = "sha256";
575
576 params[0] = OSSL_PARAM_construct_utf8_stringcxx . . $ OSSL_PARAM_construct_utf8_string(36e42f396e332aec).(OSSL_MAC_PARAM_DIGESTcxx . . $ `<external>/16618910896700259571/core_names.h:342:10`!, digest_algorithm, 0);
577 params[1] = OSSL_PARAM_construct_endcxx . . $ OSSL_PARAM_construct_end(67cd56e5f0b61162).();
578
579 hmac->maccxx . . $ mz_crypt_hmac_s#mac. = EVP_MAC_fetchcxx . . $ EVP_MAC_fetch(a5b0066d625fde31).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, "HMAC", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
580 if (!hmac->maccxx . . $ mz_crypt_hmac_s#mac.)
581 return MZ_MEM_ERRORcxx . . $ `mz.h:24:9`!;
582 hmac->ctxcxx . . $ mz_crypt_hmac_s#ctx. = EVP_MAC_CTX_newcxx . . $ EVP_MAC_CTX_new(ff75c7a9ab2ccfeb).(hmac->maccxx . . $ mz_crypt_hmac_s#mac.);
583 if (!hmac->ctxcxx . . $ mz_crypt_hmac_s#ctx.)
584 return MZ_MEM_ERRORcxx . . $ `mz.h:24:9`!;
585 result = EVP_MAC_initcxx . . $ EVP_MAC_init(8b9203cf66d5aef9).(hmac->ctxcxx . . $ mz_crypt_hmac_s#ctx., key, key_length, params);
586 #endif
587
588 if (!result) {
589 hmac->errorcxx . . $ mz_crypt_hmac_s#error. = ERR_get_errorcxx . . $ ERR_get_error(f708dce9a8856c70).();
590 return MZ_HASH_ERRORcxx . . $ `mz.h:39:9`!;
591 }
592
593 return MZ_OKcxx . . $ `mz.h:21:9`!;
594 }
595
596 int32_tcxx . . $ int32_t# mz_crypt_hmac_updatecxx . . $ mz_crypt_hmac_update(91e54fd90adbb21).(void *handle, const void *buf, int32_tcxx . . $ int32_t# size) {
597 mz_crypt_hmaccxx . . $ mz_crypt_hmac# *hmac = (mz_crypt_hmaccxx . . $ mz_crypt_hmac# *)handle;
598 int32_tcxx . . $ int32_t# result = 0;
599
600 if (!hmac || !buf)
601 return MZ_PARAM_ERRORcxx . . $ `mz.h:31:9`!;
602
603 #if OPENSSL_VERSION_NUMBERcxx . . $ `<external>/4166512202731279593/opensslv.h:115:10`! < 0x30000000L
604 result = HMAC_Update(hmac->ctx, buf, size);
605 #else
606 result = EVP_MAC_updatecxx . . $ EVP_MAC_update(4642d84dbd1e572e).(hmac->ctxcxx . . $ mz_crypt_hmac_s#ctx., buf, size);
607 #endif
608 if (!result) {
609 hmac->errorcxx . . $ mz_crypt_hmac_s#error. = ERR_get_errorcxx . . $ ERR_get_error(f708dce9a8856c70).();
610 return MZ_HASH_ERRORcxx . . $ `mz.h:39:9`!;
611 }
612
613 return MZ_OKcxx . . $ `mz.h:21:9`!;
614 }
615
616 int32_tcxx . . $ int32_t# mz_crypt_hmac_endcxx . . $ mz_crypt_hmac_end(78b1a2a92e9cffd0).(void *handle, uint8_tcxx . . $ uint8_t# *digest, int32_tcxx . . $ int32_t# digest_size) {
617 mz_crypt_hmaccxx . . $ mz_crypt_hmac# *hmac = (mz_crypt_hmaccxx . . $ mz_crypt_hmac# *)handle;
618 int32_tcxx . . $ int32_t# result = 0;
619
620 if (!hmac || !digest)
621 return MZ_PARAM_ERRORcxx . . $ `mz.h:31:9`!;
622
623 #if OPENSSL_VERSION_NUMBERcxx . . $ `<external>/4166512202731279593/opensslv.h:115:10`! < 0x30000000L
624 if (hmac->algorithm == MZ_HASH_SHA1) {
625 if (digest_size < MZ_HASH_SHA1_SIZE)
626 return MZ_BUF_ERROR;
627
628 result = HMAC_Final(hmac->ctx, digest, (uint32_t *)&digest_size);
629 } else {
630 if (digest_size < MZ_HASH_SHA256_SIZE)
631 return MZ_BUF_ERROR;
632 result = HMAC_Final(hmac->ctx, digest, (uint32_t *)&digest_size);
633 }
634 #else
635 {
636 size_t digest_outsize = digest_size;
637 result = EVP_MAC_finalcxx . . $ EVP_MAC_final(3b356203923de0ea).(hmac->ctxcxx . . $ mz_crypt_hmac_s#ctx., digest, &digest_outsize, digest_size);
638 }
639 #endif
640
641 if (!result) {
642 hmac->errorcxx . . $ mz_crypt_hmac_s#error. = ERR_get_errorcxx . . $ ERR_get_error(f708dce9a8856c70).();
643 return MZ_HASH_ERRORcxx . . $ `mz.h:39:9`!;
644 }
645
646 return MZ_OKcxx . . $ `mz.h:21:9`!;
647 }
648
649 void mz_crypt_hmac_set_algorithmcxx . . $ mz_crypt_hmac_set_algorithm(7ff71eb16271959b).(void *handle, uint16_tcxx . . $ uint16_t# algorithm) {
650 mz_crypt_hmaccxx . . $ mz_crypt_hmac# *hmac = (mz_crypt_hmaccxx . . $ mz_crypt_hmac# *)handle;
651 hmac->algorithmcxx . . $ mz_crypt_hmac_s#algorithm. = algorithm;
652 }
653
654 int32_tcxx . . $ int32_t# mz_crypt_hmac_copycxx . . $ mz_crypt_hmac_copy(361d5d7064a2a85d).(void *src_handle, void *target_handle) {
655 mz_crypt_hmaccxx . . $ mz_crypt_hmac# *source = (mz_crypt_hmaccxx . . $ mz_crypt_hmac# *)src_handle;
656 mz_crypt_hmaccxx . . $ mz_crypt_hmac# *target = (mz_crypt_hmaccxx . . $ mz_crypt_hmac# *)target_handle;
657
658 if (!source || !target)
659 return MZ_PARAM_ERRORcxx . . $ `mz.h:31:9`!;
660
661 mz_crypt_hmac_resetcxx . . $ mz_crypt_hmac_reset(5d22bdacc48458e8).(target_handle);
662
663 #if OPENSSL_VERSION_NUMBERcxx . . $ `<external>/4166512202731279593/opensslv.h:115:10`! < 0x30000000L
664 if (!target->ctx)
665 target->ctx = HMAC_CTX_new();
666
667 if (!HMAC_CTX_copy(target->ctx, source->ctx)) {
668 target->error = ERR_get_error();
669 return MZ_HASH_ERROR;
670 }
671 #else
672 if (!target->ctxcxx . . $ mz_crypt_hmac_s#ctx.)
673 target->ctxcxx . . $ mz_crypt_hmac_s#ctx. = EVP_MAC_CTX_dupcxx . . $ EVP_MAC_CTX_dup(22c5efa4fd7ed003).(source->ctxcxx . . $ mz_crypt_hmac_s#ctx.);
674 if (!target->ctxcxx . . $ mz_crypt_hmac_s#ctx.)
675 return MZ_MEM_ERRORcxx . . $ `mz.h:24:9`!;
676 #endif
677
678 return MZ_OKcxx . . $ `mz.h:21:9`!;
679 }
680
681 void *mz_crypt_hmac_createcxx . . $ mz_crypt_hmac_create(50c7df7de5344ebb).(void) {
682 mz_crypt_hmaccxx . . $ mz_crypt_hmac# *hmac = (mz_crypt_hmaccxx . . $ mz_crypt_hmac# *)calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, sizeof(mz_crypt_hmaccxx . . $ mz_crypt_hmac#));
683 if (hmac)
684 hmac->algorithmcxx . . $ mz_crypt_hmac_s#algorithm. = MZ_HASH_SHA256cxx . . $ `mz.h:131:9`!;
685 return hmac;
686 }
687
688 void mz_crypt_hmac_deletecxx . . $ mz_crypt_hmac_delete(539e082cf00e1f43).(void **handle) {
689 mz_crypt_hmaccxx . . $ mz_crypt_hmac# *hmac = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
690 if (!handle)
691 return;
692 hmac = (mz_crypt_hmaccxx . . $ mz_crypt_hmac# *)*handle;
693 if (hmac) {
694 mz_crypt_hmac_freecxx . . $ mz_crypt_hmac_free(5d22bdacc48458e8).(*handle);
695 freecxx . . $ free(5d22bdacc48458e8).(hmac);
696 }
697 *handle = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
698 }