diff mbox

[for-2.9,3/3] tests: crypto: add testcase for standard des(ecb)

Message ID 1480928380-161760-4-git-send-email-longpeng2@huawei.com (mailing list archive)
State New, archived
Headers show

Commit Message

Longpeng(Mike) Dec. 5, 2016, 8:59 a.m. UTC
As we have added standart DES support when using gcrypt/nettle,
so this patch add a testcase for standard ecb(des).

Note: the data is copied from linux-kernel's tcrypt module.

Signed-off-by: Longpeng(Mike) <longpeng2@huawei.com>
---
 tests/test-crypto-cipher.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Daniel P. Berrangé Dec. 5, 2016, 9:24 a.m. UTC | #1
On Mon, Dec 05, 2016 at 04:59:40PM +0800, Longpeng(Mike) wrote:
> As we have added standart DES support when using gcrypt/nettle,
> so this patch add a testcase for standard ecb(des).
> 
> Note: the data is copied from linux-kernel's tcrypt module.
> 
> Signed-off-by: Longpeng(Mike) <longpeng2@huawei.com>
> ---
>  tests/test-crypto-cipher.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/tests/test-crypto-cipher.c b/tests/test-crypto-cipher.c
> index 5d9e535..382d77e 100644
> --- a/tests/test-crypto-cipher.c
> +++ b/tests/test-crypto-cipher.c
> @@ -150,6 +150,17 @@ static QCryptoCipherTestData test_data[] = {
>              "b2eb05e2c39be9fcda6c19078c6a9d1b",
>      },
>      {
> +        .path = "/crypto/cipher/des-ecb",
> +        .alg = QCRYPTO_CIPHER_ALG_DES,
> +        .mode = QCRYPTO_CIPHER_MODE_ECB,
> +        .key =
> +            "0123456789abcdef",
> +        .plaintext =
> +            "0123456789abcde7",
> +        .ciphertext =
> +            "c95744256a5ed31d",
> +    },
> +    {
>          .path = "/crypto/cipher/des-rfb-ecb-56",
>          .alg = QCRYPTO_CIPHER_ALG_DES_RFB,
>          .mode = QCRYPTO_CIPHER_MODE_ECB,

This should be included as part of the patch which adds the cipher
in the first place. Ideally there should be a CBC mode test as well.

Regards,
Daniel
Longpeng(Mike) Dec. 5, 2016, 9:46 a.m. UTC | #2
Hi Daniel,

On 2016/12/5 17:24, Daniel P. Berrange wrote:

> On Mon, Dec 05, 2016 at 04:59:40PM +0800, Longpeng(Mike) wrote:
......
>>      {
>> +        .path = "/crypto/cipher/des-ecb",
>> +        .alg = QCRYPTO_CIPHER_ALG_DES,
>> +        .mode = QCRYPTO_CIPHER_MODE_ECB,
>> +        .key =
>> +            "0123456789abcdef",
>> +        .plaintext =
>> +            "0123456789abcde7",
>> +        .ciphertext =
>> +            "c95744256a5ed31d",
>> +    },
>> +    {
>>          .path = "/crypto/cipher/des-rfb-ecb-56",
>>          .alg = QCRYPTO_CIPHER_ALG_DES_RFB,
>>          .mode = QCRYPTO_CIPHER_MODE_ECB,
> 
> This should be included as part of the patch which adds the cipher
> in the first place. Ideally there should be a CBC mode test as well.
> 

Okay.
I will put this in the first patch(which adds the cipher) and add a cbc(aes)
testcase in v2. :)

> Regards,
> Daniel
diff mbox

Patch

diff --git a/tests/test-crypto-cipher.c b/tests/test-crypto-cipher.c
index 5d9e535..382d77e 100644
--- a/tests/test-crypto-cipher.c
+++ b/tests/test-crypto-cipher.c
@@ -150,6 +150,17 @@  static QCryptoCipherTestData test_data[] = {
             "b2eb05e2c39be9fcda6c19078c6a9d1b",
     },
     {
+        .path = "/crypto/cipher/des-ecb",
+        .alg = QCRYPTO_CIPHER_ALG_DES,
+        .mode = QCRYPTO_CIPHER_MODE_ECB,
+        .key =
+            "0123456789abcdef",
+        .plaintext =
+            "0123456789abcde7",
+        .ciphertext =
+            "c95744256a5ed31d",
+    },
+    {
         .path = "/crypto/cipher/des-rfb-ecb-56",
         .alg = QCRYPTO_CIPHER_ALG_DES_RFB,
         .mode = QCRYPTO_CIPHER_MODE_ECB,