* [Qemu-devel] [PULL 0/4] cryptodev patches
@ 2016-12-24 6:12 Gonglei
2016-12-24 6:12 ` [Qemu-devel] [PULL 1/4] cryptodev: fix the check of aes algorithm Gonglei
` (5 more replies)
0 siblings, 6 replies; 8+ messages in thread
From: Gonglei @ 2016-12-24 6:12 UTC (permalink / raw)
To: qemu-devel; +Cc: peter.maydell, Gonglei
The following changes since commit a470b33259bf82ef2336bfcd5d07640562d3f63b:
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging (2016-12-22 19:23:51 +0000)
are available in the git repository at:
https://github.com/gongleiarei/qemu.git tags/cryptodev-next-20161224
for you to fetch changes up to 48ae36c0ad16bb757d4f6e243b8e9072fc8e8c8e:
cryptodev: add 3des-ede support (2016-12-24 13:46:27 +0800)
----------------------------------------------------------------
- add xts mode support
- add 3DES algorithm support
- other trivial fixes
----------------------------------------------------------------
Longpeng(Mike) (4):
cryptodev: fix the check of aes algorithm
cryptodev: add xts(aes) support
cryptodev: remove single-DES support in cryptodev
cryptodev: add 3des-ede support
backends/cryptodev-builtin.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++---------------
1 file changed, 50 insertions(+), 15 deletions(-)
--
1.7.12.4
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Qemu-devel] [PULL 1/4] cryptodev: fix the check of aes algorithm
2016-12-24 6:12 [Qemu-devel] [PULL 0/4] cryptodev patches Gonglei
@ 2016-12-24 6:12 ` Gonglei
2016-12-24 6:12 ` [Qemu-devel] [PULL 2/4] cryptodev: add xts(aes) support Gonglei
` (4 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Gonglei @ 2016-12-24 6:12 UTC (permalink / raw)
To: qemu-devel; +Cc: peter.maydell, Longpeng(Mike), Gonglei
From: "Longpeng(Mike)" <longpeng2@huawei.com>
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>
---
backends/cryptodev-builtin.c | 47 +++++++++++++++++++++++++++++++-------------
1 file changed, 33 insertions(+), 14 deletions(-)
diff --git a/backends/cryptodev-builtin.c b/backends/cryptodev-builtin.c
index eda954b..57980cb 100644
--- a/backends/cryptodev-builtin.c
+++ b/backends/cryptodev-builtin.c
@@ -111,23 +111,42 @@ cryptodev_builtin_get_unused_session_index(
return -1;
}
+#define AES_KEYSIZE_128 16
+#define AES_KEYSIZE_192 24
+#define AES_KEYSIZE_256 32
+#define AES_KEYSIZE_128_XTS AES_KEYSIZE_256
+#define AES_KEYSIZE_256_XTS 64
+
static int
-cryptodev_builtin_get_aes_algo(uint32_t key_len, Error **errp)
+cryptodev_builtin_get_aes_algo(uint32_t key_len, int mode, Error **errp)
{
int algo;
- if (key_len == 128 / 8) {
+ if (key_len == AES_KEYSIZE_128) {
algo = QCRYPTO_CIPHER_ALG_AES_128;
- } else if (key_len == 192 / 8) {
+ } else if (key_len == AES_KEYSIZE_192) {
algo = QCRYPTO_CIPHER_ALG_AES_192;
- } else if (key_len == 256 / 8) {
- algo = QCRYPTO_CIPHER_ALG_AES_256;
+ } else if (key_len == AES_KEYSIZE_256) { /* equals AES_KEYSIZE_128_XTS */
+ if (mode == QCRYPTO_CIPHER_MODE_XTS) {
+ algo = QCRYPTO_CIPHER_ALG_AES_128;
+ } else {
+ algo = QCRYPTO_CIPHER_ALG_AES_256;
+ }
+ } else if (key_len == AES_KEYSIZE_256_XTS) {
+ if (mode == QCRYPTO_CIPHER_MODE_XTS) {
+ algo = QCRYPTO_CIPHER_ALG_AES_256;
+ } else {
+ goto err;
+ }
} else {
- error_setg(errp, "Unsupported key length :%u", key_len);
- return -1;
+ goto err;
}
return algo;
+
+err:
+ error_setg(errp, "Unsupported key length :%u", key_len);
+ return -1;
}
static int cryptodev_builtin_create_cipher_session(
@@ -155,32 +174,32 @@ static int cryptodev_builtin_create_cipher_session(
switch (sess_info->cipher_alg) {
case VIRTIO_CRYPTO_CIPHER_AES_ECB:
+ mode = QCRYPTO_CIPHER_MODE_ECB;
algo = cryptodev_builtin_get_aes_algo(sess_info->key_len,
- errp);
+ mode, errp);
if (algo < 0) {
return -1;
}
- mode = QCRYPTO_CIPHER_MODE_ECB;
break;
case VIRTIO_CRYPTO_CIPHER_AES_CBC:
+ mode = QCRYPTO_CIPHER_MODE_CBC;
algo = cryptodev_builtin_get_aes_algo(sess_info->key_len,
- errp);
+ mode, errp);
if (algo < 0) {
return -1;
}
- mode = QCRYPTO_CIPHER_MODE_CBC;
break;
case VIRTIO_CRYPTO_CIPHER_AES_CTR:
+ mode = QCRYPTO_CIPHER_MODE_CTR;
algo = cryptodev_builtin_get_aes_algo(sess_info->key_len,
- errp);
+ mode, errp);
if (algo < 0) {
return -1;
}
- mode = QCRYPTO_CIPHER_MODE_CTR;
break;
case VIRTIO_CRYPTO_CIPHER_DES_ECB:
- algo = QCRYPTO_CIPHER_ALG_DES_RFB;
mode = QCRYPTO_CIPHER_MODE_ECB;
+ algo = QCRYPTO_CIPHER_ALG_DES_RFB;
break;
default:
error_setg(errp, "Unsupported cipher alg :%u",
--
1.7.12.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Qemu-devel] [PULL 2/4] cryptodev: add xts(aes) support
2016-12-24 6:12 [Qemu-devel] [PULL 0/4] cryptodev patches Gonglei
2016-12-24 6:12 ` [Qemu-devel] [PULL 1/4] cryptodev: fix the check of aes algorithm Gonglei
@ 2016-12-24 6:12 ` Gonglei
2016-12-24 6:12 ` [Qemu-devel] [PULL 3/4] cryptodev: remove single-DES support in cryptodev Gonglei
` (3 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Gonglei @ 2016-12-24 6:12 UTC (permalink / raw)
To: qemu-devel; +Cc: peter.maydell, Longpeng(Mike), Gonglei
From: "Longpeng(Mike)" <longpeng2@huawei.com>
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>
---
backends/cryptodev-builtin.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/backends/cryptodev-builtin.c b/backends/cryptodev-builtin.c
index 57980cb..a4224f4 100644
--- a/backends/cryptodev-builtin.c
+++ b/backends/cryptodev-builtin.c
@@ -197,6 +197,14 @@ static int cryptodev_builtin_create_cipher_session(
return -1;
}
break;
+ case VIRTIO_CRYPTO_CIPHER_AES_XTS:
+ mode = QCRYPTO_CIPHER_MODE_XTS;
+ algo = cryptodev_builtin_get_aes_algo(sess_info->key_len,
+ mode, errp);
+ if (algo < 0) {
+ return -1;
+ }
+ break;
case VIRTIO_CRYPTO_CIPHER_DES_ECB:
mode = QCRYPTO_CIPHER_MODE_ECB;
algo = QCRYPTO_CIPHER_ALG_DES_RFB;
--
1.7.12.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Qemu-devel] [PULL 3/4] cryptodev: remove single-DES support in cryptodev
2016-12-24 6:12 [Qemu-devel] [PULL 0/4] cryptodev patches Gonglei
2016-12-24 6:12 ` [Qemu-devel] [PULL 1/4] cryptodev: fix the check of aes algorithm Gonglei
2016-12-24 6:12 ` [Qemu-devel] [PULL 2/4] cryptodev: add xts(aes) support Gonglei
@ 2016-12-24 6:12 ` Gonglei
2016-12-24 6:12 ` [Qemu-devel] [PULL 4/4] cryptodev: add 3des-ede support Gonglei
` (2 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Gonglei @ 2016-12-24 6:12 UTC (permalink / raw)
To: qemu-devel; +Cc: peter.maydell, Longpeng(Mike), Gonglei
From: "Longpeng(Mike)" <longpeng2@huawei.com>
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>
---
backends/cryptodev-builtin.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/backends/cryptodev-builtin.c b/backends/cryptodev-builtin.c
index a4224f4..5fb2836 100644
--- a/backends/cryptodev-builtin.c
+++ b/backends/cryptodev-builtin.c
@@ -205,10 +205,6 @@ static int cryptodev_builtin_create_cipher_session(
return -1;
}
break;
- case VIRTIO_CRYPTO_CIPHER_DES_ECB:
- mode = QCRYPTO_CIPHER_MODE_ECB;
- algo = QCRYPTO_CIPHER_ALG_DES_RFB;
- break;
default:
error_setg(errp, "Unsupported cipher alg :%u",
sess_info->cipher_alg);
--
1.7.12.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Qemu-devel] [PULL 4/4] cryptodev: add 3des-ede support
2016-12-24 6:12 [Qemu-devel] [PULL 0/4] cryptodev patches Gonglei
` (2 preceding siblings ...)
2016-12-24 6:12 ` [Qemu-devel] [PULL 3/4] cryptodev: remove single-DES support in cryptodev Gonglei
@ 2016-12-24 6:12 ` Gonglei
2016-12-27 17:29 ` [Qemu-devel] [PULL 0/4] cryptodev patches Peter Maydell
2017-01-06 16:04 ` Peter Maydell
5 siblings, 0 replies; 8+ messages in thread
From: Gonglei @ 2016-12-24 6:12 UTC (permalink / raw)
To: qemu-devel; +Cc: peter.maydell, Longpeng(Mike), Gonglei
From: "Longpeng(Mike)" <longpeng2@huawei.com>
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>
---
backends/cryptodev-builtin.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/backends/cryptodev-builtin.c b/backends/cryptodev-builtin.c
index 5fb2836..486b4a6 100644
--- a/backends/cryptodev-builtin.c
+++ b/backends/cryptodev-builtin.c
@@ -205,6 +205,18 @@ static int cryptodev_builtin_create_cipher_session(
return -1;
}
break;
+ case VIRTIO_CRYPTO_CIPHER_3DES_ECB:
+ mode = QCRYPTO_CIPHER_MODE_ECB;
+ algo = QCRYPTO_CIPHER_ALG_3DES;
+ break;
+ case VIRTIO_CRYPTO_CIPHER_3DES_CBC:
+ mode = QCRYPTO_CIPHER_MODE_CBC;
+ algo = QCRYPTO_CIPHER_ALG_3DES;
+ break;
+ case VIRTIO_CRYPTO_CIPHER_3DES_CTR:
+ mode = QCRYPTO_CIPHER_MODE_CTR;
+ algo = QCRYPTO_CIPHER_ALG_3DES;
+ break;
default:
error_setg(errp, "Unsupported cipher alg :%u",
sess_info->cipher_alg);
--
1.7.12.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PULL 0/4] cryptodev patches
2016-12-24 6:12 [Qemu-devel] [PULL 0/4] cryptodev patches Gonglei
` (3 preceding siblings ...)
2016-12-24 6:12 ` [Qemu-devel] [PULL 4/4] cryptodev: add 3des-ede support Gonglei
@ 2016-12-27 17:29 ` Peter Maydell
2016-12-28 1:03 ` Gonglei (Arei)
2017-01-06 16:04 ` Peter Maydell
5 siblings, 1 reply; 8+ messages in thread
From: Peter Maydell @ 2016-12-27 17:29 UTC (permalink / raw)
To: Gonglei; +Cc: QEMU Developers
On 24 December 2016 at 06:12, Gonglei <arei.gonglei@huawei.com> wrote:
> The following changes since commit a470b33259bf82ef2336bfcd5d07640562d3f63b:
>
> Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging (2016-12-22 19:23:51 +0000)
>
> are available in the git repository at:
>
>
> https://github.com/gongleiarei/qemu.git tags/cryptodev-next-20161224
>
> for you to fetch changes up to 48ae36c0ad16bb757d4f6e243b8e9072fc8e8c8e:
>
> cryptodev: add 3des-ede support (2016-12-24 13:46:27 +0800)
>
> ----------------------------------------------------------------
> - add xts mode support
> - add 3DES algorithm support
> - other trivial fixes
>
> ----------------------------------------------------------------
> Longpeng(Mike) (4):
> cryptodev: fix the check of aes algorithm
> cryptodev: add xts(aes) support
> cryptodev: remove single-DES support in cryptodev
> cryptodev: add 3des-ede support
>
> backends/cryptodev-builtin.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++---------------
> 1 file changed, 50 insertions(+), 15 deletions(-)
Hi. This pull request does not appear to be signed by the GPG
key that I have on record for you, and the key it is signed
by seems to be only self-signed and not signed by anybody
else...
thanks
-- PMM
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PULL 0/4] cryptodev patches
2016-12-27 17:29 ` [Qemu-devel] [PULL 0/4] cryptodev patches Peter Maydell
@ 2016-12-28 1:03 ` Gonglei (Arei)
0 siblings, 0 replies; 8+ messages in thread
From: Gonglei (Arei) @ 2016-12-28 1:03 UTC (permalink / raw)
To: Peter Maydell; +Cc: QEMU Developers
>
> From: Peter Maydell [mailto:peter.maydell@linaro.org]
> Sent: Wednesday, December 28, 2016 1:29 AM
> To: Gonglei (Arei)
> Cc: QEMU Developers
> Subject: Re: [PULL 0/4] cryptodev patches
>
> On 24 December 2016 at 06:12, Gonglei <arei.gonglei@huawei.com> wrote:
> > The following changes since commit
> a470b33259bf82ef2336bfcd5d07640562d3f63b:
> >
> > Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into
> staging (2016-12-22 19:23:51 +0000)
> >
> > are available in the git repository at:
> >
> >
> > https://github.com/gongleiarei/qemu.git tags/cryptodev-next-20161224
> >
> > for you to fetch changes up to
> 48ae36c0ad16bb757d4f6e243b8e9072fc8e8c8e:
> >
> > cryptodev: add 3des-ede support (2016-12-24 13:46:27 +0800)
> >
> > ----------------------------------------------------------------
> > - add xts mode support
> > - add 3DES algorithm support
> > - other trivial fixes
> >
> > ----------------------------------------------------------------
> > Longpeng(Mike) (4):
> > cryptodev: fix the check of aes algorithm
> > cryptodev: add xts(aes) support
> > cryptodev: remove single-DES support in cryptodev
> > cryptodev: add 3des-ede support
> >
> > backends/cryptodev-builtin.c | 65
> ++++++++++++++++++++++++++++++++++++++++++++++++++---------------
> > 1 file changed, 50 insertions(+), 15 deletions(-)
>
> Hi. This pull request does not appear to be signed by the GPG
> key that I have on record for you, and the key it is signed
> by seems to be only self-signed and not signed by anybody
> else...
>
Sorry about that. Actually I had pushed the key to public key server.
I can search my key in the web site, pls see:
http://keyserver.ubuntu.com:11371/pks/lookup?op=vindex&fingerprint=on&search=0x2ED7FDE9063C864D
How do I do now? Thanks!
Regards,
-Gonglei
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PULL 0/4] cryptodev patches
2016-12-24 6:12 [Qemu-devel] [PULL 0/4] cryptodev patches Gonglei
` (4 preceding siblings ...)
2016-12-27 17:29 ` [Qemu-devel] [PULL 0/4] cryptodev patches Peter Maydell
@ 2017-01-06 16:04 ` Peter Maydell
5 siblings, 0 replies; 8+ messages in thread
From: Peter Maydell @ 2017-01-06 16:04 UTC (permalink / raw)
To: Gonglei; +Cc: QEMU Developers
On 24 December 2016 at 06:12, Gonglei <arei.gonglei@huawei.com> wrote:
> The following changes since commit a470b33259bf82ef2336bfcd5d07640562d3f63b:
>
> Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging (2016-12-22 19:23:51 +0000)
>
> are available in the git repository at:
>
>
> https://github.com/gongleiarei/qemu.git tags/cryptodev-next-20161224
>
> for you to fetch changes up to 48ae36c0ad16bb757d4f6e243b8e9072fc8e8c8e:
>
> cryptodev: add 3des-ede support (2016-12-24 13:46:27 +0800)
>
> ----------------------------------------------------------------
> - add xts mode support
> - add 3DES algorithm support
> - other trivial fixes
>
> ----------------------------------------------------------------
> Longpeng(Mike) (4):
> cryptodev: fix the check of aes algorithm
> cryptodev: add xts(aes) support
> cryptodev: remove single-DES support in cryptodev
> cryptodev: add 3des-ede support
>
> backends/cryptodev-builtin.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++---------------
> 1 file changed, 50 insertions(+), 15 deletions(-)
Applied to master, thanks.
-- PMM
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2017-01-06 16:05 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-24 6:12 [Qemu-devel] [PULL 0/4] cryptodev patches Gonglei
2016-12-24 6:12 ` [Qemu-devel] [PULL 1/4] cryptodev: fix the check of aes algorithm Gonglei
2016-12-24 6:12 ` [Qemu-devel] [PULL 2/4] cryptodev: add xts(aes) support Gonglei
2016-12-24 6:12 ` [Qemu-devel] [PULL 3/4] cryptodev: remove single-DES support in cryptodev Gonglei
2016-12-24 6:12 ` [Qemu-devel] [PULL 4/4] cryptodev: add 3des-ede support Gonglei
2016-12-27 17:29 ` [Qemu-devel] [PULL 0/4] cryptodev patches Peter Maydell
2016-12-28 1:03 ` Gonglei (Arei)
2017-01-06 16:04 ` Peter Maydell
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.