[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]
Communications Technical Reference, Volume 1

cbc_crypt, des_setparity, or ecb_crypt Subroutine

Purpose

Implements Data Encryption Standard (DES) encryption routines.

Library

DES library (libdes.a)

Syntax

# include <des_crypt.h>
int ecb_crypt (key, data, datalen, mode)
char *key;
char *data;
unsigned datalen;
unsigned mode;
int cbc_crypt(key, data, datalen, mode, ivec)
char *key;
char *data;
unsigned datalen;
unsigned mode;
char 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.

Parameters

data Specifies that the data is to be 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 the key, which for DES is 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 data is to be encrypted or decrypted. This parameter is formed by logically ORing the DES_ENCRYPT or DES_DECRYPT symbols. For software versus hardware encryption, logically OR the DES_HW or DES_SW symbols. These four symbols are defined in the /usr/include/des_crypt.h file.

Return Values

DESERR_BADPARAM Specifies that a bad parameter was passed to routine.
DESERR_HWERR Specifies that an error occurred in the hardware or driver.
DESERR_NOHWDEVICE Specifies that encryption succeeded, but was done in software instead of the requested hardware.
DESERR_NONE Specifies no error.
Note: Given the stat variable, for example, which contains the return value for either the ecb_crypt or cbc_crypt subroutine, the DES_FAILED(stat) macro is false only for the DESERR_NONE and DESERR_NOHWDEVICE return values.

Implementation Specifics

These subroutines are not available for export outside the United States.

Files

/usr/include/des_crypt.h Defines macros and needed symbols for the mode parameter.

Related Information

Secure NFS in AIX Version 4.3 System Management Guide: Communications and Networks.

Example Using DES Authentication in AIX Version 4.3 Communications Programming Concepts.


[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]