1 /**************************************************************************** 2 **************************************************************************** 3 *** 4 *** This header was automatically generated from a Linux kernel header 5 *** of the same name, to make information necessary for userspace to 6 *** call into the kernel available to libc. It contains only constants, 7 *** structures, and macros generated from the original header, and thus, 8 *** contains no copyrightable information. 9 *** 10 *** To edit the content of this header, modify the corresponding 11 *** source file (e.g. under external/kernel-headers/original/) then 12 *** run bionic/libc/kernel/tools/update_all.py 13 *** 14 *** Any manual change here will be lost the next time this script will 15 *** be run. You've been warned! 16 *** 17 **************************************************************************** 18 ****************************************************************************/ 19 #ifndef _VIRTIO_CRYPTO_H 20 #define _VIRTIO_CRYPTO_H 21 #include <linux/types.h> 22 #include <linux/virtio_types.h> 23 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 24 #include <linux/virtio_ids.h> 25 #include <linux/virtio_config.h> 26 #define VIRTIO_CRYPTO_SERVICE_CIPHER 0 27 #define VIRTIO_CRYPTO_SERVICE_HASH 1 28 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 29 #define VIRTIO_CRYPTO_SERVICE_MAC 2 30 #define VIRTIO_CRYPTO_SERVICE_AEAD 3 31 #define VIRTIO_CRYPTO_OPCODE(service,op) (((service) << 8) | (op)) 32 struct virtio_crypto_ctrl_header { 33 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 34 #define VIRTIO_CRYPTO_CIPHER_CREATE_SESSION VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_CIPHER, 0x02) 35 #define VIRTIO_CRYPTO_CIPHER_DESTROY_SESSION VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_CIPHER, 0x03) 36 #define VIRTIO_CRYPTO_HASH_CREATE_SESSION VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_HASH, 0x02) 37 #define VIRTIO_CRYPTO_HASH_DESTROY_SESSION VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_HASH, 0x03) 38 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 39 #define VIRTIO_CRYPTO_MAC_CREATE_SESSION VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_MAC, 0x02) 40 #define VIRTIO_CRYPTO_MAC_DESTROY_SESSION VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_MAC, 0x03) 41 #define VIRTIO_CRYPTO_AEAD_CREATE_SESSION VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_AEAD, 0x02) 42 #define VIRTIO_CRYPTO_AEAD_DESTROY_SESSION VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_AEAD, 0x03) 43 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 44 __le32 opcode; 45 __le32 algo; 46 __le32 flag; 47 __le32 queue_id; 48 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 49 }; 50 struct virtio_crypto_cipher_session_para { 51 #define VIRTIO_CRYPTO_NO_CIPHER 0 52 #define VIRTIO_CRYPTO_CIPHER_ARC4 1 53 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 54 #define VIRTIO_CRYPTO_CIPHER_AES_ECB 2 55 #define VIRTIO_CRYPTO_CIPHER_AES_CBC 3 56 #define VIRTIO_CRYPTO_CIPHER_AES_CTR 4 57 #define VIRTIO_CRYPTO_CIPHER_DES_ECB 5 58 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 59 #define VIRTIO_CRYPTO_CIPHER_DES_CBC 6 60 #define VIRTIO_CRYPTO_CIPHER_3DES_ECB 7 61 #define VIRTIO_CRYPTO_CIPHER_3DES_CBC 8 62 #define VIRTIO_CRYPTO_CIPHER_3DES_CTR 9 63 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 64 #define VIRTIO_CRYPTO_CIPHER_KASUMI_F8 10 65 #define VIRTIO_CRYPTO_CIPHER_SNOW3G_UEA2 11 66 #define VIRTIO_CRYPTO_CIPHER_AES_F8 12 67 #define VIRTIO_CRYPTO_CIPHER_AES_XTS 13 68 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 69 #define VIRTIO_CRYPTO_CIPHER_ZUC_EEA3 14 70 __le32 algo; 71 __le32 keylen; 72 #define VIRTIO_CRYPTO_OP_ENCRYPT 1 73 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 74 #define VIRTIO_CRYPTO_OP_DECRYPT 2 75 __le32 op; 76 __le32 padding; 77 }; 78 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 79 struct virtio_crypto_session_input { 80 __le64 session_id; 81 __le32 status; 82 __le32 padding; 83 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 84 }; 85 struct virtio_crypto_cipher_session_req { 86 struct virtio_crypto_cipher_session_para para; 87 __u8 padding[32]; 88 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 89 }; 90 struct virtio_crypto_hash_session_para { 91 #define VIRTIO_CRYPTO_NO_HASH 0 92 #define VIRTIO_CRYPTO_HASH_MD5 1 93 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 94 #define VIRTIO_CRYPTO_HASH_SHA1 2 95 #define VIRTIO_CRYPTO_HASH_SHA_224 3 96 #define VIRTIO_CRYPTO_HASH_SHA_256 4 97 #define VIRTIO_CRYPTO_HASH_SHA_384 5 98 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 99 #define VIRTIO_CRYPTO_HASH_SHA_512 6 100 #define VIRTIO_CRYPTO_HASH_SHA3_224 7 101 #define VIRTIO_CRYPTO_HASH_SHA3_256 8 102 #define VIRTIO_CRYPTO_HASH_SHA3_384 9 103 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 104 #define VIRTIO_CRYPTO_HASH_SHA3_512 10 105 #define VIRTIO_CRYPTO_HASH_SHA3_SHAKE128 11 106 #define VIRTIO_CRYPTO_HASH_SHA3_SHAKE256 12 107 __le32 algo; 108 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 109 __le32 hash_result_len; 110 __u8 padding[8]; 111 }; 112 struct virtio_crypto_hash_create_session_req { 113 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 114 struct virtio_crypto_hash_session_para para; 115 __u8 padding[40]; 116 }; 117 struct virtio_crypto_mac_session_para { 118 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 119 #define VIRTIO_CRYPTO_NO_MAC 0 120 #define VIRTIO_CRYPTO_MAC_HMAC_MD5 1 121 #define VIRTIO_CRYPTO_MAC_HMAC_SHA1 2 122 #define VIRTIO_CRYPTO_MAC_HMAC_SHA_224 3 123 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 124 #define VIRTIO_CRYPTO_MAC_HMAC_SHA_256 4 125 #define VIRTIO_CRYPTO_MAC_HMAC_SHA_384 5 126 #define VIRTIO_CRYPTO_MAC_HMAC_SHA_512 6 127 #define VIRTIO_CRYPTO_MAC_CMAC_3DES 25 128 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 129 #define VIRTIO_CRYPTO_MAC_CMAC_AES 26 130 #define VIRTIO_CRYPTO_MAC_KASUMI_F9 27 131 #define VIRTIO_CRYPTO_MAC_SNOW3G_UIA2 28 132 #define VIRTIO_CRYPTO_MAC_GMAC_AES 41 133 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 134 #define VIRTIO_CRYPTO_MAC_GMAC_TWOFISH 42 135 #define VIRTIO_CRYPTO_MAC_CBCMAC_AES 49 136 #define VIRTIO_CRYPTO_MAC_CBCMAC_KASUMI_F9 50 137 #define VIRTIO_CRYPTO_MAC_XCBC_AES 53 138 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 139 __le32 algo; 140 __le32 hash_result_len; 141 __le32 auth_key_len; 142 __le32 padding; 143 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 144 }; 145 struct virtio_crypto_mac_create_session_req { 146 struct virtio_crypto_mac_session_para para; 147 __u8 padding[40]; 148 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 149 }; 150 struct virtio_crypto_aead_session_para { 151 #define VIRTIO_CRYPTO_NO_AEAD 0 152 #define VIRTIO_CRYPTO_AEAD_GCM 1 153 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 154 #define VIRTIO_CRYPTO_AEAD_CCM 2 155 #define VIRTIO_CRYPTO_AEAD_CHACHA20_POLY1305 3 156 __le32 algo; 157 __le32 key_len; 158 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 159 __le32 hash_result_len; 160 __le32 aad_len; 161 __le32 op; 162 __le32 padding; 163 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 164 }; 165 struct virtio_crypto_aead_create_session_req { 166 struct virtio_crypto_aead_session_para para; 167 __u8 padding[32]; 168 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 169 }; 170 struct virtio_crypto_alg_chain_session_para { 171 #define VIRTIO_CRYPTO_SYM_ALG_CHAIN_ORDER_HASH_THEN_CIPHER 1 172 #define VIRTIO_CRYPTO_SYM_ALG_CHAIN_ORDER_CIPHER_THEN_HASH 2 173 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 174 __le32 alg_chain_order; 175 #define VIRTIO_CRYPTO_SYM_HASH_MODE_PLAIN 1 176 #define VIRTIO_CRYPTO_SYM_HASH_MODE_AUTH 2 177 #define VIRTIO_CRYPTO_SYM_HASH_MODE_NESTED 3 178 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 179 __le32 hash_mode; 180 struct virtio_crypto_cipher_session_para cipher_param; 181 union { 182 struct virtio_crypto_hash_session_para hash_param; 183 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 184 struct virtio_crypto_mac_session_para mac_param; 185 __u8 padding[16]; 186 } u; 187 __le32 aad_len; 188 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 189 __le32 padding; 190 }; 191 struct virtio_crypto_alg_chain_session_req { 192 struct virtio_crypto_alg_chain_session_para para; 193 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 194 }; 195 struct virtio_crypto_sym_create_session_req { 196 union { 197 struct virtio_crypto_cipher_session_req cipher; 198 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 199 struct virtio_crypto_alg_chain_session_req chain; 200 __u8 padding[48]; 201 } u; 202 #define VIRTIO_CRYPTO_SYM_OP_NONE 0 203 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 204 #define VIRTIO_CRYPTO_SYM_OP_CIPHER 1 205 #define VIRTIO_CRYPTO_SYM_OP_ALGORITHM_CHAINING 2 206 __le32 op_type; 207 __le32 padding; 208 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 209 }; 210 struct virtio_crypto_destroy_session_req { 211 __le64 session_id; 212 __u8 padding[48]; 213 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 214 }; 215 struct virtio_crypto_op_ctrl_req { 216 struct virtio_crypto_ctrl_header header; 217 union { 218 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 219 struct virtio_crypto_sym_create_session_req sym_create_session; 220 struct virtio_crypto_hash_create_session_req hash_create_session; 221 struct virtio_crypto_mac_create_session_req mac_create_session; 222 struct virtio_crypto_aead_create_session_req aead_create_session; 223 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 224 struct virtio_crypto_destroy_session_req destroy_session; 225 __u8 padding[56]; 226 } u; 227 }; 228 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 229 struct virtio_crypto_op_header { 230 #define VIRTIO_CRYPTO_CIPHER_ENCRYPT VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_CIPHER, 0x00) 231 #define VIRTIO_CRYPTO_CIPHER_DECRYPT VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_CIPHER, 0x01) 232 #define VIRTIO_CRYPTO_HASH VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_HASH, 0x00) 233 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 234 #define VIRTIO_CRYPTO_MAC VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_MAC, 0x00) 235 #define VIRTIO_CRYPTO_AEAD_ENCRYPT VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_AEAD, 0x00) 236 #define VIRTIO_CRYPTO_AEAD_DECRYPT VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_AEAD, 0x01) 237 __le32 opcode; 238 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 239 __le32 algo; 240 __le64 session_id; 241 __le32 flag; 242 __le32 padding; 243 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 244 }; 245 struct virtio_crypto_cipher_para { 246 __le32 iv_len; 247 __le32 src_data_len; 248 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 249 __le32 dst_data_len; 250 __le32 padding; 251 }; 252 struct virtio_crypto_hash_para { 253 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 254 __le32 src_data_len; 255 __le32 hash_result_len; 256 }; 257 struct virtio_crypto_mac_para { 258 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 259 struct virtio_crypto_hash_para hash; 260 }; 261 struct virtio_crypto_aead_para { 262 __le32 iv_len; 263 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 264 __le32 aad_len; 265 __le32 src_data_len; 266 __le32 dst_data_len; 267 }; 268 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 269 struct virtio_crypto_cipher_data_req { 270 struct virtio_crypto_cipher_para para; 271 __u8 padding[24]; 272 }; 273 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 274 struct virtio_crypto_hash_data_req { 275 struct virtio_crypto_hash_para para; 276 __u8 padding[40]; 277 }; 278 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 279 struct virtio_crypto_mac_data_req { 280 struct virtio_crypto_mac_para para; 281 __u8 padding[40]; 282 }; 283 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 284 struct virtio_crypto_alg_chain_data_para { 285 __le32 iv_len; 286 __le32 src_data_len; 287 __le32 dst_data_len; 288 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 289 __le32 cipher_start_src_offset; 290 __le32 len_to_cipher; 291 __le32 hash_start_src_offset; 292 __le32 len_to_hash; 293 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 294 __le32 aad_len; 295 __le32 hash_result_len; 296 __le32 reserved; 297 }; 298 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 299 struct virtio_crypto_alg_chain_data_req { 300 struct virtio_crypto_alg_chain_data_para para; 301 }; 302 struct virtio_crypto_sym_data_req { 303 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 304 union { 305 struct virtio_crypto_cipher_data_req cipher; 306 struct virtio_crypto_alg_chain_data_req chain; 307 __u8 padding[40]; 308 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 309 } u; 310 __le32 op_type; 311 __le32 padding; 312 }; 313 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 314 struct virtio_crypto_aead_data_req { 315 struct virtio_crypto_aead_para para; 316 __u8 padding[32]; 317 }; 318 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 319 struct virtio_crypto_op_data_req { 320 struct virtio_crypto_op_header header; 321 union { 322 struct virtio_crypto_sym_data_req sym_req; 323 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 324 struct virtio_crypto_hash_data_req hash_req; 325 struct virtio_crypto_mac_data_req mac_req; 326 struct virtio_crypto_aead_data_req aead_req; 327 __u8 padding[48]; 328 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 329 } u; 330 }; 331 #define VIRTIO_CRYPTO_OK 0 332 #define VIRTIO_CRYPTO_ERR 1 333 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 334 #define VIRTIO_CRYPTO_BADMSG 2 335 #define VIRTIO_CRYPTO_NOTSUPP 3 336 #define VIRTIO_CRYPTO_INVSESS 4 337 #define VIRTIO_CRYPTO_S_HW_READY (1 << 0) 338 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 339 struct virtio_crypto_config { 340 __u32 status; 341 __u32 max_dataqueues; 342 __u32 crypto_services; 343 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 344 __u32 cipher_algo_l; 345 __u32 cipher_algo_h; 346 __u32 hash_algo; 347 __u32 mac_algo_l; 348 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 349 __u32 mac_algo_h; 350 __u32 aead_algo; 351 __u32 max_cipher_key_len; 352 __u32 max_auth_key_len; 353 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 354 __u32 reserve; 355 __u64 max_size; 356 }; 357 struct virtio_crypto_inhdr { 358 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 359 __u8 status; 360 }; 361 #endif 362