1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux 1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 /* 2 /* 3 * Crypto user configuration API. 3 * Crypto user configuration API. 4 * 4 * 5 * Copyright (C) 2011 secunet Security Network 5 * Copyright (C) 2011 secunet Security Networks AG 6 * Copyright (C) 2011 Steffen Klassert <steffe 6 * Copyright (C) 2011 Steffen Klassert <steffen.klassert@secunet.com> 7 * 7 * 8 * This program is free software; you can redi 8 * This program is free software; you can redistribute it and/or modify it 9 * under the terms and conditions of the GNU G 9 * under the terms and conditions of the GNU General Public License, 10 * version 2, as published by the Free Softwar 10 * version 2, as published by the Free Software Foundation. 11 * 11 * 12 * This program is distributed in the hope it 12 * This program is distributed in the hope it will be useful, but WITHOUT 13 * ANY WARRANTY; without even the implied warr 13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 * FITNESS FOR A PARTICULAR PURPOSE. See the 14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 * more details. 15 * more details. 16 * 16 * 17 * You should have received a copy of the GNU 17 * You should have received a copy of the GNU General Public License along with 18 * this program; if not, write to the Free Sof 18 * this program; if not, write to the Free Software Foundation, Inc., 19 * 51 Franklin St - Fifth Floor, Boston, MA 02 19 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. 20 */ 20 */ 21 21 22 #ifndef _UAPI_LINUX_CRYPTOUSER_H << 23 #define _UAPI_LINUX_CRYPTOUSER_H << 24 << 25 #include <linux/types.h> 22 #include <linux/types.h> 26 23 27 /* Netlink configuration messages. */ 24 /* Netlink configuration messages. */ 28 enum { 25 enum { 29 CRYPTO_MSG_BASE = 0x10, 26 CRYPTO_MSG_BASE = 0x10, 30 CRYPTO_MSG_NEWALG = 0x10, 27 CRYPTO_MSG_NEWALG = 0x10, 31 CRYPTO_MSG_DELALG, 28 CRYPTO_MSG_DELALG, 32 CRYPTO_MSG_UPDATEALG, 29 CRYPTO_MSG_UPDATEALG, 33 CRYPTO_MSG_GETALG, 30 CRYPTO_MSG_GETALG, 34 CRYPTO_MSG_DELRNG, 31 CRYPTO_MSG_DELRNG, 35 CRYPTO_MSG_GETSTAT, /* No longer suppo !! 32 CRYPTO_MSG_GETSTAT, 36 __CRYPTO_MSG_MAX 33 __CRYPTO_MSG_MAX 37 }; 34 }; 38 #define CRYPTO_MSG_MAX (__CRYPTO_MSG_MAX - 1) 35 #define CRYPTO_MSG_MAX (__CRYPTO_MSG_MAX - 1) 39 #define CRYPTO_NR_MSGTYPES (CRYPTO_MSG_MAX + 1 36 #define CRYPTO_NR_MSGTYPES (CRYPTO_MSG_MAX + 1 - CRYPTO_MSG_BASE) 40 37 41 #define CRYPTO_MAX_NAME 64 38 #define CRYPTO_MAX_NAME 64 42 39 43 /* Netlink message attributes. */ 40 /* Netlink message attributes. */ 44 enum crypto_attr_type_t { 41 enum crypto_attr_type_t { 45 CRYPTOCFGA_UNSPEC, 42 CRYPTOCFGA_UNSPEC, 46 CRYPTOCFGA_PRIORITY_VAL, /* __u 43 CRYPTOCFGA_PRIORITY_VAL, /* __u32 */ 47 CRYPTOCFGA_REPORT_LARVAL, /* str 44 CRYPTOCFGA_REPORT_LARVAL, /* struct crypto_report_larval */ 48 CRYPTOCFGA_REPORT_HASH, /* str 45 CRYPTOCFGA_REPORT_HASH, /* struct crypto_report_hash */ 49 CRYPTOCFGA_REPORT_BLKCIPHER, /* str 46 CRYPTOCFGA_REPORT_BLKCIPHER, /* struct crypto_report_blkcipher */ 50 CRYPTOCFGA_REPORT_AEAD, /* str 47 CRYPTOCFGA_REPORT_AEAD, /* struct crypto_report_aead */ 51 CRYPTOCFGA_REPORT_COMPRESS, /* str 48 CRYPTOCFGA_REPORT_COMPRESS, /* struct crypto_report_comp */ 52 CRYPTOCFGA_REPORT_RNG, /* str 49 CRYPTOCFGA_REPORT_RNG, /* struct crypto_report_rng */ 53 CRYPTOCFGA_REPORT_CIPHER, /* str 50 CRYPTOCFGA_REPORT_CIPHER, /* struct crypto_report_cipher */ 54 CRYPTOCFGA_REPORT_AKCIPHER, /* str 51 CRYPTOCFGA_REPORT_AKCIPHER, /* struct crypto_report_akcipher */ 55 CRYPTOCFGA_REPORT_KPP, /* str 52 CRYPTOCFGA_REPORT_KPP, /* struct crypto_report_kpp */ 56 CRYPTOCFGA_REPORT_ACOMP, /* str 53 CRYPTOCFGA_REPORT_ACOMP, /* struct crypto_report_acomp */ 57 CRYPTOCFGA_STAT_LARVAL, /* No !! 54 CRYPTOCFGA_STAT_LARVAL, /* struct crypto_stat */ 58 CRYPTOCFGA_STAT_HASH, /* No !! 55 CRYPTOCFGA_STAT_HASH, /* struct crypto_stat */ 59 CRYPTOCFGA_STAT_BLKCIPHER, /* No !! 56 CRYPTOCFGA_STAT_BLKCIPHER, /* struct crypto_stat */ 60 CRYPTOCFGA_STAT_AEAD, /* No !! 57 CRYPTOCFGA_STAT_AEAD, /* struct crypto_stat */ 61 CRYPTOCFGA_STAT_COMPRESS, /* No !! 58 CRYPTOCFGA_STAT_COMPRESS, /* struct crypto_stat */ 62 CRYPTOCFGA_STAT_RNG, /* No !! 59 CRYPTOCFGA_STAT_RNG, /* struct crypto_stat */ 63 CRYPTOCFGA_STAT_CIPHER, /* No !! 60 CRYPTOCFGA_STAT_CIPHER, /* struct crypto_stat */ 64 CRYPTOCFGA_STAT_AKCIPHER, /* No !! 61 CRYPTOCFGA_STAT_AKCIPHER, /* struct crypto_stat */ 65 CRYPTOCFGA_STAT_KPP, /* No !! 62 CRYPTOCFGA_STAT_KPP, /* struct crypto_stat */ 66 CRYPTOCFGA_STAT_ACOMP, /* No !! 63 CRYPTOCFGA_STAT_ACOMP, /* struct crypto_stat */ 67 __CRYPTOCFGA_MAX 64 __CRYPTOCFGA_MAX 68 65 69 #define CRYPTOCFGA_MAX (__CRYPTOCFGA_MAX - 1) 66 #define CRYPTOCFGA_MAX (__CRYPTOCFGA_MAX - 1) 70 }; 67 }; 71 68 72 struct crypto_user_alg { 69 struct crypto_user_alg { 73 char cru_name[CRYPTO_MAX_NAME]; 70 char cru_name[CRYPTO_MAX_NAME]; 74 char cru_driver_name[CRYPTO_MAX_NAME]; 71 char cru_driver_name[CRYPTO_MAX_NAME]; 75 char cru_module_name[CRYPTO_MAX_NAME]; 72 char cru_module_name[CRYPTO_MAX_NAME]; 76 __u32 cru_type; 73 __u32 cru_type; 77 __u32 cru_mask; 74 __u32 cru_mask; 78 __u32 cru_refcnt; 75 __u32 cru_refcnt; 79 __u32 cru_flags; 76 __u32 cru_flags; 80 }; 77 }; 81 78 82 /* No longer supported, do not use. */ << 83 struct crypto_stat_aead { 79 struct crypto_stat_aead { 84 char type[CRYPTO_MAX_NAME]; 80 char type[CRYPTO_MAX_NAME]; 85 __u64 stat_encrypt_cnt; 81 __u64 stat_encrypt_cnt; 86 __u64 stat_encrypt_tlen; 82 __u64 stat_encrypt_tlen; 87 __u64 stat_decrypt_cnt; 83 __u64 stat_decrypt_cnt; 88 __u64 stat_decrypt_tlen; 84 __u64 stat_decrypt_tlen; 89 __u64 stat_err_cnt; 85 __u64 stat_err_cnt; 90 }; 86 }; 91 87 92 /* No longer supported, do not use. */ << 93 struct crypto_stat_akcipher { 88 struct crypto_stat_akcipher { 94 char type[CRYPTO_MAX_NAME]; 89 char type[CRYPTO_MAX_NAME]; 95 __u64 stat_encrypt_cnt; 90 __u64 stat_encrypt_cnt; 96 __u64 stat_encrypt_tlen; 91 __u64 stat_encrypt_tlen; 97 __u64 stat_decrypt_cnt; 92 __u64 stat_decrypt_cnt; 98 __u64 stat_decrypt_tlen; 93 __u64 stat_decrypt_tlen; 99 __u64 stat_verify_cnt; 94 __u64 stat_verify_cnt; 100 __u64 stat_sign_cnt; 95 __u64 stat_sign_cnt; 101 __u64 stat_err_cnt; 96 __u64 stat_err_cnt; 102 }; 97 }; 103 98 104 /* No longer supported, do not use. */ << 105 struct crypto_stat_cipher { 99 struct crypto_stat_cipher { 106 char type[CRYPTO_MAX_NAME]; 100 char type[CRYPTO_MAX_NAME]; 107 __u64 stat_encrypt_cnt; 101 __u64 stat_encrypt_cnt; 108 __u64 stat_encrypt_tlen; 102 __u64 stat_encrypt_tlen; 109 __u64 stat_decrypt_cnt; 103 __u64 stat_decrypt_cnt; 110 __u64 stat_decrypt_tlen; 104 __u64 stat_decrypt_tlen; 111 __u64 stat_err_cnt; 105 __u64 stat_err_cnt; 112 }; 106 }; 113 107 114 /* No longer supported, do not use. */ << 115 struct crypto_stat_compress { 108 struct crypto_stat_compress { 116 char type[CRYPTO_MAX_NAME]; 109 char type[CRYPTO_MAX_NAME]; 117 __u64 stat_compress_cnt; 110 __u64 stat_compress_cnt; 118 __u64 stat_compress_tlen; 111 __u64 stat_compress_tlen; 119 __u64 stat_decompress_cnt; 112 __u64 stat_decompress_cnt; 120 __u64 stat_decompress_tlen; 113 __u64 stat_decompress_tlen; 121 __u64 stat_err_cnt; 114 __u64 stat_err_cnt; 122 }; 115 }; 123 116 124 /* No longer supported, do not use. */ << 125 struct crypto_stat_hash { 117 struct crypto_stat_hash { 126 char type[CRYPTO_MAX_NAME]; 118 char type[CRYPTO_MAX_NAME]; 127 __u64 stat_hash_cnt; 119 __u64 stat_hash_cnt; 128 __u64 stat_hash_tlen; 120 __u64 stat_hash_tlen; 129 __u64 stat_err_cnt; 121 __u64 stat_err_cnt; 130 }; 122 }; 131 123 132 /* No longer supported, do not use. */ << 133 struct crypto_stat_kpp { 124 struct crypto_stat_kpp { 134 char type[CRYPTO_MAX_NAME]; 125 char type[CRYPTO_MAX_NAME]; 135 __u64 stat_setsecret_cnt; 126 __u64 stat_setsecret_cnt; 136 __u64 stat_generate_public_key_cnt; 127 __u64 stat_generate_public_key_cnt; 137 __u64 stat_compute_shared_secret_cnt; 128 __u64 stat_compute_shared_secret_cnt; 138 __u64 stat_err_cnt; 129 __u64 stat_err_cnt; 139 }; 130 }; 140 131 141 /* No longer supported, do not use. */ << 142 struct crypto_stat_rng { 132 struct crypto_stat_rng { 143 char type[CRYPTO_MAX_NAME]; 133 char type[CRYPTO_MAX_NAME]; 144 __u64 stat_generate_cnt; 134 __u64 stat_generate_cnt; 145 __u64 stat_generate_tlen; 135 __u64 stat_generate_tlen; 146 __u64 stat_seed_cnt; 136 __u64 stat_seed_cnt; 147 __u64 stat_err_cnt; 137 __u64 stat_err_cnt; 148 }; 138 }; 149 139 150 /* No longer supported, do not use. */ << 151 struct crypto_stat_larval { 140 struct crypto_stat_larval { 152 char type[CRYPTO_MAX_NAME]; 141 char type[CRYPTO_MAX_NAME]; 153 }; 142 }; 154 143 155 struct crypto_report_larval { 144 struct crypto_report_larval { 156 char type[CRYPTO_MAX_NAME]; 145 char type[CRYPTO_MAX_NAME]; 157 }; 146 }; 158 147 159 struct crypto_report_hash { 148 struct crypto_report_hash { 160 char type[CRYPTO_MAX_NAME]; 149 char type[CRYPTO_MAX_NAME]; 161 unsigned int blocksize; 150 unsigned int blocksize; 162 unsigned int digestsize; 151 unsigned int digestsize; 163 }; 152 }; 164 153 165 struct crypto_report_cipher { 154 struct crypto_report_cipher { 166 char type[CRYPTO_MAX_NAME]; 155 char type[CRYPTO_MAX_NAME]; 167 unsigned int blocksize; 156 unsigned int blocksize; 168 unsigned int min_keysize; 157 unsigned int min_keysize; 169 unsigned int max_keysize; 158 unsigned int max_keysize; 170 }; 159 }; 171 160 172 struct crypto_report_blkcipher { 161 struct crypto_report_blkcipher { 173 char type[CRYPTO_MAX_NAME]; 162 char type[CRYPTO_MAX_NAME]; 174 char geniv[CRYPTO_MAX_NAME]; 163 char geniv[CRYPTO_MAX_NAME]; 175 unsigned int blocksize; 164 unsigned int blocksize; 176 unsigned int min_keysize; 165 unsigned int min_keysize; 177 unsigned int max_keysize; 166 unsigned int max_keysize; 178 unsigned int ivsize; 167 unsigned int ivsize; 179 }; 168 }; 180 169 181 struct crypto_report_aead { 170 struct crypto_report_aead { 182 char type[CRYPTO_MAX_NAME]; 171 char type[CRYPTO_MAX_NAME]; 183 char geniv[CRYPTO_MAX_NAME]; 172 char geniv[CRYPTO_MAX_NAME]; 184 unsigned int blocksize; 173 unsigned int blocksize; 185 unsigned int maxauthsize; 174 unsigned int maxauthsize; 186 unsigned int ivsize; 175 unsigned int ivsize; 187 }; 176 }; 188 177 189 struct crypto_report_comp { 178 struct crypto_report_comp { 190 char type[CRYPTO_MAX_NAME]; 179 char type[CRYPTO_MAX_NAME]; 191 }; 180 }; 192 181 193 struct crypto_report_rng { 182 struct crypto_report_rng { 194 char type[CRYPTO_MAX_NAME]; 183 char type[CRYPTO_MAX_NAME]; 195 unsigned int seedsize; 184 unsigned int seedsize; 196 }; 185 }; 197 186 198 struct crypto_report_akcipher { 187 struct crypto_report_akcipher { 199 char type[CRYPTO_MAX_NAME]; 188 char type[CRYPTO_MAX_NAME]; 200 }; 189 }; 201 190 202 struct crypto_report_kpp { 191 struct crypto_report_kpp { 203 char type[CRYPTO_MAX_NAME]; 192 char type[CRYPTO_MAX_NAME]; 204 }; 193 }; 205 194 206 struct crypto_report_acomp { 195 struct crypto_report_acomp { 207 char type[CRYPTO_MAX_NAME]; 196 char type[CRYPTO_MAX_NAME]; 208 }; 197 }; 209 198 210 #define CRYPTO_REPORT_MAXSIZE (sizeof(struct c 199 #define CRYPTO_REPORT_MAXSIZE (sizeof(struct crypto_user_alg) + \ 211 sizeof(struct c 200 sizeof(struct crypto_report_blkcipher)) 212 << 213 #endif /* _UAPI_LINUX_CRYPTOUSER_H */ << 214 201
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.