21.03.2013 Views

Problem - Kevin Tafuro

Problem - Kevin Tafuro

Problem - Kevin Tafuro

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

can arise. For general-purpose use, we recommend a high-level abstraction, such as<br />

that discussed in Recipe 5.16.<br />

With that out of the way, we’ll note that each cipher mode has its advantages and<br />

drawbacks. Certain drawbacks are common to all of the popular cipher modes and<br />

should usually be solved at another layer. In particular:<br />

• If a network attack destroys or modifies data in transit, any cipher mode that<br />

does not perform integrity checking will, if the attacker does his job properly, fail<br />

to detect an error. The modes we discuss that provide built-in integrity checking<br />

are CWC, CCM, and OCB.<br />

• When an attacker does tamper with a data stream by adding or truncating, most<br />

modes will be completely unable to recover. In some limited circumstances, CFB<br />

mode can recover, but this problem is nonetheless better solved at the protocol<br />

layer.<br />

• Especially when padding is not necessary, the ciphertext length gives away information<br />

about the length of the original message, which can occasionally be useful<br />

to an attacker. This is a covert channel, but one that most people choose to<br />

ignore. If you wish to eliminate risks with regard to this problem, pad to a large<br />

length, even if padding is not needed. To get rid of the risk completely, send<br />

fixed-size messages at regular intervals, whether or not there is “real” data to<br />

send. Bogus messages to eliminate covert channels are called cover traffic.<br />

• Block ciphers leak information about the key as they get used. Some block<br />

cipher modes leak a lot more information than others. In particular, CBC mode<br />

leaks a lot more information than something like CTR mode.<br />

If you do not use a cipher mode that provides built-in integrity checking,<br />

be sure to use a MAC (message authentication code) whenever<br />

encrypting.<br />

In the following sections, we’ll go over the important properties of each of the most<br />

popular modes, pointing out the tradeoffs involved with each (we’ll avoid discussing<br />

the details of the modes here; we’ll do that in later recipes). Note that if a problem is<br />

listed for only a single cipher mode and goes unmentioned elsewhere, it is not a<br />

problem for those other modes. For each of the modes we discuss, speed is not a significant<br />

concern; the only thing that has a significant impact on performance is the<br />

underlying block cipher. *<br />

* Integrity-aware modes will necessarily be slower than raw encryption modes, but CWC and OCB are faster<br />

than combining an integrity primitive with a standard mode, and CCM is just as fast as doing so.<br />

This is the Title of the Book, eMatter Edition<br />

Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.<br />

Selecting a Cipher Mode | 163

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!