I was working with tomcrypt library and wanted to use CCM encauth functionality from tomcrypt in my code. And so I was going through the documentation. But I think the example provided in the document has a typo mistake while calling ccm_memory function while decrypting data.
I think it should be -
ccm_memory(find_cipher("aes"), key, 16, /* 128-bit key */ NULL, /* not prescheduled */ nonce, 12, /* 96-bit nonce */ NULL, 0, /* no header */ pt, 32, /* 32-byte plaintext */ ct, /* ciphertext */ tagcp, &taglen, CCM_DECRYPT);
for decrypting the data as against -
ccm_memory(find_cipher("aes"), key, 16, /* 128-bit key */ NULL, /* not prescheduled */ nonce, 12, /* 96-bit nonce */ NULL, 0, /* no header */ ct, 32, /* 32-byte ciphertext */ pt, /* plaintext */ tagcp, &taglen, CCM_DECRYPT);
provided in the documentation. Please correct me if I'm wrong.