• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * drivers/hyperhold/hp_device.h
4  *
5  * Copyright (c) 2020-2022 Huawei Technologies Co., Ltd.
6  */
7 
8 #ifndef _HP_DEVICE_H_
9 #define _HP_DEVICE_H_
10 
11 #include <linux/kernel.h>
12 #include <linux/blkdev.h>
13 #include <crypto/skcipher.h>
14 
15 enum {
16 	HP_DEV_ENCRYPT,
17 	HP_DEV_DECRYPT,
18 };
19 
20 struct hp_device {
21 	struct file *filp;
22 	struct block_device *bdev;
23 	u32 old_block_size;
24 	u64 dev_size;
25 	u32 sec_size;
26 
27 	struct crypto_skcipher *ctfm;
28 	struct blk_crypto_key *blk_key;
29 };
30 
31 void unbind_bdev(struct hp_device *dev);
32 bool bind_bdev(struct hp_device *dev, const char *name);
33 bool crypto_init(struct hp_device *dev, bool soft);
34 void crypto_deinit(struct hp_device *dev);
35 int soft_crypt_page(struct crypto_skcipher *ctfm,
36 	struct page *dst_page, struct page *src_page, unsigned int op);
37 void inline_crypt_bio(struct blk_crypto_key *blk_key, struct bio *bio);
38 #endif
39