patch: make *outfile extern
[platform/upstream/cdrkit.git] / genisoimage / sha512.h
1 /* Declaration of functions and data types used for SHA512 sum computing
2    library functions.
3    Copyright (C) 2007 Free Software Foundation, Inc.
4
5    Copied here from the GNU C Library version 2.7 on the 10 May 2009
6    by Steve McIntyre <93sam@debian.org>. This code was under GPL v2.1
7    in glibc, and that license gives us the option to use and
8    distribute the code under the terms of the GPL v2 instead. I'm
9    taking that option.
10
11    This program is free software; you can redistribute it and/or modify it
12    under the terms of the GNU General Public License as published by the
13    Free Software Foundation; either version 2, or (at your option) any
14    later version.
15
16    This program is distributed in the hope that it will be useful,
17    but WITHOUT ANY WARRANTY; without even the implied warranty of
18    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19    GNU General Public License for more details.
20
21    You should have received a copy of the GNU General Public License
22    along with this program; if not, write to the Free Software Foundation,
23    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
24
25 #ifndef _SHA512_H
26 #define _SHA512_H 1
27
28 #include <limits.h>
29 #include <stdint.h>
30 #include <stdio.h>
31
32
33 /* Structure to save state of computation between the single steps.  */
34 struct sha512_ctx
35 {
36   uint64_t H[8];
37
38   uint64_t total[2];
39   uint64_t buflen;
40   char buffer[256] __attribute__ ((__aligned__ (__alignof__ (uint64_t))));
41 };
42
43 /* Initialize structure containing state of computation.
44    (FIPS 180-2: 5.3.3)  */
45 extern void sha512_init_ctx (struct sha512_ctx *ctx) __THROW;
46
47 /* Starting with the result of former calls of this function (or the
48    initialization function update the context for the next LEN bytes
49    starting at BUFFER.
50    It is NOT required that LEN is a multiple of 128.  */
51 extern void sha512_process_bytes (const void *buffer, size_t len,
52                                     struct sha512_ctx *ctx) __THROW;
53
54 /* Process the remaining bytes in the buffer and put result from CTX
55    in first 64 bytes following RESBUF.
56
57    IMPORTANT: On some systems it is required that RESBUF is correctly
58    aligned for a 64 bits value.  */
59 extern void *sha512_finish_ctx (struct sha512_ctx *ctx, void *resbuf)
60   __THROW;
61
62 #endif /* sha512.h */