1des_crypt(3)               Library Functions Manual               des_crypt(3)
2
3
4

NAME

6       des_crypt,  ecb_crypt,  cbc_crypt, des_setparity, DES_FAILED - fast DES
7       encryption
8

LIBRARY

10       Standard C library (libc, -lc)
11

SYNOPSIS

13       #include <rpc/des_crypt.h>
14
15       [[deprecated]] int ecb_crypt(char *key, char data[.datalen],
16                                    unsigned int datalen, unsigned int mode);
17       [[deprecated]] int cbc_crypt(char *key, char data[.datalen],
18                                    unsigned int datalen, unsigned int mode,
19                                    char *ivec);
20
21       [[deprecated]] void des_setparity(char *key);
22
23       [[deprecated]] int DES_FAILED(int status);
24

DESCRIPTION

26       ecb_crypt() and cbc_crypt() implement  the  NBS  DES  (Data  Encryption
27       Standard).   These  routines  are  faster and more general purpose than
28       crypt(3).  They also are able to utilize DES hardware if it  is  avail‐
29       able.   ecb_crypt()  encrypts in ECB (Electronic Code Book) mode, which
30       encrypts blocks of data independently.   cbc_crypt()  encrypts  in  CBC
31       (Cipher  Block Chaining) mode, which chains together successive blocks.
32       CBC mode protects against insertions, deletions, and  substitutions  of
33       blocks.   Also,  regularities  in the clear text will not appear in the
34       cipher text.
35
36       Here is how to use these routines.  The first  argument,  key,  is  the
37       8-byte  encryption key with parity.  To set the key's parity, which for
38       DES is in the low bit of each byte, use  des_setparity().   The  second
39       argument,  data,  contains  the data to be encrypted or decrypted.  The
40       third argument, datalen, is the length in bytes of data, which must  be
41       a  multiple  of  8.   The fourth argument, mode, is formed by ORing to‐
42       gether some things.  For the encryption direction OR in either  DES_EN‐
43       CRYPT  or  DES_DECRYPT.  For software versus hardware encryption, OR in
44       either DES_HW or DES_SW.  If DES_HW is specified, and there is no hard‐
45       ware,  then the encryption is performed in software and the routine re‐
46       turns DESERR_NOHWDEVICE.  For cbc_crypt(), the  argument  ivec  is  the
47       8-byte  initialization  vector  for the chaining.  It is updated to the
48       next initialization vector upon return.
49

RETURN VALUE

51       DESERR_NONE
52              No error.
53
54       DESERR_NOHWDEVICE
55              Encryption succeeded, but done in software instead  of  the  re‐
56              quested hardware.
57
58       DESERR_HWERROR
59              An error occurred in the hardware or driver.
60
61       DESERR_BADPARAM
62              Bad argument to routine.
63
64       Given  a  result  status stat, the macro DES_FAILED(stat) is false only
65       for the first two statuses.
66

ATTRIBUTES

68       For an  explanation  of  the  terms  used  in  this  section,  see  at‐
69       tributes(7).
70
71       ┌────────────────────────────────────────────┬───────────────┬─────────┐
72Interface                                   Attribute     Value   
73       ├────────────────────────────────────────────┼───────────────┼─────────┤
74ecb_crypt(), cbc_crypt(), des_setparity()   │ Thread safety │ MT-Safe │
75       └────────────────────────────────────────────┴───────────────┴─────────┘
76

STANDARDS

78       None.
79

HISTORY

81       4.3BSD.  glibc 2.1.  Removed in glibc 2.28.
82
83       Because they employ the DES block cipher, which is no longer considered
84       secure, these functions were removed.  Applications should switch to  a
85       modern cryptography library, such as libgcrypt.
86

SEE ALSO

88       des(1), crypt(3), xcrypt(3)
89
90
91
92Linux man-pages 6.05              2023-07-20                      des_crypt(3)
Impressum