hc
2023-12-02 57e32c52610e6a560beda60bf33c48f9f42306d5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Copyright 2019 Google LLC
 */
 
#ifndef __LINUX_BLK_CRYPTO_H
#define __LINUX_BLK_CRYPTO_H
 
#include <linux/bio.h>
 
#ifdef CONFIG_BLK_INLINE_ENCRYPTION
 
int blk_crypto_submit_bio(struct bio **bio_ptr);
 
bool blk_crypto_endio(struct bio *bio);
 
int blk_crypto_init_key(struct blk_crypto_key *blk_key,
           const u8 *raw_key, unsigned int raw_key_size,
           bool is_hw_wrapped,
           enum blk_crypto_mode_num crypto_mode,
           unsigned int dun_bytes,
           unsigned int data_unit_size);
 
int blk_crypto_start_using_mode(enum blk_crypto_mode_num crypto_mode,
               unsigned int dun_bytes,
               unsigned int data_unit_size,
               bool is_hw_wrapped_key,
               struct request_queue *q);
 
int blk_crypto_evict_key(struct request_queue *q,
            const struct blk_crypto_key *key);
 
#else /* CONFIG_BLK_INLINE_ENCRYPTION */
 
static inline int blk_crypto_submit_bio(struct bio **bio_ptr)
{
   return 0;
}
 
static inline bool blk_crypto_endio(struct bio *bio)
{
   return true;
}
 
#endif /* CONFIG_BLK_INLINE_ENCRYPTION */
 
#ifdef CONFIG_BLK_INLINE_ENCRYPTION_FALLBACK
 
int blk_crypto_fallback_init(void);
 
#else /* CONFIG_BLK_INLINE_ENCRYPTION_FALLBACK */
 
static inline int blk_crypto_fallback_init(void)
{
   return 0;
}
 
#endif /* CONFIG_BLK_INLINE_ENCRYPTION_FALLBACK */
 
#endif /* __LINUX_BLK_CRYPTO_H */