Steffen Klassert | a38f790 | 2011-09-27 07:23:50 +0200 | [diff] [blame] | 1 | /* |
| 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. */ |
| 22 | enum { |
| 23 | CRYPTO_MSG_BASE = 0x10, |
| 24 | CRYPTO_MSG_NEWALG = 0x10, |
| 25 | CRYPTO_MSG_DELALG, |
| 26 | CRYPTO_MSG_UPDATEALG, |
| 27 | CRYPTO_MSG_GETALG, |
Herbert Xu | 9aa867e | 2015-06-21 19:11:45 +0800 | [diff] [blame] | 28 | CRYPTO_MSG_DELRNG, |
Steffen Klassert | a38f790 | 2011-09-27 07:23:50 +0200 | [diff] [blame] | 29 | __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. */ |
| 37 | enum crypto_attr_type_t { |
| 38 | CRYPTOCFGA_UNSPEC, |
| 39 | CRYPTOCFGA_PRIORITY_VAL, /* __u32 */ |
Steffen Klassert | 6c5a86f5 | 2011-09-27 07:25:05 +0200 | [diff] [blame] | 40 | CRYPTOCFGA_REPORT_LARVAL, /* struct crypto_report_larval */ |
Steffen Klassert | f4d663c | 2011-09-27 07:26:10 +0200 | [diff] [blame] | 41 | CRYPTOCFGA_REPORT_HASH, /* struct crypto_report_hash */ |
Steffen Klassert | 50496a1 | 2011-09-27 07:41:54 +0200 | [diff] [blame] | 42 | CRYPTOCFGA_REPORT_BLKCIPHER, /* struct crypto_report_blkcipher */ |
Steffen Klassert | 6ad414f | 2011-09-27 07:44:27 +0200 | [diff] [blame] | 43 | CRYPTOCFGA_REPORT_AEAD, /* struct crypto_report_aead */ |
Steffen Klassert | a55465d | 2011-09-27 07:46:32 +0200 | [diff] [blame] | 44 | CRYPTOCFGA_REPORT_COMPRESS, /* struct crypto_report_comp */ |
Steffen Klassert | 792608e | 2011-09-27 07:47:11 +0200 | [diff] [blame] | 45 | CRYPTOCFGA_REPORT_RNG, /* struct crypto_report_rng */ |
Steffen Klassert | 07a5fa4 | 2011-09-27 07:48:01 +0200 | [diff] [blame] | 46 | CRYPTOCFGA_REPORT_CIPHER, /* struct crypto_report_cipher */ |
Tadeusz Struk | 3c339ab | 2015-06-16 10:30:55 -0700 | [diff] [blame] | 47 | CRYPTOCFGA_REPORT_AKCIPHER, /* struct crypto_report_akcipher */ |
Salvatore Benedetto | 4e5f2c4 | 2016-06-22 17:49:13 +0100 | [diff] [blame] | 48 | CRYPTOCFGA_REPORT_KPP, /* struct crypto_report_kpp */ |
Steffen Klassert | a38f790 | 2011-09-27 07:23:50 +0200 | [diff] [blame] | 49 | __CRYPTOCFGA_MAX |
| 50 | |
| 51 | #define CRYPTOCFGA_MAX (__CRYPTOCFGA_MAX - 1) |
| 52 | }; |
| 53 | |
| 54 | struct crypto_user_alg { |
| 55 | char cru_name[CRYPTO_MAX_ALG_NAME]; |
| 56 | char cru_driver_name[CRYPTO_MAX_ALG_NAME]; |
| 57 | char cru_module_name[CRYPTO_MAX_ALG_NAME]; |
| 58 | __u32 cru_type; |
| 59 | __u32 cru_mask; |
| 60 | __u32 cru_refcnt; |
| 61 | __u32 cru_flags; |
| 62 | }; |
Steffen Klassert | 6c5a86f5 | 2011-09-27 07:25:05 +0200 | [diff] [blame] | 63 | |
| 64 | struct crypto_report_larval { |
| 65 | char type[CRYPTO_MAX_NAME]; |
| 66 | }; |
Steffen Klassert | f4d663c | 2011-09-27 07:26:10 +0200 | [diff] [blame] | 67 | |
| 68 | struct crypto_report_hash { |
| 69 | char type[CRYPTO_MAX_NAME]; |
| 70 | unsigned int blocksize; |
| 71 | unsigned int digestsize; |
| 72 | }; |
Steffen Klassert | 50496a1 | 2011-09-27 07:41:54 +0200 | [diff] [blame] | 73 | |
Steffen Klassert | 07a5fa4 | 2011-09-27 07:48:01 +0200 | [diff] [blame] | 74 | struct crypto_report_cipher { |
| 75 | char type[CRYPTO_MAX_ALG_NAME]; |
| 76 | unsigned int blocksize; |
| 77 | unsigned int min_keysize; |
| 78 | unsigned int max_keysize; |
| 79 | }; |
| 80 | |
Steffen Klassert | 50496a1 | 2011-09-27 07:41:54 +0200 | [diff] [blame] | 81 | struct crypto_report_blkcipher { |
| 82 | char type[CRYPTO_MAX_NAME]; |
| 83 | char geniv[CRYPTO_MAX_NAME]; |
| 84 | unsigned int blocksize; |
| 85 | unsigned int min_keysize; |
| 86 | unsigned int max_keysize; |
| 87 | unsigned int ivsize; |
| 88 | }; |
Steffen Klassert | 6ad414f | 2011-09-27 07:44:27 +0200 | [diff] [blame] | 89 | |
| 90 | struct crypto_report_aead { |
| 91 | char type[CRYPTO_MAX_NAME]; |
| 92 | char geniv[CRYPTO_MAX_NAME]; |
| 93 | unsigned int blocksize; |
| 94 | unsigned int maxauthsize; |
| 95 | unsigned int ivsize; |
| 96 | }; |
Steffen Klassert | a55465d | 2011-09-27 07:46:32 +0200 | [diff] [blame] | 97 | |
| 98 | struct crypto_report_comp { |
| 99 | char type[CRYPTO_MAX_NAME]; |
| 100 | }; |
Steffen Klassert | 792608e | 2011-09-27 07:47:11 +0200 | [diff] [blame] | 101 | |
| 102 | struct crypto_report_rng { |
| 103 | char type[CRYPTO_MAX_NAME]; |
| 104 | unsigned int seedsize; |
| 105 | }; |
Steffen Klassert | 5219a53 | 2012-03-29 09:04:46 +0200 | [diff] [blame] | 106 | |
Tadeusz Struk | 3c339ab | 2015-06-16 10:30:55 -0700 | [diff] [blame] | 107 | struct crypto_report_akcipher { |
| 108 | char type[CRYPTO_MAX_NAME]; |
| 109 | }; |
| 110 | |
Salvatore Benedetto | 4e5f2c4 | 2016-06-22 17:49:13 +0100 | [diff] [blame] | 111 | struct crypto_report_kpp { |
| 112 | char type[CRYPTO_MAX_NAME]; |
| 113 | }; |
| 114 | |
Steffen Klassert | 5219a53 | 2012-03-29 09:04:46 +0200 | [diff] [blame] | 115 | #define CRYPTO_REPORT_MAXSIZE (sizeof(struct crypto_user_alg) + \ |
| 116 | sizeof(struct crypto_report_blkcipher)) |