diff mbox

[for-2.9] cryptodev: add 3des-ede support

Message ID 1481165546-203200-1-git-send-email-longpeng2@huawei.com (mailing list archive)
State New, archived
Headers show

Commit Message

Longpeng(Mike) Dec. 8, 2016, 2:52 a.m. UTC
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>
---
Changes since v1:
    - split the original pathset. [Gonglei]

---
 backends/cryptodev-builtin.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Gonglei (Arei) Dec. 9, 2016, 5:47 a.m. UTC | #1
> -----Original Message-----
> From: longpeng
> Sent: Thursday, December 08, 2016 10:52 AM
> To: Gonglei (Arei)
> Cc: Wubin (H); Zhoujian (jay, Euler); qemu-devel@nongnu.org; longpeng
> Subject: [PATCH for-2.9] cryptodev: add 3des-ede support
> 
> 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>
> ---
> Changes since v1:
>     - split the original pathset. [Gonglei]
> 
> ---
>  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.8.3.1
> 

Queued, thanks.

Regards,
-Gonglei
diff mbox

Patch

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);