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/*- 11e1051a39Sopenharmony_ci * Generic support for ARIA GCM. 12e1051a39Sopenharmony_ci */ 13e1051a39Sopenharmony_ci 14e1051a39Sopenharmony_ci#include "cipher_aria_gcm.h" 15e1051a39Sopenharmony_ci 16e1051a39Sopenharmony_cistatic int aria_gcm_initkey(PROV_GCM_CTX *ctx, const unsigned char *key, 17e1051a39Sopenharmony_ci size_t keylen) 18e1051a39Sopenharmony_ci{ 19e1051a39Sopenharmony_ci PROV_ARIA_GCM_CTX *actx = (PROV_ARIA_GCM_CTX *)ctx; 20e1051a39Sopenharmony_ci ARIA_KEY *ks = &actx->ks.ks; 21e1051a39Sopenharmony_ci 22e1051a39Sopenharmony_ci GCM_HW_SET_KEY_CTR_FN(ks, ossl_aria_set_encrypt_key, ossl_aria_encrypt, NULL); 23e1051a39Sopenharmony_ci return 1; 24e1051a39Sopenharmony_ci} 25e1051a39Sopenharmony_ci 26e1051a39Sopenharmony_cistatic const PROV_GCM_HW aria_gcm = { 27e1051a39Sopenharmony_ci aria_gcm_initkey, 28e1051a39Sopenharmony_ci ossl_gcm_setiv, 29e1051a39Sopenharmony_ci ossl_gcm_aad_update, 30e1051a39Sopenharmony_ci ossl_gcm_cipher_update, 31e1051a39Sopenharmony_ci ossl_gcm_cipher_final, 32e1051a39Sopenharmony_ci ossl_gcm_one_shot 33e1051a39Sopenharmony_ci}; 34e1051a39Sopenharmony_ciconst PROV_GCM_HW *ossl_prov_aria_hw_gcm(size_t keybits) 35e1051a39Sopenharmony_ci{ 36e1051a39Sopenharmony_ci return &aria_gcm; 37e1051a39Sopenharmony_ci} 38