cc_cipher.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /* Copyright (C) 2012-2018 ARM Limited or its affiliates. */
  3. /* \file cc_cipher.h
  4. * ARM CryptoCell Cipher Crypto API
  5. */
  6. #ifndef __CC_CIPHER_H__
  7. #define __CC_CIPHER_H__
  8. #include <linux/kernel.h>
  9. #include <crypto/algapi.h>
  10. #include "cc_driver.h"
  11. #include "cc_buffer_mgr.h"
  12. /* Crypto cipher flags */
  13. #define CC_CRYPTO_CIPHER_KEY_KFDE0 BIT(0)
  14. #define CC_CRYPTO_CIPHER_KEY_KFDE1 BIT(1)
  15. #define CC_CRYPTO_CIPHER_KEY_KFDE2 BIT(2)
  16. #define CC_CRYPTO_CIPHER_KEY_KFDE3 BIT(3)
  17. #define CC_CRYPTO_CIPHER_DU_SIZE_512B BIT(4)
  18. #define CC_CRYPTO_CIPHER_KEY_KFDE_MASK (CC_CRYPTO_CIPHER_KEY_KFDE0 | \
  19. CC_CRYPTO_CIPHER_KEY_KFDE1 | \
  20. CC_CRYPTO_CIPHER_KEY_KFDE2 | \
  21. CC_CRYPTO_CIPHER_KEY_KFDE3)
  22. struct cipher_req_ctx {
  23. struct async_gen_req_ctx gen_ctx;
  24. enum cc_req_dma_buf_type dma_buf_type;
  25. u32 in_nents;
  26. u32 in_mlli_nents;
  27. u32 out_nents;
  28. u32 out_mlli_nents;
  29. u8 *backup_info; /*store iv for generated IV flow*/
  30. u8 *iv;
  31. bool is_giv;
  32. struct mlli_params mlli_params;
  33. };
  34. int cc_cipher_alloc(struct cc_drvdata *drvdata);
  35. int cc_cipher_free(struct cc_drvdata *drvdata);
  36. struct arm_hw_key_info {
  37. int hw_key1;
  38. int hw_key2;
  39. };
  40. /*
  41. * This is a stub function that will replaced when we
  42. * implement secure keys
  43. */
  44. static inline bool cc_is_hw_key(struct crypto_tfm *tfm)
  45. {
  46. return false;
  47. }
  48. #endif /*__CC_CIPHER_H__*/