OSDN Git Service

(split) Apply minor changes from v3.32 to v3.35 in the upstream.
[linuxjm/LDP_man-pages.git] / draft / man3 / des_crypt.3
1 .\" @(#)des_crypt.3     2.1 88/08/11 4.0 RPCSRC; from 1.16 88/03/02 SMI;
2 .\"
3 .\" Taken from libc4 sources, which say:
4 .\" Copyright (C) 1993 Eric Young - can be distributed under GPL.
5 .\"
6 .\" However, the above header line suggests that this file in fact is
7 .\" Copyright Sun Microsystems, Inc (and is provided for unrestricted use,
8 .\" see other Sun RPC sources).
9 .\"
10 .\" Japanese Version Copyright (c) 2004 Yuichi SATO
11 .\"         all rights reserved.
12 .\" Translated Fri Jul 23 05:53:35 JST 2004
13 .\"         by Yuichi SATO <ysato444@yahoo.co.jp>
14 .\"
15 .TH DES_CRYPT 3  2007-05-18 "" "Linux Programmer's Manual"
16 .\"O .SH NAME
17 .SH Ì¾Á°
18 .\"O des_crypt, ecb_crypt, cbc_crypt, des_setparity, DES_FAILED \- fast
19 .\"O DES encryption
20 des_crypt, ecb_crypt, cbc_crypt, des_setparity, DES_FAILED \- ¹â®¤Ê DES °Å¹æ²½
21 .\"O .SH SYNOPSIS
22 .SH ½ñ¼°
23 .nf
24 .\"O .\" Sun version
25 .\" Sun ¤Î¾ì¹ç¤Ï
26 .\" .B #include <des_crypt.h>
27 .B #include <rpc/des_crypt.h>
28 .LP
29 .BI "int ecb_crypt(char *" key ", char *" data ", unsigned " datalen ,
30 .BI "              unsigned " mode );
31 .LP
32 .BI "int cbc_crypt(char *" key ", char *" data ", unsigned " datalen ,
33 .BI "              unsigned " mode ", char *" ivec );
34 .LP
35 .BI "void des_setparity(char *" key );
36 .LP
37 .BI "int DES_FAILED(int " status );
38 .fi
39 .\"O .SH DESCRIPTION
40 .SH ÀâÌÀ
41 .\"O .BR ecb_crypt ()
42 .\"O and
43 .\"O .BR cbc_crypt ()
44 .\"O implement the
45 .\"O NBS
46 .\"O DES
47 .\"O (Data Encryption Standard).
48 .BR ecb_crypt ()
49 ¤È
50 .BR cbc_crypt ()
51 ¤Ï
52 NBS
53 DES
54 (Data Encryption Standard, ¥Ç¡¼¥¿°Å¹æ²½µ¬³Ê) ¤ò¼ÂÁõ¤·¤Æ¤¤¤ë¡£
55 .\"O These routines are faster and more general purpose than
56 .\"O .BR crypt (3).
57 ¤³¤ì¤é¤Î¥ë¡¼¥Á¥ó¤Ï
58 .BR crypt (3)
59 ¤è¤ê¤â¹â®¤Ç¤è¤ê°ìÈÌŪ¤ÊÌÜŪ¤Ë»ÈÍѤǤ­¤ë¡£
60 .\"O They also are able to utilize
61 .\"O DES
62 .\"O hardware if it is available.
63 ÍøÍѲÄǽ¤Ç¤¢¤ì¤Ð¡¢¤³¤ì¤é¤Î¥ë¡¼¥Á¥ó¤Ï
64 DES
65 ¥Ï¡¼¥É¥¦¥§¥¢¤ò»ÈÍѤ¹¤ë¤³¤È¤â¤Ç¤­¤ë¡£
66 .\"O .BR ecb_crypt ()
67 .\"O encrypts in
68 .\"O ECB
69 .\"O (Electronic Code Book)
70 .\"O mode, which encrypts blocks of data independently.
71 .BR ecb_crypt ()
72 ¤Ï
73 ECB
74 (Electronic Code Book) ¥â¡¼¥É¤Ç°Å¹æ²½¤¹¤ë¡£
75 ¤³¤Î¥â¡¼¥É¤Ç¤Ï (¸Ä¡¹¤Î) ¥Ç¡¼¥¿¤Î¥Ö¥í¥Ã¥¯¤òÆÈΩ¤·¤Æ°Å¹æ²½¤¹¤ë
76 .\"O .BR cbc_crypt ()
77 .\"O encrypts in
78 .\"O CBC
79 .\"O (Cipher Block Chaining)
80 .\"O mode, which chains together
81 .\"O successive blocks.
82 .BR cbc_crypt ()
83 ¤Ï
84 CBC
85 (Cipher Block Chaining) ¥â¡¼¥É¤Ç°Å¹æ²½¤¹¤ë¡£
86 ¤³¤Î¥â¡¼¥É¤Ç¤ÏϢ³¤¹¤ë¥Ö¥í¥Ã¥¯¤ò¸ß¤¤¤ËÏ¢º¿¤µ¤»¤Æ°Å¹æ²½¤¹¤ë¡£
87 .\"O CBC
88 .\"O mode protects against insertions, deletions and
89 .\"O substitutions of blocks.
90 .\"O Also, regularities in the clear text will
91 .\"O not appear in the cipher text.
92 CBC
93 ¤Ï¥Ö¥í¥Ã¥¯¤ÎÁÞÆþ¡¦ºï½ü¡¦ÃÖ¤­´¹¤¨¤«¤éÊݸ¤ë¡£
94 ¤Þ¤¿Ê¿Ê¸¤Îµ¬Â§À­¤¬°Å¹æʸ¤Ë¸½¤ì¤Ê¤¤¡£
95 .LP
96 .\"O Here is how to use these routines.
97 .\"O The first argument,
98 .\"O .IR key ,
99 .\"O is the 8-byte encryption key with parity.
100 ¤³¤ì¤é¤Î¥ë¡¼¥Á¥ó¤Î»ÈÍÑË¡¤ò¼¨¤¹¡£
101 Âè 1 °ú¤­¿ô
102 .I key
103 ¤Ï¥Ñ¥ê¥Æ¥£ÉÕ¤­¤Î 8 ¥Ð¥¤¥È¤Î°Å¹æ²½¸°¤Ç¤¢¤ë¡£
104 .\"O To set the key's parity, which for
105 .\"O DES
106 .\"O is in the low bit of each byte, use
107 .\"O .BR des_setparity ().
108 ¸°¤Î¥Ñ¥ê¥Æ¥£¤òÀßÄꤹ¤ë¤Ë¤Ï
109 .BR des_setparity ()
110 ¤ò»È¤¦¤³¤È¡£
111 DES
112 ¤Î¾ì¹ç¡¢¸°¤Î¥Ñ¥ê¥Æ¥£¤Ï³Æ¥Ð¥¤¥È¤ÎºÇ²¼°Ì¥Ó¥Ã¥È¤Ç¤¢¤ë¡£
113 .\"O The second argument,
114 .\"O .IR data ,
115 .\"O contains the data to be encrypted or decrypted.
116 Âè 2 °ú¤­¿ô
117 .I data
118 ¤Ï°Å¹æ²½¤Þ¤¿¤ÏÉü¹æ²½¤µ¤ì¤ë¥Ç¡¼¥¿¤ò´Þ¤à¡£
119 .\"O The
120 .\"O third argument,
121 .\"O .IR datalen ,
122 .\"O is the length in bytes of
123 .\"O .IR data ,
124 .\"O which must be a multiple of 8.
125 Âè 3 °ú¤­¿ô
126 .I datalen
127 ¤Ï
128 .I data
129 ¤Î¥Ð¥¤¥ÈŤǤ¢¤ê¡¢8 ¤ÎÇÜ¿ô¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
130 .\"O The fourth argument,
131 .\"O .IR mode ,
132 .\"O is formed by ORing together some things.
133 Âè 4 °ú¤­¿ô
134 .I mode
135 ¤Ï¤¤¤¯¤Ä¤«¤ÎÃͤò OR ¤¹¤ë¤³¤È¤ÇºîÀ®¤¹¤ë¡£
136 .\"O For the encryption direction OR in either
137 .\"O .BR DES_ENCRYPT
138 .\"O or
139 .\"O .BR DES_DECRYPT .
140 °Å¹æ²½¤ÎÊý¸þ (ÌõÃð: °Å¹æ²½¤Ê¤Î¤«Éü¹æ²½¤Ê¤Î¤«) ¤ò»ØÄꤹ¤ë¤¿¤á¡¢
141 .BR DES_ENCRYPT
142 ¤Þ¤¿¤Ï
143 .BR DES_DECRYPT
144 ¤ò OR ¤¹¤ë¡£
145 .\"O For software versus hardware
146 .\"O encryption, OR in either
147 .\"O .BR DES_HW
148 .\"O or
149 .\"O .BR DES_SW .
150 °Å¹æ²½¤ò¥½¥Õ¥È¥¦¥§¥¢¤Ç¹Ô¤¦¤«¥Ï¡¼¥É¥¦¥§¥¢¤Ç¹Ô¤¦¤«¤ò»ØÄꤹ¤ë¤¿¤á¡¢
151 .BR DES_HW
152 ¤Þ¤¿¤Ï
153 .BR DES_SW
154 ¤ò OR ¤¹¤ë¡£
155 .\"O If
156 .\"O .BR DES_HW
157 .\"O is specified, and there is no hardware, then the encryption is performed
158 .\"O in software and the routine returns
159 .\"O .BR DESERR_NOHWDEVICE .
160 .BR DES_HW
161 ¤¬»ØÄꤵ¤ì¤Æ¤¤¤Æ¡¢¤«¤Ä¥Ï¡¼¥É¥¦¥§¥¢¤¬¤Ê¤¤¾ì¹ç¡¢
162 °Å¹æ²½¤Ï¥½¥Õ¥È¥¦¥§¥¢¤Ç¼Â¹Ô¤µ¤ì¤Æ¡¢¥ë¡¼¥Á¥ó¤Ï
163 .BR DESERR_NOHWDEVICE
164 ¤òÊÖ¤¹¡£
165 .\"O For
166 .\"O .BR cbc_crypt (),
167 .\"O the argument
168 .\"O .I ivec
169 .\"O is the 8-byte initialization
170 .\"O vector for the chaining.
171 .\"O It is updated to the next initialization
172 .\"O vector upon return.
173 .BR cbc_crypt ()
174 ¤Ë¤ª¤¤¤Æ¡¢°ú¤­¿ô
175 .I ivec
176 ¤Ï¥Ç¡¼¥¿¥Ö¥í¥Ã¥¯¤òÏ¢º¿¤µ¤»¤ëºÝ¤Î 8 ¥Ð¥¤¥È¤Î½é´ü²½¥Ù¥¯¥È¥ë¤Ç¤¢¤ë¡£
177 ¤³¤Î°ú¤­¿ô¤Ï¥ë¡¼¥Á¥ó¤«¤éÌá¤ë¤È¤­¤Ë¼¡¤Î½é´ü²½¥Ù¥¯¥È¥ë¤Ë¹¹¿·¤µ¤ì¤ë¡£
178 .\"O .SH RETURN VALUE
179 .SH ÊÖ¤êÃÍ
180 .PD 0
181 .TP 20
182 .\"O .BR DESERR_NONE
183 .B DESERR_NONE
184 .\"O No error.
185 ¥¨¥é¡¼¤Ê¤·¡£
186 .TP
187 .\"O .BR DESERR_NOHWDEVICE
188 .B DESERR_NOHWDEVICE
189 .\"O Encryption succeeded, but done in software instead of the requested hardware.
190 °Å¹æ²½¤ÏÀ®¸ù¤·¤¿¤¬¡¢Í׵ᤵ¤ì¤¿¥Ï¡¼¥É¥¦¥§¥¢¤ÎÂå¤ï¤ê¤Ë¥½¥Õ¥È¥¦¥§¥¢¤Ç¼Â¹Ô¤µ¤ì¤¿¡£
191 .TP
192 .\"O .BR DESERR_HWERROR
193 .B DESERR_HWERROR
194 .\"O An error occurred in the hardware or driver.
195 ¥Ï¡¼¥É¥¦¥§¥¢¤Þ¤¿¤Ï¥É¥é¥¤¥Ð¤Ç¥¨¥é¡¼¤¬È¯À¸¤·¤¿¡£
196 .TP
197 .\"O .BR DESERR_BADPARAM
198 .B DESERR_BADPARAM
199 .\"O Bad argument to routine.
200 ¥ë¡¼¥Á¥ó¤Ø¤Î°ú¤­¿ô¤¬ÉÔÀµ¤Ç¤¢¤ë¡£
201 .PD
202 .LP
203 .\"O Given a result status
204 .\"O .IR stat ,
205 .\"O the macro
206 .\"O .\" .BR DES_FAILED\c
207 .\"O .\" .BR ( stat )
208 .\"O .BI DES_FAILED( stat )
209 .\"O is false only for the first two statuses.
210 ·ë²Ì¤Î¾õÂÖ
211 .I stat
212 ¤òÍ¿¤¨¤¿¤È¤­¡¢¥Þ¥¯¥í
213 .\" .BR DES_FAILED\c
214 .\" .BR ( stat )
215 .BI DES_FAILED( stat )
216 ¤¬ false ¤Ë¤Ê¤ë¤Î¤Ï¡¢ºÇ½é¤Î 2 ¤Ä¤À¤±¤Ç¤¢¤ë¡£
217 .\"O .\" So far the Sun page
218 .\"O .\" Some additions - aeb
219 .\" ¤³¤³¤Þ¤Ç¤¬ Sun ¤Î man ¥Ú¡¼¥¸¤Ç¤¢¤ë¡£
220 .\" aeb ¤¬¤¤¤¯¤Ä¤«Äɲäò¹Ô¤Ã¤¿¡£
221 .\"O .SH VERSIONS
222 .SH ¥Ð¡¼¥¸¥ç¥ó
223 .\"O These routines are present in libc 4.6.27 and later, and in
224 .\"O glibc 2.1 and later.
225 ¤³¤ì¤é¤Î¥ë¡¼¥Á¥ó¤Ï libc 4.6.27 °Ê¹ß¤È glibc 2.1 °Ê¹ß¤Ë¸ºß¤¹¤ë¡£
226 .\"O .SH "CONFORMING TO"
227 .SH ½àµò
228 .\"O 4.3BSD.
229 .\"O Not in POSIX.1-2001.
230 4.3BSD. POSIX.1-2001 ¤Ë¤Ï¤Ê¤¤¡£
231 .\"O .SH "SEE ALSO"
232 .SH ´ØÏ¢¹àÌÜ
233 .BR des (1),
234 .BR crypt (3),
235 .BR xcrypt (3)