I'm looking for an example of using OpenSSL's AES CCM encryption. Apparently, this is one of the two 'custom' cipher modes that require additional setup beyond EVP_CipherInit_ex(). Any suggestions would be appreciated.
In short:
// Tell the alg we will encrypt Psize bytes
int outl = 0;
EVP_EncryptUpdate(ctx, 0, &outl, 0, Psize);
// Add the AAD
EVP_EncryptUpdate(ctx, 0, &outl, A, Asize);
// Now we encrypt the data in P, placing the output in CT
EVP_EncryptUpdate(ctx, CT, &outl, P, Psize);
For more details, please see my blog post on this, http://www.fredriks.se/?p=23.