|
SharkSSL C/C++ Reference
TLS, cryptography, certificates, and PSA integration
|
AES-CCM.
Data Structures | |
| struct | SharkSslAesCcmCtx |
| AesCcmCtx. More... | |
Typedefs | |
| typedef struct SharkSslAesCcmCtx | SharkSslAesCcmCtx |
| AesCcmCtx. More... | |
Functions | |
| SHARKSSL_API SHARKSSL_AES_API_STATUS | SharkSslAesCcmCtx_constructor (SharkSslAesCcmCtx *ctx, const U8 *key, U8 keyLen, U8 tagLen) |
| Initialize. More... | |
| SHARKSSL_API int | SharkSslAesCcmCtx_encrypt (SharkSslAesCcmCtx *ctx, const U8 vect[12], U8 *tagout, const U8 *auth, U16 authlen, const U8 *input, U8 *output, U32 len) |
| Encrypt. More... | |
| SHARKSSL_API int | SharkSslAesCcmCtx_decrypt (SharkSslAesCcmCtx *ctx, const U8 vect[12], U8 *tagin, const U8 *auth, U16 authlen, const U8 *input, U8 *output, U32 len) |
| Decrypt. More... | |
| typedef struct SharkSslAesCcmCtx SharkSslAesCcmCtx |
AesCcmCtx.
| SHARKSSL_AES_API_STATUS SharkSslAesCcmCtx_constructor | ( | SharkSslAesCcmCtx * | ctx, |
| const U8 * | key, | ||
| U8 | keyLen, | ||
| U8 | tagLen | ||
| ) |
Initialize.
The caller owns the context.
| ctx | Uninitialized data of size sizeof(SharkSslAesCcmCtx). |
| key | the encryption/decryption key |
| keyLen | 'key' length |
| tagLen | length of the tag (8 or 16 bytes) |
The key length is in bytes: 16, 24, or 32, subject to the enabled algorithms/backend. Clear the context with its destructor after use.
| int SharkSslAesCcmCtx_decrypt | ( | SharkSslAesCcmCtx * | ctx, |
| const U8 | vect[12], | ||
| U8 * | tagin, | ||
| const U8 * | auth, | ||
| U16 | authlen, | ||
| const U8 * | input, | ||
| U8 * | output, | ||
| U32 | len | ||
| ) |
Decrypt.
| ctx | SharkSslAesCcmCtx *; required initialized context with an 8- or 16-byte tag. |
| vect | const U8[12]; required nonce. For encryption, never reuse a nonce with the same key. |
| tagin | U8 *; required expected tag of ctx->tagLen bytes; borrowed for comparison. |
| auth | const U8 *; additional authenticated data, or NULL with authlen=0. |
| authlen | U16; AAD length in bytes. The native default requires less than 15; SHARKSSL_ENABLE_CCM_AUTH_ALL=1 permits lengths below 0xFEFF. |
| input | const U8 *; required input buffer. |
| output | U8 *; required output buffer of at least len bytes; exact in-place operation is supported. Discard output unless the call succeeds. |
| len | U32; message length in bytes. The fixed 12-byte CCM nonce limits the encoded message length to less than 2^24 bytes. |
| int SharkSslAesCcmCtx_encrypt | ( | SharkSslAesCcmCtx * | ctx, |
| const U8 | vect[12], | ||
| U8 * | tagout, | ||
| const U8 * | auth, | ||
| U16 | authlen, | ||
| const U8 * | input, | ||
| U8 * | output, | ||
| U32 | len | ||
| ) |
Encrypt.
| ctx | SharkSslAesCcmCtx *; required initialized context with an 8- or 16-byte tag. |
| vect | const U8[12]; required nonce. For encryption, never reuse a nonce with the same key. |
| tagout | U8 *; required output tag buffer of ctx->tagLen bytes. |
| auth | const U8 *; additional authenticated data, or NULL with authlen=0. |
| authlen | U16; AAD length in bytes. The native default requires less than 15; SHARKSSL_ENABLE_CCM_AUTH_ALL=1 permits lengths below 0xFEFF. |
| input | const U8 *; required input buffer. |
| output | U8 *; required output buffer of at least len bytes; exact in-place operation is supported. Discard output unless the call succeeds. |
| len | U32; message length in bytes. The fixed 12-byte CCM nonce limits the encoded message length to less than 2^24 bytes. |