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.

MAC (which we recommend), we strongly recommend that you use another<br />

alternative. Note that HMAC does not use a nonce by default, making HMAC<br />

vulnerable to capture replay attacks (and theoretically vulnerable to a birthday<br />

attack). Additional effort can thwart such attacks, as shown in Recipe 6.12.<br />

MAC127<br />

MAC127 is a MAC we define in Recipe 6.14 that is based on Dan Bernstein’s<br />

hash127. This MAC is very similar to CMAC, but it runs faster in software. It’s<br />

the fastest MAC in software that we would actually recommend using.<br />

OMAC1, OMAC2<br />

OMAC1 and OMAC2, which we discuss in Recipe 6.11, are MACs built upon<br />

AES. They are almost identical to each other, working by running the block<br />

cipher in CBC mode and performing a bit of additional magic at the end. These<br />

are “fixed” versions of a well-known MAC called CBC-MAC. CBC-MAC, without<br />

the kinds of modifications OMAC1 and OMAC2 make, was insecure unless<br />

all messages MAC’d with it were exactly the same size. The OMAC algorithms<br />

are a nice, general-purpose pair of MACs for when you want to keep your system<br />

simple, with only one cryptographic primitive. What’s more, if you use an<br />

OMAC with AES in CTR mode, you need only have an implementation of the<br />

AES encryption operation (which is quite different code from the decryption<br />

operation). There is little practical difference between OMAC1 and OMAC2,<br />

although they both give different outputs. OMAC1 is slightly preferable, as it has<br />

a very slight speed advantage. Neither OMAC1 nor OMAC2 takes a nonce. As<br />

of this writing, NIST is expected to standardize OMAC1.<br />

PMAC<br />

PMAC is also parallelizable, but it is protected by patent. We won’t discuss this<br />

MAC further because there are reasonable free alternatives.<br />

RMAC<br />

RMAC is another MAC built upon a block cipher. It works by running the block<br />

cipher in CBC mode and performing a bit of additional magic at the end. This is<br />

a mode created by NIST, but cryptographers have found theoretical problems<br />

with it under certain conditions; * thus, we do not recommend it for any use.<br />

UMAC32<br />

On many platforms, UMAC is the reigning speed champion for MACs implemented<br />

in software. The version of UMAC timed for Table 6-2 uses 64-bit tags,<br />

which are sufficient for most applications, if a bit liberal. That size is sufficient<br />

because tags generally need to have security for only a fraction of a second,<br />

assuming some resistance to capture replay attacks. 64 bits of strength should<br />

* In particular, RMAC makes more assumptions about the underlying block cipher than other MACs need to<br />

make. The extra assumptions are a bit unreasonable, because they require the block cipher to resist relatedkey<br />

attacks, which are not well studied.<br />

Choosing a Message Authentication Code | 261<br />

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

Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.

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

Saved successfully!

Ooh no, something went wrong!