]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blob - drivers/staging/ccree/ssi_cipher.h
iio: imu: inv_mpu6050: test whoami first and against all known values
[mirror_ubuntu-artful-kernel.git] / drivers / staging / ccree / ssi_cipher.h
1 /*
2 * Copyright (C) 2012-2017 ARM Limited or its affiliates.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, see <http://www.gnu.org/licenses/>.
15 */
16
17 /* \file ssi_cipher.h
18 ARM CryptoCell Cipher Crypto API
19 */
20
21 #ifndef __SSI_CIPHER_H__
22 #define __SSI_CIPHER_H__
23
24 #include <linux/kernel.h>
25 #include <crypto/algapi.h>
26 #include "ssi_driver.h"
27 #include "ssi_buffer_mgr.h"
28
29
30 /* Crypto cipher flags */
31 #define CC_CRYPTO_CIPHER_KEY_KFDE0 (1 << 0)
32 #define CC_CRYPTO_CIPHER_KEY_KFDE1 (1 << 1)
33 #define CC_CRYPTO_CIPHER_KEY_KFDE2 (1 << 2)
34 #define CC_CRYPTO_CIPHER_KEY_KFDE3 (1 << 3)
35 #define CC_CRYPTO_CIPHER_DU_SIZE_512B (1 << 4)
36
37 #define CC_CRYPTO_CIPHER_KEY_KFDE_MASK (CC_CRYPTO_CIPHER_KEY_KFDE0 | CC_CRYPTO_CIPHER_KEY_KFDE1 | CC_CRYPTO_CIPHER_KEY_KFDE2 | CC_CRYPTO_CIPHER_KEY_KFDE3)
38
39
40 struct blkcipher_req_ctx {
41 struct async_gen_req_ctx gen_ctx;
42 enum ssi_req_dma_buf_type dma_buf_type;
43 u32 in_nents;
44 u32 in_mlli_nents;
45 u32 out_nents;
46 u32 out_mlli_nents;
47 u8 *backup_info; /*store iv for generated IV flow*/
48 bool is_giv;
49 struct mlli_params mlli_params;
50 };
51
52
53
54 int ssi_ablkcipher_alloc(struct ssi_drvdata *drvdata);
55
56 int ssi_ablkcipher_free(struct ssi_drvdata *drvdata);
57
58 #ifndef CRYPTO_ALG_BULK_MASK
59
60 #define CRYPTO_ALG_BULK_DU_512 0x00002000
61 #define CRYPTO_ALG_BULK_DU_4096 0x00004000
62 #define CRYPTO_ALG_BULK_MASK (CRYPTO_ALG_BULK_DU_512 |\
63 CRYPTO_ALG_BULK_DU_4096)
64 #endif /* CRYPTO_ALG_BULK_MASK */
65
66
67 #ifdef CRYPTO_TFM_REQ_HW_KEY
68
69 static inline bool ssi_is_hw_key(struct crypto_tfm *tfm)
70 {
71 return (crypto_tfm_get_flags(tfm) & CRYPTO_TFM_REQ_HW_KEY);
72 }
73
74 #else
75
76 struct arm_hw_key_info {
77 int hw_key1;
78 int hw_key2;
79 };
80
81 static inline bool ssi_is_hw_key(struct crypto_tfm *tfm)
82 {
83 return 0;
84 }
85
86 #endif /* CRYPTO_TFM_REQ_HW_KEY */
87
88
89 #endif /*__SSI_CIPHER_H__*/