1e1051a39Sopenharmony_ci/*
2e1051a39Sopenharmony_ci * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.
3e1051a39Sopenharmony_ci *
4e1051a39Sopenharmony_ci * Licensed under the Apache License 2.0 (the "License").  You may not use
5e1051a39Sopenharmony_ci * this file except in compliance with the License.  You can obtain a copy
6e1051a39Sopenharmony_ci * in the file LICENSE in the source distribution or at
7e1051a39Sopenharmony_ci * https://www.openssl.org/source/license.html
8e1051a39Sopenharmony_ci */
9e1051a39Sopenharmony_ci
10e1051a39Sopenharmony_ci/* Dispatch functions for ARIA GCM mode */
11e1051a39Sopenharmony_ci
12e1051a39Sopenharmony_ci#include "cipher_aria_gcm.h"
13e1051a39Sopenharmony_ci#include "prov/implementations.h"
14e1051a39Sopenharmony_ci#include "prov/providercommon.h"
15e1051a39Sopenharmony_ci
16e1051a39Sopenharmony_cistatic void *aria_gcm_newctx(void *provctx, size_t keybits)
17e1051a39Sopenharmony_ci{
18e1051a39Sopenharmony_ci    PROV_ARIA_GCM_CTX *ctx;
19e1051a39Sopenharmony_ci
20e1051a39Sopenharmony_ci    if (!ossl_prov_is_running())
21e1051a39Sopenharmony_ci        return NULL;
22e1051a39Sopenharmony_ci
23e1051a39Sopenharmony_ci    ctx = OPENSSL_zalloc(sizeof(*ctx));
24e1051a39Sopenharmony_ci    if (ctx != NULL)
25e1051a39Sopenharmony_ci        ossl_gcm_initctx(provctx, &ctx->base, keybits,
26e1051a39Sopenharmony_ci                         ossl_prov_aria_hw_gcm(keybits));
27e1051a39Sopenharmony_ci    return ctx;
28e1051a39Sopenharmony_ci}
29e1051a39Sopenharmony_ci
30e1051a39Sopenharmony_cistatic OSSL_FUNC_cipher_freectx_fn aria_gcm_freectx;
31e1051a39Sopenharmony_cistatic void aria_gcm_freectx(void *vctx)
32e1051a39Sopenharmony_ci{
33e1051a39Sopenharmony_ci    PROV_ARIA_GCM_CTX *ctx = (PROV_ARIA_GCM_CTX *)vctx;
34e1051a39Sopenharmony_ci
35e1051a39Sopenharmony_ci    OPENSSL_clear_free(ctx,  sizeof(*ctx));
36e1051a39Sopenharmony_ci}
37e1051a39Sopenharmony_ci
38e1051a39Sopenharmony_ci/* ossl_aria128gcm_functions */
39e1051a39Sopenharmony_ciIMPLEMENT_aead_cipher(aria, gcm, GCM, AEAD_FLAGS, 128, 8, 96);
40e1051a39Sopenharmony_ci/* ossl_aria192gcm_functions */
41e1051a39Sopenharmony_ciIMPLEMENT_aead_cipher(aria, gcm, GCM, AEAD_FLAGS, 192, 8, 96);
42e1051a39Sopenharmony_ci/* ossl_aria256gcm_functions */
43e1051a39Sopenharmony_ciIMPLEMENT_aead_cipher(aria, gcm, GCM, AEAD_FLAGS, 256, 8, 96);
44e1051a39Sopenharmony_ci
45