blob: fdcbb3c29083bb58531f8992bbdd47d5fa0fc23b [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
Nicolas Dichtel9078b4e2017-03-27 14:20:11 +020021#include <linux/types.h>
22
Steffen Klasserta38f7902011-09-27 07:23:50 +020023/* Netlink configuration messages. */
24enum {
25 CRYPTO_MSG_BASE = 0x10,
26 CRYPTO_MSG_NEWALG = 0x10,
27 CRYPTO_MSG_DELALG,
28 CRYPTO_MSG_UPDATEALG,
29 CRYPTO_MSG_GETALG,
Herbert Xu9aa867e2015-06-21 19:11:45 +080030 CRYPTO_MSG_DELRNG,
Steffen Klasserta38f7902011-09-27 07:23:50 +020031 __CRYPTO_MSG_MAX
32};
33#define CRYPTO_MSG_MAX (__CRYPTO_MSG_MAX - 1)
34#define CRYPTO_NR_MSGTYPES (CRYPTO_MSG_MAX + 1 - CRYPTO_MSG_BASE)
35
Herbert Xu44737102017-04-06 16:16:08 +080036#define CRYPTO_MAX_NAME 64
Steffen Klasserta38f7902011-09-27 07:23:50 +020037
38/* Netlink message attributes. */
39enum crypto_attr_type_t {
40 CRYPTOCFGA_UNSPEC,
41 CRYPTOCFGA_PRIORITY_VAL, /* __u32 */
Steffen Klassert6c5a86f52011-09-27 07:25:05 +020042 CRYPTOCFGA_REPORT_LARVAL, /* struct crypto_report_larval */
Steffen Klassertf4d663c2011-09-27 07:26:10 +020043 CRYPTOCFGA_REPORT_HASH, /* struct crypto_report_hash */
Steffen Klassert50496a12011-09-27 07:41:54 +020044 CRYPTOCFGA_REPORT_BLKCIPHER, /* struct crypto_report_blkcipher */
Steffen Klassert6ad414f2011-09-27 07:44:27 +020045 CRYPTOCFGA_REPORT_AEAD, /* struct crypto_report_aead */
Steffen Klasserta55465d2011-09-27 07:46:32 +020046 CRYPTOCFGA_REPORT_COMPRESS, /* struct crypto_report_comp */
Steffen Klassert792608e2011-09-27 07:47:11 +020047 CRYPTOCFGA_REPORT_RNG, /* struct crypto_report_rng */
Steffen Klassert07a5fa42011-09-27 07:48:01 +020048 CRYPTOCFGA_REPORT_CIPHER, /* struct crypto_report_cipher */
Tadeusz Struk3c339ab2015-06-16 10:30:55 -070049 CRYPTOCFGA_REPORT_AKCIPHER, /* struct crypto_report_akcipher */
Salvatore Benedetto4e5f2c42016-06-22 17:49:13 +010050 CRYPTOCFGA_REPORT_KPP, /* struct crypto_report_kpp */
Giovanni Cabiddu2ebda742016-10-21 13:19:47 +010051 CRYPTOCFGA_REPORT_ACOMP, /* struct crypto_report_acomp */
Steffen Klasserta38f7902011-09-27 07:23:50 +020052 __CRYPTOCFGA_MAX
53
54#define CRYPTOCFGA_MAX (__CRYPTOCFGA_MAX - 1)
55};
56
57struct crypto_user_alg {
Herbert Xu44737102017-04-06 16:16:08 +080058 char cru_name[CRYPTO_MAX_NAME];
59 char cru_driver_name[CRYPTO_MAX_NAME];
60 char cru_module_name[CRYPTO_MAX_NAME];
Steffen Klasserta38f7902011-09-27 07:23:50 +020061 __u32 cru_type;
62 __u32 cru_mask;
63 __u32 cru_refcnt;
64 __u32 cru_flags;
65};
Steffen Klassert6c5a86f52011-09-27 07:25:05 +020066
67struct crypto_report_larval {
68 char type[CRYPTO_MAX_NAME];
69};
Steffen Klassertf4d663c2011-09-27 07:26:10 +020070
71struct crypto_report_hash {
72 char type[CRYPTO_MAX_NAME];
73 unsigned int blocksize;
74 unsigned int digestsize;
75};
Steffen Klassert50496a12011-09-27 07:41:54 +020076
Steffen Klassert07a5fa42011-09-27 07:48:01 +020077struct crypto_report_cipher {
Herbert Xu44737102017-04-06 16:16:08 +080078 char type[CRYPTO_MAX_NAME];
Steffen Klassert07a5fa42011-09-27 07:48:01 +020079 unsigned int blocksize;
80 unsigned int min_keysize;
81 unsigned int max_keysize;
82};
83
Steffen Klassert50496a12011-09-27 07:41:54 +020084struct crypto_report_blkcipher {
85 char type[CRYPTO_MAX_NAME];
86 char geniv[CRYPTO_MAX_NAME];
87 unsigned int blocksize;
88 unsigned int min_keysize;
89 unsigned int max_keysize;
90 unsigned int ivsize;
91};
Steffen Klassert6ad414f2011-09-27 07:44:27 +020092
93struct crypto_report_aead {
94 char type[CRYPTO_MAX_NAME];
95 char geniv[CRYPTO_MAX_NAME];
96 unsigned int blocksize;
97 unsigned int maxauthsize;
98 unsigned int ivsize;
99};
Steffen Klasserta55465d2011-09-27 07:46:32 +0200100
101struct crypto_report_comp {
102 char type[CRYPTO_MAX_NAME];
103};
Steffen Klassert792608e2011-09-27 07:47:11 +0200104
105struct crypto_report_rng {
106 char type[CRYPTO_MAX_NAME];
107 unsigned int seedsize;
108};
Steffen Klassert5219a532012-03-29 09:04:46 +0200109
Tadeusz Struk3c339ab2015-06-16 10:30:55 -0700110struct crypto_report_akcipher {
111 char type[CRYPTO_MAX_NAME];
112};
113
Salvatore Benedetto4e5f2c42016-06-22 17:49:13 +0100114struct crypto_report_kpp {
115 char type[CRYPTO_MAX_NAME];
116};
117
Giovanni Cabiddu2ebda742016-10-21 13:19:47 +0100118struct crypto_report_acomp {
119 char type[CRYPTO_MAX_NAME];
120};
121
Steffen Klassert5219a532012-03-29 09:04:46 +0200122#define CRYPTO_REPORT_MAXSIZE (sizeof(struct crypto_user_alg) + \
123 sizeof(struct crypto_report_blkcipher))