Turn from: http://www.ualberta.ca/dept/chemeng/AIX-43/share/man/info/C/a_doc_lib/libs/commtrf1/cbc_crypt.htm
Purpose
Implements Data Encryption Standard (DES) encryption routines. Library
DES Library (libdes.a) Syntax
# include <des_crypt.h>
int Ecb_crypt (keydatadatalenmode)
char *key;
char *data;
Datalen;
mode;
int Cbc_crypt (keydatadatalenmodeivec)
char *key;
char *data;
Datalen;
mode;
Ivec;
void des_setparity (key)
char *key;
Description
The ecb_crypt and cbc_crypt subroutines implement DES encryption routines, set by the National Bureau of Standards. The Ecb_crypt subroutine encrypts in ECB (Electronic Code book) mode, which encrypts the blocks of data independently . The Cbc_crypt subroutine encrypts in CBC (Cipher block chaining) mode, which chains, together successive. CBC mode protects against insertions, deletions, and substitutions of blocks. Also, regularities in the clear text won't appear in the cipher text. Note: The DES library must is installed to use this subroutines. Parameters
Data |
Specifies that's the data is either encrypted or decrypted. |
Datalen |
Specifies the length in bytes of data. The length must be a multiple of 8. |
Key |
Specifies the 8-byte encryption key with parity. To set the "parity for" key, which for DES are in the "low" bit of each byte, use the des_setparity subroutine. |
Ivec |
Initializes the vector for the chaining in 8-byte. This is updated to the next initialization vector upon return. |
Mode |
Specifies whether the data is to be encrypted or decrypted. This parameter was formed by logically oring the des_encrypt or des_decrypt. For software versus hardware encryption, logically or the des_hw or des_sw. These four symbols are defined in the /usr/include/des_crypt.h file. |
return Values
Deserr_badparam |
Specifies that a bad parameter is passed to routine. |
Deserr_hwerr |
Specifies that a error occurred in the hardware or driver. |
Deserr_nohwdevice |
Specifies that encryption succeeded, but was do in software instead of the requested hardware. |
Deserr_none |
Specifies no error. |
Note:Given the
StatVariable, for example, which contains the return value for either the
Ecb_cryptOr
Cbc_cryptsubroutine, the
des_failed (STAT)Macro is false to the
Deserr_noneand
Deserr_nohwdevicereturn values.
Implementation Specifics
These subroutines are are not available for export outside the United States. Files
/usr/include/des_crypt.h |
Defines macros and needed symbols for the mode parameter.
|