-
Notifications
You must be signed in to change notification settings - Fork 6
/
caam-keygen.h
62 lines (51 loc) · 1.95 KB
/
caam-keygen.h
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
61
62
/* SPDX-License-Identifier: BSD-3-Clause */
/*
* Copyright 2020 NXP
*/
#ifndef CAAM_KEYGEN_H
#define CAAM_KEYGEN_H
#include <linux/types.h>
/**
* struct caam_keygen_cmd - Structure that contains all the necessary
* information to transfer user-space data
* to kernel space. This data is used to generate
* a black key and encapsulate it into a blob
*
* @key_enc_len : Length of the key_enc field
* @key_mode_len : Length of the key_mode field
* @key_value_len : Length of the key_value field
* @black_key_len : Length of the generated black key
* @key_enc : Encrypted Key Type
* Can be either ecb or ccm (AES-ECB or AES-CCM)
* @key_mode : The key mode used to generate the black key
* Can be either -s (for random black key) or
* -t (for black key generated from a plaintext)
* @key_value : Based on the key_mode field, can be either the
* plaintext (for black key generated from a plaintext)
* or size of key in case of black key generated
* from random
* @black_key : Black key data obtained from CAAM
* @blob_len : Length of the blob that encapsulates the black key
* @blob : Blob data obtained from CAAM
*/
struct caam_keygen_cmd {
__u8 key_enc_len;
__u8 key_mode_len;
__u16 key_value_len;
__u32 black_key_len;
__u64 key_enc;
__u64 key_mode;
__u64 key_value;
__u64 black_key;
__u32 blob_len;
__u64 blob;
};
/* The ioctl type, documented in ioctl-number.txt */
#define CAAM_KEYGEN_IOCTL_TYPE 'K'
/* Create a key */
#define CAAM_KEYGEN_IOCTL_CREATE \
_IOWR(CAAM_KEYGEN_IOCTL_TYPE, 0, struct caam_keygen_cmd)
/* Import a key from a blob */
#define CAAM_KEYGEN_IOCTL_IMPORT \
_IOWR(CAAM_KEYGEN_IOCTL_TYPE, 1, struct caam_keygen_cmd)
#endif /* CAAM_KEYGEN_H */