cipher_aria_ccm.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * Copyright 2019 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. /* Dispatch functions for ARIA CCM mode */
  10. #include "cipher_aria_ccm.h"
  11. #include "internal/provider_algs.h"
  12. static OSSL_OP_cipher_freectx_fn aria_ccm_freectx;
  13. static void *aria_ccm_newctx(void *provctx, size_t keybits)
  14. {
  15. PROV_ARIA_CCM_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));
  16. if (ctx != NULL)
  17. ccm_initctx(&ctx->base, keybits, PROV_ARIA_HW_ccm(keybits));
  18. return ctx;
  19. }
  20. static void aria_ccm_freectx(void *vctx)
  21. {
  22. PROV_ARIA_CCM_CTX *ctx = (PROV_ARIA_CCM_CTX *)vctx;
  23. ccm_finalctx((PROV_CCM_CTX *)ctx);
  24. OPENSSL_clear_free(ctx, sizeof(*ctx));
  25. }
  26. /* aria128ccm functions */
  27. IMPLEMENT_aead_cipher(aria, ccm, CCM, AEAD_FLAGS, 128, 8, 96);
  28. /* aria192ccm functions */
  29. IMPLEMENT_aead_cipher(aria, ccm, CCM, AEAD_FLAGS, 192, 8, 96);
  30. /* aria256ccm functions */
  31. IMPLEMENT_aead_cipher(aria, ccm, CCM, AEAD_FLAGS, 256, 8, 96);