OSDN Git Service

6c54b5b1eb7c9da7f1d40f021c404f5f108825bb
[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
133 .\"O OR'ing
134 .\"O together some things.
135 Âè 4 °ú¤­¿ô
136 .I mode
137 ¤Ï¤¤¤¯¤Ä¤«¤ÎÃͤò OR ¤¹¤ë¤³¤È¤ÇºîÀ®¤¹¤ë¡£
138 .\"O For the encryption direction OR in either
139 .\"O .BR DES_ENCRYPT
140 .\"O or
141 .\"O .BR DES_DECRYPT .
142 °Å¹æ²½¤ÎÊý¸þ (ÌõÃð: °Å¹æ²½¤Ê¤Î¤«Éü¹æ²½¤Ê¤Î¤«) ¤ò»ØÄꤹ¤ë¤¿¤á¡¢
143 .BR DES_ENCRYPT
144 ¤Þ¤¿¤Ï
145 .BR DES_DECRYPT
146 ¤ò OR ¤¹¤ë¡£
147 .\"O For software versus hardware
148 .\"O encryption, OR in either
149 .\"O .BR DES_HW
150 .\"O or
151 .\"O .BR DES_SW .
152 °Å¹æ²½¤ò¥½¥Õ¥È¥¦¥§¥¢¤Ç¹Ô¤¦¤«¥Ï¡¼¥É¥¦¥§¥¢¤Ç¹Ô¤¦¤«¤ò»ØÄꤹ¤ë¤¿¤á¡¢
153 .BR DES_HW
154 ¤Þ¤¿¤Ï
155 .BR DES_SW
156 ¤ò OR ¤¹¤ë¡£
157 .\"O If
158 .\"O .BR DES_HW
159 .\"O is specified, and there is no hardware, then the encryption is performed
160 .\"O in software and the routine returns
161 .\"O .BR DESERR_NOHWDEVICE .
162 .BR DES_HW
163 ¤¬»ØÄꤵ¤ì¤Æ¤¤¤Æ¡¢¤«¤Ä¥Ï¡¼¥É¥¦¥§¥¢¤¬¤Ê¤¤¾ì¹ç¡¢
164 °Å¹æ²½¤Ï¥½¥Õ¥È¥¦¥§¥¢¤Ç¼Â¹Ô¤µ¤ì¤Æ¡¢¥ë¡¼¥Á¥ó¤Ï
165 .BR DESERR_NOHWDEVICE
166 ¤òÊÖ¤¹¡£
167 .\"O For
168 .\"O .BR cbc_crypt (),
169 .\"O the argument
170 .\"O .I ivec
171 .\"O is the 8-byte initialization
172 .\"O vector for the chaining.
173 .\"O It is updated to the next initialization
174 .\"O vector upon return.
175 .BR cbc_crypt ()
176 ¤Ë¤ª¤¤¤Æ¡¢°ú¤­¿ô
177 .I ivec
178 ¤Ï¥Ç¡¼¥¿¥Ö¥í¥Ã¥¯¤òÏ¢º¿¤µ¤»¤ëºÝ¤Î 8 ¥Ð¥¤¥È¤Î½é´ü²½¥Ù¥¯¥È¥ë¤Ç¤¢¤ë¡£
179 ¤³¤Î°ú¤­¿ô¤Ï¥ë¡¼¥Á¥ó¤«¤éÌá¤ë¤È¤­¤Ë¼¡¤Î½é´ü²½¥Ù¥¯¥È¥ë¤Ë¹¹¿·¤µ¤ì¤ë¡£
180 .\"O .SH RETURN VALUE
181 .SH ÊÖ¤êÃÍ
182 .PD 0
183 .TP 20
184 .\"O .BR DESERR_NONE
185 .B DESERR_NONE
186 .\"O No error.
187 ¥¨¥é¡¼¤Ê¤·¡£
188 .TP
189 .\"O .BR DESERR_NOHWDEVICE
190 .B DESERR_NOHWDEVICE
191 .\"O Encryption succeeded, but done in software instead of the requested hardware.
192 °Å¹æ²½¤ÏÀ®¸ù¤·¤¿¤¬¡¢Í׵ᤵ¤ì¤¿¥Ï¡¼¥É¥¦¥§¥¢¤ÎÂå¤ï¤ê¤Ë¥½¥Õ¥È¥¦¥§¥¢¤Ç¼Â¹Ô¤µ¤ì¤¿¡£
193 .TP
194 .\"O .BR DESERR_HWERROR
195 .B DESERR_HWERROR
196 .\"O An error occurred in the hardware or driver.
197 ¥Ï¡¼¥É¥¦¥§¥¢¤Þ¤¿¤Ï¥É¥é¥¤¥Ð¤Ç¥¨¥é¡¼¤¬È¯À¸¤·¤¿¡£
198 .TP
199 .\"O .BR DESERR_BADPARAM
200 .B DESERR_BADPARAM
201 .\"O Bad argument to routine.
202 ¥ë¡¼¥Á¥ó¤Ø¤Î°ú¤­¿ô¤¬ÉÔÀµ¤Ç¤¢¤ë¡£
203 .PD
204 .LP
205 .\"O Given a result status
206 .\"O .IR stat ,
207 .\"O the macro
208 .\"O .\" .BR DES_FAILED\c
209 .\"O .\" .BR ( stat )
210 .\"O .BI DES_FAILED( stat )
211 .\"O is false only for the first two statuses.
212 ·ë²Ì¤Î¾õÂÖ
213 .I stat
214 ¤òÍ¿¤¨¤¿¤È¤­¡¢¥Þ¥¯¥í
215 .\" .BR DES_FAILED\c
216 .\" .BR ( stat )
217 .BI DES_FAILED( stat )
218 ¤¬ false ¤Ë¤Ê¤ë¤Î¤Ï¡¢ºÇ½é¤Î 2 ¤Ä¤À¤±¤Ç¤¢¤ë¡£
219 .\"O .\" So far the Sun page
220 .\"O .\" Some additions - aeb
221 .\" ¤³¤³¤Þ¤Ç¤¬ Sun ¤Î man ¥Ú¡¼¥¸¤Ç¤¢¤ë¡£
222 .\" aeb ¤¬¤¤¤¯¤Ä¤«Äɲäò¹Ô¤Ã¤¿¡£
223 .\"O .SH VERSIONS
224 .SH ¥Ð¡¼¥¸¥ç¥ó
225 .\"O These routines are present in libc 4.6.27 and later, and in
226 .\"O glibc 2.1 and later.
227 ¤³¤ì¤é¤Î¥ë¡¼¥Á¥ó¤Ï libc 4.6.27 °Ê¹ß¤È glibc 2.1 °Ê¹ß¤Ë¸ºß¤¹¤ë¡£
228 .\"O .SH "CONFORMING TO"
229 .SH ½àµò
230 .\"O 4.3BSD.
231 .\"O Not in POSIX.1-2001.
232 4.3BSD. POSIX.1-2001 ¤Ë¤Ï¤Ê¤¤¡£
233 .\"O .SH "SEE ALSO"
234 .SH ´ØÏ¢¹àÌÜ
235 .BR des (1),
236 .BR crypt (3),
237 .BR xcrypt (3)