geode-aes.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /* Copyright (C) 2003-2006, Advanced Micro Devices, Inc.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License as published by
  5. * the Free Software Foundation; either version 2 of the License, or
  6. * (at your option) any later version.
  7. */
  8. #ifndef _GEODE_AES_H_
  9. #define _GEODE_AES_H_
  10. /* driver logic flags */
  11. #define AES_IV_LENGTH 16
  12. #define AES_KEY_LENGTH 16
  13. #define AES_MIN_BLOCK_SIZE 16
  14. #define AES_MODE_ECB 0
  15. #define AES_MODE_CBC 1
  16. #define AES_DIR_DECRYPT 0
  17. #define AES_DIR_ENCRYPT 1
  18. #define AES_FLAGS_HIDDENKEY (1 << 0)
  19. /* Register definitions */
  20. #define AES_CTRLA_REG 0x0000
  21. #define AES_CTRL_START 0x01
  22. #define AES_CTRL_DECRYPT 0x00
  23. #define AES_CTRL_ENCRYPT 0x02
  24. #define AES_CTRL_WRKEY 0x04
  25. #define AES_CTRL_DCA 0x08
  26. #define AES_CTRL_SCA 0x10
  27. #define AES_CTRL_CBC 0x20
  28. #define AES_INTR_REG 0x0008
  29. #define AES_INTRA_PENDING (1 << 16)
  30. #define AES_INTRB_PENDING (1 << 17)
  31. #define AES_INTR_PENDING (AES_INTRA_PENDING | AES_INTRB_PENDING)
  32. #define AES_INTR_MASK 0x07
  33. #define AES_SOURCEA_REG 0x0010
  34. #define AES_DSTA_REG 0x0014
  35. #define AES_LENA_REG 0x0018
  36. #define AES_WRITEKEY0_REG 0x0030
  37. #define AES_WRITEIV0_REG 0x0040
  38. /* A very large counter that is used to gracefully bail out of an
  39. * operation in case of trouble
  40. */
  41. #define AES_OP_TIMEOUT 0x50000
  42. struct geode_aes_op {
  43. void *src;
  44. void *dst;
  45. u32 mode;
  46. u32 dir;
  47. u32 flags;
  48. int len;
  49. u8 key[AES_KEY_LENGTH];
  50. u8 *iv;
  51. union {
  52. struct crypto_blkcipher *blk;
  53. struct crypto_cipher *cip;
  54. } fallback;
  55. u32 keylen;
  56. };
  57. #endif