annotate lib/sha512.h @ 17463:203c036eb0c6

bootstrap: support checksum utils without a --status option * build-aux/bootstrap: Only look for sha1sum if updating po files. Add sha1 to the list of supported checksum utils since it's now supported through adjustments below. (update_po_files): Remove the use of --status in a way that will suppress all error messages, but since this is only used to minimize updates, it shouldn't cause an issue. Exit early if there is a problem updating the po file checksums. (find_tool): Remove the check for --version support as this is optional as per commit 86186b17. Don't even check for the presence of the command as if that is needed, it's supported through configuring prerequisites in bootstrap.conf. Prompt that when a tool isn't found, one can define an environment variable to add to the hardcoded search list.
author Pádraig Brady <P@draigBrady.com>
date Thu, 08 Aug 2013 11:08:49 +0100
parents e542fd46ad6f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10058
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
1 /* Declarations of functions and data types used for SHA512 and SHA384 sum
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
2 library functions.
17249
e542fd46ad6f maint: update all copyright year number ranges
Eric Blake <eblake@redhat.com>
parents: 16201
diff changeset
3 Copyright (C) 2005-2006, 2008-2013 Free Software Foundation, Inc.
10058
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
4
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
5 This program is free software: you can redistribute it and/or modify
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
6 it under the terms of the GNU General Public License as published by
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
7 the Free Software Foundation, either version 3 of the License, or
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
8 (at your option) any later version.
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
9
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
10 This program is distributed in the hope that it will be useful,
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
13 GNU General Public License for more details.
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
14
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
15 You should have received a copy of the GNU General Public License
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
17
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
18 #ifndef SHA512_H
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
19 # define SHA512_H 1
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
20
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
21 # include <stdio.h>
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
22
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
23 # include "u64.h"
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
24
11731
2ddd55967fe9 C++: wrap md2,md5,sha1,etc. function declarations in extern "C" scope
Peter Simons <simons@cryp.to>
parents: 10295
diff changeset
25 # ifdef __cplusplus
2ddd55967fe9 C++: wrap md2,md5,sha1,etc. function declarations in extern "C" scope
Peter Simons <simons@cryp.to>
parents: 10295
diff changeset
26 extern "C" {
2ddd55967fe9 C++: wrap md2,md5,sha1,etc. function declarations in extern "C" scope
Peter Simons <simons@cryp.to>
parents: 10295
diff changeset
27 # endif
2ddd55967fe9 C++: wrap md2,md5,sha1,etc. function declarations in extern "C" scope
Peter Simons <simons@cryp.to>
parents: 10295
diff changeset
28
10058
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
29 /* Structure to save state of computation between the single steps. */
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
30 struct sha512_ctx
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
31 {
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
32 u64 state[8];
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
33
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
34 u64 total[2];
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
35 size_t buflen;
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
36 u64 buffer[32];
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
37 };
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
38
10295
f265e54053d2 sha256.h: correct definition on SHA224_DIGEST_SIZE
Jim Meyering <meyering@redhat.com>
parents: 10058
diff changeset
39 enum { SHA384_DIGEST_SIZE = 384 / 8 };
f265e54053d2 sha256.h: correct definition on SHA224_DIGEST_SIZE
Jim Meyering <meyering@redhat.com>
parents: 10058
diff changeset
40 enum { SHA512_DIGEST_SIZE = 512 / 8 };
10058
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
41
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
42 /* Initialize structure containing state of computation. */
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
43 extern void sha512_init_ctx (struct sha512_ctx *ctx);
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
44 extern void sha384_init_ctx (struct sha512_ctx *ctx);
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
45
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
46 /* Starting with the result of former calls of this function (or the
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
47 initialization function update the context for the next LEN bytes
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
48 starting at BUFFER.
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
49 It is necessary that LEN is a multiple of 128!!! */
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
50 extern void sha512_process_block (const void *buffer, size_t len,
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11749
diff changeset
51 struct sha512_ctx *ctx);
10058
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
52
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
53 /* Starting with the result of former calls of this function (or the
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
54 initialization function update the context for the next LEN bytes
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
55 starting at BUFFER.
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
56 It is NOT required that LEN is a multiple of 128. */
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
57 extern void sha512_process_bytes (const void *buffer, size_t len,
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11749
diff changeset
58 struct sha512_ctx *ctx);
10058
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
59
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
60 /* Process the remaining bytes in the buffer and put result from CTX
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
61 in first 64 (48) bytes following RESBUF. The result is always in little
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
62 endian byte order, so that a byte-wise output yields to the wanted
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
63 ASCII representation of the message digest. */
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
64 extern void *sha512_finish_ctx (struct sha512_ctx *ctx, void *resbuf);
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
65 extern void *sha384_finish_ctx (struct sha512_ctx *ctx, void *resbuf);
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
66
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
67
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
68 /* Put result from CTX in first 64 (48) bytes following RESBUF. The result is
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
69 always in little endian byte order, so that a byte-wise output yields
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
70 to the wanted ASCII representation of the message digest.
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
71
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
72 IMPORTANT: On some systems it is required that RESBUF is correctly
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
73 aligned for a 32 bits value. */
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
74 extern void *sha512_read_ctx (const struct sha512_ctx *ctx, void *resbuf);
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
75 extern void *sha384_read_ctx (const struct sha512_ctx *ctx, void *resbuf);
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
76
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
77
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
78 /* Compute SHA512 (SHA384) message digest for bytes read from STREAM. The
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
79 resulting message digest number will be written into the 64 (48) bytes
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
80 beginning at RESBLOCK. */
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
81 extern int sha512_stream (FILE *stream, void *resblock);
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
82 extern int sha384_stream (FILE *stream, void *resblock);
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
83
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
84 /* Compute SHA512 (SHA384) message digest for LEN bytes beginning at BUFFER. The
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
85 result is always in little endian byte order, so that a byte-wise
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
86 output yields to the wanted ASCII representation of the message
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
87 digest. */
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
88 extern void *sha512_buffer (const char *buffer, size_t len, void *resblock);
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
89 extern void *sha384_buffer (const char *buffer, size_t len, void *resblock);
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
90
11731
2ddd55967fe9 C++: wrap md2,md5,sha1,etc. function declarations in extern "C" scope
Peter Simons <simons@cryp.to>
parents: 10295
diff changeset
91 # ifdef __cplusplus
2ddd55967fe9 C++: wrap md2,md5,sha1,etc. function declarations in extern "C" scope
Peter Simons <simons@cryp.to>
parents: 10295
diff changeset
92 }
2ddd55967fe9 C++: wrap md2,md5,sha1,etc. function declarations in extern "C" scope
Peter Simons <simons@cryp.to>
parents: 10295
diff changeset
93 # endif
2ddd55967fe9 C++: wrap md2,md5,sha1,etc. function declarations in extern "C" scope
Peter Simons <simons@cryp.to>
parents: 10295
diff changeset
94
10058
e65afb893b33 New modules: crypto/sha256, crypto/sha512 (from coreutils)
Jim Meyering <meyering@redhat.com>
parents:
diff changeset
95 #endif