5.10. Using CWC Mode
Problem
You want to use CWC mode to get encryption and message integrity in a single mode.
Solution
Use the reference implementation available from http://www.zork.org/cwc/, or use Brian Gladman’s implementation, available from http://fp.gladman.plus.com/AES/cwc.zip.
Discussion
CWC mode is a mode of operation for providing both encryption and message integrity. This mode is parallelizable, fast in both software and hardware (where it can achieve speeds of 10 gigabits per second), unencumbered by patents, and provably secure to good bounds with standard assumptions. (We compare CWC to other modes in Recipe 5.4.)
CWC mode is not simple to implement because it uses a universal hash function as a component that is conceptually straightforward but somewhat complex to implement well. We therefore recommend using an off-the-shelf implementation, such as the implementation on the official CWC web page (http://www.zork.org/cwc/).
Here, we’ll discuss how to use the distribution available from the CWC web page. This implementation has a set of macros similar to the macros we develop in Recipe 5.5 allowing you to bind the library to any AES implementation. In particular, if you edit local_options.h , you need to do the following:
Set
AES_KS_Tto whatever value you would setSPC_KEY_SCHED(see Recipe 5.5).Set
CWC_AES_SETUPto whatever value you would setSPC_ENCRYPT_INIT(see Recipe 5.5).Set
CWC_AES_ENCRYPTto whatever value you would setSPC_DO_ENCRYPT(see Recipe 5.5).
Once ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access