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
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
15 #include "internal/deprecated.h"
17 /* Dispatch functions for AES GCM mode */
19 #include "cipher_aes_gcm.h"
20 #include "prov/implementations.h"
22 static void *aes_gcm_newctx(void *provctx, size_t keybits)
24 PROV_AES_GCM_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));
27 gcm_initctx(provctx, &ctx->base, keybits, PROV_AES_HW_gcm(keybits), 8);
31 static OSSL_FUNC_cipher_freectx_fn aes_gcm_freectx;
32 static void aes_gcm_freectx(void *vctx)
34 PROV_AES_GCM_CTX *ctx = (PROV_AES_GCM_CTX *)vctx;
36 OPENSSL_clear_free(ctx, sizeof(*ctx));
39 /* aes128gcm_functions */
40 IMPLEMENT_aead_cipher(aes, gcm, GCM, AEAD_FLAGS, 128, 8, 96);
41 /* aes192gcm_functions */
42 IMPLEMENT_aead_cipher(aes, gcm, GCM, AEAD_FLAGS, 192, 8, 96);
43 /* aes256gcm_functions */
44 IMPLEMENT_aead_cipher(aes, gcm, GCM, AEAD_FLAGS, 256, 8, 96);