summaryrefslogtreecommitdiff
path: root/backends/cryptodev-builtin.c
AgeCommit message (Collapse)Author
2020-04-29cryptodev: Fix cryptodev_builtin_cleanup() error API violationMarkus Armbruster
The Error ** argument must be NULL, &error_abort, &error_fatal, or a pointer to a variable containing NULL. Passing an argument of the latter kind twice without clearing it in between is wrong: if the first call sets an error, it no longer points to NULL for the second call. cryptodev_builtin_cleanup() passes @errp to cryptodev_builtin_sym_close_session() in a loop. Harmless, because cryptodev_builtin_sym_close_session() can't actually fail. Fix it anyway. Cc: Gonglei <arei.gonglei@huawei.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20200422130719.28225-2-armbru@redhat.com>
2019-08-16Include hw/boards.h a bit lessMarkus Armbruster
hw/boards.h pulls in almost 60 headers. The less we include it into headers, the better. As a first step, drop superfluous inclusions, and downgrade some more to what's actually needed. Gets rid of just one inclusion into a header. Cc: Eduardo Habkost <ehabkost@redhat.com> Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Message-Id: <20190812052359.30071-23-armbru@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
2018-03-01cryptodev: add vhost supportGonglei
Impliment the vhost-crypto's funtions, such as startup, stop and notification etc. Introduce an enum QCryptoCryptoDevBackendOptionsType in order to identify the cryptodev vhost backend is vhost-user or vhost-kernel-module (If exist). At this point, the cryptdoev-vhost-user works. Signed-off-by: Gonglei <arei.gonglei@huawei.com> Signed-off-by: Longpeng(Mike) <longpeng2@huawei.com> Signed-off-by: Jay Zhou <jianjay.zhou@huawei.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2017-03-23cryptodev: fix asserting single queueHalil Pasic
We already check for queues == 1 in cryptodev_builtin_init and when that is not true raise an error. But before that error is reported the assertion in cryptodev_builtin_cleanup kicks in (because object is being finalized and freed). Let's remove assert(queues == 1) form cryptodev_builtin_cleanup as it does only harm and no good. Reported-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com> Signed-off-by: Halil Pasic <pasic@linux.vnet.ibm.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Gonglei <arei.gonglei@huawei.com>
2017-03-23cryptodev: setiv only when really needLongpeng(Mike)
ECB mode cipher doesn't need IV, if we setiv for it then qemu crypto API would report "Expected IV size 0 not **", so we should setiv only when the cipher algos really need. Signed-off-by: Longpeng(Mike) <longpeng2@huawei.com> Signed-off-by: Gonglei <arei.gonglei@huawei.com>
2017-01-10cryptodev: wrap the ready flagGonglei
The ready flag should be set by the children of cryptodev backend interface. Warp the setter/getter functions for it. Signed-off-by: Gonglei <arei.gonglei@huawei.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2016-12-24cryptodev: add 3des-ede supportLongpeng(Mike)
This patch add 3des-ede support for cryptodev. However this is effective only when backend using libgcrypt/nettle, because cipher-builtin doesn't support 3des-ede yet. Signed-off-by: Longpeng(Mike) <longpeng2@huawei.com> Signed-off-by: Gonglei <arei.gonglei@huawei.com>
2016-12-24cryptodev: remove single-DES support in cryptodevLongpeng(Mike)
Single-DES is obsolete and it's broken/useless for decades, we should remove it in cryptodev, as suggested by Daniel. Guest who wants to use this obsolete cipher alg will use its built-in implementation instead. Signed-off-by: Longpeng(Mike) <longpeng2@huawei.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Signed-off-by: Gonglei <arei.gonglei@huawei.com>
2016-12-24cryptodev: add xts(aes) supportLongpeng(Mike)
This patch add xts(aes) support. Signed-off-by: Longpeng(Mike) <longpeng2@huawei.com> Reviewed-by: Gonglei <arei.gonglei@huawei.com> Signed-off-by: Gonglei <arei.gonglei@huawei.com>
2016-12-24cryptodev: fix the check of aes algorithmLongpeng(Mike)
As the key length of xts(aes) is different with other mode of aes, so we should check specially in cryptodev_builtin_get_aes_algo, if it is xts mode. Signed-off-by: Longpeng(Mike) <longpeng2@huawei.com> Reviewed-by: Gonglei <arei.gonglei@huawei.com> Signed-off-by: Gonglei <arei.gonglei@huawei.com>
2016-10-30cryptodev: introduce a new cryptodev backendGonglei
The new cryptodev backend named cryptodev-builtin, which realized by QEMU cipher APIs. These APIs can be backed by either nettle or gcrypt. Signed-off-by: Gonglei <arei.gonglei@huawei.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>