xref: /linux/include/uapi/linux/blk-crypto.h (revision 9b960d8cd6f712cb2c03e2bdd4d5ca058238037f)
1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 #ifndef _UAPI_LINUX_BLK_CRYPTO_H
3 #define _UAPI_LINUX_BLK_CRYPTO_H
4 
5 #include <linux/ioctl.h>
6 #include <linux/types.h>
7 
8 struct blk_crypto_import_key_arg {
9 	/* Raw key (input) */
10 	__u64 raw_key_ptr;
11 	__u64 raw_key_size;
12 	/* Long-term wrapped key blob (output) */
13 	__u64 lt_key_ptr;
14 	__u64 lt_key_size;
15 	__u64 reserved[4];
16 };
17 
18 struct blk_crypto_generate_key_arg {
19 	/* Long-term wrapped key blob (output) */
20 	__u64 lt_key_ptr;
21 	__u64 lt_key_size;
22 	__u64 reserved[4];
23 };
24 
25 struct blk_crypto_prepare_key_arg {
26 	/* Long-term wrapped key blob (input) */
27 	__u64 lt_key_ptr;
28 	__u64 lt_key_size;
29 	/* Ephemerally-wrapped key blob (output) */
30 	__u64 eph_key_ptr;
31 	__u64 eph_key_size;
32 	__u64 reserved[4];
33 };
34 
35 /*
36  * These ioctls share the block device ioctl space; see uapi/linux/fs.h.
37  * 140-141 are reserved for future blk-crypto ioctls; any more than that would
38  * require an additional allocation from the block device ioctl space.
39  */
40 #define BLKCRYPTOIMPORTKEY _IOWR(0x12, 137, struct blk_crypto_import_key_arg)
41 #define BLKCRYPTOGENERATEKEY _IOWR(0x12, 138, struct blk_crypto_generate_key_arg)
42 #define BLKCRYPTOPREPAREKEY _IOWR(0x12, 139, struct blk_crypto_prepare_key_arg)
43 
44 #endif /* _UAPI_LINUX_BLK_CRYPTO_H */
45