Greg Kroah-Hartman | e2be04c | 2017-11-01 15:09:13 +0100 | [diff] [blame^] | 1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ |
Steffen Klassert | a38f790 | 2011-09-27 07:23:50 +0200 | [diff] [blame] | 2 | /* |
| 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 Dichtel | 9078b4e | 2017-03-27 14:20:11 +0200 | [diff] [blame] | 22 | #include <linux/types.h> |
| 23 | |
Steffen Klassert | a38f790 | 2011-09-27 07:23:50 +0200 | [diff] [blame] | 24 | /* Netlink configuration messages. */ |
| 25 | enum { |
| 26 | CRYPTO_MSG_BASE = 0x10, |
| 27 | CRYPTO_MSG_NEWALG = 0x10, |
| 28 | CRYPTO_MSG_DELALG, |
| 29 | CRYPTO_MSG_UPDATEALG, |
| 30 | CRYPTO_MSG_GETALG, |
Herbert Xu | 9aa867e | 2015-06-21 19:11:45 +0800 | [diff] [blame] | 31 | CRYPTO_MSG_DELRNG, |
Steffen Klassert | a38f790 | 2011-09-27 07:23:50 +0200 | [diff] [blame] | 32 | __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 Xu | 4473710 | 2017-04-06 16:16:08 +0800 | [diff] [blame] | 37 | #define CRYPTO_MAX_NAME 64 |
Steffen Klassert | a38f790 | 2011-09-27 07:23:50 +0200 | [diff] [blame] | 38 | |
| 39 | /* Netlink message attributes. */ |
| 40 | enum crypto_attr_type_t { |
| 41 | CRYPTOCFGA_UNSPEC, |
| 42 | CRYPTOCFGA_PRIORITY_VAL, /* __u32 */ |
Steffen Klassert | 6c5a86f5 | 2011-09-27 07:25:05 +0200 | [diff] [blame] | 43 | CRYPTOCFGA_REPORT_LARVAL, /* struct crypto_report_larval */ |
Steffen Klassert | f4d663c | 2011-09-27 07:26:10 +0200 | [diff] [blame] | 44 | CRYPTOCFGA_REPORT_HASH, /* struct crypto_report_hash */ |
Steffen Klassert | 50496a1 | 2011-09-27 07:41:54 +0200 | [diff] [blame] | 45 | CRYPTOCFGA_REPORT_BLKCIPHER, /* struct crypto_report_blkcipher */ |
Steffen Klassert | 6ad414f | 2011-09-27 07:44:27 +0200 | [diff] [blame] | 46 | CRYPTOCFGA_REPORT_AEAD, /* struct crypto_report_aead */ |
Steffen Klassert | a55465d | 2011-09-27 07:46:32 +0200 | [diff] [blame] | 47 | CRYPTOCFGA_REPORT_COMPRESS, /* struct crypto_report_comp */ |
Steffen Klassert | 792608e | 2011-09-27 07:47:11 +0200 | [diff] [blame] | 48 | CRYPTOCFGA_REPORT_RNG, /* struct crypto_report_rng */ |
Steffen Klassert | 07a5fa4 | 2011-09-27 07:48:01 +0200 | [diff] [blame] | 49 | CRYPTOCFGA_REPORT_CIPHER, /* struct crypto_report_cipher */ |
Tadeusz Struk | 3c339ab | 2015-06-16 10:30:55 -0700 | [diff] [blame] | 50 | CRYPTOCFGA_REPORT_AKCIPHER, /* struct crypto_report_akcipher */ |
Salvatore Benedetto | 4e5f2c4 | 2016-06-22 17:49:13 +0100 | [diff] [blame] | 51 | CRYPTOCFGA_REPORT_KPP, /* struct crypto_report_kpp */ |
Giovanni Cabiddu | 2ebda74 | 2016-10-21 13:19:47 +0100 | [diff] [blame] | 52 | CRYPTOCFGA_REPORT_ACOMP, /* struct crypto_report_acomp */ |
Steffen Klassert | a38f790 | 2011-09-27 07:23:50 +0200 | [diff] [blame] | 53 | __CRYPTOCFGA_MAX |
| 54 | |
| 55 | #define CRYPTOCFGA_MAX (__CRYPTOCFGA_MAX - 1) |
| 56 | }; |
| 57 | |
| 58 | struct crypto_user_alg { |
Herbert Xu | 4473710 | 2017-04-06 16:16:08 +0800 | [diff] [blame] | 59 | char cru_name[CRYPTO_MAX_NAME]; |
| 60 | char cru_driver_name[CRYPTO_MAX_NAME]; |
| 61 | char cru_module_name[CRYPTO_MAX_NAME]; |
Steffen Klassert | a38f790 | 2011-09-27 07:23:50 +0200 | [diff] [blame] | 62 | __u32 cru_type; |
| 63 | __u32 cru_mask; |
| 64 | __u32 cru_refcnt; |
| 65 | __u32 cru_flags; |
| 66 | }; |
Steffen Klassert | 6c5a86f5 | 2011-09-27 07:25:05 +0200 | [diff] [blame] | 67 | |
| 68 | struct crypto_report_larval { |
| 69 | char type[CRYPTO_MAX_NAME]; |
| 70 | }; |
Steffen Klassert | f4d663c | 2011-09-27 07:26:10 +0200 | [diff] [blame] | 71 | |
| 72 | struct crypto_report_hash { |
| 73 | char type[CRYPTO_MAX_NAME]; |
| 74 | unsigned int blocksize; |
| 75 | unsigned int digestsize; |
| 76 | }; |
Steffen Klassert | 50496a1 | 2011-09-27 07:41:54 +0200 | [diff] [blame] | 77 | |
Steffen Klassert | 07a5fa4 | 2011-09-27 07:48:01 +0200 | [diff] [blame] | 78 | struct crypto_report_cipher { |
Herbert Xu | 4473710 | 2017-04-06 16:16:08 +0800 | [diff] [blame] | 79 | char type[CRYPTO_MAX_NAME]; |
Steffen Klassert | 07a5fa4 | 2011-09-27 07:48:01 +0200 | [diff] [blame] | 80 | unsigned int blocksize; |
| 81 | unsigned int min_keysize; |
| 82 | unsigned int max_keysize; |
| 83 | }; |
| 84 | |
Steffen Klassert | 50496a1 | 2011-09-27 07:41:54 +0200 | [diff] [blame] | 85 | struct 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 Klassert | 6ad414f | 2011-09-27 07:44:27 +0200 | [diff] [blame] | 93 | |
| 94 | struct 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 Klassert | a55465d | 2011-09-27 07:46:32 +0200 | [diff] [blame] | 101 | |
| 102 | struct crypto_report_comp { |
| 103 | char type[CRYPTO_MAX_NAME]; |
| 104 | }; |
Steffen Klassert | 792608e | 2011-09-27 07:47:11 +0200 | [diff] [blame] | 105 | |
| 106 | struct crypto_report_rng { |
| 107 | char type[CRYPTO_MAX_NAME]; |
| 108 | unsigned int seedsize; |
| 109 | }; |
Steffen Klassert | 5219a53 | 2012-03-29 09:04:46 +0200 | [diff] [blame] | 110 | |
Tadeusz Struk | 3c339ab | 2015-06-16 10:30:55 -0700 | [diff] [blame] | 111 | struct crypto_report_akcipher { |
| 112 | char type[CRYPTO_MAX_NAME]; |
| 113 | }; |
| 114 | |
Salvatore Benedetto | 4e5f2c4 | 2016-06-22 17:49:13 +0100 | [diff] [blame] | 115 | struct crypto_report_kpp { |
| 116 | char type[CRYPTO_MAX_NAME]; |
| 117 | }; |
| 118 | |
Giovanni Cabiddu | 2ebda74 | 2016-10-21 13:19:47 +0100 | [diff] [blame] | 119 | struct crypto_report_acomp { |
| 120 | char type[CRYPTO_MAX_NAME]; |
| 121 | }; |
| 122 | |
Steffen Klassert | 5219a53 | 2012-03-29 09:04:46 +0200 | [diff] [blame] | 123 | #define CRYPTO_REPORT_MAXSIZE (sizeof(struct crypto_user_alg) + \ |
| 124 | sizeof(struct crypto_report_blkcipher)) |