9103 opengroup acknowledgement should be properly formatted in man pages
[unleashed.git] / usr / src / man / man3c / encrypt.3c
blob196c0a9d1117126a4de4f20f17117c83bd44145a
1 .\"
2 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
3 .\" permission to reproduce portions of its copyrighted documentation.
4 .\" Original documentation from The Open Group can be obtained online at
5 .\" http://www.opengroup.org/bookstore/.
6 .\"
7 .\" The Institute of Electrical and Electronics Engineers and The Open
8 .\" Group, have given us permission to reprint portions of their
9 .\" documentation.
10 .\"
11 .\" In the following statement, the phrase ``this text'' refers to portions
12 .\" of the system documentation.
13 .\"
14 .\" Portions of this text are reprinted and reproduced in electronic form
15 .\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
16 .\" Standard for Information Technology -- Portable Operating System
17 .\" Interface (POSIX), The Open Group Base Specifications Issue 6,
18 .\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
19 .\" Engineers, Inc and The Open Group.  In the event of any discrepancy
20 .\" between these versions and the original IEEE and The Open Group
21 .\" Standard, the original IEEE and The Open Group Standard is the referee
22 .\" document.  The original Standard can be obtained online at
23 .\" http://www.opengroup.org/unix/online.html.
24 .\"
25 .\" This notice shall appear on any product containing this material.
26 .\"
27 .\" The contents of this file are subject to the terms of the
28 .\" Common Development and Distribution License (the "License").
29 .\" You may not use this file except in compliance with the License.
30 .\"
31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
32 .\" or http://www.opensolaris.org/os/licensing.
33 .\" See the License for the specific language governing permissions
34 .\" and limitations under the License.
35 .\"
36 .\" When distributing Covered Code, include this CDDL HEADER in each
37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
38 .\" If applicable, add the following below this CDDL HEADER, with the
39 .\" fields enclosed by brackets "[]" replaced with your own identifying
40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
41 .\"
42 .\"
43 .\" Portions Copyright (c) 1992, X/Open Company Limited  All Rights Reserved
44 .\" Copyright (c) 2001, Sun Microsystems, Inc. All Rights Reserved.
45 .\"
46 .TH ENCRYPT 3C "May 2, 2001"
47 .SH NAME
48 encrypt \- encoding function
49 .SH SYNOPSIS
50 .LP
51 .nf
52 #include <crypt.h>
54 \fBvoid\fR \fBencrypt\fR(\fBchar\fR \fIblock[64]\fR, \fBint\fR \fIedflag\fR);
55 .fi
57 .SS "Standard conforming"
58 .LP
59 .nf
60 #include <unistd.h>
62 \fBvoid\fR \fBencrypt\fR(\fBchar\fR \fIblock[64]\fR, \fBint\fR \fIedflag\fR);
63 .fi
65 .SH DESCRIPTION
66 .sp
67 .LP
68 The \fBencrypt()\fR function provides (rather primitive) access to the hashing
69 algorithm employed by the \fBcrypt\fR(3C) function. The key generated by
70 \fBsetkey\fR(3C) is used to encrypt the string \fIblock\fR with
71 \fBencrypt()\fR.
72 .sp
73 .LP
74 The \fIblock\fR argument to \fBencrypt()\fR is an array of length 64 bytes
75 containing only the bytes with numerical value of 0 and 1. The array is
76 modified in place to a similar array using the key set by \fBsetkey\fR(3C). If
77 \fIedflag\fR is 0, the argument is encoded.  If \fIedflag\fR is 1, the argument
78 may be decoded (see the \fBUSAGE\fR section below); if the argument is not
79 decoded, \fBerrno\fR will be set to \fBENOSYS\fR.
80 .SH RETURN VALUES
81 .sp
82 .LP
83 The \fBencrypt()\fR function returns no value.
84 .SH ERRORS
85 .sp
86 .LP
87 The \fBencrypt()\fR function will fail if:
88 .sp
89 .ne 2
90 .na
91 \fB\fBENOSYS\fR\fR
92 .ad
93 .RS 10n
94 The functionality is not supported on this implementation.
95 .RE
97 .SH USAGE
98 .sp
99 .LP
100 In some environments, decoding may not be implemented.  This is related to U.S.
101 Government restrictions on encryption and decryption routines: the \fBDES\fR
102 decryption algorithm cannot be exported outside the U.S.A. Historical practice
103 has been to ship a different version of the encryption library without the
104 decryption feature in the routines supplied. Thus the exported version of
105 \fBencrypt()\fR does encoding but not decoding.
108 Because \fBencrypt()\fR does not return a value, applications wishing to check
109 for errors should set \fBerrno\fR to 0, call \fBencrypt()\fR, then test
110 \fBerrno\fR and, if it is non-zero, assume an error has occurred.
111 .SH ATTRIBUTES
114 See \fBattributes\fR(5) for descriptions of the following attributes:
119 box;
120 c | c
121 l | l .
122 ATTRIBUTE TYPE  ATTRIBUTE VALUE
124 Interface Stability     Standard
126 MT-Level        Safe
129 .SH SEE ALSO
132 \fBcrypt\fR(3C), \fBsetkey\fR(3C), \fBattributes\fR(5)