21.03.2013 Views

Problem - Kevin Tafuro

Problem - Kevin Tafuro

Problem - Kevin Tafuro

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

int spc_ctr_final(SPC_CTR_CTX *ctx) {<br />

spc_memset(&ctx, 0, sizeof(SPC_CTR_CTX));<br />

return 1;<br />

}<br />

See Also<br />

Recipes 4.9, 5.4, 5.5, 5.16, 13.2<br />

5.10 Using CWC Mode<br />

<strong>Problem</strong><br />

You want to use CWC mode to get encryption and message integrity in a single<br />

mode.<br />

Solution<br />

Use the reference implementation available from http://www.zork.org/cwc/, or use<br />

Brian Gladman’s implementation, available from http://fp.gladman.plus.com/AES/<br />

cwc.zip.<br />

Discussion<br />

CWC mode is a mode of operation for providing both encryption and message integrity.<br />

This mode is parallelizable, fast in both software and hardware (where it can<br />

achieve speeds of 10 gigabits per second), unencumbered by patents, and provably<br />

secure to good bounds with standard assumptions. (We compare CWC to other<br />

modes in Recipe 5.4.)<br />

CWC mode is not simple to implement because it uses a universal hash function as a<br />

component that is conceptually straightforward but somewhat complex to implement<br />

well. We therefore recommend using an off-the-shelf implementation, such as<br />

the implementation on the official CWC web page (http://www.zork.org/cwc/).<br />

Here, we’ll discuss how to use the distribution available from the CWC web page.<br />

This implementation has a set of macros similar to the macros we develop in Recipe<br />

5.5 allowing you to bind the library to any AES implementation. In particular, if you<br />

edit local_options.h, you need to do the following:<br />

1. Set AES_KS_T to whatever value you would set SPC_KEY_SCHED (see Recipe 5.5).<br />

2. Set CWC_AES_SETUP to whatever value you would set SPC_ENCRYPT_INIT (see Recipe<br />

5.5).<br />

3. Set CWC_AES_ENCRYPT to whatever value you would set SPC_DO_ENCRYPT (see Recipe<br />

5.5).<br />

202 | Chapter 5: Symmetric Encryption<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!