Merge tag 'nios2-v5.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/lftan...
[linux-block.git] / include / uapi / linux / cryptouser.h
CommitLineData
e2be04c7 1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
a38f7907
SK
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
68289c63
MY
22#ifndef _UAPI_LINUX_CRYPTOUSER_H
23#define _UAPI_LINUX_CRYPTOUSER_H
24
9078b4ee
ND
25#include <linux/types.h>
26
a38f7907
SK
27/* Netlink configuration messages. */
28enum {
29 CRYPTO_MSG_BASE = 0x10,
30 CRYPTO_MSG_NEWALG = 0x10,
31 CRYPTO_MSG_DELALG,
32 CRYPTO_MSG_UPDATEALG,
33 CRYPTO_MSG_GETALG,
9aa867e4 34 CRYPTO_MSG_DELRNG,
cac5818c 35 CRYPTO_MSG_GETSTAT,
a38f7907
SK
36 __CRYPTO_MSG_MAX
37};
38#define CRYPTO_MSG_MAX (__CRYPTO_MSG_MAX - 1)
39#define CRYPTO_NR_MSGTYPES (CRYPTO_MSG_MAX + 1 - CRYPTO_MSG_BASE)
40
4473710d 41#define CRYPTO_MAX_NAME 64
a38f7907
SK
42
43/* Netlink message attributes. */
44enum crypto_attr_type_t {
45 CRYPTOCFGA_UNSPEC,
46 CRYPTOCFGA_PRIORITY_VAL, /* __u32 */
6c5a86f5 47 CRYPTOCFGA_REPORT_LARVAL, /* struct crypto_report_larval */
f4d663ce 48 CRYPTOCFGA_REPORT_HASH, /* struct crypto_report_hash */
50496a1f 49 CRYPTOCFGA_REPORT_BLKCIPHER, /* struct crypto_report_blkcipher */
6ad414fe 50 CRYPTOCFGA_REPORT_AEAD, /* struct crypto_report_aead */
a55465dc 51 CRYPTOCFGA_REPORT_COMPRESS, /* struct crypto_report_comp */
792608e9 52 CRYPTOCFGA_REPORT_RNG, /* struct crypto_report_rng */
07a5fa4a 53 CRYPTOCFGA_REPORT_CIPHER, /* struct crypto_report_cipher */
3c339ab8 54 CRYPTOCFGA_REPORT_AKCIPHER, /* struct crypto_report_akcipher */
4e5f2c40 55 CRYPTOCFGA_REPORT_KPP, /* struct crypto_report_kpp */
2ebda74f 56 CRYPTOCFGA_REPORT_ACOMP, /* struct crypto_report_acomp */
cac5818c
CL
57 CRYPTOCFGA_STAT_LARVAL, /* struct crypto_stat */
58 CRYPTOCFGA_STAT_HASH, /* struct crypto_stat */
59 CRYPTOCFGA_STAT_BLKCIPHER, /* struct crypto_stat */
60 CRYPTOCFGA_STAT_AEAD, /* struct crypto_stat */
61 CRYPTOCFGA_STAT_COMPRESS, /* struct crypto_stat */
62 CRYPTOCFGA_STAT_RNG, /* struct crypto_stat */
63 CRYPTOCFGA_STAT_CIPHER, /* struct crypto_stat */
64 CRYPTOCFGA_STAT_AKCIPHER, /* struct crypto_stat */
65 CRYPTOCFGA_STAT_KPP, /* struct crypto_stat */
66 CRYPTOCFGA_STAT_ACOMP, /* struct crypto_stat */
a38f7907
SK
67 __CRYPTOCFGA_MAX
68
69#define CRYPTOCFGA_MAX (__CRYPTOCFGA_MAX - 1)
70};
71
72struct crypto_user_alg {
4473710d
HX
73 char cru_name[CRYPTO_MAX_NAME];
74 char cru_driver_name[CRYPTO_MAX_NAME];
75 char cru_module_name[CRYPTO_MAX_NAME];
a38f7907
SK
76 __u32 cru_type;
77 __u32 cru_mask;
78 __u32 cru_refcnt;
79 __u32 cru_flags;
80};
6c5a86f5 81
7f0a9d5c 82struct crypto_stat_aead {
cac5818c 83 char type[CRYPTO_MAX_NAME];
7f0a9d5c
CL
84 __u64 stat_encrypt_cnt;
85 __u64 stat_encrypt_tlen;
86 __u64 stat_decrypt_cnt;
87 __u64 stat_decrypt_tlen;
44f13133 88 __u64 stat_err_cnt;
7f0a9d5c
CL
89};
90
91struct crypto_stat_akcipher {
92 char type[CRYPTO_MAX_NAME];
93 __u64 stat_encrypt_cnt;
94 __u64 stat_encrypt_tlen;
95 __u64 stat_decrypt_cnt;
96 __u64 stat_decrypt_tlen;
97 __u64 stat_verify_cnt;
6e8e72cd 98 __u64 stat_sign_cnt;
44f13133 99 __u64 stat_err_cnt;
7f0a9d5c
CL
100};
101
102struct crypto_stat_cipher {
103 char type[CRYPTO_MAX_NAME];
104 __u64 stat_encrypt_cnt;
105 __u64 stat_encrypt_tlen;
106 __u64 stat_decrypt_cnt;
107 __u64 stat_decrypt_tlen;
44f13133 108 __u64 stat_err_cnt;
7f0a9d5c
CL
109};
110
111struct crypto_stat_compress {
112 char type[CRYPTO_MAX_NAME];
113 __u64 stat_compress_cnt;
114 __u64 stat_compress_tlen;
115 __u64 stat_decompress_cnt;
116 __u64 stat_decompress_tlen;
44f13133 117 __u64 stat_err_cnt;
7f0a9d5c
CL
118};
119
120struct crypto_stat_hash {
121 char type[CRYPTO_MAX_NAME];
122 __u64 stat_hash_cnt;
123 __u64 stat_hash_tlen;
44f13133 124 __u64 stat_err_cnt;
7f0a9d5c
CL
125};
126
127struct crypto_stat_kpp {
128 char type[CRYPTO_MAX_NAME];
129 __u64 stat_setsecret_cnt;
130 __u64 stat_generate_public_key_cnt;
131 __u64 stat_compute_shared_secret_cnt;
44f13133 132 __u64 stat_err_cnt;
7f0a9d5c
CL
133};
134
135struct crypto_stat_rng {
136 char type[CRYPTO_MAX_NAME];
137 __u64 stat_generate_cnt;
138 __u64 stat_generate_tlen;
139 __u64 stat_seed_cnt;
44f13133 140 __u64 stat_err_cnt;
7f0a9d5c
CL
141};
142
143struct crypto_stat_larval {
144 char type[CRYPTO_MAX_NAME];
cac5818c
CL
145};
146
6c5a86f5
SK
147struct crypto_report_larval {
148 char type[CRYPTO_MAX_NAME];
149};
f4d663ce
SK
150
151struct crypto_report_hash {
152 char type[CRYPTO_MAX_NAME];
153 unsigned int blocksize;
154 unsigned int digestsize;
155};
50496a1f 156
07a5fa4a 157struct crypto_report_cipher {
4473710d 158 char type[CRYPTO_MAX_NAME];
07a5fa4a
SK
159 unsigned int blocksize;
160 unsigned int min_keysize;
161 unsigned int max_keysize;
162};
163
50496a1f
SK
164struct crypto_report_blkcipher {
165 char type[CRYPTO_MAX_NAME];
166 char geniv[CRYPTO_MAX_NAME];
167 unsigned int blocksize;
168 unsigned int min_keysize;
169 unsigned int max_keysize;
170 unsigned int ivsize;
171};
6ad414fe
SK
172
173struct crypto_report_aead {
174 char type[CRYPTO_MAX_NAME];
175 char geniv[CRYPTO_MAX_NAME];
176 unsigned int blocksize;
177 unsigned int maxauthsize;
178 unsigned int ivsize;
179};
a55465dc
SK
180
181struct crypto_report_comp {
182 char type[CRYPTO_MAX_NAME];
183};
792608e9
SK
184
185struct crypto_report_rng {
186 char type[CRYPTO_MAX_NAME];
187 unsigned int seedsize;
188};
5219a534 189
3c339ab8
TS
190struct crypto_report_akcipher {
191 char type[CRYPTO_MAX_NAME];
192};
193
4e5f2c40
SB
194struct crypto_report_kpp {
195 char type[CRYPTO_MAX_NAME];
196};
197
2ebda74f
GC
198struct crypto_report_acomp {
199 char type[CRYPTO_MAX_NAME];
200};
201
5219a534
SK
202#define CRYPTO_REPORT_MAXSIZE (sizeof(struct crypto_user_alg) + \
203 sizeof(struct crypto_report_blkcipher))
68289c63
MY
204
205#endif /* _UAPI_LINUX_CRYPTOUSER_H */