cipher_aes_hw_armv8.inc 1.5 KB

12345678910111213141516171819202122232425262728293031323334
  1. /*
  2. * Copyright 2023 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. * Crypto extension support for AES modes ecb, cbc, ofb, cfb, ctr.
  11. * This file is included by cipher_aes_hw.c
  12. */
  13. static int cipher_hw_aes_arm_initkey(PROV_CIPHER_CTX *dat,
  14. const unsigned char *key,
  15. size_t keylen)
  16. {
  17. int ret = cipher_hw_aes_initkey(dat, key, keylen);
  18. if (AES_UNROLL12_EOR3_CAPABLE && dat->mode == EVP_CIPH_CTR_MODE)
  19. dat->stream.ctr = (ctr128_f)HWAES_ctr32_encrypt_blocks_unroll12_eor3;
  20. return ret;
  21. }
  22. #define PROV_CIPHER_HW_declare(mode) \
  23. static const PROV_CIPHER_HW aes_arm_##mode = { \
  24. cipher_hw_aes_arm_initkey, \
  25. ossl_cipher_hw_generic_##mode, \
  26. cipher_hw_aes_copyctx \
  27. };
  28. #define PROV_CIPHER_HW_select(mode) \
  29. if (ARMv8_HWAES_CAPABLE) \
  30. return &aes_arm_##mode;