1 .\" @(#)des_crypt.3 2.1 88/08/11 4.0 RPCSRC; from 1.16 88/03/02 SMI;
3 .\" Taken from libc4 sources, which say:
4 .\" Copyright (C) 1993 Eric Young - can be distributed under GPL.
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).
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>
15 .TH DES_CRYPT 3 2007-05-18 "" "Linux Programmer's Manual"
18 .\"O des_crypt, ecb_crypt, cbc_crypt, des_setparity, DES_FAILED \- fast
20 des_crypt, ecb_crypt, cbc_crypt, des_setparity, DES_FAILED \- ¹â®¤Ê DES °Å¹æ²½
26 .\" .B #include <des_crypt.h>
27 .B #include <rpc/des_crypt.h>
29 .BI "int ecb_crypt(char *" key ", char *" data ", unsigned " datalen ,
30 .BI " unsigned " mode );
32 .BI "int cbc_crypt(char *" key ", char *" data ", unsigned " datalen ,
33 .BI " unsigned " mode ", char *" ivec );
35 .BI "void des_setparity(char *" key );
37 .BI "int DES_FAILED(int " status );
47 .\"O (Data Encryption Standard).
54 (Data Encryption Standard, ¥Ç¡¼¥¿°Å¹æ²½µ¬³Ê) ¤ò¼ÂÁõ¤·¤Æ¤¤¤ë¡£
55 .\"O These routines are faster and more general purpose than
59 ¤è¤ê¤â¹â®¤Ç¤è¤ê°ìÈÌŪ¤ÊÌÜŪ¤Ë»ÈÍѤǤ¤ë¡£
60 .\"O They also are able to utilize
62 .\"O hardware if it is available.
63 ÍøÍѲÄǽ¤Ç¤¢¤ì¤Ð¡¢¤³¤ì¤é¤Î¥ë¡¼¥Á¥ó¤Ï
65 ¥Ï¡¼¥É¥¦¥§¥¢¤ò»ÈÍѤ¹¤ë¤³¤È¤â¤Ç¤¤ë¡£
69 .\"O (Electronic Code Book)
70 .\"O mode, which encrypts blocks of data independently.
74 (Electronic Code Book) ¥â¡¼¥É¤Ç°Å¹æ²½¤¹¤ë¡£
75 ¤³¤Î¥â¡¼¥É¤Ç¤Ï (¸Ä¡¹¤Î) ¥Ç¡¼¥¿¤Î¥Ö¥í¥Ã¥¯¤òÆÈΩ¤·¤Æ°Å¹æ²½¤¹¤ë
79 .\"O (Cipher Block Chaining)
80 .\"O mode, which chains together
81 .\"O successive blocks.
85 (Cipher Block Chaining) ¥â¡¼¥É¤Ç°Å¹æ²½¤¹¤ë¡£
86 ¤³¤Î¥â¡¼¥É¤Ç¤ÏϢ³¤¹¤ë¥Ö¥í¥Ã¥¯¤ò¸ß¤¤¤ËÏ¢º¿¤µ¤»¤Æ°Å¹æ²½¤¹¤ë¡£
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.
93 ¤Ï¥Ö¥í¥Ã¥¯¤ÎÁÞÆþ¡¦ºï½ü¡¦ÃÖ¤´¹¤¨¤«¤éÊݸ¤ë¡£
94 ¤Þ¤¿Ê¿Ê¸¤Îµ¬Â§À¤¬°Å¹æʸ¤Ë¸½¤ì¤Ê¤¤¡£
96 .\"O Here is how to use these routines.
97 .\"O The first argument,
99 .\"O is the 8-byte encryption key with parity.
100 ¤³¤ì¤é¤Î¥ë¡¼¥Á¥ó¤Î»ÈÍÑË¡¤ò¼¨¤¹¡£
103 ¤Ï¥Ñ¥ê¥Æ¥£ÉÕ¤¤Î 8 ¥Ð¥¤¥È¤Î°Å¹æ²½¸°¤Ç¤¢¤ë¡£
104 .\"O To set the key's parity, which for
106 .\"O is in the low bit of each byte, use
107 .\"O .BR des_setparity ().
108 ¸°¤Î¥Ñ¥ê¥Æ¥£¤òÀßÄꤹ¤ë¤Ë¤Ï
112 ¤Î¾ì¹ç¡¢¸°¤Î¥Ñ¥ê¥Æ¥£¤Ï³Æ¥Ð¥¤¥È¤ÎºÇ²¼°Ì¥Ó¥Ã¥È¤Ç¤¢¤ë¡£
113 .\"O The second argument,
115 .\"O contains the data to be encrypted or decrypted.
118 ¤Ï°Å¹æ²½¤Þ¤¿¤ÏÉü¹æ²½¤µ¤ì¤ë¥Ç¡¼¥¿¤ò´Þ¤à¡£
122 .\"O is the length in bytes of
124 .\"O which must be a multiple of 8.
129 ¤Î¥Ð¥¤¥ÈŤǤ¢¤ê¡¢8 ¤ÎÇÜ¿ô¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
130 .\"O The fourth argument,
134 .\"O together some things.
137 ¤Ï¤¤¤¯¤Ä¤«¤ÎÃͤò OR ¤¹¤ë¤³¤È¤ÇºîÀ®¤¹¤ë¡£
138 .\"O For the encryption direction OR in either
141 .\"O .BR DES_DECRYPT .
142 °Å¹æ²½¤ÎÊý¸þ (ÌõÃð: °Å¹æ²½¤Ê¤Î¤«Éü¹æ²½¤Ê¤Î¤«) ¤ò»ØÄꤹ¤ë¤¿¤á¡¢
147 .\"O For software versus hardware
148 .\"O encryption, OR in either
152 °Å¹æ²½¤ò¥½¥Õ¥È¥¦¥§¥¢¤Ç¹Ô¤¦¤«¥Ï¡¼¥É¥¦¥§¥¢¤Ç¹Ô¤¦¤«¤ò»ØÄꤹ¤ë¤¿¤á¡¢
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 .
163 ¤¬»ØÄꤵ¤ì¤Æ¤¤¤Æ¡¢¤«¤Ä¥Ï¡¼¥É¥¦¥§¥¢¤¬¤Ê¤¤¾ì¹ç¡¢
164 °Å¹æ²½¤Ï¥½¥Õ¥È¥¦¥§¥¢¤Ç¼Â¹Ô¤µ¤ì¤Æ¡¢¥ë¡¼¥Á¥ó¤Ï
165 .BR DESERR_NOHWDEVICE
168 .\"O .BR cbc_crypt (),
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.
178 ¤Ï¥Ç¡¼¥¿¥Ö¥í¥Ã¥¯¤òÏ¢º¿¤µ¤»¤ëºÝ¤Î 8 ¥Ð¥¤¥È¤Î½é´ü²½¥Ù¥¯¥È¥ë¤Ç¤¢¤ë¡£
179 ¤³¤Î°ú¤¿ô¤Ï¥ë¡¼¥Á¥ó¤«¤éÌá¤ë¤È¤¤Ë¼¡¤Î½é´ü²½¥Ù¥¯¥È¥ë¤Ë¹¹¿·¤µ¤ì¤ë¡£
180 .\"O .SH RETURN VALUE
189 .\"O .BR DESERR_NOHWDEVICE
191 .\"O Encryption succeeded, but done in software instead of the requested hardware.
192 °Å¹æ²½¤ÏÀ®¸ù¤·¤¿¤¬¡¢Í׵ᤵ¤ì¤¿¥Ï¡¼¥É¥¦¥§¥¢¤ÎÂå¤ï¤ê¤Ë¥½¥Õ¥È¥¦¥§¥¢¤Ç¼Â¹Ô¤µ¤ì¤¿¡£
194 .\"O .BR DESERR_HWERROR
196 .\"O An error occurred in the hardware or driver.
197 ¥Ï¡¼¥É¥¦¥§¥¢¤Þ¤¿¤Ï¥É¥é¥¤¥Ð¤Ç¥¨¥é¡¼¤¬È¯À¸¤·¤¿¡£
199 .\"O .BR DESERR_BADPARAM
201 .\"O Bad argument to routine.
202 ¥ë¡¼¥Á¥ó¤Ø¤Î°ú¤¿ô¤¬ÉÔÀµ¤Ç¤¢¤ë¡£
205 .\"O Given a result status
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.
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 ¤¬¤¤¤¯¤Ä¤«Äɲäò¹Ô¤Ã¤¿¡£
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"
231 .\"O Not in POSIX.1-2001.
232 4.3BSD. POSIX.1-2001 ¤Ë¤Ï¤Ê¤¤¡£