Move everything from /var/adm to /var/log
[unleashed.git] / share / man / man3ext / md4.3ext
blob8f9c8e1ccb05f068d660a1cc2271a24e95bbcadb
1 '\" te
2 .\" Copyright (c) 2007, Sun Microsystems, Inc.  All Rights Reserved.
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH MD4 3EXT "Nov 13, 2007"
7 .SH NAME
8 md4, MD4Init, MD4Update, MD4Final \- MD4 digest functions
9 .SH SYNOPSIS
10 .LP
11 .nf
12 \fBcc\fR [ \fIflag\fR ... ] \fIfile\fR ... \fB-lmd\fR [ \fIlibrary\fR ... ]
13 #include <md4.h>
15 \fBvoid\fR \fBMD4Init\fR(\fBMD4_CTX *\fR\fIcontext\fR);
16 .fi
18 .LP
19 .nf
20 \fBvoid\fR \fBMD4Update\fR(\fBMD4_CTX *\fR\fIcontext\fR, \fBunsigned char *\fR\fIinput\fR,
21      \fBunsigned int\fR \fIinlen\fR);
22 .fi
24 .LP
25 .nf
26 \fBvoid\fR \fBMD4Final\fR(\fBunsigned char *\fR\fIoutput\fR, \fBMD4_CTX *\fR\fIcontext\fR);
27 .fi
29 .SH DESCRIPTION
30 .sp
31 .LP
32 The \fBMD4\fR functions implement the \fBMD4\fR message-digest algorithm. The
33 algorithm takes as input a message of arbitrary length and produces a
34 "fingerprint" or "message digest" as output. The \fBMD4\fR message-digest
35 algorithm is intended for digital signature applications in which large files
36 are "compressed" in a secure manner before being encrypted with a private
37 (secret) key under a public-key cryptosystem such as RSA.
38 .SS "\fBMD4Init()\fR, \fBMD4Update()\fR, \fBMD4Final()\fR"
39 .sp
40 .LP
41 The \fBMD4Init()\fR, \fBMD4Update()\fR, and \fBMD4Final()\fR functions allow an
42 \fBMD4\fR digest to be computed over multiple message blocks. Between blocks,
43 the state of the \fBMD4\fR computation is held in an \fBMD4\fR context
44 structure allocated by the caller. A complete digest computation consists of
45 calls to \fBMD4\fR functions in the following order: one call to
46 \fBMD4Init()\fR, one or more calls to \fBMD4Update()\fR, and one call to
47 \fBMD4Final()\fR.
48 .sp
49 .LP
50 The \fBMD4Init()\fR function initializes the \fBMD4\fR context structure
51 pointed to by \fIcontext\fR.
52 .sp
53 .LP
54 The \fBMD4Update()\fR function computes a partial \fBMD4\fR digest on the
55 \fIinlen\fR-byte message block pointed to by \fIinput\fR, and updates the
56 \fBMD4\fR context structure pointed to by \fIcontext\fR accordingly.
57 .sp
58 .LP
59 The \fBMD4Final()\fR function generates the final \fBMD4\fR digest, using the
60 \fBMD4\fR context structure pointed to by \fIcontext\fR. The \fBMD4\fR digest
61 is written to output. After a call to \fBMD4Final()\fR, the state of the
62 context structure is undefined. It must be reinitialized with \fBMD4Init()\fR
63 before it can be used again.
64 .SH RETURN VALUES
65 .sp
66 .LP
67 These functions do not return a value.
68 .SH SECURITY
69 .sp
70 .LP
71 The \fBMD4\fR digest algorithm is not currently considered cryptographically
72 secure. It is included in \fBlibmd\fR(3LIB) for use by legacy protocols and
73 systems only. It should not be used by new systems or protocols.
74 .SH EXAMPLES
75 .LP
76 \fBExample 1 \fRAuthenticate a message found in multiple buffers
77 .sp
78 .LP
79 The following is a sample function that must authenticate a message that is
80 found in multiple buffers. The calling function provides an authentication
81 buffer that will contain the result of the \fBMD4\fR digest.
83 .sp
84 .in +2
85 .nf
86 #include <sys/types.h>
87 #include <sys/uio.h>
88 #include <md4.h>
90 int
91 AuthenticateMsg(unsigned char *auth_buffer, struct iovec
92                 *messageIov, unsigned int num_buffers)
94     MD4_CTX ctx;
95     unsigned int i;
97     MD4Init(&ctx);
99     for(i=0; i<num_buffers; i++)
100     {
101          MD4Update(&ctx, messageIov->iov_base,
102                    messageIov->iov_len);
103          messageIov += sizeof(struct iovec);
104     }
106     MD4Final(auth_buffer, &ctx);
108     return 0;
111 .in -2
113 .SH ATTRIBUTES
116 See \fBattributes\fR(5) for descriptions of the following attributes:
121 box;
122 c | c
123 l | l .
124 ATTRIBUTE TYPE  ATTRIBUTE VALUE
126 Interface Stability     Committed
128 MT-Level        MT-Safe
131 .SH SEE ALSO
134 \fBlibmd\fR(3LIB)
137 RFC 1320