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