Merge tag 'acpi-4.20-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael...
[linux-2.6-microblaze.git] / include / uapi / linux / cryptouser.h
1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 /*
3  * Crypto user configuration API.
4  *
5  * Copyright (C) 2011 secunet Security Networks AG
6  * Copyright (C) 2011 Steffen Klassert <steffen.klassert@secunet.com>
7  *
8  * This program is free software; you can redistribute it and/or modify it
9  * under the terms and conditions of the GNU General Public License,
10  * version 2, as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope it will be useful, but WITHOUT
13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
15  * more details.
16  *
17  * You should have received a copy of the GNU General Public License along with
18  * this program; if not, write to the Free Software Foundation, Inc.,
19  * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
20  */
21
22 #include <linux/types.h>
23
24 /* Netlink configuration messages.  */
25 enum {
26         CRYPTO_MSG_BASE = 0x10,
27         CRYPTO_MSG_NEWALG = 0x10,
28         CRYPTO_MSG_DELALG,
29         CRYPTO_MSG_UPDATEALG,
30         CRYPTO_MSG_GETALG,
31         CRYPTO_MSG_DELRNG,
32         CRYPTO_MSG_GETSTAT,
33         __CRYPTO_MSG_MAX
34 };
35 #define CRYPTO_MSG_MAX (__CRYPTO_MSG_MAX - 1)
36 #define CRYPTO_NR_MSGTYPES (CRYPTO_MSG_MAX + 1 - CRYPTO_MSG_BASE)
37
38 #define CRYPTO_MAX_NAME 64
39
40 /* Netlink message attributes.  */
41 enum crypto_attr_type_t {
42         CRYPTOCFGA_UNSPEC,
43         CRYPTOCFGA_PRIORITY_VAL,        /* __u32 */
44         CRYPTOCFGA_REPORT_LARVAL,       /* struct crypto_report_larval */
45         CRYPTOCFGA_REPORT_HASH,         /* struct crypto_report_hash */
46         CRYPTOCFGA_REPORT_BLKCIPHER,    /* struct crypto_report_blkcipher */
47         CRYPTOCFGA_REPORT_AEAD,         /* struct crypto_report_aead */
48         CRYPTOCFGA_REPORT_COMPRESS,     /* struct crypto_report_comp */
49         CRYPTOCFGA_REPORT_RNG,          /* struct crypto_report_rng */
50         CRYPTOCFGA_REPORT_CIPHER,       /* struct crypto_report_cipher */
51         CRYPTOCFGA_REPORT_AKCIPHER,     /* struct crypto_report_akcipher */
52         CRYPTOCFGA_REPORT_KPP,          /* struct crypto_report_kpp */
53         CRYPTOCFGA_REPORT_ACOMP,        /* struct crypto_report_acomp */
54         CRYPTOCFGA_STAT_LARVAL,         /* struct crypto_stat */
55         CRYPTOCFGA_STAT_HASH,           /* struct crypto_stat */
56         CRYPTOCFGA_STAT_BLKCIPHER,      /* struct crypto_stat */
57         CRYPTOCFGA_STAT_AEAD,           /* struct crypto_stat */
58         CRYPTOCFGA_STAT_COMPRESS,       /* struct crypto_stat */
59         CRYPTOCFGA_STAT_RNG,            /* struct crypto_stat */
60         CRYPTOCFGA_STAT_CIPHER,         /* struct crypto_stat */
61         CRYPTOCFGA_STAT_AKCIPHER,       /* struct crypto_stat */
62         CRYPTOCFGA_STAT_KPP,            /* struct crypto_stat */
63         CRYPTOCFGA_STAT_ACOMP,          /* struct crypto_stat */
64         __CRYPTOCFGA_MAX
65
66 #define CRYPTOCFGA_MAX (__CRYPTOCFGA_MAX - 1)
67 };
68
69 struct crypto_user_alg {
70         char cru_name[CRYPTO_MAX_NAME];
71         char cru_driver_name[CRYPTO_MAX_NAME];
72         char cru_module_name[CRYPTO_MAX_NAME];
73         __u32 cru_type;
74         __u32 cru_mask;
75         __u32 cru_refcnt;
76         __u32 cru_flags;
77 };
78
79 struct crypto_stat {
80         char type[CRYPTO_MAX_NAME];
81         union {
82                 __u32 stat_encrypt_cnt;
83                 __u32 stat_compress_cnt;
84                 __u32 stat_generate_cnt;
85                 __u32 stat_hash_cnt;
86                 __u32 stat_setsecret_cnt;
87         };
88         union {
89                 __u64 stat_encrypt_tlen;
90                 __u64 stat_compress_tlen;
91                 __u64 stat_generate_tlen;
92                 __u64 stat_hash_tlen;
93         };
94         union {
95                 __u32 stat_akcipher_err_cnt;
96                 __u32 stat_cipher_err_cnt;
97                 __u32 stat_compress_err_cnt;
98                 __u32 stat_aead_err_cnt;
99                 __u32 stat_hash_err_cnt;
100                 __u32 stat_rng_err_cnt;
101                 __u32 stat_kpp_err_cnt;
102         };
103         union {
104                 __u32 stat_decrypt_cnt;
105                 __u32 stat_decompress_cnt;
106                 __u32 stat_seed_cnt;
107                 __u32 stat_generate_public_key_cnt;
108         };
109         union {
110                 __u64 stat_decrypt_tlen;
111                 __u64 stat_decompress_tlen;
112         };
113         union {
114                 __u32 stat_verify_cnt;
115                 __u32 stat_compute_shared_secret_cnt;
116         };
117         __u32 stat_sign_cnt;
118 };
119
120 struct crypto_report_larval {
121         char type[CRYPTO_MAX_NAME];
122 };
123
124 struct crypto_report_hash {
125         char type[CRYPTO_MAX_NAME];
126         unsigned int blocksize;
127         unsigned int digestsize;
128 };
129
130 struct crypto_report_cipher {
131         char type[CRYPTO_MAX_NAME];
132         unsigned int blocksize;
133         unsigned int min_keysize;
134         unsigned int max_keysize;
135 };
136
137 struct crypto_report_blkcipher {
138         char type[CRYPTO_MAX_NAME];
139         char geniv[CRYPTO_MAX_NAME];
140         unsigned int blocksize;
141         unsigned int min_keysize;
142         unsigned int max_keysize;
143         unsigned int ivsize;
144 };
145
146 struct crypto_report_aead {
147         char type[CRYPTO_MAX_NAME];
148         char geniv[CRYPTO_MAX_NAME];
149         unsigned int blocksize;
150         unsigned int maxauthsize;
151         unsigned int ivsize;
152 };
153
154 struct crypto_report_comp {
155         char type[CRYPTO_MAX_NAME];
156 };
157
158 struct crypto_report_rng {
159         char type[CRYPTO_MAX_NAME];
160         unsigned int seedsize;
161 };
162
163 struct crypto_report_akcipher {
164         char type[CRYPTO_MAX_NAME];
165 };
166
167 struct crypto_report_kpp {
168         char type[CRYPTO_MAX_NAME];
169 };
170
171 struct crypto_report_acomp {
172         char type[CRYPTO_MAX_NAME];
173 };
174
175 #define CRYPTO_REPORT_MAXSIZE (sizeof(struct crypto_user_alg) + \
176                                sizeof(struct crypto_report_blkcipher))