ccp.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604
  1. /*
  2. * AMD Cryptographic Coprocessor (CCP) driver
  3. *
  4. * Copyright (C) 2013,2017 Advanced Micro Devices, Inc.
  5. *
  6. * Author: Tom Lendacky <thomas.lendacky@amd.com>
  7. * Author: Gary R Hook <gary.hook@amd.com>
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2 as
  11. * published by the Free Software Foundation.
  12. */
  13. #ifndef __CPP_H__
  14. #define __CPP_H__
  15. #include <linux/scatterlist.h>
  16. #include <linux/workqueue.h>
  17. #include <linux/list.h>
  18. #include <crypto/aes.h>
  19. #include <crypto/sha.h>
  20. struct ccp_device;
  21. struct ccp_cmd;
  22. #if defined(CONFIG_CRYPTO_DEV_CCP_DD) || \
  23. defined(CONFIG_CRYPTO_DEV_CCP_DD_MODULE)
  24. /**
  25. * ccp_present - check if a CCP device is present
  26. *
  27. * Returns zero if a CCP device is present, -ENODEV otherwise.
  28. */
  29. int ccp_present(void);
  30. #define CCP_VSIZE 16
  31. #define CCP_VMASK ((unsigned int)((1 << CCP_VSIZE) - 1))
  32. #define CCP_VERSION(v, r) ((unsigned int)((v << CCP_VSIZE) \
  33. | (r & CCP_VMASK)))
  34. /**
  35. * ccp_version - get the version of the CCP
  36. *
  37. * Returns a positive version number, or zero if no CCP
  38. */
  39. unsigned int ccp_version(void);
  40. /**
  41. * ccp_enqueue_cmd - queue an operation for processing by the CCP
  42. *
  43. * @cmd: ccp_cmd struct to be processed
  44. *
  45. * Refer to the ccp_cmd struct below for required fields.
  46. *
  47. * Queue a cmd to be processed by the CCP. If queueing the cmd
  48. * would exceed the defined length of the cmd queue the cmd will
  49. * only be queued if the CCP_CMD_MAY_BACKLOG flag is set and will
  50. * result in a return code of -EBUSY.
  51. *
  52. * The callback routine specified in the ccp_cmd struct will be
  53. * called to notify the caller of completion (if the cmd was not
  54. * backlogged) or advancement out of the backlog. If the cmd has
  55. * advanced out of the backlog the "err" value of the callback
  56. * will be -EINPROGRESS. Any other "err" value during callback is
  57. * the result of the operation.
  58. *
  59. * The cmd has been successfully queued if:
  60. * the return code is -EINPROGRESS or
  61. * the return code is -EBUSY and CCP_CMD_MAY_BACKLOG flag is set
  62. */
  63. int ccp_enqueue_cmd(struct ccp_cmd *cmd);
  64. #else /* CONFIG_CRYPTO_DEV_CCP_DD is not enabled */
  65. static inline int ccp_present(void)
  66. {
  67. return -ENODEV;
  68. }
  69. static inline unsigned int ccp_version(void)
  70. {
  71. return 0;
  72. }
  73. static inline int ccp_enqueue_cmd(struct ccp_cmd *cmd)
  74. {
  75. return -ENODEV;
  76. }
  77. #endif /* CONFIG_CRYPTO_DEV_CCP_DD */
  78. /***** AES engine *****/
  79. /**
  80. * ccp_aes_type - AES key size
  81. *
  82. * @CCP_AES_TYPE_128: 128-bit key
  83. * @CCP_AES_TYPE_192: 192-bit key
  84. * @CCP_AES_TYPE_256: 256-bit key
  85. */
  86. enum ccp_aes_type {
  87. CCP_AES_TYPE_128 = 0,
  88. CCP_AES_TYPE_192,
  89. CCP_AES_TYPE_256,
  90. CCP_AES_TYPE__LAST,
  91. };
  92. /**
  93. * ccp_aes_mode - AES operation mode
  94. *
  95. * @CCP_AES_MODE_ECB: ECB mode
  96. * @CCP_AES_MODE_CBC: CBC mode
  97. * @CCP_AES_MODE_OFB: OFB mode
  98. * @CCP_AES_MODE_CFB: CFB mode
  99. * @CCP_AES_MODE_CTR: CTR mode
  100. * @CCP_AES_MODE_CMAC: CMAC mode
  101. */
  102. enum ccp_aes_mode {
  103. CCP_AES_MODE_ECB = 0,
  104. CCP_AES_MODE_CBC,
  105. CCP_AES_MODE_OFB,
  106. CCP_AES_MODE_CFB,
  107. CCP_AES_MODE_CTR,
  108. CCP_AES_MODE_CMAC,
  109. CCP_AES_MODE__LAST,
  110. };
  111. /**
  112. * ccp_aes_mode - AES operation mode
  113. *
  114. * @CCP_AES_ACTION_DECRYPT: AES decrypt operation
  115. * @CCP_AES_ACTION_ENCRYPT: AES encrypt operation
  116. */
  117. enum ccp_aes_action {
  118. CCP_AES_ACTION_DECRYPT = 0,
  119. CCP_AES_ACTION_ENCRYPT,
  120. CCP_AES_ACTION__LAST,
  121. };
  122. /**
  123. * struct ccp_aes_engine - CCP AES operation
  124. * @type: AES operation key size
  125. * @mode: AES operation mode
  126. * @action: AES operation (decrypt/encrypt)
  127. * @key: key to be used for this AES operation
  128. * @key_len: length in bytes of key
  129. * @iv: IV to be used for this AES operation
  130. * @iv_len: length in bytes of iv
  131. * @src: data to be used for this operation
  132. * @dst: data produced by this operation
  133. * @src_len: length in bytes of data used for this operation
  134. * @cmac_final: indicates final operation when running in CMAC mode
  135. * @cmac_key: K1/K2 key used in final CMAC operation
  136. * @cmac_key_len: length in bytes of cmac_key
  137. *
  138. * Variables required to be set when calling ccp_enqueue_cmd():
  139. * - type, mode, action, key, key_len, src, dst, src_len
  140. * - iv, iv_len for any mode other than ECB
  141. * - cmac_final for CMAC mode
  142. * - cmac_key, cmac_key_len for CMAC mode if cmac_final is non-zero
  143. *
  144. * The iv variable is used as both input and output. On completion of the
  145. * AES operation the new IV overwrites the old IV.
  146. */
  147. struct ccp_aes_engine {
  148. enum ccp_aes_type type;
  149. enum ccp_aes_mode mode;
  150. enum ccp_aes_action action;
  151. struct scatterlist *key;
  152. u32 key_len; /* In bytes */
  153. struct scatterlist *iv;
  154. u32 iv_len; /* In bytes */
  155. struct scatterlist *src, *dst;
  156. u64 src_len; /* In bytes */
  157. u32 cmac_final; /* Indicates final cmac cmd */
  158. struct scatterlist *cmac_key; /* K1/K2 cmac key required for
  159. * final cmac cmd */
  160. u32 cmac_key_len; /* In bytes */
  161. };
  162. /***** XTS-AES engine *****/
  163. /**
  164. * ccp_xts_aes_unit_size - XTS unit size
  165. *
  166. * @CCP_XTS_AES_UNIT_SIZE_16: Unit size of 16 bytes
  167. * @CCP_XTS_AES_UNIT_SIZE_512: Unit size of 512 bytes
  168. * @CCP_XTS_AES_UNIT_SIZE_1024: Unit size of 1024 bytes
  169. * @CCP_XTS_AES_UNIT_SIZE_2048: Unit size of 2048 bytes
  170. * @CCP_XTS_AES_UNIT_SIZE_4096: Unit size of 4096 bytes
  171. */
  172. enum ccp_xts_aes_unit_size {
  173. CCP_XTS_AES_UNIT_SIZE_16 = 0,
  174. CCP_XTS_AES_UNIT_SIZE_512,
  175. CCP_XTS_AES_UNIT_SIZE_1024,
  176. CCP_XTS_AES_UNIT_SIZE_2048,
  177. CCP_XTS_AES_UNIT_SIZE_4096,
  178. CCP_XTS_AES_UNIT_SIZE__LAST,
  179. };
  180. /**
  181. * struct ccp_xts_aes_engine - CCP XTS AES operation
  182. * @action: AES operation (decrypt/encrypt)
  183. * @unit_size: unit size of the XTS operation
  184. * @key: key to be used for this XTS AES operation
  185. * @key_len: length in bytes of key
  186. * @iv: IV to be used for this XTS AES operation
  187. * @iv_len: length in bytes of iv
  188. * @src: data to be used for this operation
  189. * @dst: data produced by this operation
  190. * @src_len: length in bytes of data used for this operation
  191. * @final: indicates final XTS operation
  192. *
  193. * Variables required to be set when calling ccp_enqueue_cmd():
  194. * - action, unit_size, key, key_len, iv, iv_len, src, dst, src_len, final
  195. *
  196. * The iv variable is used as both input and output. On completion of the
  197. * AES operation the new IV overwrites the old IV.
  198. */
  199. struct ccp_xts_aes_engine {
  200. enum ccp_aes_type type;
  201. enum ccp_aes_action action;
  202. enum ccp_xts_aes_unit_size unit_size;
  203. struct scatterlist *key;
  204. u32 key_len; /* In bytes */
  205. struct scatterlist *iv;
  206. u32 iv_len; /* In bytes */
  207. struct scatterlist *src, *dst;
  208. u64 src_len; /* In bytes */
  209. u32 final;
  210. };
  211. /***** SHA engine *****/
  212. /**
  213. * ccp_sha_type - type of SHA operation
  214. *
  215. * @CCP_SHA_TYPE_1: SHA-1 operation
  216. * @CCP_SHA_TYPE_224: SHA-224 operation
  217. * @CCP_SHA_TYPE_256: SHA-256 operation
  218. */
  219. enum ccp_sha_type {
  220. CCP_SHA_TYPE_1 = 1,
  221. CCP_SHA_TYPE_224,
  222. CCP_SHA_TYPE_256,
  223. CCP_SHA_TYPE__LAST,
  224. };
  225. /**
  226. * struct ccp_sha_engine - CCP SHA operation
  227. * @type: Type of SHA operation
  228. * @ctx: current hash value
  229. * @ctx_len: length in bytes of hash value
  230. * @src: data to be used for this operation
  231. * @src_len: length in bytes of data used for this operation
  232. * @opad: data to be used for final HMAC operation
  233. * @opad_len: length in bytes of data used for final HMAC operation
  234. * @first: indicates first SHA operation
  235. * @final: indicates final SHA operation
  236. * @msg_bits: total length of the message in bits used in final SHA operation
  237. *
  238. * Variables required to be set when calling ccp_enqueue_cmd():
  239. * - type, ctx, ctx_len, src, src_len, final
  240. * - msg_bits if final is non-zero
  241. *
  242. * The ctx variable is used as both input and output. On completion of the
  243. * SHA operation the new hash value overwrites the old hash value.
  244. */
  245. struct ccp_sha_engine {
  246. enum ccp_sha_type type;
  247. struct scatterlist *ctx;
  248. u32 ctx_len; /* In bytes */
  249. struct scatterlist *src;
  250. u64 src_len; /* In bytes */
  251. struct scatterlist *opad;
  252. u32 opad_len; /* In bytes */
  253. u32 first; /* Indicates first sha cmd */
  254. u32 final; /* Indicates final sha cmd */
  255. u64 msg_bits; /* Message length in bits required for
  256. * final sha cmd */
  257. };
  258. /***** RSA engine *****/
  259. /**
  260. * struct ccp_rsa_engine - CCP RSA operation
  261. * @key_size: length in bits of RSA key
  262. * @exp: RSA exponent
  263. * @exp_len: length in bytes of exponent
  264. * @mod: RSA modulus
  265. * @mod_len: length in bytes of modulus
  266. * @src: data to be used for this operation
  267. * @dst: data produced by this operation
  268. * @src_len: length in bytes of data used for this operation
  269. *
  270. * Variables required to be set when calling ccp_enqueue_cmd():
  271. * - key_size, exp, exp_len, mod, mod_len, src, dst, src_len
  272. */
  273. struct ccp_rsa_engine {
  274. u32 key_size; /* In bits */
  275. struct scatterlist *exp;
  276. u32 exp_len; /* In bytes */
  277. struct scatterlist *mod;
  278. u32 mod_len; /* In bytes */
  279. struct scatterlist *src, *dst;
  280. u32 src_len; /* In bytes */
  281. };
  282. /***** Passthru engine *****/
  283. /**
  284. * ccp_passthru_bitwise - type of bitwise passthru operation
  285. *
  286. * @CCP_PASSTHRU_BITWISE_NOOP: no bitwise operation performed
  287. * @CCP_PASSTHRU_BITWISE_AND: perform bitwise AND of src with mask
  288. * @CCP_PASSTHRU_BITWISE_OR: perform bitwise OR of src with mask
  289. * @CCP_PASSTHRU_BITWISE_XOR: perform bitwise XOR of src with mask
  290. * @CCP_PASSTHRU_BITWISE_MASK: overwrite with mask
  291. */
  292. enum ccp_passthru_bitwise {
  293. CCP_PASSTHRU_BITWISE_NOOP = 0,
  294. CCP_PASSTHRU_BITWISE_AND,
  295. CCP_PASSTHRU_BITWISE_OR,
  296. CCP_PASSTHRU_BITWISE_XOR,
  297. CCP_PASSTHRU_BITWISE_MASK,
  298. CCP_PASSTHRU_BITWISE__LAST,
  299. };
  300. /**
  301. * ccp_passthru_byteswap - type of byteswap passthru operation
  302. *
  303. * @CCP_PASSTHRU_BYTESWAP_NOOP: no byte swapping performed
  304. * @CCP_PASSTHRU_BYTESWAP_32BIT: swap bytes within 32-bit words
  305. * @CCP_PASSTHRU_BYTESWAP_256BIT: swap bytes within 256-bit words
  306. */
  307. enum ccp_passthru_byteswap {
  308. CCP_PASSTHRU_BYTESWAP_NOOP = 0,
  309. CCP_PASSTHRU_BYTESWAP_32BIT,
  310. CCP_PASSTHRU_BYTESWAP_256BIT,
  311. CCP_PASSTHRU_BYTESWAP__LAST,
  312. };
  313. /**
  314. * struct ccp_passthru_engine - CCP pass-through operation
  315. * @bit_mod: bitwise operation to perform
  316. * @byte_swap: byteswap operation to perform
  317. * @mask: mask to be applied to data
  318. * @mask_len: length in bytes of mask
  319. * @src: data to be used for this operation
  320. * @dst: data produced by this operation
  321. * @src_len: length in bytes of data used for this operation
  322. * @final: indicate final pass-through operation
  323. *
  324. * Variables required to be set when calling ccp_enqueue_cmd():
  325. * - bit_mod, byte_swap, src, dst, src_len
  326. * - mask, mask_len if bit_mod is not CCP_PASSTHRU_BITWISE_NOOP
  327. */
  328. struct ccp_passthru_engine {
  329. enum ccp_passthru_bitwise bit_mod;
  330. enum ccp_passthru_byteswap byte_swap;
  331. struct scatterlist *mask;
  332. u32 mask_len; /* In bytes */
  333. struct scatterlist *src, *dst;
  334. u64 src_len; /* In bytes */
  335. u32 final;
  336. };
  337. /**
  338. * struct ccp_passthru_nomap_engine - CCP pass-through operation
  339. * without performing DMA mapping
  340. * @bit_mod: bitwise operation to perform
  341. * @byte_swap: byteswap operation to perform
  342. * @mask: mask to be applied to data
  343. * @mask_len: length in bytes of mask
  344. * @src: data to be used for this operation
  345. * @dst: data produced by this operation
  346. * @src_len: length in bytes of data used for this operation
  347. * @final: indicate final pass-through operation
  348. *
  349. * Variables required to be set when calling ccp_enqueue_cmd():
  350. * - bit_mod, byte_swap, src, dst, src_len
  351. * - mask, mask_len if bit_mod is not CCP_PASSTHRU_BITWISE_NOOP
  352. */
  353. struct ccp_passthru_nomap_engine {
  354. enum ccp_passthru_bitwise bit_mod;
  355. enum ccp_passthru_byteswap byte_swap;
  356. dma_addr_t mask;
  357. u32 mask_len; /* In bytes */
  358. dma_addr_t src_dma, dst_dma;
  359. u64 src_len; /* In bytes */
  360. u32 final;
  361. };
  362. /***** ECC engine *****/
  363. #define CCP_ECC_MODULUS_BYTES 48 /* 384-bits */
  364. #define CCP_ECC_MAX_OPERANDS 6
  365. #define CCP_ECC_MAX_OUTPUTS 3
  366. /**
  367. * ccp_ecc_function - type of ECC function
  368. *
  369. * @CCP_ECC_FUNCTION_MMUL_384BIT: 384-bit modular multiplication
  370. * @CCP_ECC_FUNCTION_MADD_384BIT: 384-bit modular addition
  371. * @CCP_ECC_FUNCTION_MINV_384BIT: 384-bit multiplicative inverse
  372. * @CCP_ECC_FUNCTION_PADD_384BIT: 384-bit point addition
  373. * @CCP_ECC_FUNCTION_PMUL_384BIT: 384-bit point multiplication
  374. * @CCP_ECC_FUNCTION_PDBL_384BIT: 384-bit point doubling
  375. */
  376. enum ccp_ecc_function {
  377. CCP_ECC_FUNCTION_MMUL_384BIT = 0,
  378. CCP_ECC_FUNCTION_MADD_384BIT,
  379. CCP_ECC_FUNCTION_MINV_384BIT,
  380. CCP_ECC_FUNCTION_PADD_384BIT,
  381. CCP_ECC_FUNCTION_PMUL_384BIT,
  382. CCP_ECC_FUNCTION_PDBL_384BIT,
  383. };
  384. /**
  385. * struct ccp_ecc_modular_math - CCP ECC modular math parameters
  386. * @operand_1: first operand for the modular math operation
  387. * @operand_1_len: length of the first operand
  388. * @operand_2: second operand for the modular math operation
  389. * (not used for CCP_ECC_FUNCTION_MINV_384BIT)
  390. * @operand_2_len: length of the second operand
  391. * (not used for CCP_ECC_FUNCTION_MINV_384BIT)
  392. * @result: result of the modular math operation
  393. * @result_len: length of the supplied result buffer
  394. */
  395. struct ccp_ecc_modular_math {
  396. struct scatterlist *operand_1;
  397. unsigned int operand_1_len; /* In bytes */
  398. struct scatterlist *operand_2;
  399. unsigned int operand_2_len; /* In bytes */
  400. struct scatterlist *result;
  401. unsigned int result_len; /* In bytes */
  402. };
  403. /**
  404. * struct ccp_ecc_point - CCP ECC point definition
  405. * @x: the x coordinate of the ECC point
  406. * @x_len: the length of the x coordinate
  407. * @y: the y coordinate of the ECC point
  408. * @y_len: the length of the y coordinate
  409. */
  410. struct ccp_ecc_point {
  411. struct scatterlist *x;
  412. unsigned int x_len; /* In bytes */
  413. struct scatterlist *y;
  414. unsigned int y_len; /* In bytes */
  415. };
  416. /**
  417. * struct ccp_ecc_point_math - CCP ECC point math parameters
  418. * @point_1: the first point of the ECC point math operation
  419. * @point_2: the second point of the ECC point math operation
  420. * (only used for CCP_ECC_FUNCTION_PADD_384BIT)
  421. * @domain_a: the a parameter of the ECC curve
  422. * @domain_a_len: the length of the a parameter
  423. * @scalar: the scalar parameter for the point match operation
  424. * (only used for CCP_ECC_FUNCTION_PMUL_384BIT)
  425. * @scalar_len: the length of the scalar parameter
  426. * (only used for CCP_ECC_FUNCTION_PMUL_384BIT)
  427. * @result: the point resulting from the point math operation
  428. */
  429. struct ccp_ecc_point_math {
  430. struct ccp_ecc_point point_1;
  431. struct ccp_ecc_point point_2;
  432. struct scatterlist *domain_a;
  433. unsigned int domain_a_len; /* In bytes */
  434. struct scatterlist *scalar;
  435. unsigned int scalar_len; /* In bytes */
  436. struct ccp_ecc_point result;
  437. };
  438. /**
  439. * struct ccp_ecc_engine - CCP ECC operation
  440. * @function: ECC function to perform
  441. * @mod: ECC modulus
  442. * @mod_len: length in bytes of modulus
  443. * @mm: module math parameters
  444. * @pm: point math parameters
  445. * @ecc_result: result of the ECC operation
  446. *
  447. * Variables required to be set when calling ccp_enqueue_cmd():
  448. * - function, mod, mod_len
  449. * - operand, operand_len, operand_count, output, output_len, output_count
  450. * - ecc_result
  451. */
  452. struct ccp_ecc_engine {
  453. enum ccp_ecc_function function;
  454. struct scatterlist *mod;
  455. u32 mod_len; /* In bytes */
  456. union {
  457. struct ccp_ecc_modular_math mm;
  458. struct ccp_ecc_point_math pm;
  459. } u;
  460. u16 ecc_result;
  461. };
  462. /**
  463. * ccp_engine - CCP operation identifiers
  464. *
  465. * @CCP_ENGINE_AES: AES operation
  466. * @CCP_ENGINE_XTS_AES: 128-bit XTS AES operation
  467. * @CCP_ENGINE_RSVD1: unused
  468. * @CCP_ENGINE_SHA: SHA operation
  469. * @CCP_ENGINE_RSA: RSA operation
  470. * @CCP_ENGINE_PASSTHRU: pass-through operation
  471. * @CCP_ENGINE_ZLIB_DECOMPRESS: unused
  472. * @CCP_ENGINE_ECC: ECC operation
  473. */
  474. enum ccp_engine {
  475. CCP_ENGINE_AES = 0,
  476. CCP_ENGINE_XTS_AES_128,
  477. CCP_ENGINE_RSVD1,
  478. CCP_ENGINE_SHA,
  479. CCP_ENGINE_RSA,
  480. CCP_ENGINE_PASSTHRU,
  481. CCP_ENGINE_ZLIB_DECOMPRESS,
  482. CCP_ENGINE_ECC,
  483. CCP_ENGINE__LAST,
  484. };
  485. /* Flag values for flags member of ccp_cmd */
  486. #define CCP_CMD_MAY_BACKLOG 0x00000001
  487. #define CCP_CMD_PASSTHRU_NO_DMA_MAP 0x00000002
  488. /**
  489. * struct ccp_cmd - CPP operation request
  490. * @entry: list element (ccp driver use only)
  491. * @work: work element used for callbacks (ccp driver use only)
  492. * @ccp: CCP device to be run on
  493. * @ret: operation return code (ccp driver use only)
  494. * @flags: cmd processing flags
  495. * @engine: CCP operation to perform
  496. * @engine_error: CCP engine return code
  497. * @u: engine specific structures, refer to specific engine struct below
  498. * @callback: operation completion callback function
  499. * @data: parameter value to be supplied to the callback function
  500. *
  501. * Variables required to be set when calling ccp_enqueue_cmd():
  502. * - engine, callback
  503. * - See the operation structures below for what is required for each
  504. * operation.
  505. */
  506. struct ccp_cmd {
  507. /* The list_head, work_struct, ccp and ret variables are for use
  508. * by the CCP driver only.
  509. */
  510. struct list_head entry;
  511. struct work_struct work;
  512. struct ccp_device *ccp;
  513. int ret;
  514. u32 flags;
  515. enum ccp_engine engine;
  516. u32 engine_error;
  517. union {
  518. struct ccp_aes_engine aes;
  519. struct ccp_xts_aes_engine xts;
  520. struct ccp_sha_engine sha;
  521. struct ccp_rsa_engine rsa;
  522. struct ccp_passthru_engine passthru;
  523. struct ccp_passthru_nomap_engine passthru_nomap;
  524. struct ccp_ecc_engine ecc;
  525. } u;
  526. /* Completion callback support */
  527. void (*callback)(void *data, int err);
  528. void *data;
  529. };
  530. #endif