A SERVICE OF

logo

Chapter 6 Symmetric-Key Operations 179
Block Ciphers
encryptionMethodName
is the block cipher that you will use; for this example, use des.
The information in the Reference Manual indicates that you do not need to supply any
parameters for the DES encryption algorithm, so set
encryptionParams
to NULL_PTR.
Use Cipher Block Chaining (CBC) for your feedback method. For this method, the
Reference Manual says that
feedbackParams
is an ITEM structure containing the
initialization vector:
See Block Ciphers on page 37 for an explanation of initialization vectors. Use a
random number generator to produce an IV. Remember, the IV is not secret and will
not assist anyone in breaking the encryption, but you should use a different IV for
different messages. The size of the IV is eight bytes, because DES encrypts blocks of
eight bytes. The size of the IV is always related to the size of the block, not the key:
typedef struct {
unsigned char *encryptionMethodName; /* examples include des, rc5 */
POINTER encryptionParams; /* e.g., RC5 parameters */
unsigned char *feedbackMethodName;
POINTER feedbackParams; /* Points at init vector ITEM */
/* for all feedback modes except cfb */
unsigned char *paddingMethodName;
POINTER paddingParams; /* Ignored for now, but may be used */
/* for new padding schemes */
} B_BLK_CIPHER_W_FEEDBACK_PARAMS;
typedef struct {
unsigned char *data;
unsigned int len;
} ITEM;
unsigned char *ivBytes[BLOCK_SIZE];
B_BLK_CIPHER_W_FEEDBACK_PARAMS fbParams;
ITEM ivItem;