B_DecryptInit,

Block Ciphers

Decrypting

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

The RC5 Cipher

The RC5 cipher is more properly known as RC5 w/r/b, where w stands for word-size, r stands for rounds, and b stands for key size in bytes.

The word size parameter is designed to take advantage of variable hardware word sizes. A hardware implementation can choose a 16-, 32-, or 64-bit word size, depending on how many bits make up a register, or word. Software implementations of the RC5 cipher can emulate any word size, regardless of the size of the machine’s register size. Crypto-C implements word sizes of 32 or 64 bits; the 64-bit implementation has not been optimized.

The next feature of the RC5 cipher is the rounds parameter. Increasing the number of rounds increases security, but slows down the operation. This allows the application developer to establish a desired trade-off between security and speed. The RC5 cipher allows round counts from 0 to 255 rounds. RSA Security recommends using at least 16 rounds for the 32-bit word implementation. Analysis indicates that, in theory, the RC5 cipher may be susceptible to various attacks for values less than 16.

The last feature is the variable key size. Whereas a DES key requires eight bytes, an RC5 key can be anywhere between zero and 255 bytes. The larger the key, the greater the security. Key size has no appreciable effect on speed.

The RC5 cipher is a block cipher; the size of the blocks is twice the word size. For RC5 32/r/b, the block size is 64 bits or 8 bytes; for RC5 64/r/b, the block size is 128 bits or 16 bytes.

The example in this section corresponds to the file rc5.c.

Step 1: Creating An Algorithm Object

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.

1 9 0

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 212
Image 212
RSA Security 5.2.2 manual RC5 Cipher, Decrypting