]>
Commit | Line | Data |
---|---|---|
e1178600 SL |
1 | /* |
2 | * Copyright 2019 The OpenSSL Project Authors. All Rights Reserved. | |
3 | * | |
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 | |
8 | */ | |
9 | ||
10 | /* Dispatch functions for AES CCM mode */ | |
11 | ||
604e884b | 12 | #include "prov/ciphercommon.h" |
68a51d59 | 13 | #include "prov/ciphercommon_ccm.h" |
af3e7e1b | 14 | #include "prov/implementations.h" |
e1178600 SL |
15 | |
16 | static void *aes_ccm_newctx(void *provctx, size_t keybits) | |
17 | { | |
18 | PROV_AES_CCM_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx)); | |
19 | ||
20 | if (ctx != NULL) | |
21 | ccm_initctx(&ctx->base, keybits, PROV_AES_HW_ccm(keybits)); | |
22 | return ctx; | |
23 | } | |
24 | ||
25 | static OSSL_OP_cipher_freectx_fn aes_ccm_freectx; | |
26 | static void aes_ccm_freectx(void *vctx) | |
27 | { | |
28 | PROV_AES_CCM_CTX *ctx = (PROV_AES_CCM_CTX *)vctx; | |
29 | ||
e1178600 SL |
30 | OPENSSL_clear_free(ctx, sizeof(*ctx)); |
31 | } | |
32 | ||
33 | /* aes128ccm_functions */ | |
34 | IMPLEMENT_aead_cipher(aes, ccm, CCM, AEAD_FLAGS, 128, 8, 96); | |
35 | /* aes192ccm_functions */ | |
36 | IMPLEMENT_aead_cipher(aes, ccm, CCM, AEAD_FLAGS, 192, 8, 96); | |
37 | /* aes256ccm_functions */ | |
38 | IMPLEMENT_aead_cipher(aes, ccm, CCM, AEAD_FLAGS, 256, 8, 96); |