Correct PPTP server firewall rules chain.
[tomato/davidwu.git] / release / src / router / mdadm / sha1.h
blobbb48855b8da8b694f33bdcd8b03edf692789c786
1 /* Declarations of functions and data types used for SHA1 sum
2 library functions.
3 Copyright (C) 2000, 2001, 2003, 2005 Free Software Foundation, Inc.
5 This program is free software; you can redistribute it and/or modify it
6 under the terms of the GNU General Public License as published by the
7 Free Software Foundation; either version 2, or (at your option) any
8 later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software Foundation,
17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
19 #ifndef SHA1_H
20 # define SHA1_H 1
22 # include <stdio.h>
23 # include "md5.h"
25 /* Structure to save state of computation between the single steps. */
26 struct sha1_ctx
28 md5_uint32 A;
29 md5_uint32 B;
30 md5_uint32 C;
31 md5_uint32 D;
32 md5_uint32 E;
34 md5_uint32 total[2];
35 md5_uint32 buflen;
36 char buffer[128] __attribute__ ((__aligned__ (__alignof__ (md5_uint32))));
40 /* Initialize structure containing state of computation. */
41 extern void sha1_init_ctx (struct sha1_ctx *ctx);
43 /* Starting with the result of former calls of this function (or the
44 initialization function update the context for the next LEN bytes
45 starting at BUFFER.
46 It is necessary that LEN is a multiple of 64!!! */
47 extern void sha1_process_block (const void *buffer, size_t len,
48 struct sha1_ctx *ctx);
50 /* Starting with the result of former calls of this function (or the
51 initialization function update the context for the next LEN bytes
52 starting at BUFFER.
53 It is NOT required that LEN is a multiple of 64. */
54 extern void sha1_process_bytes (const void *buffer, size_t len,
55 struct sha1_ctx *ctx);
57 /* Process the remaining bytes in the buffer and put result from CTX
58 in first 20 bytes following RESBUF. The result is always in little
59 endian byte order, so that a byte-wise output yields to the wanted
60 ASCII representation of the message digest.
62 IMPORTANT: On some systems it is required that RESBUF be correctly
63 aligned for a 32 bits value. */
64 extern void *sha1_finish_ctx (struct sha1_ctx *ctx, void *resbuf);
67 /* Put result from CTX in first 20 bytes following RESBUF. The result is
68 always in little endian byte order, so that a byte-wise output yields
69 to the wanted ASCII representation of the message digest.
71 IMPORTANT: On some systems it is required that RESBUF is correctly
72 aligned for a 32 bits value. */
73 extern void *sha1_read_ctx (const struct sha1_ctx *ctx, void *resbuf);
76 /* Compute SHA1 message digest for bytes read from STREAM. The
77 resulting message digest number will be written into the 20 bytes
78 beginning at RESBLOCK. */
79 extern int sha1_stream (FILE *stream, void *resblock);
81 /* Compute SHA1 message digest for LEN bytes beginning at BUFFER. The
82 result is always in little endian byte order, so that a byte-wise
83 output yields to the wanted ASCII representation of the message
84 digest. */
85 extern void *sha1_buffer (const char *buffer, size_t len, void *resblock);
87 #endif