aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ccp.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/ccp.h')
-rw-r--r--include/linux/ccp.h68
1 files changed, 67 insertions, 1 deletions
diff --git a/include/linux/ccp.h b/include/linux/ccp.h
index c41b8d99dd0e..3285c944194a 100644
--- a/include/linux/ccp.h
+++ b/include/linux/ccp.h
@@ -123,6 +123,10 @@ enum ccp_aes_mode {
123 CCP_AES_MODE_CFB, 123 CCP_AES_MODE_CFB,
124 CCP_AES_MODE_CTR, 124 CCP_AES_MODE_CTR,
125 CCP_AES_MODE_CMAC, 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,
126 CCP_AES_MODE__LAST, 130 CCP_AES_MODE__LAST,
127}; 131};
128 132
@@ -137,6 +141,9 @@ enum ccp_aes_action {
137 CCP_AES_ACTION_ENCRYPT, 141 CCP_AES_ACTION_ENCRYPT,
138 CCP_AES_ACTION__LAST, 142 CCP_AES_ACTION__LAST,
139}; 143};
144/* Overloaded field */
145#define CCP_AES_GHASHAAD CCP_AES_ACTION_DECRYPT
146#define CCP_AES_GHASHFINAL CCP_AES_ACTION_ENCRYPT
140 147
141/** 148/**
142 * struct ccp_aes_engine - CCP AES operation 149 * struct ccp_aes_engine - CCP AES operation
@@ -181,6 +188,8 @@ struct ccp_aes_engine {
181 struct scatterlist *cmac_key; /* K1/K2 cmac key required for 188 struct scatterlist *cmac_key; /* K1/K2 cmac key required for
182 * final cmac cmd */ 189 * final cmac cmd */
183 u32 cmac_key_len; /* In bytes */ 190 u32 cmac_key_len; /* In bytes */
191
192 u32 aad_len; /* In bytes */
184}; 193};
185 194
186/***** XTS-AES engine *****/ 195/***** XTS-AES engine *****/
@@ -249,6 +258,8 @@ enum ccp_sha_type {
249 CCP_SHA_TYPE_1 = 1, 258 CCP_SHA_TYPE_1 = 1,
250 CCP_SHA_TYPE_224, 259 CCP_SHA_TYPE_224,
251 CCP_SHA_TYPE_256, 260 CCP_SHA_TYPE_256,
261 CCP_SHA_TYPE_384,
262 CCP_SHA_TYPE_512,
252 CCP_SHA_TYPE__LAST, 263 CCP_SHA_TYPE__LAST,
253}; 264};
254 265
@@ -290,6 +301,60 @@ struct ccp_sha_engine {
290 * final sha cmd */ 301 * final sha cmd */
291}; 302};
292 303
304/***** 3DES engine *****/
305enum 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
312enum ccp_des3_type {
313 CCP_DES3_TYPE_168 = 1,
314 CCP_DES3_TYPE__LAST,
315 };
316
317enum 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 */
343struct 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
293/***** RSA engine *****/ 358/***** RSA engine *****/
294/** 359/**
295 * struct ccp_rsa_engine - CCP RSA operation 360 * struct ccp_rsa_engine - CCP RSA operation
@@ -539,7 +604,7 @@ struct ccp_ecc_engine {
539enum ccp_engine { 604enum ccp_engine {
540 CCP_ENGINE_AES = 0, 605 CCP_ENGINE_AES = 0,
541 CCP_ENGINE_XTS_AES_128, 606 CCP_ENGINE_XTS_AES_128,
542 CCP_ENGINE_RSVD1, 607 CCP_ENGINE_DES3,
543 CCP_ENGINE_SHA, 608 CCP_ENGINE_SHA,
544 CCP_ENGINE_RSA, 609 CCP_ENGINE_RSA,
545 CCP_ENGINE_PASSTHRU, 610 CCP_ENGINE_PASSTHRU,
@@ -587,6 +652,7 @@ struct ccp_cmd {
587 union { 652 union {
588 struct ccp_aes_engine aes; 653 struct ccp_aes_engine aes;
589 struct ccp_xts_aes_engine xts; 654 struct ccp_xts_aes_engine xts;
655 struct ccp_des3_engine des3;
590 struct ccp_sha_engine sha; 656 struct ccp_sha_engine sha;
591 struct ccp_rsa_engine rsa; 657 struct ccp_rsa_engine rsa;
592 struct ccp_passthru_engine passthru; 658 struct ccp_passthru_engine passthru;