cipher_aria_gcm_hw.c 985 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.
  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. * Generic support for ARIA GCM.
  11. */
  12. #include "cipher_aria_gcm.h"
  13. static int aria_gcm_initkey(PROV_GCM_CTX *ctx, const unsigned char *key,
  14. size_t keylen)
  15. {
  16. PROV_ARIA_GCM_CTX *actx = (PROV_ARIA_GCM_CTX *)ctx;
  17. ARIA_KEY *ks = &actx->ks.ks;
  18. GCM_HW_SET_KEY_CTR_FN(ks, ossl_aria_set_encrypt_key, ossl_aria_encrypt, NULL);
  19. return 1;
  20. }
  21. static const PROV_GCM_HW aria_gcm = {
  22. aria_gcm_initkey,
  23. ossl_gcm_setiv,
  24. ossl_gcm_aad_update,
  25. ossl_gcm_cipher_update,
  26. ossl_gcm_cipher_final,
  27. ossl_gcm_one_shot
  28. };
  29. const PROV_GCM_HW *ossl_prov_aria_hw_gcm(size_t keybits)
  30. {
  31. return &aria_gcm;
  32. }