The example in this AI_FeedbackCipher

Block Ciphers

if (encryptedData != NULL_PTR) {

T_memset (encryptedData, 0, encryptedDataLen); T_free (encryptedData);

encryptedData = NULL_PTR;

}

Decrypting

As in the “Introductory Example” on page 9, decrypting is similar to encrypting. Use the same AI, IV, and key data. Use the proper decrypting AM and call B_DecryptInit, B_DecryptUpdate, and B_DecryptFinal.

The RC6 Cipher

The RC6 cipher was developed by Ronald Rivest and Matthew Robshaw, Ray Sidney, and Lisa Yin of RSA Laboratories West as a candidate for the Advanced Encryption Standard (AES). RC6 allows for a variable number of rounds; however, the implementation in this version of Crypto-C fixes the number of rounds at 20. Later versions of Crypto-C may extend this value.

section corresponds to the file rc6.c, which uses AI_RC6_CBCPad. also supports the RC6 symmetric block cipher.

AI_FeedbackCipher is useful if your application has a need to support block cipher modes other than CBC. See the rc6fb.c sample program for more information.

Step 1: Create

Declare a variable to be B_ALGORITHM_OBJ and as defined in the function prototype in Chapter 4 of the Reference Manual, its address is the argument for B_CreateAlgorithmObject.

B_ALGORITHM_OBJ rc6Encrypter = (B_ALGORITHM_OBJ)NULL_PTR;

if ((status = B_CreateAlgorithmObject (&rc6Encrypter)) != 0) break;

Step 2: Set

For this example, you will perform an RC6 operation in CBC mode using PKCS V#5 padding. To do this, use AI_RC6_CBCPad in the call to B_SetAlgorithmInfo. Notice

1 9 6

R S A B S A F E C r y p t o - C D e v e l o p e r ’s G u i d e

Page 218
Image 218
RSA Security 5.2.2 manual RC6 Cipher, EncryptedData = Nullptr