dlitz/pycrypto — pull request #33 by Legrandin (2013-02-05 21:23:33+00:00)
Title: Add support for CCM mode

This changeset adds support for the authenticated encryption mode CCM.
It works with all ciphers having block size of 128 bits, which means only AES.
There are unit test cases with test vectors from NIST 800SP-38C and RFC3610.

The API is borrowed from the Hash module.
Associated data is fed into the cipher with update().
The MAC tag is returned by the final call to digest().
When decrypting, MAC comparison can be done by digest(), which throws an exception if there is a mismatch.

CCM mode is not very elegant in that one must declare the length of the associated data and the length of the cipher/plaintext when the object is created.