1.\" @(#)des_crypt.3 2.1 88/08/11 4.0 RPCSRC; from 1.16 88/03/02 SMI;
| 1.\" @(#)des_crypt.3 2.1 88/08/11 4.0 RPCSRC; from 1.16 88/03/02 SMI;
|
2.\" $FreeBSD: head/lib/libc/rpc/des_crypt.3 50476 1999-08-28 00:22:10Z peter $
| 2.\" $FreeBSD: head/lib/libc/rpc/des_crypt.3 57686 2000-03-02 09:14:21Z sheldonh $
|
3.\" 4.TH DES_CRYPT 3 "6 October 1987" 5.SH NAME 6des_crypt, ecb_crypt, cbc_crypt, des_setparity \- fast DES encryption 7.SH SYNOPSIS 8.nf 9.B #include <des_crypt.h> 10.LP 11.B int ecb_crypt(key, data, datalen, mode) 12.B char *key; 13.B char *data; 14.B unsigned datalen; 15.B unsigned mode; 16.LP 17.B int cbc_crypt(key, data, datalen, mode, ivec) 18.B char *key; 19.B char *data; 20.B unsigned datalen; 21.B unsigned mode; 22.B char *ivec; 23.LP 24.B void des_setparity(key) 25.B char *key; 26.fi 27.SH DESCRIPTION 28.IX encryption cbc_crypt "" \fLcbc_crypt\fP 29.IX "des encryption" cbc_crypt "DES encryption" \fLcbc_crypt\fP 30.IX encryption des_setparity "" \fLdes_setparity\fP 31.IX "des encryption" des_setparity "DES encryption" \fLdes_setparity\fP 32.B ecb_crypt(\|) 33and 34.B cbc_crypt(\|) 35implement the 36.SM NBS 37.SM DES 38(Data Encryption Standard). 39These routines are faster and more general purpose than 40.BR crypt (3). 41They also are able to utilize 42.SM DES 43hardware if it is available. 44.B ecb_crypt(\|) 45encrypts in 46.SM ECB 47(Electronic Code Book) 48mode, which encrypts blocks of data independently. 49.B cbc_crypt(\|) 50encrypts in 51.SM CBC 52(Cipher Block Chaining) 53mode, which chains together 54successive blocks. 55.SM CBC 56mode protects against insertions, deletions and
| 3.\" 4.TH DES_CRYPT 3 "6 October 1987" 5.SH NAME 6des_crypt, ecb_crypt, cbc_crypt, des_setparity \- fast DES encryption 7.SH SYNOPSIS 8.nf 9.B #include <des_crypt.h> 10.LP 11.B int ecb_crypt(key, data, datalen, mode) 12.B char *key; 13.B char *data; 14.B unsigned datalen; 15.B unsigned mode; 16.LP 17.B int cbc_crypt(key, data, datalen, mode, ivec) 18.B char *key; 19.B char *data; 20.B unsigned datalen; 21.B unsigned mode; 22.B char *ivec; 23.LP 24.B void des_setparity(key) 25.B char *key; 26.fi 27.SH DESCRIPTION 28.IX encryption cbc_crypt "" \fLcbc_crypt\fP 29.IX "des encryption" cbc_crypt "DES encryption" \fLcbc_crypt\fP 30.IX encryption des_setparity "" \fLdes_setparity\fP 31.IX "des encryption" des_setparity "DES encryption" \fLdes_setparity\fP 32.B ecb_crypt(\|) 33and 34.B cbc_crypt(\|) 35implement the 36.SM NBS 37.SM DES 38(Data Encryption Standard). 39These routines are faster and more general purpose than 40.BR crypt (3). 41They also are able to utilize 42.SM DES 43hardware if it is available. 44.B ecb_crypt(\|) 45encrypts in 46.SM ECB 47(Electronic Code Book) 48mode, which encrypts blocks of data independently. 49.B cbc_crypt(\|) 50encrypts in 51.SM CBC 52(Cipher Block Chaining) 53mode, which chains together 54successive blocks. 55.SM CBC 56mode protects against insertions, deletions and
|
57substitutions of blocks. Also, regularities in the clear text will
| 57substitutions of blocks. 58Also, regularities in the clear text will
|
58not appear in the cipher text. 59.LP 60Here is how to use these routines. The first parameter, 61.IR key , 62is the 8-byte encryption key with parity. 63To set the key's parity, which for 64.SM DES 65is in the low bit of each byte, use 66.IR des_setparity . 67The second parameter, 68.IR data ,
| 59not appear in the cipher text. 60.LP 61Here is how to use these routines. The first parameter, 62.IR key , 63is the 8-byte encryption key with parity. 64To set the key's parity, which for 65.SM DES 66is in the low bit of each byte, use 67.IR des_setparity . 68The second parameter, 69.IR data ,
|
69contains the data to be encrypted or decrypted. The
| 70contains the data to be encrypted or decrypted. 71The
|
70third parameter, 71.IR datalen , 72is the length in bytes of 73.IR data , 74which must be a multiple of 8. The fourth parameter, 75.IR mode , 76is formed by 77.SM OR\s0'ing 78together some things. For the encryption direction 'or' in either 79.SM DES_ENCRYPT 80or 81.SM DES_DECRYPT\s0. 82For software versus hardware 83encryption, 'or' in either 84.SM DES_HW 85or 86.SM DES_SW\s0. 87If 88.SM DES_HW 89is specified, and there is no hardware, then the encryption is performed 90in software and the routine returns 91.SM DESERR_NOHWDEVICE\s0. 92For 93.IR cbc_crypt , 94the parameter 95.I ivec 96is the the 8-byte initialization 97vector for the chaining. It is updated to the next initialization 98vector upon return. 99.LP 100.SH "SEE ALSO" 101.BR des (1), 102.BR crypt (3) 103.SH DIAGNOSTICS 104.PD 0 105.TP 20 106.SM DESERR_NONE 107No error. 108.TP 109.SM DESERR_NOHWDEVICE 110Encryption succeeded, but done in software instead of the requested hardware. 111.TP 112.SM DESERR_HWERR 113An error occurred in the hardware or driver. 114.TP 115.SM DESERR_BADPARAM 116Bad parameter to routine. 117.PD 118.LP 119Given a result status 120.IR stat , 121the macro 122.SM DES_FAILED\c 123.BR ( stat ) 124is false only for the first two statuses. 125.SH RESTRICTIONS 126These routines are not available in RPCSRC 4.0. 127This information is provided to describe the DES interface expected by 128Secure RPC.
| 72third parameter, 73.IR datalen , 74is the length in bytes of 75.IR data , 76which must be a multiple of 8. The fourth parameter, 77.IR mode , 78is formed by 79.SM OR\s0'ing 80together some things. For the encryption direction 'or' in either 81.SM DES_ENCRYPT 82or 83.SM DES_DECRYPT\s0. 84For software versus hardware 85encryption, 'or' in either 86.SM DES_HW 87or 88.SM DES_SW\s0. 89If 90.SM DES_HW 91is specified, and there is no hardware, then the encryption is performed 92in software and the routine returns 93.SM DESERR_NOHWDEVICE\s0. 94For 95.IR cbc_crypt , 96the parameter 97.I ivec 98is the the 8-byte initialization 99vector for the chaining. It is updated to the next initialization 100vector upon return. 101.LP 102.SH "SEE ALSO" 103.BR des (1), 104.BR crypt (3) 105.SH DIAGNOSTICS 106.PD 0 107.TP 20 108.SM DESERR_NONE 109No error. 110.TP 111.SM DESERR_NOHWDEVICE 112Encryption succeeded, but done in software instead of the requested hardware. 113.TP 114.SM DESERR_HWERR 115An error occurred in the hardware or driver. 116.TP 117.SM DESERR_BADPARAM 118Bad parameter to routine. 119.PD 120.LP 121Given a result status 122.IR stat , 123the macro 124.SM DES_FAILED\c 125.BR ( stat ) 126is false only for the first two statuses. 127.SH RESTRICTIONS 128These routines are not available in RPCSRC 4.0. 129This information is provided to describe the DES interface expected by 130Secure RPC.
|