]>
Commit | Line | Data |
---|---|---|
e1178600 | 1 | /* |
33388b44 | 2 | * Copyright 2019-2020 The OpenSSL Project Authors. All Rights Reserved. |
e1178600 SL |
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 | ||
c72fa255 MC |
10 | /* |
11 | * AES low level APIs are deprecated for public use, but still ok for internal | |
12 | * use where we're using them to implement the higher level EVP interface, as is | |
13 | * the case here. | |
14 | */ | |
15 | #include "internal/deprecated.h" | |
16 | ||
e1178600 SL |
17 | /* Dispatch functions for AES CCM mode */ |
18 | ||
e85f3a14 | 19 | #include "cipher_aes_ccm.h" |
af3e7e1b | 20 | #include "prov/implementations.h" |
e1178600 SL |
21 | |
22 | static void *aes_ccm_newctx(void *provctx, size_t keybits) | |
23 | { | |
24 | PROV_AES_CCM_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx)); | |
25 | ||
26 | if (ctx != NULL) | |
27 | ccm_initctx(&ctx->base, keybits, PROV_AES_HW_ccm(keybits)); | |
28 | return ctx; | |
29 | } | |
30 | ||
363b1e5d | 31 | static OSSL_FUNC_cipher_freectx_fn aes_ccm_freectx; |
e1178600 SL |
32 | static void aes_ccm_freectx(void *vctx) |
33 | { | |
34 | PROV_AES_CCM_CTX *ctx = (PROV_AES_CCM_CTX *)vctx; | |
35 | ||
e1178600 SL |
36 | OPENSSL_clear_free(ctx, sizeof(*ctx)); |
37 | } | |
38 | ||
39 | /* aes128ccm_functions */ | |
40 | IMPLEMENT_aead_cipher(aes, ccm, CCM, AEAD_FLAGS, 128, 8, 96); | |
41 | /* aes192ccm_functions */ | |
42 | IMPLEMENT_aead_cipher(aes, ccm, CCM, AEAD_FLAGS, 192, 8, 96); | |
43 | /* aes256ccm_functions */ | |
44 | IMPLEMENT_aead_cipher(aes, ccm, CCM, AEAD_FLAGS, 256, 8, 96); |