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 .TH DES_CRYPT 3 2007-05-18 "" "Linux Programmer's Manual"
12 des_crypt, ecb_crypt, cbc_crypt, des_setparity, DES_FAILED \- fast
17 .\" .B #include <des_crypt.h>
18 .B #include <rpc/des_crypt.h>
20 .BI "int ecb_crypt(char *" key ", char *" data ", unsigned " datalen ,
21 .BI " unsigned " mode );
23 .BI "int cbc_crypt(char *" key ", char *" data ", unsigned " datalen ,
24 .BI " unsigned " mode ", char *" ivec );
26 .BI "void des_setparity(char *" key );
28 .BI "int DES_FAILED(int " status );
37 (Data Encryption Standard).
38 These routines are faster and more general purpose than
40 They also are able to utilize
42 hardware if it is available.
46 (Electronic Code Book)
47 mode, which encrypts blocks of data independently.
51 (Cipher Block Chaining)
52 mode, which chains together
55 mode protects against insertions, deletions and
56 substitutions of blocks.
57 Also, regularities in the clear text will
58 not appear in the cipher text.
60 Here is how to use these routines.
63 is the 8-byte encryption key with parity.
64 To set the key's parity, which for
66 is in the low bit of each byte, use
70 contains the data to be encrypted or decrypted.
74 is the length in bytes of
76 which must be a multiple of 8.
82 For the encryption direction OR in either
86 For software versus hardware
87 encryption, OR in either
93 is specified, and there is no hardware, then the encryption is performed
94 in software and the routine returns
95 .BR DESERR_NOHWDEVICE .
100 is the 8-byte initialization
101 vector for the chaining.
102 It is updated to the next initialization
110 .BR DESERR_NOHWDEVICE
111 Encryption succeeded, but done in software instead of the requested hardware.
114 An error occurred in the hardware or driver.
117 Bad argument to routine.
120 Given a result status
125 .BI DES_FAILED( stat )
126 is false only for the first two statuses.
127 .\" So far the Sun page
128 .\" Some additions - aeb
130 These routines are present in libc 4.6.27 and later, and in