Back to home page

OSCL-LXR

 
 

    


0001 #ifndef _VIRTIO_CRYPTO_H
0002 #define _VIRTIO_CRYPTO_H
0003 /* This header is BSD licensed so anyone can use the definitions to implement
0004  * compatible drivers/servers.
0005  *
0006  * Redistribution and use in source and binary forms, with or without
0007  * modification, are permitted provided that the following conditions
0008  * are met:
0009  * 1. Redistributions of source code must retain the above copyright
0010  *    notice, this list of conditions and the following disclaimer.
0011  * 2. Redistributions in binary form must reproduce the above copyright
0012  *    notice, this list of conditions and the following disclaimer in the
0013  *    documentation and/or other materials provided with the distribution.
0014  * 3. Neither the name of IBM nor the names of its contributors
0015  *    may be used to endorse or promote products derived from this software
0016  *    without specific prior written permission.
0017  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
0018  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
0019  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
0020  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL IBM OR
0021  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
0022  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
0023  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
0024  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
0025  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
0026  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
0027  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
0028  * SUCH DAMAGE.
0029  */
0030 #include <linux/types.h>
0031 #include <linux/virtio_types.h>
0032 #include <linux/virtio_ids.h>
0033 #include <linux/virtio_config.h>
0034 
0035 
0036 #define VIRTIO_CRYPTO_SERVICE_CIPHER 0
0037 #define VIRTIO_CRYPTO_SERVICE_HASH   1
0038 #define VIRTIO_CRYPTO_SERVICE_MAC    2
0039 #define VIRTIO_CRYPTO_SERVICE_AEAD   3
0040 #define VIRTIO_CRYPTO_SERVICE_AKCIPHER 4
0041 
0042 #define VIRTIO_CRYPTO_OPCODE(service, op)   (((service) << 8) | (op))
0043 
0044 struct virtio_crypto_ctrl_header {
0045 #define VIRTIO_CRYPTO_CIPHER_CREATE_SESSION \
0046        VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_CIPHER, 0x02)
0047 #define VIRTIO_CRYPTO_CIPHER_DESTROY_SESSION \
0048        VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_CIPHER, 0x03)
0049 #define VIRTIO_CRYPTO_HASH_CREATE_SESSION \
0050        VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_HASH, 0x02)
0051 #define VIRTIO_CRYPTO_HASH_DESTROY_SESSION \
0052        VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_HASH, 0x03)
0053 #define VIRTIO_CRYPTO_MAC_CREATE_SESSION \
0054        VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_MAC, 0x02)
0055 #define VIRTIO_CRYPTO_MAC_DESTROY_SESSION \
0056        VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_MAC, 0x03)
0057 #define VIRTIO_CRYPTO_AEAD_CREATE_SESSION \
0058        VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_AEAD, 0x02)
0059 #define VIRTIO_CRYPTO_AEAD_DESTROY_SESSION \
0060        VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_AEAD, 0x03)
0061 #define VIRTIO_CRYPTO_AKCIPHER_CREATE_SESSION \
0062        VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_AKCIPHER, 0x04)
0063 #define VIRTIO_CRYPTO_AKCIPHER_DESTROY_SESSION \
0064        VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_AKCIPHER, 0x05)
0065     __le32 opcode;
0066     __le32 algo;
0067     __le32 flag;
0068     /* data virtqueue id */
0069     __le32 queue_id;
0070 };
0071 
0072 struct virtio_crypto_cipher_session_para {
0073 #define VIRTIO_CRYPTO_NO_CIPHER                 0
0074 #define VIRTIO_CRYPTO_CIPHER_ARC4               1
0075 #define VIRTIO_CRYPTO_CIPHER_AES_ECB            2
0076 #define VIRTIO_CRYPTO_CIPHER_AES_CBC            3
0077 #define VIRTIO_CRYPTO_CIPHER_AES_CTR            4
0078 #define VIRTIO_CRYPTO_CIPHER_DES_ECB            5
0079 #define VIRTIO_CRYPTO_CIPHER_DES_CBC            6
0080 #define VIRTIO_CRYPTO_CIPHER_3DES_ECB           7
0081 #define VIRTIO_CRYPTO_CIPHER_3DES_CBC           8
0082 #define VIRTIO_CRYPTO_CIPHER_3DES_CTR           9
0083 #define VIRTIO_CRYPTO_CIPHER_KASUMI_F8          10
0084 #define VIRTIO_CRYPTO_CIPHER_SNOW3G_UEA2        11
0085 #define VIRTIO_CRYPTO_CIPHER_AES_F8             12
0086 #define VIRTIO_CRYPTO_CIPHER_AES_XTS            13
0087 #define VIRTIO_CRYPTO_CIPHER_ZUC_EEA3           14
0088     __le32 algo;
0089     /* length of key */
0090     __le32 keylen;
0091 
0092 #define VIRTIO_CRYPTO_OP_ENCRYPT  1
0093 #define VIRTIO_CRYPTO_OP_DECRYPT  2
0094     /* encrypt or decrypt */
0095     __le32 op;
0096     __le32 padding;
0097 };
0098 
0099 struct virtio_crypto_session_input {
0100     /* Device-writable part */
0101     __le64 session_id;
0102     __le32 status;
0103     __le32 padding;
0104 };
0105 
0106 struct virtio_crypto_cipher_session_req {
0107     struct virtio_crypto_cipher_session_para para;
0108     __u8 padding[32];
0109 };
0110 
0111 struct virtio_crypto_hash_session_para {
0112 #define VIRTIO_CRYPTO_NO_HASH            0
0113 #define VIRTIO_CRYPTO_HASH_MD5           1
0114 #define VIRTIO_CRYPTO_HASH_SHA1          2
0115 #define VIRTIO_CRYPTO_HASH_SHA_224       3
0116 #define VIRTIO_CRYPTO_HASH_SHA_256       4
0117 #define VIRTIO_CRYPTO_HASH_SHA_384       5
0118 #define VIRTIO_CRYPTO_HASH_SHA_512       6
0119 #define VIRTIO_CRYPTO_HASH_SHA3_224      7
0120 #define VIRTIO_CRYPTO_HASH_SHA3_256      8
0121 #define VIRTIO_CRYPTO_HASH_SHA3_384      9
0122 #define VIRTIO_CRYPTO_HASH_SHA3_512      10
0123 #define VIRTIO_CRYPTO_HASH_SHA3_SHAKE128      11
0124 #define VIRTIO_CRYPTO_HASH_SHA3_SHAKE256      12
0125     __le32 algo;
0126     /* hash result length */
0127     __le32 hash_result_len;
0128     __u8 padding[8];
0129 };
0130 
0131 struct virtio_crypto_hash_create_session_req {
0132     struct virtio_crypto_hash_session_para para;
0133     __u8 padding[40];
0134 };
0135 
0136 struct virtio_crypto_mac_session_para {
0137 #define VIRTIO_CRYPTO_NO_MAC                       0
0138 #define VIRTIO_CRYPTO_MAC_HMAC_MD5                 1
0139 #define VIRTIO_CRYPTO_MAC_HMAC_SHA1                2
0140 #define VIRTIO_CRYPTO_MAC_HMAC_SHA_224             3
0141 #define VIRTIO_CRYPTO_MAC_HMAC_SHA_256             4
0142 #define VIRTIO_CRYPTO_MAC_HMAC_SHA_384             5
0143 #define VIRTIO_CRYPTO_MAC_HMAC_SHA_512             6
0144 #define VIRTIO_CRYPTO_MAC_CMAC_3DES                25
0145 #define VIRTIO_CRYPTO_MAC_CMAC_AES                 26
0146 #define VIRTIO_CRYPTO_MAC_KASUMI_F9                27
0147 #define VIRTIO_CRYPTO_MAC_SNOW3G_UIA2              28
0148 #define VIRTIO_CRYPTO_MAC_GMAC_AES                 41
0149 #define VIRTIO_CRYPTO_MAC_GMAC_TWOFISH             42
0150 #define VIRTIO_CRYPTO_MAC_CBCMAC_AES               49
0151 #define VIRTIO_CRYPTO_MAC_CBCMAC_KASUMI_F9         50
0152 #define VIRTIO_CRYPTO_MAC_XCBC_AES                 53
0153     __le32 algo;
0154     /* hash result length */
0155     __le32 hash_result_len;
0156     /* length of authenticated key */
0157     __le32 auth_key_len;
0158     __le32 padding;
0159 };
0160 
0161 struct virtio_crypto_mac_create_session_req {
0162     struct virtio_crypto_mac_session_para para;
0163     __u8 padding[40];
0164 };
0165 
0166 struct virtio_crypto_aead_session_para {
0167 #define VIRTIO_CRYPTO_NO_AEAD     0
0168 #define VIRTIO_CRYPTO_AEAD_GCM    1
0169 #define VIRTIO_CRYPTO_AEAD_CCM    2
0170 #define VIRTIO_CRYPTO_AEAD_CHACHA20_POLY1305  3
0171     __le32 algo;
0172     /* length of key */
0173     __le32 key_len;
0174     /* hash result length */
0175     __le32 hash_result_len;
0176     /* length of the additional authenticated data (AAD) in bytes */
0177     __le32 aad_len;
0178     /* encrypt or decrypt, See above VIRTIO_CRYPTO_OP_* */
0179     __le32 op;
0180     __le32 padding;
0181 };
0182 
0183 struct virtio_crypto_aead_create_session_req {
0184     struct virtio_crypto_aead_session_para para;
0185     __u8 padding[32];
0186 };
0187 
0188 struct virtio_crypto_rsa_session_para {
0189 #define VIRTIO_CRYPTO_RSA_RAW_PADDING   0
0190 #define VIRTIO_CRYPTO_RSA_PKCS1_PADDING 1
0191     __le32 padding_algo;
0192 
0193 #define VIRTIO_CRYPTO_RSA_NO_HASH   0
0194 #define VIRTIO_CRYPTO_RSA_MD2       1
0195 #define VIRTIO_CRYPTO_RSA_MD3       2
0196 #define VIRTIO_CRYPTO_RSA_MD4       3
0197 #define VIRTIO_CRYPTO_RSA_MD5       4
0198 #define VIRTIO_CRYPTO_RSA_SHA1      5
0199 #define VIRTIO_CRYPTO_RSA_SHA256    6
0200 #define VIRTIO_CRYPTO_RSA_SHA384    7
0201 #define VIRTIO_CRYPTO_RSA_SHA512    8
0202 #define VIRTIO_CRYPTO_RSA_SHA224    9
0203     __le32 hash_algo;
0204 };
0205 
0206 struct virtio_crypto_ecdsa_session_para {
0207 #define VIRTIO_CRYPTO_CURVE_UNKNOWN   0
0208 #define VIRTIO_CRYPTO_CURVE_NIST_P192 1
0209 #define VIRTIO_CRYPTO_CURVE_NIST_P224 2
0210 #define VIRTIO_CRYPTO_CURVE_NIST_P256 3
0211 #define VIRTIO_CRYPTO_CURVE_NIST_P384 4
0212 #define VIRTIO_CRYPTO_CURVE_NIST_P521 5
0213     __le32 curve_id;
0214     __le32 padding;
0215 };
0216 
0217 struct virtio_crypto_akcipher_session_para {
0218 #define VIRTIO_CRYPTO_NO_AKCIPHER    0
0219 #define VIRTIO_CRYPTO_AKCIPHER_RSA   1
0220 #define VIRTIO_CRYPTO_AKCIPHER_DSA   2
0221 #define VIRTIO_CRYPTO_AKCIPHER_ECDSA 3
0222     __le32 algo;
0223 
0224 #define VIRTIO_CRYPTO_AKCIPHER_KEY_TYPE_PUBLIC  1
0225 #define VIRTIO_CRYPTO_AKCIPHER_KEY_TYPE_PRIVATE 2
0226     __le32 keytype;
0227     __le32 keylen;
0228 
0229     union {
0230         struct virtio_crypto_rsa_session_para rsa;
0231         struct virtio_crypto_ecdsa_session_para ecdsa;
0232     } u;
0233 };
0234 
0235 struct virtio_crypto_akcipher_create_session_req {
0236     struct virtio_crypto_akcipher_session_para para;
0237     __u8 padding[36];
0238 };
0239 
0240 struct virtio_crypto_alg_chain_session_para {
0241 #define VIRTIO_CRYPTO_SYM_ALG_CHAIN_ORDER_HASH_THEN_CIPHER  1
0242 #define VIRTIO_CRYPTO_SYM_ALG_CHAIN_ORDER_CIPHER_THEN_HASH  2
0243     __le32 alg_chain_order;
0244 /* Plain hash */
0245 #define VIRTIO_CRYPTO_SYM_HASH_MODE_PLAIN    1
0246 /* Authenticated hash (mac) */
0247 #define VIRTIO_CRYPTO_SYM_HASH_MODE_AUTH     2
0248 /* Nested hash */
0249 #define VIRTIO_CRYPTO_SYM_HASH_MODE_NESTED   3
0250     __le32 hash_mode;
0251     struct virtio_crypto_cipher_session_para cipher_param;
0252     union {
0253         struct virtio_crypto_hash_session_para hash_param;
0254         struct virtio_crypto_mac_session_para mac_param;
0255         __u8 padding[16];
0256     } u;
0257     /* length of the additional authenticated data (AAD) in bytes */
0258     __le32 aad_len;
0259     __le32 padding;
0260 };
0261 
0262 struct virtio_crypto_alg_chain_session_req {
0263     struct virtio_crypto_alg_chain_session_para para;
0264 };
0265 
0266 struct virtio_crypto_sym_create_session_req {
0267     union {
0268         struct virtio_crypto_cipher_session_req cipher;
0269         struct virtio_crypto_alg_chain_session_req chain;
0270         __u8 padding[48];
0271     } u;
0272 
0273     /* Device-readable part */
0274 
0275 /* No operation */
0276 #define VIRTIO_CRYPTO_SYM_OP_NONE  0
0277 /* Cipher only operation on the data */
0278 #define VIRTIO_CRYPTO_SYM_OP_CIPHER  1
0279 /*
0280  * Chain any cipher with any hash or mac operation. The order
0281  * depends on the value of alg_chain_order param
0282  */
0283 #define VIRTIO_CRYPTO_SYM_OP_ALGORITHM_CHAINING  2
0284     __le32 op_type;
0285     __le32 padding;
0286 };
0287 
0288 struct virtio_crypto_destroy_session_req {
0289     /* Device-readable part */
0290     __le64  session_id;
0291     __u8 padding[48];
0292 };
0293 
0294 /* The request of the control virtqueue's packet */
0295 struct virtio_crypto_op_ctrl_req {
0296     struct virtio_crypto_ctrl_header header;
0297 
0298     union {
0299         struct virtio_crypto_sym_create_session_req
0300             sym_create_session;
0301         struct virtio_crypto_hash_create_session_req
0302             hash_create_session;
0303         struct virtio_crypto_mac_create_session_req
0304             mac_create_session;
0305         struct virtio_crypto_aead_create_session_req
0306             aead_create_session;
0307         struct virtio_crypto_akcipher_create_session_req
0308             akcipher_create_session;
0309         struct virtio_crypto_destroy_session_req
0310             destroy_session;
0311         __u8 padding[56];
0312     } u;
0313 };
0314 
0315 struct virtio_crypto_op_header {
0316 #define VIRTIO_CRYPTO_CIPHER_ENCRYPT \
0317     VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_CIPHER, 0x00)
0318 #define VIRTIO_CRYPTO_CIPHER_DECRYPT \
0319     VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_CIPHER, 0x01)
0320 #define VIRTIO_CRYPTO_HASH \
0321     VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_HASH, 0x00)
0322 #define VIRTIO_CRYPTO_MAC \
0323     VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_MAC, 0x00)
0324 #define VIRTIO_CRYPTO_AEAD_ENCRYPT \
0325     VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_AEAD, 0x00)
0326 #define VIRTIO_CRYPTO_AEAD_DECRYPT \
0327     VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_AEAD, 0x01)
0328 #define VIRTIO_CRYPTO_AKCIPHER_ENCRYPT \
0329     VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_AKCIPHER, 0x00)
0330 #define VIRTIO_CRYPTO_AKCIPHER_DECRYPT \
0331     VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_AKCIPHER, 0x01)
0332 #define VIRTIO_CRYPTO_AKCIPHER_SIGN \
0333     VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_AKCIPHER, 0x02)
0334 #define VIRTIO_CRYPTO_AKCIPHER_VERIFY \
0335     VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_AKCIPHER, 0x03)
0336     __le32 opcode;
0337     /* algo should be service-specific algorithms */
0338     __le32 algo;
0339     /* session_id should be service-specific algorithms */
0340     __le64 session_id;
0341     /* control flag to control the request */
0342     __le32 flag;
0343     __le32 padding;
0344 };
0345 
0346 struct virtio_crypto_cipher_para {
0347     /*
0348      * Byte Length of valid IV/Counter
0349      *
0350      * For block ciphers in CBC or F8 mode, or for Kasumi in F8 mode, or for
0351      *   SNOW3G in UEA2 mode, this is the length of the IV (which
0352      *   must be the same as the block length of the cipher).
0353      * For block ciphers in CTR mode, this is the length of the counter
0354      *   (which must be the same as the block length of the cipher).
0355      * For AES-XTS, this is the 128bit tweak, i, from IEEE Std 1619-2007.
0356      *
0357      * The IV/Counter will be updated after every partial cryptographic
0358      * operation.
0359      */
0360     __le32 iv_len;
0361     /* length of source data */
0362     __le32 src_data_len;
0363     /* length of dst data */
0364     __le32 dst_data_len;
0365     __le32 padding;
0366 };
0367 
0368 struct virtio_crypto_hash_para {
0369     /* length of source data */
0370     __le32 src_data_len;
0371     /* hash result length */
0372     __le32 hash_result_len;
0373 };
0374 
0375 struct virtio_crypto_mac_para {
0376     struct virtio_crypto_hash_para hash;
0377 };
0378 
0379 struct virtio_crypto_aead_para {
0380     /*
0381      * Byte Length of valid IV data pointed to by the below iv_addr
0382      * parameter.
0383      *
0384      * For GCM mode, this is either 12 (for 96-bit IVs) or 16, in which
0385      *   case iv_addr points to J0.
0386      * For CCM mode, this is the length of the nonce, which can be in the
0387      *   range 7 to 13 inclusive.
0388      */
0389     __le32 iv_len;
0390     /* length of additional auth data */
0391     __le32 aad_len;
0392     /* length of source data */
0393     __le32 src_data_len;
0394     /* length of dst data */
0395     __le32 dst_data_len;
0396 };
0397 
0398 struct virtio_crypto_cipher_data_req {
0399     /* Device-readable part */
0400     struct virtio_crypto_cipher_para para;
0401     __u8 padding[24];
0402 };
0403 
0404 struct virtio_crypto_hash_data_req {
0405     /* Device-readable part */
0406     struct virtio_crypto_hash_para para;
0407     __u8 padding[40];
0408 };
0409 
0410 struct virtio_crypto_mac_data_req {
0411     /* Device-readable part */
0412     struct virtio_crypto_mac_para para;
0413     __u8 padding[40];
0414 };
0415 
0416 struct virtio_crypto_alg_chain_data_para {
0417     __le32 iv_len;
0418     /* Length of source data */
0419     __le32 src_data_len;
0420     /* Length of destination data */
0421     __le32 dst_data_len;
0422     /* Starting point for cipher processing in source data */
0423     __le32 cipher_start_src_offset;
0424     /* Length of the source data that the cipher will be computed on */
0425     __le32 len_to_cipher;
0426     /* Starting point for hash processing in source data */
0427     __le32 hash_start_src_offset;
0428     /* Length of the source data that the hash will be computed on */
0429     __le32 len_to_hash;
0430     /* Length of the additional auth data */
0431     __le32 aad_len;
0432     /* Length of the hash result */
0433     __le32 hash_result_len;
0434     __le32 reserved;
0435 };
0436 
0437 struct virtio_crypto_alg_chain_data_req {
0438     /* Device-readable part */
0439     struct virtio_crypto_alg_chain_data_para para;
0440 };
0441 
0442 struct virtio_crypto_sym_data_req {
0443     union {
0444         struct virtio_crypto_cipher_data_req cipher;
0445         struct virtio_crypto_alg_chain_data_req chain;
0446         __u8 padding[40];
0447     } u;
0448 
0449     /* See above VIRTIO_CRYPTO_SYM_OP_* */
0450     __le32 op_type;
0451     __le32 padding;
0452 };
0453 
0454 struct virtio_crypto_aead_data_req {
0455     /* Device-readable part */
0456     struct virtio_crypto_aead_para para;
0457     __u8 padding[32];
0458 };
0459 
0460 struct virtio_crypto_akcipher_para {
0461     __le32 src_data_len;
0462     __le32 dst_data_len;
0463 };
0464 
0465 struct virtio_crypto_akcipher_data_req {
0466     struct virtio_crypto_akcipher_para para;
0467     __u8 padding[40];
0468 };
0469 
0470 /* The request of the data virtqueue's packet */
0471 struct virtio_crypto_op_data_req {
0472     struct virtio_crypto_op_header header;
0473 
0474     union {
0475         struct virtio_crypto_sym_data_req  sym_req;
0476         struct virtio_crypto_hash_data_req hash_req;
0477         struct virtio_crypto_mac_data_req mac_req;
0478         struct virtio_crypto_aead_data_req aead_req;
0479         struct virtio_crypto_akcipher_data_req akcipher_req;
0480         __u8 padding[48];
0481     } u;
0482 };
0483 
0484 #define VIRTIO_CRYPTO_OK        0
0485 #define VIRTIO_CRYPTO_ERR       1
0486 #define VIRTIO_CRYPTO_BADMSG    2
0487 #define VIRTIO_CRYPTO_NOTSUPP   3
0488 #define VIRTIO_CRYPTO_INVSESS   4 /* Invalid session id */
0489 #define VIRTIO_CRYPTO_NOSPC     5 /* no free session ID */
0490 #define VIRTIO_CRYPTO_KEY_REJECTED 6 /* Signature verification failed */
0491 
0492 /* The accelerator hardware is ready */
0493 #define VIRTIO_CRYPTO_S_HW_READY  (1 << 0)
0494 
0495 struct virtio_crypto_config {
0496     /* See VIRTIO_CRYPTO_OP_* above */
0497     __le32  status;
0498 
0499     /*
0500      * Maximum number of data queue
0501      */
0502     __le32  max_dataqueues;
0503 
0504     /*
0505      * Specifies the services mask which the device support,
0506      * see VIRTIO_CRYPTO_SERVICE_* above
0507      */
0508     __le32 crypto_services;
0509 
0510     /* Detailed algorithms mask */
0511     __le32 cipher_algo_l;
0512     __le32 cipher_algo_h;
0513     __le32 hash_algo;
0514     __le32 mac_algo_l;
0515     __le32 mac_algo_h;
0516     __le32 aead_algo;
0517     /* Maximum length of cipher key */
0518     __le32 max_cipher_key_len;
0519     /* Maximum length of authenticated key */
0520     __le32 max_auth_key_len;
0521     __le32 akcipher_algo;
0522     /* Maximum size of each crypto request's content */
0523     __le64 max_size;
0524 };
0525 
0526 struct virtio_crypto_inhdr {
0527     /* See VIRTIO_CRYPTO_* above */
0528     __u8 status;
0529 };
0530 #endif