blob: 11d21fce14d6e08147c94c53b88c66435ac374e8 [file] [log] [blame]
Steffen Klasserta38f7902011-09-27 07:23:50 +02001/*
2 * Crypto user configuration API.
3 *
4 * Copyright (C) 2011 secunet Security Networks AG
5 * Copyright (C) 2011 Steffen Klassert <steffen.klassert@secunet.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms and conditions of the GNU General Public License,
9 * version 2, as published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * more details.
15 *
16 * You should have received a copy of the GNU General Public License along with
17 * this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21/* Netlink configuration messages. */
22enum {
23 CRYPTO_MSG_BASE = 0x10,
24 CRYPTO_MSG_NEWALG = 0x10,
25 CRYPTO_MSG_DELALG,
26 CRYPTO_MSG_UPDATEALG,
27 CRYPTO_MSG_GETALG,
Herbert Xu9aa867e2015-06-21 19:11:45 +080028 CRYPTO_MSG_DELRNG,
Steffen Klasserta38f7902011-09-27 07:23:50 +020029 __CRYPTO_MSG_MAX
30};
31#define CRYPTO_MSG_MAX (__CRYPTO_MSG_MAX - 1)
32#define CRYPTO_NR_MSGTYPES (CRYPTO_MSG_MAX + 1 - CRYPTO_MSG_BASE)
33
34#define CRYPTO_MAX_NAME CRYPTO_MAX_ALG_NAME
35
36/* Netlink message attributes. */
37enum crypto_attr_type_t {
38 CRYPTOCFGA_UNSPEC,
39 CRYPTOCFGA_PRIORITY_VAL, /* __u32 */
Steffen Klassert6c5a86f52011-09-27 07:25:05 +020040 CRYPTOCFGA_REPORT_LARVAL, /* struct crypto_report_larval */
Steffen Klassertf4d663c2011-09-27 07:26:10 +020041 CRYPTOCFGA_REPORT_HASH, /* struct crypto_report_hash */
Steffen Klassert50496a12011-09-27 07:41:54 +020042 CRYPTOCFGA_REPORT_BLKCIPHER, /* struct crypto_report_blkcipher */
Steffen Klassert6ad414f2011-09-27 07:44:27 +020043 CRYPTOCFGA_REPORT_AEAD, /* struct crypto_report_aead */
Steffen Klasserta55465d2011-09-27 07:46:32 +020044 CRYPTOCFGA_REPORT_COMPRESS, /* struct crypto_report_comp */
Steffen Klassert792608e2011-09-27 07:47:11 +020045 CRYPTOCFGA_REPORT_RNG, /* struct crypto_report_rng */
Steffen Klassert07a5fa42011-09-27 07:48:01 +020046 CRYPTOCFGA_REPORT_CIPHER, /* struct crypto_report_cipher */
Tadeusz Struk3c339ab2015-06-16 10:30:55 -070047 CRYPTOCFGA_REPORT_AKCIPHER, /* struct crypto_report_akcipher */
Salvatore Benedetto4e5f2c42016-06-22 17:49:13 +010048 CRYPTOCFGA_REPORT_KPP, /* struct crypto_report_kpp */
Giovanni Cabiddu2ebda742016-10-21 13:19:47 +010049 CRYPTOCFGA_REPORT_ACOMP, /* struct crypto_report_acomp */
Steffen Klasserta38f7902011-09-27 07:23:50 +020050 __CRYPTOCFGA_MAX
51
52#define CRYPTOCFGA_MAX (__CRYPTOCFGA_MAX - 1)
53};
54
55struct crypto_user_alg {
56 char cru_name[CRYPTO_MAX_ALG_NAME];
57 char cru_driver_name[CRYPTO_MAX_ALG_NAME];
58 char cru_module_name[CRYPTO_MAX_ALG_NAME];
59 __u32 cru_type;
60 __u32 cru_mask;
61 __u32 cru_refcnt;
62 __u32 cru_flags;
63};
Steffen Klassert6c5a86f52011-09-27 07:25:05 +020064
65struct crypto_report_larval {
66 char type[CRYPTO_MAX_NAME];
67};
Steffen Klassertf4d663c2011-09-27 07:26:10 +020068
69struct crypto_report_hash {
70 char type[CRYPTO_MAX_NAME];
71 unsigned int blocksize;
72 unsigned int digestsize;
73};
Steffen Klassert50496a12011-09-27 07:41:54 +020074
Steffen Klassert07a5fa42011-09-27 07:48:01 +020075struct crypto_report_cipher {
76 char type[CRYPTO_MAX_ALG_NAME];
77 unsigned int blocksize;
78 unsigned int min_keysize;
79 unsigned int max_keysize;
80};
81
Steffen Klassert50496a12011-09-27 07:41:54 +020082struct crypto_report_blkcipher {
83 char type[CRYPTO_MAX_NAME];
84 char geniv[CRYPTO_MAX_NAME];
85 unsigned int blocksize;
86 unsigned int min_keysize;
87 unsigned int max_keysize;
88 unsigned int ivsize;
89};
Steffen Klassert6ad414f2011-09-27 07:44:27 +020090
91struct crypto_report_aead {
92 char type[CRYPTO_MAX_NAME];
93 char geniv[CRYPTO_MAX_NAME];
94 unsigned int blocksize;
95 unsigned int maxauthsize;
96 unsigned int ivsize;
97};
Steffen Klasserta55465d2011-09-27 07:46:32 +020098
99struct crypto_report_comp {
100 char type[CRYPTO_MAX_NAME];
101};
Steffen Klassert792608e2011-09-27 07:47:11 +0200102
103struct crypto_report_rng {
104 char type[CRYPTO_MAX_NAME];
105 unsigned int seedsize;
106};
Steffen Klassert5219a532012-03-29 09:04:46 +0200107
Tadeusz Struk3c339ab2015-06-16 10:30:55 -0700108struct crypto_report_akcipher {
109 char type[CRYPTO_MAX_NAME];
110};
111
Salvatore Benedetto4e5f2c42016-06-22 17:49:13 +0100112struct crypto_report_kpp {
113 char type[CRYPTO_MAX_NAME];
114};
115
Giovanni Cabiddu2ebda742016-10-21 13:19:47 +0100116struct crypto_report_acomp {
117 char type[CRYPTO_MAX_NAME];
118};
119
Steffen Klassert5219a532012-03-29 09:04:46 +0200120#define CRYPTO_REPORT_MAXSIZE (sizeof(struct crypto_user_alg) + \
121 sizeof(struct crypto_report_blkcipher))