1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
3 * Crypto user configuration API.
5 * Copyright (C) 2011 secunet Security Networks AG
6 * Copyright (C) 2011 Steffen Klassert <steffen.klassert@secunet.com>
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.
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
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.
22 #include <linux/types.h>
24 /* Netlink configuration messages. */
26 CRYPTO_MSG_BASE = 0x10,
27 CRYPTO_MSG_NEWALG = 0x10,
35 #define CRYPTO_MSG_MAX (__CRYPTO_MSG_MAX - 1)
36 #define CRYPTO_NR_MSGTYPES (CRYPTO_MSG_MAX + 1 - CRYPTO_MSG_BASE)
38 #define CRYPTO_MAX_NAME 64
40 /* Netlink message attributes. */
41 enum crypto_attr_type_t {
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 */
66 #define CRYPTOCFGA_MAX (__CRYPTOCFGA_MAX - 1)
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];
79 struct crypto_stat_aead {
80 char type[CRYPTO_MAX_NAME];
81 __u64 stat_encrypt_cnt;
82 __u64 stat_encrypt_tlen;
83 __u64 stat_decrypt_cnt;
84 __u64 stat_decrypt_tlen;
85 __u64 stat_aead_err_cnt;
88 struct crypto_stat_akcipher {
89 char type[CRYPTO_MAX_NAME];
90 __u64 stat_encrypt_cnt;
91 __u64 stat_encrypt_tlen;
92 __u64 stat_decrypt_cnt;
93 __u64 stat_decrypt_tlen;
94 __u64 stat_verify_cnt;
96 __u64 stat_akcipher_err_cnt;
99 struct crypto_stat_cipher {
100 char type[CRYPTO_MAX_NAME];
101 __u64 stat_encrypt_cnt;
102 __u64 stat_encrypt_tlen;
103 __u64 stat_decrypt_cnt;
104 __u64 stat_decrypt_tlen;
105 __u64 stat_cipher_err_cnt;
108 struct crypto_stat_compress {
109 char type[CRYPTO_MAX_NAME];
110 __u64 stat_compress_cnt;
111 __u64 stat_compress_tlen;
112 __u64 stat_decompress_cnt;
113 __u64 stat_decompress_tlen;
114 __u64 stat_compress_err_cnt;
117 struct crypto_stat_hash {
118 char type[CRYPTO_MAX_NAME];
120 __u64 stat_hash_tlen;
121 __u64 stat_hash_err_cnt;
124 struct crypto_stat_kpp {
125 char type[CRYPTO_MAX_NAME];
126 __u64 stat_setsecret_cnt;
127 __u64 stat_generate_public_key_cnt;
128 __u64 stat_compute_shared_secret_cnt;
129 __u64 stat_kpp_err_cnt;
132 struct crypto_stat_rng {
133 char type[CRYPTO_MAX_NAME];
134 __u64 stat_generate_cnt;
135 __u64 stat_generate_tlen;
137 __u64 stat_rng_err_cnt;
140 struct crypto_stat_larval {
141 char type[CRYPTO_MAX_NAME];
144 struct crypto_report_larval {
145 char type[CRYPTO_MAX_NAME];
148 struct crypto_report_hash {
149 char type[CRYPTO_MAX_NAME];
150 unsigned int blocksize;
151 unsigned int digestsize;
154 struct crypto_report_cipher {
155 char type[CRYPTO_MAX_NAME];
156 unsigned int blocksize;
157 unsigned int min_keysize;
158 unsigned int max_keysize;
161 struct crypto_report_blkcipher {
162 char type[CRYPTO_MAX_NAME];
163 char geniv[CRYPTO_MAX_NAME];
164 unsigned int blocksize;
165 unsigned int min_keysize;
166 unsigned int max_keysize;
170 struct crypto_report_aead {
171 char type[CRYPTO_MAX_NAME];
172 char geniv[CRYPTO_MAX_NAME];
173 unsigned int blocksize;
174 unsigned int maxauthsize;
178 struct crypto_report_comp {
179 char type[CRYPTO_MAX_NAME];
182 struct crypto_report_rng {
183 char type[CRYPTO_MAX_NAME];
184 unsigned int seedsize;
187 struct crypto_report_akcipher {
188 char type[CRYPTO_MAX_NAME];
191 struct crypto_report_kpp {
192 char type[CRYPTO_MAX_NAME];
195 struct crypto_report_acomp {
196 char type[CRYPTO_MAX_NAME];
199 #define CRYPTO_REPORT_MAXSIZE (sizeof(struct crypto_user_alg) + \
200 sizeof(struct crypto_report_blkcipher))