]>
Commit | Line | Data |
---|---|---|
e1178600 | 1 | /* |
8020d79b | 2 | * Copyright 2019-2021 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 | ||
10 | /* Dispatch functions for ARIA CCM mode */ | |
11 | ||
4a42e264 | 12 | #include "cipher_aria_ccm.h" |
af3e7e1b | 13 | #include "prov/implementations.h" |
f99d3eed | 14 | #include "prov/providercommon.h" |
4a42e264 | 15 | |
363b1e5d | 16 | static OSSL_FUNC_cipher_freectx_fn aria_ccm_freectx; |
e1178600 SL |
17 | |
18 | static void *aria_ccm_newctx(void *provctx, size_t keybits) | |
19 | { | |
f99d3eed | 20 | PROV_ARIA_CCM_CTX *ctx; |
e1178600 | 21 | |
f99d3eed P |
22 | if (!ossl_prov_is_running()) |
23 | return NULL; | |
24 | ||
25 | ctx = OPENSSL_zalloc(sizeof(*ctx)); | |
e1178600 | 26 | if (ctx != NULL) |
e36b3c2f | 27 | ossl_ccm_initctx(&ctx->base, keybits, ossl_prov_aria_hw_ccm(keybits)); |
e1178600 SL |
28 | return ctx; |
29 | } | |
30 | ||
e1178600 SL |
31 | static void aria_ccm_freectx(void *vctx) |
32 | { | |
33 | PROV_ARIA_CCM_CTX *ctx = (PROV_ARIA_CCM_CTX *)vctx; | |
34 | ||
e1178600 SL |
35 | OPENSSL_clear_free(ctx, sizeof(*ctx)); |
36 | } | |
37 | ||
38 | /* aria128ccm functions */ | |
39 | IMPLEMENT_aead_cipher(aria, ccm, CCM, AEAD_FLAGS, 128, 8, 96); | |
40 | /* aria192ccm functions */ | |
41 | IMPLEMENT_aead_cipher(aria, ccm, CCM, AEAD_FLAGS, 192, 8, 96); | |
42 | /* aria256ccm functions */ | |
43 | IMPLEMENT_aead_cipher(aria, ccm, CCM, AEAD_FLAGS, 256, 8, 96); | |
44 |