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];
80 char type[CRYPTO_MAX_NAME];
82 __u32 stat_encrypt_cnt;
83 __u32 stat_compress_cnt;
84 __u32 stat_generate_cnt;
86 __u32 stat_setsecret_cnt;
89 __u64 stat_encrypt_tlen;
90 __u64 stat_compress_tlen;
91 __u64 stat_generate_tlen;
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;
104 __u32 stat_decrypt_cnt;
105 __u32 stat_decompress_cnt;
107 __u32 stat_generate_public_key_cnt;
110 __u64 stat_decrypt_tlen;
111 __u64 stat_decompress_tlen;
114 __u32 stat_verify_cnt;
115 __u32 stat_compute_shared_secret_cnt;
120 struct crypto_report_larval {
121 char type[CRYPTO_MAX_NAME];
124 struct crypto_report_hash {
125 char type[CRYPTO_MAX_NAME];
126 unsigned int blocksize;
127 unsigned int digestsize;
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;
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;
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;
154 struct crypto_report_comp {
155 char type[CRYPTO_MAX_NAME];
158 struct crypto_report_rng {
159 char type[CRYPTO_MAX_NAME];
160 unsigned int seedsize;
163 struct crypto_report_akcipher {
164 char type[CRYPTO_MAX_NAME];
167 struct crypto_report_kpp {
168 char type[CRYPTO_MAX_NAME];
171 struct crypto_report_acomp {
172 char type[CRYPTO_MAX_NAME];
175 #define CRYPTO_REPORT_MAXSIZE (sizeof(struct crypto_user_alg) + \
176 sizeof(struct crypto_report_blkcipher))