1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-07-28 00:21:48 +03:00

Add ccm_init/free()

This commit is contained in:
Manuel Pégourié-Gonnard
2014-05-06 12:12:45 +02:00
parent a6916fada8
commit 9fe0d13e8d
4 changed files with 100 additions and 0 deletions

View File

@ -36,6 +36,34 @@
extern "C" {
#endif
/**
* \brief CCM context structure
*/
typedef struct {
cipher_context_t cipher_ctx; /*!< cipher context used */
}
ccm_context;
/**
* \brief CCM initialization (encryption and decryption)
*
* \param ctx CCM context to be initialized
* \param cipher cipher to use (a 128-bit block cipher)
* \param key encryption key
* \param keysize key size in bits (must be acceptable by the cipher)
*
* \return 0 if successful, or a cipher specific error code
*/
int ccm_init( ccm_context *ctx, cipher_id_t cipher,
const unsigned char *key, unsigned int keysize );
/**
* \brief Free a CCM context and underlying cipher sub-context
*
* \param ctx CCM context to free
*/
void ccm_free( ccm_context *ctx );
#if defined(POLARSSL_SELF_TEST) && defined(POLARSSL_AES_C)
/**
* \brief Checkup routine