virtio-crypto: use private buffer for control request
[linux-2.6-microblaze.git] / drivers / crypto / virtio / virtio_crypto_common.h
index e693d4e..2422237 100644 (file)
@@ -13,6 +13,7 @@
 #include <crypto/aead.h>
 #include <crypto/aes.h>
 #include <crypto/engine.h>
+#include <uapi/linux/virtio_crypto.h>
 
 
 /* Internal representation of a data virtqueue */
@@ -65,11 +66,6 @@ struct virtio_crypto {
        /* Maximum size of per request */
        u64 max_size;
 
-       /* Control VQ buffers: protected by the ctrl_lock */
-       struct virtio_crypto_op_ctrl_req ctrl;
-       struct virtio_crypto_session_input input;
-       struct virtio_crypto_inhdr ctrl_status;
-
        unsigned long status;
        atomic_t ref_count;
        struct list_head list;
@@ -85,6 +81,17 @@ struct virtio_crypto_sym_session_info {
        __u64 session_id;
 };
 
+/*
+ * Note: there are padding fields in request, clear them to zero before
+ *       sending to host to avoid to divulge any information.
+ * Ex, virtio_crypto_ctrl_request::ctrl::u::destroy_session::padding[48]
+ */
+struct virtio_crypto_ctrl_request {
+       struct virtio_crypto_op_ctrl_req ctrl;
+       struct virtio_crypto_session_input input;
+       struct virtio_crypto_inhdr ctrl_status;
+};
+
 struct virtio_crypto_request;
 typedef void (*virtio_crypto_data_callback)
                (struct virtio_crypto_request *vc_req, int len);