annotate lib/md2.h @ 7292:17785d5bede0

Fix docstrings
author Sergey Poznyakoff <gray@gnu.org.ua>
date Sun, 10 Sep 2006 11:52:44 +0000
parents 076accb971ef
children 5680cf5b5595
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6431
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
1 /* Declarations of functions and data types used for MD2 sum
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
2 library functions.
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
3 Copyright (C) 2000, 2001, 2003, 2005 Free Software Foundation, Inc.
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
4
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
5 This program is free software; you can redistribute it and/or modify it
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
6 under the terms of the GNU General Public License as published by the
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
7 Free Software Foundation; either version 2, or (at your option) any
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
8 later version.
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
9
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
10 This program is distributed in the hope that it will be useful,
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
13 GNU General Public License for more details.
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
14
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
15 You should have received a copy of the GNU General Public License
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
16 along with this program; if not, write to the Free Software Foundation,
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
18
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
19 #ifndef MD2_H
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
20 # define MD2_H 1
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
21
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
22 # include <stdio.h>
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
23 # include <stddef.h>
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
24
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
25 # define MD2_DIGEST_SIZE 16
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
26
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
27 /* Structure to save state of computation between the single steps. */
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
28 struct md2_ctx
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
29 {
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
30 unsigned char chksum[16], X[48], buf[16];
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
31 size_t curlen;
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
32 };
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
33
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
34
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
35 /* Initialize structure containing state of computation. */
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
36 extern void md2_init_ctx (struct md2_ctx *ctx);
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
37
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
38 /* Starting with the result of former calls of this function (or the
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
39 initialization function update the context for the next LEN bytes
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
40 starting at BUFFER.
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
41 It is NOT required that LEN is a multiple of 64. */
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
42 extern void md2_process_block (const void *buffer, size_t len,
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
43 struct md2_ctx *ctx);
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
44
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
45 /* Starting with the result of former calls of this function (or the
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
46 initialization function update the context for the next LEN bytes
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
47 starting at BUFFER.
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
48 It is NOT required that LEN is a multiple of 64. */
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
49 extern void md2_process_bytes (const void *buffer, size_t len,
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
50 struct md2_ctx *ctx);
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
51
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
52 /* Process the remaining bytes in the buffer and put result from CTX
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
53 in first 16 bytes following RESBUF. The result is always in little
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
54 endian byte order, so that a byte-wise output yields to the wanted
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
55 ASCII representation of the message digest.
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
56
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
57 IMPORTANT: On some systems it is required that RESBUF be correctly
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
58 aligned for a 32 bits value. */
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
59 extern void *md2_finish_ctx (struct md2_ctx *ctx, void *resbuf);
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
60
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
61
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
62 /* Put result from CTX in first 16 bytes following RESBUF. The result is
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
63 always in little endian byte order, so that a byte-wise output yields
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
64 to the wanted ASCII representation of the message digest.
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
65
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
66 IMPORTANT: On some systems it is required that RESBUF is correctly
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
67 aligned for a 32 bits value. */
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
68 extern void *md2_read_ctx (const struct md2_ctx *ctx, void *resbuf);
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
69
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
70
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
71 /* Compute MD2 message digest for bytes read from STREAM. The
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
72 resulting message digest number will be written into the 16 bytes
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
73 beginning at RESBLOCK. */
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
74 extern int md2_stream (FILE *stream, void *resblock);
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
75
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
76 /* Compute MD2 message digest for LEN bytes beginning at BUFFER. The
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
77 result is always in little endian byte order, so that a byte-wise
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
78 output yields to the wanted ASCII representation of the message
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
79 digest. */
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
80 extern void *md2_buffer (const char *buffer, size_t len, void *resblock);
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
81
076accb971ef Add MD2 and hash fixes.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
82 #endif