2 * Copyright 2019-2020 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 ARIA GCM mode */
12 #include "cipher_aria_gcm.h"
13 #include "prov/implementations.h"
14 #include "prov/providercommon.h"
16 #define ARIA_GCM_IV_MIN_SIZE (32 / 8) /* size in bytes */
18 static void *aria_gcm_newctx(void *provctx, size_t keybits)
20 PROV_ARIA_GCM_CTX *ctx;
22 if (!ossl_prov_is_running())
25 ctx = OPENSSL_zalloc(sizeof(*ctx));
27 ossl_gcm_initctx(provctx, &ctx->base, keybits,
28 ossl_prov_aria_hw_gcm(keybits), ARIA_GCM_IV_MIN_SIZE);
32 static OSSL_FUNC_cipher_freectx_fn aria_gcm_freectx;
33 static void aria_gcm_freectx(void *vctx)
35 PROV_ARIA_GCM_CTX *ctx = (PROV_ARIA_GCM_CTX *)vctx;
37 OPENSSL_clear_free(ctx, sizeof(*ctx));
40 /* ossl_aria128gcm_functions */
41 IMPLEMENT_aead_cipher(aria, gcm, GCM, AEAD_FLAGS, 128, 8, 96);
42 /* ossl_aria192gcm_functions */
43 IMPLEMENT_aead_cipher(aria, gcm, GCM, AEAD_FLAGS, 192, 8, 96);
44 /* ossl_aria256gcm_functions */
45 IMPLEMENT_aead_cipher(aria, gcm, GCM, AEAD_FLAGS, 256, 8, 96);