geode-aes.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /* Copyright (C) 2003-2006, Advanced Micro Devices, Inc.
  3. */
  4. #ifndef _GEODE_AES_H_
  5. #define _GEODE_AES_H_
  6. /* driver logic flags */
  7. #define AES_MODE_ECB 0
  8. #define AES_MODE_CBC 1
  9. #define AES_DIR_DECRYPT 0
  10. #define AES_DIR_ENCRYPT 1
  11. #define AES_FLAGS_HIDDENKEY (1 << 0)
  12. /* Register definitions */
  13. #define AES_CTRLA_REG 0x0000
  14. #define AES_CTRL_START 0x01
  15. #define AES_CTRL_DECRYPT 0x00
  16. #define AES_CTRL_ENCRYPT 0x02
  17. #define AES_CTRL_WRKEY 0x04
  18. #define AES_CTRL_DCA 0x08
  19. #define AES_CTRL_SCA 0x10
  20. #define AES_CTRL_CBC 0x20
  21. #define AES_INTR_REG 0x0008
  22. #define AES_INTRA_PENDING (1 << 16)
  23. #define AES_INTRB_PENDING (1 << 17)
  24. #define AES_INTR_PENDING (AES_INTRA_PENDING | AES_INTRB_PENDING)
  25. #define AES_INTR_MASK 0x07
  26. #define AES_SOURCEA_REG 0x0010
  27. #define AES_DSTA_REG 0x0014
  28. #define AES_LENA_REG 0x0018
  29. #define AES_WRITEKEY0_REG 0x0030
  30. #define AES_WRITEIV0_REG 0x0040
  31. /* A very large counter that is used to gracefully bail out of an
  32. * operation in case of trouble
  33. */
  34. #define AES_OP_TIMEOUT 0x50000
  35. struct geode_aes_tfm_ctx {
  36. u8 key[AES_KEYSIZE_128];
  37. union {
  38. struct crypto_skcipher *skcipher;
  39. struct crypto_cipher *cip;
  40. } fallback;
  41. u32 keylen;
  42. };
  43. #endif