ica_3des_cfb

Purpose

Encrypt or decrypt data with a 3DES key using Cipher Feedback (CFB) mode, as described in NIST Special Publication 800-38A Chapter 6.3.

Format


unsigned int ica_3des_cfb(const unsigned char *in_data,
  unsigned char *out_data,
  unsigned long data_length,
  const unsigned char *key,
  unsigned char *iv,
  unsigned int lcfb,
  unsigned int direction);

Required hardware support

KMF-TDEA-192

Parameters

const unsigned char *in_data
Pointer to a readable buffer that contains the message to be encrypted or decrypted. The size of the message in bytes is data_length. The size of this buffer must be at least as large as data_length.
unsigned char *out_data
Pointer to a writable buffer to contain the resulting encrypted or decrypted message. The size of this buffer in bytes must be at least as large as data_length.
unsigned long data_length
Length in bytes of the message to be encrypted or decrypted, which resides at the beginning of in_data.
const unsigned char *key
Pointer to a valid 3DES key of 24 bytes in length.
unsigned char *iv
Pointer to a valid initialization vector of cipher block size number of bytes (8 bytes for 3DES). This vector is overwritten during the function. The result value in iv can be used as the initialization vector for a chained ica_3des_cfb call with the same key, if the data_length in the preceding call is a multiple of lcfb.
unsigned int lcfb
Length in bytes of the cipher feedback, which is a value greater than or equal to 1 and less than or equal to the cipher block size (8 bytes for 3DES).
unsigned int direction
0
Use the decrypt function.
1
Use the encrypt function.

Return codes

0
Success

For return codes indicating exceptions, see Return codes.