1 /*- 2 * Copyright (c) 2003-2007 Tim Kientzle 3 * Copyright (c) 2011 Andres Mejia 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR 16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27 #ifndef ARCHIVE_DIGEST_PRIVATE_H_INCLUDED 28 #define ARCHIVE_DIGEST_PRIVATE_H_INCLUDED 29 30 #ifndef __LIBARCHIVE_BUILD 31 #error This header is only to be used internally to libarchive. 32 #endif 33 #ifndef __LIBARCHIVE_CONFIG_H_INCLUDED 34 #error "Should have include config.h first!" 35 #endif 36 37 /* 38 * Crypto support in various Operating Systems: 39 * 40 * NetBSD: 41 * - MD5 and SHA1 in libc: without _ after algorithm name 42 * - SHA2 in libc: with _ after algorithm name 43 * 44 * OpenBSD: 45 * - MD5, SHA1 and SHA2 in libc: without _ after algorithm name 46 * - OpenBSD 4.4 and earlier have SHA2 in libc with _ after algorithm name 47 * 48 * DragonFly and FreeBSD: 49 * - MD5 libmd: without _ after algorithm name 50 * - SHA1, SHA256 and SHA512 in libmd: with _ after algorithm name 51 * 52 * Mac OS X (10.4 and later): 53 * - MD5, SHA1 and SHA2 in libSystem: with CC_ prefix and _ after algorithm name 54 * 55 * OpenSSL: 56 * - MD5, SHA1 and SHA2 in libcrypto: with _ after algorithm name 57 * 58 * Windows: 59 * - MD5, SHA1 and SHA2 in archive_crypto.c using Windows crypto API 60 */ 61 62 /* libc crypto headers */ 63 #if defined(ARCHIVE_CRYPTO_MD5_LIBC) 64 #include <md5.h> 65 #endif 66 #if defined(ARCHIVE_CRYPTO_RMD160_LIBC) 67 #include <rmd160.h> 68 #endif 69 #if defined(ARCHIVE_CRYPTO_SHA1_LIBC) 70 #include <sha1.h> 71 #endif 72 #if defined(ARCHIVE_CRYPTO_SHA256_LIBC) ||\ 73 defined(ARCHIVE_CRYPTO_SHA256_LIBC2) ||\ 74 defined(ARCHIVE_CRYPTO_SHA256_LIBC3) ||\ 75 defined(ARCHIVE_CRYPTO_SHA384_LIBC) ||\ 76 defined(ARCHIVE_CRYPTO_SHA384_LIBC2) ||\ 77 defined(ARCHIVE_CRYPTO_SHA384_LIBC3) ||\ 78 defined(ARCHIVE_CRYPTO_SHA512_LIBC) ||\ 79 defined(ARCHIVE_CRYPTO_SHA512_LIBC2) ||\ 80 defined(ARCHIVE_CRYPTO_SHA512_LIBC3) 81 #include <sha2.h> 82 #endif 83 84 /* libmd crypto headers */ 85 #if defined(ARCHIVE_CRYPTO_MD5_LIBMD) ||\ 86 defined(ARCHIVE_CRYPTO_RMD160_LIBMD) ||\ 87 defined(ARCHIVE_CRYPTO_SHA1_LIBMD) ||\ 88 defined(ARCHIVE_CRYPTO_SHA256_LIBMD) ||\ 89 defined(ARCHIVE_CRYPTO_SHA512_LIBMD) 90 #define ARCHIVE_CRYPTO_LIBMD 1 91 #endif 92 93 #if defined(ARCHIVE_CRYPTO_MD5_LIBMD) 94 #include <md5.h> 95 #endif 96 #if defined(ARCHIVE_CRYPTO_RMD160_LIBMD) 97 #include <ripemd.h> 98 #endif 99 #if defined(ARCHIVE_CRYPTO_SHA1_LIBMD) 100 #include <sha.h> 101 #endif 102 #if defined(ARCHIVE_CRYPTO_SHA256_LIBMD) 103 #include <sha256.h> 104 #endif 105 #if defined(ARCHIVE_CRYPTO_SHA512_LIBMD) 106 #include <sha512.h> 107 #endif 108 109 /* libSystem crypto headers */ 110 #if defined(ARCHIVE_CRYPTO_MD5_LIBSYSTEM) ||\ 111 defined(ARCHIVE_CRYPTO_SHA1_LIBSYSTEM) ||\ 112 defined(ARCHIVE_CRYPTO_SHA256_LIBSYSTEM) ||\ 113 defined(ARCHIVE_CRYPTO_SHA384_LIBSYSTEM) ||\ 114 defined(ARCHIVE_CRYPTO_SHA512_LIBSYSTEM) 115 #include <CommonCrypto/CommonDigest.h> 116 #define ARCHIVE_CRYPTO_CommonCrypto 1 117 #endif 118 119 /* mbed TLS crypto headers */ 120 #if defined(ARCHIVE_CRYPTO_MD5_MBEDTLS) 121 #include <mbedtls/md5.h> 122 #endif 123 #if defined(ARCHIVE_CRYPTO_RMD160_MBEDTLS) 124 #include <mbedtls/ripemd160.h> 125 #endif 126 #if defined(ARCHIVE_CRYPTO_SHA1_MBEDTLS) 127 #include <mbedtls/sha1.h> 128 #endif 129 #if defined(ARCHIVE_CRYPTO_SHA256_MBEDTLS) 130 #include <mbedtls/sha256.h> 131 #endif 132 #if defined(ARCHIVE_CRYPTO_SHA384_MBEDTLS) ||\ 133 defined(ARCHIVE_CRYPTO_SHA512_MBEDTLS) 134 #include <mbedtls/sha512.h> 135 #endif 136 137 /* Nettle crypto headers */ 138 #if defined(ARCHIVE_CRYPTO_MD5_NETTLE) 139 #include <nettle/md5.h> 140 #endif 141 #if defined(ARCHIVE_CRYPTO_RMD160_NETTLE) 142 #include <nettle/ripemd160.h> 143 #endif 144 #if defined(ARCHIVE_CRYPTO_SHA1_NETTLE) ||\ 145 defined(ARCHIVE_CRYPTO_SHA256_NETTLE) ||\ 146 defined(ARCHIVE_CRYPTO_SHA384_NETTLE) ||\ 147 defined(ARCHIVE_CRYPTO_SHA512_NETTLE) 148 #include <nettle/sha.h> 149 #endif 150 151 /* OpenSSL crypto headers */ 152 #if defined(ARCHIVE_CRYPTO_MD5_OPENSSL) ||\ 153 defined(ARCHIVE_CRYPTO_RMD160_OPENSSL) ||\ 154 defined(ARCHIVE_CRYPTO_SHA1_OPENSSL) ||\ 155 defined(ARCHIVE_CRYPTO_SHA256_OPENSSL) ||\ 156 defined(ARCHIVE_CRYPTO_SHA384_OPENSSL) ||\ 157 defined(ARCHIVE_CRYPTO_SHA512_OPENSSL) 158 #define ARCHIVE_CRYPTO_OPENSSL 1 159 #include "archive_openssl_evp_private.h" 160 #endif 161 162 /* Windows crypto headers */ 163 #if defined(ARCHIVE_CRYPTO_MD5_WIN) ||\ 164 defined(ARCHIVE_CRYPTO_SHA1_WIN) ||\ 165 defined(ARCHIVE_CRYPTO_SHA256_WIN) ||\ 166 defined(ARCHIVE_CRYPTO_SHA384_WIN) ||\ 167 defined(ARCHIVE_CRYPTO_SHA512_WIN) 168 #if defined(HAVE_BCRYPT_H) 169 #include <bcrypt.h> 170 #define ARCHIVE_CRYPTO_CNG 1 171 typedef struct { 172 int valid; 173 BCRYPT_ALG_HANDLE hAlg; 174 BCRYPT_HASH_HANDLE hHash; 175 } Digest_CTX; 176 #endif 177 #endif 178 179 /* typedefs */ 180 #if defined(ARCHIVE_CRYPTO_MD5_LIBC) 181 typedef MD5_CTX archive_md5_ctx; 182 #elif defined(ARCHIVE_CRYPTO_MD5_LIBMD) 183 typedef MD5_CTX archive_md5_ctx; 184 #elif defined(ARCHIVE_CRYPTO_MD5_LIBSYSTEM) 185 typedef CC_MD5_CTX archive_md5_ctx; 186 #elif defined(ARCHIVE_CRYPTO_MD5_WIN) 187 typedef Digest_CTX archive_md5_ctx; 188 #elif defined(ARCHIVE_CRYPTO_MD5_MBEDTLS) 189 #define ARCHIVE_CRYPTO_MBED 1 190 typedef mbedtls_md5_context archive_md5_ctx; 191 #elif defined(ARCHIVE_CRYPTO_MD5_NETTLE) 192 #define ARCHIVE_CRYPTO_NETTLE 1 193 typedef struct md5_ctx archive_md5_ctx; 194 #elif defined(ARCHIVE_CRYPTO_MD5_OPENSSL) 195 typedef EVP_MD_CTX *archive_md5_ctx; 196 #else 197 typedef unsigned char archive_md5_ctx; 198 #endif 199 200 #if defined(ARCHIVE_CRYPTO_RMD160_LIBC) 201 typedef RMD160_CTX archive_rmd160_ctx; 202 #elif defined(ARCHIVE_CRYPTO_RMD160_LIBMD) 203 typedef RIPEMD160_CTX archive_rmd160_ctx; 204 #elif defined(ARCHIVE_CRYPTO_RMD160_MBEDTLS) 205 #define ARCHIVE_CRYPTO_MBED 1 206 typedef mbedtls_ripemd160_context archive_rmd160_ctx; 207 #elif defined(ARCHIVE_CRYPTO_RMD160_NETTLE) 208 #define ARCHIVE_CRYPTO_NETTLE 1 209 typedef struct ripemd160_ctx archive_rmd160_ctx; 210 #elif defined(ARCHIVE_CRYPTO_RMD160_OPENSSL) 211 typedef EVP_MD_CTX *archive_rmd160_ctx; 212 #else 213 typedef unsigned char archive_rmd160_ctx; 214 #endif 215 216 #if defined(ARCHIVE_CRYPTO_SHA1_LIBC) 217 typedef SHA1_CTX archive_sha1_ctx; 218 #elif defined(ARCHIVE_CRYPTO_SHA1_LIBMD) 219 typedef SHA1_CTX archive_sha1_ctx; 220 #elif defined(ARCHIVE_CRYPTO_SHA1_LIBSYSTEM) 221 typedef CC_SHA1_CTX archive_sha1_ctx; 222 #elif defined(ARCHIVE_CRYPTO_SHA1_WIN) 223 typedef Digest_CTX archive_sha1_ctx; 224 #elif defined(ARCHIVE_CRYPTO_SHA1_MBEDTLS) 225 #define ARCHIVE_CRYPTO_MBED 1 226 typedef mbedtls_sha1_context archive_sha1_ctx; 227 #elif defined(ARCHIVE_CRYPTO_SHA1_NETTLE) 228 #define ARCHIVE_CRYPTO_NETTLE 1 229 typedef struct sha1_ctx archive_sha1_ctx; 230 #elif defined(ARCHIVE_CRYPTO_SHA1_OPENSSL) 231 typedef EVP_MD_CTX *archive_sha1_ctx; 232 #else 233 typedef unsigned char archive_sha1_ctx; 234 #endif 235 236 #if defined(ARCHIVE_CRYPTO_SHA256_LIBC) 237 typedef SHA256_CTX archive_sha256_ctx; 238 #elif defined(ARCHIVE_CRYPTO_SHA256_LIBC2) 239 typedef SHA256_CTX archive_sha256_ctx; 240 #elif defined(ARCHIVE_CRYPTO_SHA256_LIBC3) 241 typedef SHA2_CTX archive_sha256_ctx; 242 #elif defined(ARCHIVE_CRYPTO_SHA256_LIBMD) 243 typedef SHA256_CTX archive_sha256_ctx; 244 #elif defined(ARCHIVE_CRYPTO_SHA256_LIBSYSTEM) 245 typedef CC_SHA256_CTX archive_sha256_ctx; 246 #elif defined(ARCHIVE_CRYPTO_SHA256_WIN) 247 typedef Digest_CTX archive_sha256_ctx; 248 #elif defined(ARCHIVE_CRYPTO_SHA256_MBEDTLS) 249 #define ARCHIVE_CRYPTO_MBED 1 250 typedef mbedtls_sha256_context archive_sha256_ctx; 251 #elif defined(ARCHIVE_CRYPTO_SHA256_NETTLE) 252 #define ARCHIVE_CRYPTO_NETTLE 1 253 typedef struct sha256_ctx archive_sha256_ctx; 254 #elif defined(ARCHIVE_CRYPTO_SHA256_OPENSSL) 255 typedef EVP_MD_CTX *archive_sha256_ctx; 256 #else 257 typedef unsigned char archive_sha256_ctx; 258 #endif 259 260 #if defined(ARCHIVE_CRYPTO_SHA384_LIBC) 261 typedef SHA384_CTX archive_sha384_ctx; 262 #elif defined(ARCHIVE_CRYPTO_SHA384_LIBC2) 263 typedef SHA384_CTX archive_sha384_ctx; 264 #elif defined(ARCHIVE_CRYPTO_SHA384_LIBC3) 265 typedef SHA2_CTX archive_sha384_ctx; 266 #elif defined(ARCHIVE_CRYPTO_SHA384_LIBSYSTEM) 267 typedef CC_SHA512_CTX archive_sha384_ctx; 268 #elif defined(ARCHIVE_CRYPTO_SHA384_WIN) 269 typedef Digest_CTX archive_sha384_ctx; 270 #elif defined(ARCHIVE_CRYPTO_SHA384_MBEDTLS) 271 #define ARCHIVE_CRYPTO_MBED 1 272 typedef mbedtls_sha512_context archive_sha384_ctx; 273 #elif defined(ARCHIVE_CRYPTO_SHA384_NETTLE) 274 #define ARCHIVE_CRYPTO_NETTLE 1 275 typedef struct sha384_ctx archive_sha384_ctx; 276 #elif defined(ARCHIVE_CRYPTO_SHA384_OPENSSL) 277 typedef EVP_MD_CTX *archive_sha384_ctx; 278 #else 279 typedef unsigned char archive_sha384_ctx; 280 #endif 281 282 #if defined(ARCHIVE_CRYPTO_SHA512_LIBC) 283 typedef SHA512_CTX archive_sha512_ctx; 284 #elif defined(ARCHIVE_CRYPTO_SHA512_LIBC2) 285 typedef SHA512_CTX archive_sha512_ctx; 286 #elif defined(ARCHIVE_CRYPTO_SHA512_LIBC3) 287 typedef SHA2_CTX archive_sha512_ctx; 288 #elif defined(ARCHIVE_CRYPTO_SHA512_LIBMD) 289 typedef SHA512_CTX archive_sha512_ctx; 290 #elif defined(ARCHIVE_CRYPTO_SHA512_LIBSYSTEM) 291 typedef CC_SHA512_CTX archive_sha512_ctx; 292 #elif defined(ARCHIVE_CRYPTO_SHA512_WIN) 293 typedef Digest_CTX archive_sha512_ctx; 294 #elif defined(ARCHIVE_CRYPTO_SHA512_MBEDTLS) 295 #define ARCHIVE_CRYPTO_MBED 1 296 typedef mbedtls_sha512_context archive_sha512_ctx; 297 #elif defined(ARCHIVE_CRYPTO_SHA512_NETTLE) 298 #define ARCHIVE_CRYPTO_NETTLE 1 299 typedef struct sha512_ctx archive_sha512_ctx; 300 #elif defined(ARCHIVE_CRYPTO_SHA512_OPENSSL) 301 typedef EVP_MD_CTX *archive_sha512_ctx; 302 #else 303 typedef unsigned char archive_sha512_ctx; 304 #endif 305 306 /* defines */ 307 #if defined(ARCHIVE_CRYPTO_MD5_LIBC) ||\ 308 defined(ARCHIVE_CRYPTO_MD5_LIBMD) || \ 309 defined(ARCHIVE_CRYPTO_MD5_LIBSYSTEM) ||\ 310 defined(ARCHIVE_CRYPTO_MD5_MBEDTLS) ||\ 311 defined(ARCHIVE_CRYPTO_MD5_NETTLE) ||\ 312 defined(ARCHIVE_CRYPTO_MD5_OPENSSL) ||\ 313 defined(ARCHIVE_CRYPTO_MD5_WIN) 314 #define ARCHIVE_HAS_MD5 315 #endif 316 #define archive_md5_init(ctx)\ 317 __archive_digest.md5init(ctx) 318 #define archive_md5_final(ctx, md)\ 319 __archive_digest.md5final(ctx, md) 320 #define archive_md5_update(ctx, buf, n)\ 321 __archive_digest.md5update(ctx, buf, n) 322 323 #if defined(ARCHIVE_CRYPTO_RMD160_LIBC) ||\ 324 defined(ARCHIVE_CRYPTO_RMD160_MBEDTLS) ||\ 325 defined(ARCHIVE_CRYPTO_RMD160_NETTLE) ||\ 326 defined(ARCHIVE_CRYPTO_RMD160_OPENSSL) 327 #define ARCHIVE_HAS_RMD160 328 #endif 329 #define archive_rmd160_init(ctx)\ 330 __archive_digest.rmd160init(ctx) 331 #define archive_rmd160_final(ctx, md)\ 332 __archive_digest.rmd160final(ctx, md) 333 #define archive_rmd160_update(ctx, buf, n)\ 334 __archive_digest.rmd160update(ctx, buf, n) 335 336 #if defined(ARCHIVE_CRYPTO_SHA1_LIBC) ||\ 337 defined(ARCHIVE_CRYPTO_SHA1_LIBMD) || \ 338 defined(ARCHIVE_CRYPTO_SHA1_LIBSYSTEM) ||\ 339 defined(ARCHIVE_CRYPTO_SHA1_MBEDTLS) ||\ 340 defined(ARCHIVE_CRYPTO_SHA1_NETTLE) ||\ 341 defined(ARCHIVE_CRYPTO_SHA1_OPENSSL) ||\ 342 defined(ARCHIVE_CRYPTO_SHA1_WIN) 343 #define ARCHIVE_HAS_SHA1 344 #endif 345 #define archive_sha1_init(ctx)\ 346 __archive_digest.sha1init(ctx) 347 #define archive_sha1_final(ctx, md)\ 348 __archive_digest.sha1final(ctx, md) 349 #define archive_sha1_update(ctx, buf, n)\ 350 __archive_digest.sha1update(ctx, buf, n) 351 352 #if defined(ARCHIVE_CRYPTO_SHA256_LIBC) ||\ 353 defined(ARCHIVE_CRYPTO_SHA256_LIBC2) ||\ 354 defined(ARCHIVE_CRYPTO_SHA256_LIBC3) ||\ 355 defined(ARCHIVE_CRYPTO_SHA256_LIBMD) ||\ 356 defined(ARCHIVE_CRYPTO_SHA256_LIBSYSTEM) ||\ 357 defined(ARCHIVE_CRYPTO_SHA256_MBEDTLS) ||\ 358 defined(ARCHIVE_CRYPTO_SHA256_NETTLE) ||\ 359 defined(ARCHIVE_CRYPTO_SHA256_OPENSSL) ||\ 360 defined(ARCHIVE_CRYPTO_SHA256_WIN) 361 #define ARCHIVE_HAS_SHA256 362 #endif 363 #define archive_sha256_init(ctx)\ 364 __archive_digest.sha256init(ctx) 365 #define archive_sha256_final(ctx, md)\ 366 __archive_digest.sha256final(ctx, md) 367 #define archive_sha256_update(ctx, buf, n)\ 368 __archive_digest.sha256update(ctx, buf, n) 369 370 #if defined(ARCHIVE_CRYPTO_SHA384_LIBC) ||\ 371 defined(ARCHIVE_CRYPTO_SHA384_LIBC2) ||\ 372 defined(ARCHIVE_CRYPTO_SHA384_LIBC3) ||\ 373 defined(ARCHIVE_CRYPTO_SHA384_LIBSYSTEM) ||\ 374 defined(ARCHIVE_CRYPTO_SHA384_MBEDTLS) ||\ 375 defined(ARCHIVE_CRYPTO_SHA384_NETTLE) ||\ 376 defined(ARCHIVE_CRYPTO_SHA384_OPENSSL) ||\ 377 defined(ARCHIVE_CRYPTO_SHA384_WIN) 378 #define ARCHIVE_HAS_SHA384 379 #endif 380 #define archive_sha384_init(ctx)\ 381 __archive_digest.sha384init(ctx) 382 #define archive_sha384_final(ctx, md)\ 383 __archive_digest.sha384final(ctx, md) 384 #define archive_sha384_update(ctx, buf, n)\ 385 __archive_digest.sha384update(ctx, buf, n) 386 387 #if defined(ARCHIVE_CRYPTO_SHA512_LIBC) ||\ 388 defined(ARCHIVE_CRYPTO_SHA512_LIBC2) ||\ 389 defined(ARCHIVE_CRYPTO_SHA512_LIBC3) ||\ 390 defined(ARCHIVE_CRYPTO_SHA512_LIBMD) ||\ 391 defined(ARCHIVE_CRYPTO_SHA512_LIBSYSTEM) ||\ 392 defined(ARCHIVE_CRYPTO_SHA512_MBEDTLS) ||\ 393 defined(ARCHIVE_CRYPTO_SHA512_NETTLE) ||\ 394 defined(ARCHIVE_CRYPTO_SHA512_OPENSSL) ||\ 395 defined(ARCHIVE_CRYPTO_SHA512_WIN) 396 #define ARCHIVE_HAS_SHA512 397 #endif 398 #define archive_sha512_init(ctx)\ 399 __archive_digest.sha512init(ctx) 400 #define archive_sha512_final(ctx, md)\ 401 __archive_digest.sha512final(ctx, md) 402 #define archive_sha512_update(ctx, buf, n)\ 403 __archive_digest.sha512update(ctx, buf, n) 404 405 /* Minimal interface to digest functionality for internal use in libarchive */ 406 struct archive_digest 407 { 408 /* Message Digest */ 409 int (*md5init)(archive_md5_ctx *ctx); 410 int (*md5update)(archive_md5_ctx *, const void *, size_t); 411 int (*md5final)(archive_md5_ctx *, void *); 412 int (*rmd160init)(archive_rmd160_ctx *); 413 int (*rmd160update)(archive_rmd160_ctx *, const void *, size_t); 414 int (*rmd160final)(archive_rmd160_ctx *, void *); 415 int (*sha1init)(archive_sha1_ctx *); 416 int (*sha1update)(archive_sha1_ctx *, const void *, size_t); 417 int (*sha1final)(archive_sha1_ctx *, void *); 418 int (*sha256init)(archive_sha256_ctx *); 419 int (*sha256update)(archive_sha256_ctx *, const void *, size_t); 420 int (*sha256final)(archive_sha256_ctx *, void *); 421 int (*sha384init)(archive_sha384_ctx *); 422 int (*sha384update)(archive_sha384_ctx *, const void *, size_t); 423 int (*sha384final)(archive_sha384_ctx *, void *); 424 int (*sha512init)(archive_sha512_ctx *); 425 int (*sha512update)(archive_sha512_ctx *, const void *, size_t); 426 int (*sha512final)(archive_sha512_ctx *, void *); 427 }; 428 429 extern const struct archive_digest __archive_digest; 430 431 #endif 432