summaryrefslogtreecommitdiff
path: root/include/uapi/linux/blk-crypto.h
blob: 97302c6eb6afec00b454422ee808e6f7e17a4f83 (plain) (blame)
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
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef _UAPI_LINUX_BLK_CRYPTO_H
#define _UAPI_LINUX_BLK_CRYPTO_H

#include <linux/ioctl.h>
#include <linux/types.h>

struct blk_crypto_import_key_arg {
	/* Raw key (input) */
	__u64 raw_key_ptr;
	__u64 raw_key_size;
	/* Long-term wrapped key blob (output) */
	__u64 lt_key_ptr;
	__u64 lt_key_size;
	__u64 reserved[4];
};

struct blk_crypto_generate_key_arg {
	/* Long-term wrapped key blob (output) */
	__u64 lt_key_ptr;
	__u64 lt_key_size;
	__u64 reserved[4];
};

struct blk_crypto_prepare_key_arg {
	/* Long-term wrapped key blob (input) */
	__u64 lt_key_ptr;
	__u64 lt_key_size;
	/* Ephemerally-wrapped key blob (output) */
	__u64 eph_key_ptr;
	__u64 eph_key_size;
	__u64 reserved[4];
};

/*
 * These ioctls share the block device ioctl space; see uapi/linux/fs.h.
 * 140-141 are reserved for future blk-crypto ioctls; any more than that would
 * require an additional allocation from the block device ioctl space.
 */
#define BLKCRYPTOIMPORTKEY _IOWR(0x12, 137, struct blk_crypto_import_key_arg)
#define BLKCRYPTOGENERATEKEY _IOWR(0x12, 138, struct blk_crypto_generate_key_arg)
#define BLKCRYPTOPREPAREKEY _IOWR(0x12, 139, struct blk_crypto_prepare_key_arg)

#endif /* _UAPI_LINUX_BLK_CRYPTO_H */