blob: ff0e64c82cda0bfa1bf5ab3610bc057a80e9de16 [file] [log] [blame]
AnilKumar Chimatae78789a2017-04-07 12:18:46 -07001/* Copyright (c) 2014-2017, 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>
AnilKumar Chimataddc48122017-06-23 03:12:57 -070018#include <crypto/skcipher.h>
AnilKumar Chimatae78789a2017-04-07 12:18:46 -070019
20#define QCRYPTO_CTX_KEY_MASK 0x000000ff
21#define QCRYPTO_CTX_USE_HW_KEY 0x00000001
22#define QCRYPTO_CTX_USE_PIPE_KEY 0x00000002
23
24#define QCRYPTO_CTX_XTS_MASK 0x0000ff00
25#define QCRYPTO_CTX_XTS_DU_SIZE_512B 0x00000100
26#define QCRYPTO_CTX_XTS_DU_SIZE_1KB 0x00000200
27
28
29int qcrypto_cipher_set_device(struct ablkcipher_request *req, unsigned int dev);
30int qcrypto_ahash_set_device(struct ahash_request *req, unsigned int dev);
31/*int qcrypto_aead_set_device(struct aead_request *req, unsigned int dev);*/
32
AnilKumar Chimataddc48122017-06-23 03:12:57 -070033int qcrypto_cipher_set_flag(struct skcipher_request *req, unsigned int flags);
AnilKumar Chimatae78789a2017-04-07 12:18:46 -070034int qcrypto_ahash_set_flag(struct ahash_request *req, unsigned int flags);
35/*int qcrypto_aead_set_flag(struct aead_request *req, unsigned int flags);*/
36
37int qcrypto_cipher_clear_flag(struct ablkcipher_request *req,
38 unsigned int flags);
39int qcrypto_ahash_clear_flag(struct ahash_request *req, unsigned int flags);
40/*int qcrypto_aead_clear_flag(struct aead_request *req, unsigned int flags);*/
41
42struct crypto_engine_entry {
43 u32 hw_instance;
44 u32 ce_device;
45 int shared;
46};
47
48int qcrypto_get_num_engines(void);
49void qcrypto_get_engine_list(size_t num_engines,
50 struct crypto_engine_entry *arr);
AnilKumar Chimataddc48122017-06-23 03:12:57 -070051int qcrypto_cipher_set_device_hw(struct skcipher_request *req,
AnilKumar Chimatae78789a2017-04-07 12:18:46 -070052 unsigned int fde_pfe,
53 unsigned int hw_inst);
54
55
56struct qcrypto_func_set {
AnilKumar Chimataddc48122017-06-23 03:12:57 -070057 int (*cipher_set)(struct skcipher_request *req,
AnilKumar Chimatae78789a2017-04-07 12:18:46 -070058 unsigned int fde_pfe,
59 unsigned int hw_inst);
AnilKumar Chimataddc48122017-06-23 03:12:57 -070060 int (*cipher_flag)(struct skcipher_request *req, unsigned int flags);
AnilKumar Chimatae78789a2017-04-07 12:18:46 -070061 int (*get_num_engines)(void);
62 void (*get_engine_list)(size_t num_engines,
63 struct crypto_engine_entry *arr);
64};
65
66#endif /* _DRIVERS_CRYPTO_MSM_QCRYPTO_H */