2 * Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
4 * Licensed under the Apache License 2.0 (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
10 /* Dispatch functions for AES CCM mode */
12 #include "cipher_local.h"
13 #include "internal/ciphers/cipher_ccm.h"
14 #include "internal/provider_algs.h"
16 static void *aes_ccm_newctx(void *provctx, size_t keybits)
18 PROV_AES_CCM_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));
21 ccm_initctx(&ctx->base, keybits, PROV_AES_HW_ccm(keybits));
25 static OSSL_OP_cipher_freectx_fn aes_ccm_freectx;
26 static void aes_ccm_freectx(void *vctx)
28 PROV_AES_CCM_CTX *ctx = (PROV_AES_CCM_CTX *)vctx;
30 ccm_finalctx((PROV_CCM_CTX *)ctx);
31 OPENSSL_clear_free(ctx, sizeof(*ctx));
34 /* aes128ccm_functions */
35 IMPLEMENT_aead_cipher(aes, ccm, CCM, AEAD_FLAGS, 128, 8, 96);
36 /* aes192ccm_functions */
37 IMPLEMENT_aead_cipher(aes, ccm, CCM, AEAD_FLAGS, 192, 8, 96);
38 /* aes256ccm_functions */
39 IMPLEMENT_aead_cipher(aes, ccm, CCM, AEAD_FLAGS, 256, 8, 96);