| Christopher Ferris | 12e1f28 | 2016-02-04 12:35:07 -0800 | [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 |  | 
| Christopher Ferris | 0543f74 | 2017-07-26 13:09:46 -0700 | [diff] [blame^] | 21 | #include <linux/types.h> | 
|  | 22 |  | 
| Christopher Ferris | 12e1f28 | 2016-02-04 12:35:07 -0800 | [diff] [blame] | 23 | /* Netlink configuration messages.  */ | 
|  | 24 | enum { | 
|  | 25 | CRYPTO_MSG_BASE = 0x10, | 
|  | 26 | CRYPTO_MSG_NEWALG = 0x10, | 
|  | 27 | CRYPTO_MSG_DELALG, | 
|  | 28 | CRYPTO_MSG_UPDATEALG, | 
|  | 29 | CRYPTO_MSG_GETALG, | 
|  | 30 | CRYPTO_MSG_DELRNG, | 
|  | 31 | __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 |  | 
| Christopher Ferris | 0543f74 | 2017-07-26 13:09:46 -0700 | [diff] [blame^] | 36 | #define CRYPTO_MAX_NAME 64 | 
| Christopher Ferris | 12e1f28 | 2016-02-04 12:35:07 -0800 | [diff] [blame] | 37 |  | 
|  | 38 | /* Netlink message attributes.  */ | 
|  | 39 | enum crypto_attr_type_t { | 
|  | 40 | CRYPTOCFGA_UNSPEC, | 
|  | 41 | CRYPTOCFGA_PRIORITY_VAL,	/* __u32 */ | 
|  | 42 | CRYPTOCFGA_REPORT_LARVAL,	/* struct crypto_report_larval */ | 
|  | 43 | CRYPTOCFGA_REPORT_HASH,		/* struct crypto_report_hash */ | 
|  | 44 | CRYPTOCFGA_REPORT_BLKCIPHER,	/* struct crypto_report_blkcipher */ | 
|  | 45 | CRYPTOCFGA_REPORT_AEAD,		/* struct crypto_report_aead */ | 
|  | 46 | CRYPTOCFGA_REPORT_COMPRESS,	/* struct crypto_report_comp */ | 
|  | 47 | CRYPTOCFGA_REPORT_RNG,		/* struct crypto_report_rng */ | 
|  | 48 | CRYPTOCFGA_REPORT_CIPHER,	/* struct crypto_report_cipher */ | 
|  | 49 | CRYPTOCFGA_REPORT_AKCIPHER,	/* struct crypto_report_akcipher */ | 
| Christopher Ferris | 6e3550f | 2016-12-12 14:51:18 -0800 | [diff] [blame] | 50 | CRYPTOCFGA_REPORT_KPP,		/* struct crypto_report_kpp */ | 
| Christopher Ferris | 2fd4b3c | 2017-02-21 12:32:08 -0800 | [diff] [blame] | 51 | CRYPTOCFGA_REPORT_ACOMP,	/* struct crypto_report_acomp */ | 
| Christopher Ferris | 12e1f28 | 2016-02-04 12:35:07 -0800 | [diff] [blame] | 52 | __CRYPTOCFGA_MAX | 
|  | 53 |  | 
|  | 54 | #define CRYPTOCFGA_MAX (__CRYPTOCFGA_MAX - 1) | 
|  | 55 | }; | 
|  | 56 |  | 
|  | 57 | struct crypto_user_alg { | 
| Christopher Ferris | 0543f74 | 2017-07-26 13:09:46 -0700 | [diff] [blame^] | 58 | char cru_name[CRYPTO_MAX_NAME]; | 
|  | 59 | char cru_driver_name[CRYPTO_MAX_NAME]; | 
|  | 60 | char cru_module_name[CRYPTO_MAX_NAME]; | 
| Christopher Ferris | 12e1f28 | 2016-02-04 12:35:07 -0800 | [diff] [blame] | 61 | __u32 cru_type; | 
|  | 62 | __u32 cru_mask; | 
|  | 63 | __u32 cru_refcnt; | 
|  | 64 | __u32 cru_flags; | 
|  | 65 | }; | 
|  | 66 |  | 
|  | 67 | struct crypto_report_larval { | 
|  | 68 | char type[CRYPTO_MAX_NAME]; | 
|  | 69 | }; | 
|  | 70 |  | 
|  | 71 | struct crypto_report_hash { | 
|  | 72 | char type[CRYPTO_MAX_NAME]; | 
|  | 73 | unsigned int blocksize; | 
|  | 74 | unsigned int digestsize; | 
|  | 75 | }; | 
|  | 76 |  | 
|  | 77 | struct crypto_report_cipher { | 
| Christopher Ferris | 0543f74 | 2017-07-26 13:09:46 -0700 | [diff] [blame^] | 78 | char type[CRYPTO_MAX_NAME]; | 
| Christopher Ferris | 12e1f28 | 2016-02-04 12:35:07 -0800 | [diff] [blame] | 79 | unsigned int blocksize; | 
|  | 80 | unsigned int min_keysize; | 
|  | 81 | unsigned int max_keysize; | 
|  | 82 | }; | 
|  | 83 |  | 
|  | 84 | struct 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 | }; | 
|  | 92 |  | 
|  | 93 | struct 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 | }; | 
|  | 100 |  | 
|  | 101 | struct crypto_report_comp { | 
|  | 102 | char type[CRYPTO_MAX_NAME]; | 
|  | 103 | }; | 
|  | 104 |  | 
|  | 105 | struct crypto_report_rng { | 
|  | 106 | char type[CRYPTO_MAX_NAME]; | 
|  | 107 | unsigned int seedsize; | 
|  | 108 | }; | 
|  | 109 |  | 
|  | 110 | struct crypto_report_akcipher { | 
|  | 111 | char type[CRYPTO_MAX_NAME]; | 
|  | 112 | }; | 
|  | 113 |  | 
| Christopher Ferris | 6e3550f | 2016-12-12 14:51:18 -0800 | [diff] [blame] | 114 | struct crypto_report_kpp { | 
|  | 115 | char type[CRYPTO_MAX_NAME]; | 
|  | 116 | }; | 
|  | 117 |  | 
| Christopher Ferris | 2fd4b3c | 2017-02-21 12:32:08 -0800 | [diff] [blame] | 118 | struct crypto_report_acomp { | 
|  | 119 | char type[CRYPTO_MAX_NAME]; | 
|  | 120 | }; | 
|  | 121 |  | 
| Christopher Ferris | 12e1f28 | 2016-02-04 12:35:07 -0800 | [diff] [blame] | 122 | #define CRYPTO_REPORT_MAXSIZE (sizeof(struct crypto_user_alg) + \ | 
|  | 123 | sizeof(struct crypto_report_blkcipher)) |