OSDN Git Service

Merge "ARM: dts: msm: remove CARVEOUT ION for msm8996 ivi multi-gvm vplatform"
[sagit-ice-cold/kernel_xiaomi_msm8998.git] / include / linux / qcrypto.h
1 /* Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
2  *
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License version 2 and
5  * only version 2 as published by the Free Software Foundation.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  * GNU General Public License for more details.
11  */
12
13 #ifndef _DRIVERS_CRYPTO_MSM_QCRYPTO_H_
14 #define _DRIVERS_CRYPTO_MSM_QCRYPTO_H_
15
16 #include <linux/crypto.h>
17 #include <crypto/hash.h>
18
19 #define QCRYPTO_CTX_KEY_MASK            0x000000ff
20 #define QCRYPTO_CTX_USE_HW_KEY          0x00000001
21 #define QCRYPTO_CTX_USE_PIPE_KEY        0x00000002
22
23 #define QCRYPTO_CTX_XTS_MASK            0x0000ff00
24 #define QCRYPTO_CTX_XTS_DU_SIZE_512B    0x00000100
25 #define QCRYPTO_CTX_XTS_DU_SIZE_1KB     0x00000200
26
27
28 int qcrypto_cipher_set_device(struct ablkcipher_request *req, unsigned int dev);
29 int qcrypto_ahash_set_device(struct ahash_request *req, unsigned int dev);
30 /*int qcrypto_aead_set_device(struct aead_request *req, unsigned int dev);*/
31
32 int qcrypto_cipher_set_flag(struct ablkcipher_request *req, unsigned int flags);
33 int qcrypto_ahash_set_flag(struct ahash_request *req, unsigned int flags);
34 /*int qcrypto_aead_set_flag(struct aead_request *req, unsigned int flags);*/
35
36 int qcrypto_cipher_clear_flag(struct ablkcipher_request *req,
37                                                         unsigned int flags);
38 int qcrypto_ahash_clear_flag(struct ahash_request *req, unsigned int flags);
39 /*int qcrypto_aead_clear_flag(struct aead_request *req, unsigned int flags);*/
40
41 struct crypto_engine_entry {
42         u32 hw_instance;
43         u32 ce_device;
44         int shared;
45 };
46
47 int qcrypto_get_num_engines(void);
48 void qcrypto_get_engine_list(size_t num_engines,
49                                 struct crypto_engine_entry *arr);
50 int qcrypto_cipher_set_device_hw(struct ablkcipher_request *req,
51                                 unsigned int fde_pfe,
52                                 unsigned int hw_inst);
53
54
55 struct qcrypto_func_set {
56         int (*cipher_set)(struct ablkcipher_request *req,
57                         unsigned int fde_pfe,
58                         unsigned hw_inst);
59         int (*cipher_flag)(struct ablkcipher_request *req, unsigned int flags);
60         int (*get_num_engines)(void);
61         void (*get_engine_list)(size_t num_engines,
62                                 struct crypto_engine_entry *arr);
63 };
64
65 #endif /* _DRIVERS_CRYPTO_MSM_QCRYPTO_H */