blob: 19bf0ca6d6353c41d4037c55c005078846ceabb7 [file] [log] [blame]
Greg Kroah-Hartmane2be04c2017-11-01 15:09:13 +01001/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
Steffen Klasserta38f7902011-09-27 07:23:50 +02002/*
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
Nicolas Dichtel9078b4e2017-03-27 14:20:11 +020022#include <linux/types.h>
23
Steffen Klasserta38f7902011-09-27 07:23:50 +020024/* Netlink configuration messages. */
25enum {
26 CRYPTO_MSG_BASE = 0x10,
27 CRYPTO_MSG_NEWALG = 0x10,
28 CRYPTO_MSG_DELALG,
29 CRYPTO_MSG_UPDATEALG,
30 CRYPTO_MSG_GETALG,
Herbert Xu9aa867e2015-06-21 19:11:45 +080031 CRYPTO_MSG_DELRNG,
Steffen Klasserta38f7902011-09-27 07:23:50 +020032 __CRYPTO_MSG_MAX
33};
34#define CRYPTO_MSG_MAX (__CRYPTO_MSG_MAX - 1)
35#define CRYPTO_NR_MSGTYPES (CRYPTO_MSG_MAX + 1 - CRYPTO_MSG_BASE)
36
Herbert Xu44737102017-04-06 16:16:08 +080037#define CRYPTO_MAX_NAME 64
Steffen Klasserta38f7902011-09-27 07:23:50 +020038
39/* Netlink message attributes. */
40enum crypto_attr_type_t {
41 CRYPTOCFGA_UNSPEC,
42 CRYPTOCFGA_PRIORITY_VAL, /* __u32 */
Steffen Klassert6c5a86f52011-09-27 07:25:05 +020043 CRYPTOCFGA_REPORT_LARVAL, /* struct crypto_report_larval */
Steffen Klassertf4d663c2011-09-27 07:26:10 +020044 CRYPTOCFGA_REPORT_HASH, /* struct crypto_report_hash */
Steffen Klassert50496a12011-09-27 07:41:54 +020045 CRYPTOCFGA_REPORT_BLKCIPHER, /* struct crypto_report_blkcipher */
Steffen Klassert6ad414f2011-09-27 07:44:27 +020046 CRYPTOCFGA_REPORT_AEAD, /* struct crypto_report_aead */
Steffen Klasserta55465d2011-09-27 07:46:32 +020047 CRYPTOCFGA_REPORT_COMPRESS, /* struct crypto_report_comp */
Steffen Klassert792608e2011-09-27 07:47:11 +020048 CRYPTOCFGA_REPORT_RNG, /* struct crypto_report_rng */
Steffen Klassert07a5fa42011-09-27 07:48:01 +020049 CRYPTOCFGA_REPORT_CIPHER, /* struct crypto_report_cipher */
Tadeusz Struk3c339ab2015-06-16 10:30:55 -070050 CRYPTOCFGA_REPORT_AKCIPHER, /* struct crypto_report_akcipher */
Salvatore Benedetto4e5f2c42016-06-22 17:49:13 +010051 CRYPTOCFGA_REPORT_KPP, /* struct crypto_report_kpp */
Giovanni Cabiddu2ebda742016-10-21 13:19:47 +010052 CRYPTOCFGA_REPORT_ACOMP, /* struct crypto_report_acomp */
Steffen Klasserta38f7902011-09-27 07:23:50 +020053 __CRYPTOCFGA_MAX
54
55#define CRYPTOCFGA_MAX (__CRYPTOCFGA_MAX - 1)
56};
57
58struct crypto_user_alg {
Herbert Xu44737102017-04-06 16:16:08 +080059 char cru_name[CRYPTO_MAX_NAME];
60 char cru_driver_name[CRYPTO_MAX_NAME];
61 char cru_module_name[CRYPTO_MAX_NAME];
Steffen Klasserta38f7902011-09-27 07:23:50 +020062 __u32 cru_type;
63 __u32 cru_mask;
64 __u32 cru_refcnt;
65 __u32 cru_flags;
66};
Steffen Klassert6c5a86f52011-09-27 07:25:05 +020067
68struct crypto_report_larval {
69 char type[CRYPTO_MAX_NAME];
70};
Steffen Klassertf4d663c2011-09-27 07:26:10 +020071
72struct crypto_report_hash {
73 char type[CRYPTO_MAX_NAME];
74 unsigned int blocksize;
75 unsigned int digestsize;
76};
Steffen Klassert50496a12011-09-27 07:41:54 +020077
Steffen Klassert07a5fa42011-09-27 07:48:01 +020078struct crypto_report_cipher {
Herbert Xu44737102017-04-06 16:16:08 +080079 char type[CRYPTO_MAX_NAME];
Steffen Klassert07a5fa42011-09-27 07:48:01 +020080 unsigned int blocksize;
81 unsigned int min_keysize;
82 unsigned int max_keysize;
83};
84
Steffen Klassert50496a12011-09-27 07:41:54 +020085struct crypto_report_blkcipher {
86 char type[CRYPTO_MAX_NAME];
87 char geniv[CRYPTO_MAX_NAME];
88 unsigned int blocksize;
89 unsigned int min_keysize;
90 unsigned int max_keysize;
91 unsigned int ivsize;
92};
Steffen Klassert6ad414f2011-09-27 07:44:27 +020093
94struct crypto_report_aead {
95 char type[CRYPTO_MAX_NAME];
96 char geniv[CRYPTO_MAX_NAME];
97 unsigned int blocksize;
98 unsigned int maxauthsize;
99 unsigned int ivsize;
100};
Steffen Klasserta55465d2011-09-27 07:46:32 +0200101
102struct crypto_report_comp {
103 char type[CRYPTO_MAX_NAME];
104};
Steffen Klassert792608e2011-09-27 07:47:11 +0200105
106struct crypto_report_rng {
107 char type[CRYPTO_MAX_NAME];
108 unsigned int seedsize;
109};
Steffen Klassert5219a532012-03-29 09:04:46 +0200110
Tadeusz Struk3c339ab2015-06-16 10:30:55 -0700111struct crypto_report_akcipher {
112 char type[CRYPTO_MAX_NAME];
113};
114
Salvatore Benedetto4e5f2c42016-06-22 17:49:13 +0100115struct crypto_report_kpp {
116 char type[CRYPTO_MAX_NAME];
117};
118
Giovanni Cabiddu2ebda742016-10-21 13:19:47 +0100119struct crypto_report_acomp {
120 char type[CRYPTO_MAX_NAME];
121};
122
Steffen Klassert5219a532012-03-29 09:04:46 +0200123#define CRYPTO_REPORT_MAXSIZE (sizeof(struct crypto_user_alg) + \
124 sizeof(struct crypto_report_blkcipher))