Re: [PATCH 1/2] crypto: testmgr: test IV value after a cipher operation

2015-10-15 Thread Herbert Xu
On Tue, Jun 16, 2015 at 11:46:46AM +0200, Boris Brezillon wrote:
> The crypto drivers are supposed to update the IV passed to the crypto
> request before calling the completion callback.
> Test for the IV value before considering the test as successful.
> 
> Signed-off-by: Boris Brezillon 

Patch applied with s/ablkcipher/skcipher/ as pointed out by Stephan.

Thanks,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/2] crypto: testmgr: test IV value after a cipher operation

2015-10-15 Thread Herbert Xu
On Tue, Jun 16, 2015 at 11:46:46AM +0200, Boris Brezillon wrote:
> The crypto drivers are supposed to update the IV passed to the crypto
> request before calling the completion callback.
> Test for the IV value before considering the test as successful.
> 
> Signed-off-by: Boris Brezillon 

Patch applied with s/ablkcipher/skcipher/ as pointed out by Stephan.

Thanks,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/2] crypto: testmgr: test IV value after a cipher operation

2015-09-07 Thread Herbert Xu
On Tue, Sep 08, 2015 at 05:23:59AM +0200, Stephan Mueller wrote:
> Am Dienstag, 16. Juni 2015, 11:46:46 schrieb Boris Brezillon:
> 
> Hi Herbert,
> 
> >The crypto drivers are supposed to update the IV passed to the crypto
> >request before calling the completion callback.
> >Test for the IV value before considering the test as successful.
> 
> May I ask whether there is anything wrong with this patch?
> 
> I am asking because the keywrapping template I would like to release would 
> need the test manager to check the generated IV.

There is nothing wrong with the patch.  I just wanted to finish
the skcipher conversion before adding this patch.

Thanks,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/2] crypto: testmgr: test IV value after a cipher operation

2015-09-07 Thread Stephan Mueller
Am Dienstag, 16. Juni 2015, 11:46:46 schrieb Boris Brezillon:

Hi Herbert,

>The crypto drivers are supposed to update the IV passed to the crypto
>request before calling the completion callback.
>Test for the IV value before considering the test as successful.

May I ask whether there is anything wrong with this patch?

I am asking because the keywrapping template I would like to release would 
need the test manager to check the generated IV.

Thanks a lot.

>
>Signed-off-by: Boris Brezillon 
>---
> crypto/testmgr.c | 12 +++-
> crypto/testmgr.h |  1 +
> 2 files changed, 12 insertions(+), 1 deletion(-)
>
>diff --git a/crypto/testmgr.c b/crypto/testmgr.c
>index f9bce3d..e6b5f24 100644
>--- a/crypto/testmgr.c
>+++ b/crypto/testmgr.c
>@@ -1013,12 +1013,22 @@ static int __test_skcipher(struct crypto_ablkcipher
>*tfm, int enc,
>
>   q = data;
>   if (memcmp(q, template[i].result, template[i].rlen)) {
>-  pr_err("alg: skcipher%s: Test %d failed on %s for 
%s\n",
>+  pr_err("alg: skcipher%s: Test %d failed (invalid 
result) on %s for %s\n",
>d, j, e, algo);
>   hexdump(q, template[i].rlen);
>   ret = -EINVAL;
>   goto out;
>   }
>+
>+  if (template[i].iv_out &&
>+  memcmp(iv, template[i].iv_out,
>+ crypto_ablkcipher_ivsize(tfm))) {
>+  pr_err("alg: skcipher%s: Test %d failed (invalid 
output IV) on %s for
>%s\n", +  d, j, e, algo);
>+  hexdump(iv, crypto_ablkcipher_ivsize(tfm));
>+  ret = -EINVAL;
>+  goto out;
>+  }
>   }
>
>   j = 0;
>diff --git a/crypto/testmgr.h b/crypto/testmgr.h
>index 62e2485..03320f9 100644
>--- a/crypto/testmgr.h
>+++ b/crypto/testmgr.h
>@@ -49,6 +49,7 @@ struct hash_testvec {
> struct cipher_testvec {
>   char *key;
>   char *iv;
>+  char *iv_out;
>   char *input;
>   char *result;
>   unsigned short tap[MAX_TAP];


Ciao
Stephan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/2] crypto: testmgr: test IV value after a cipher operation

2015-09-07 Thread Stephan Mueller
Am Dienstag, 16. Juni 2015, 11:46:46 schrieb Boris Brezillon:

Hi Herbert,

>The crypto drivers are supposed to update the IV passed to the crypto
>request before calling the completion callback.
>Test for the IV value before considering the test as successful.

May I ask whether there is anything wrong with this patch?

I am asking because the keywrapping template I would like to release would 
need the test manager to check the generated IV.

Thanks a lot.

>
>Signed-off-by: Boris Brezillon 
>---
> crypto/testmgr.c | 12 +++-
> crypto/testmgr.h |  1 +
> 2 files changed, 12 insertions(+), 1 deletion(-)
>
>diff --git a/crypto/testmgr.c b/crypto/testmgr.c
>index f9bce3d..e6b5f24 100644
>--- a/crypto/testmgr.c
>+++ b/crypto/testmgr.c
>@@ -1013,12 +1013,22 @@ static int __test_skcipher(struct crypto_ablkcipher
>*tfm, int enc,
>
>   q = data;
>   if (memcmp(q, template[i].result, template[i].rlen)) {
>-  pr_err("alg: skcipher%s: Test %d failed on %s for 
%s\n",
>+  pr_err("alg: skcipher%s: Test %d failed (invalid 
result) on %s for %s\n",
>d, j, e, algo);
>   hexdump(q, template[i].rlen);
>   ret = -EINVAL;
>   goto out;
>   }
>+
>+  if (template[i].iv_out &&
>+  memcmp(iv, template[i].iv_out,
>+ crypto_ablkcipher_ivsize(tfm))) {
>+  pr_err("alg: skcipher%s: Test %d failed (invalid 
output IV) on %s for
>%s\n", +  d, j, e, algo);
>+  hexdump(iv, crypto_ablkcipher_ivsize(tfm));
>+  ret = -EINVAL;
>+  goto out;
>+  }
>   }
>
>   j = 0;
>diff --git a/crypto/testmgr.h b/crypto/testmgr.h
>index 62e2485..03320f9 100644
>--- a/crypto/testmgr.h
>+++ b/crypto/testmgr.h
>@@ -49,6 +49,7 @@ struct hash_testvec {
> struct cipher_testvec {
>   char *key;
>   char *iv;
>+  char *iv_out;
>   char *input;
>   char *result;
>   unsigned short tap[MAX_TAP];


Ciao
Stephan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/2] crypto: testmgr: test IV value after a cipher operation

2015-09-07 Thread Herbert Xu
On Tue, Sep 08, 2015 at 05:23:59AM +0200, Stephan Mueller wrote:
> Am Dienstag, 16. Juni 2015, 11:46:46 schrieb Boris Brezillon:
> 
> Hi Herbert,
> 
> >The crypto drivers are supposed to update the IV passed to the crypto
> >request before calling the completion callback.
> >Test for the IV value before considering the test as successful.
> 
> May I ask whether there is anything wrong with this patch?
> 
> I am asking because the keywrapping template I would like to release would 
> need the test manager to check the generated IV.

There is nothing wrong with the patch.  I just wanted to finish
the skcipher conversion before adding this patch.

Thanks,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/2] crypto: testmgr: test IV value after a cipher operation

2015-06-16 Thread Boris Brezillon
The crypto drivers are supposed to update the IV passed to the crypto
request before calling the completion callback.
Test for the IV value before considering the test as successful.

Signed-off-by: Boris Brezillon 
---
 crypto/testmgr.c | 12 +++-
 crypto/testmgr.h |  1 +
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index f9bce3d..e6b5f24 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -1013,12 +1013,22 @@ static int __test_skcipher(struct crypto_ablkcipher 
*tfm, int enc,
 
q = data;
if (memcmp(q, template[i].result, template[i].rlen)) {
-   pr_err("alg: skcipher%s: Test %d failed on %s for %s\n",
+   pr_err("alg: skcipher%s: Test %d failed (invalid 
result) on %s for %s\n",
   d, j, e, algo);
hexdump(q, template[i].rlen);
ret = -EINVAL;
goto out;
}
+
+   if (template[i].iv_out &&
+   memcmp(iv, template[i].iv_out,
+  crypto_ablkcipher_ivsize(tfm))) {
+   pr_err("alg: skcipher%s: Test %d failed (invalid output 
IV) on %s for %s\n",
+  d, j, e, algo);
+   hexdump(iv, crypto_ablkcipher_ivsize(tfm));
+   ret = -EINVAL;
+   goto out;
+   }
}
 
j = 0;
diff --git a/crypto/testmgr.h b/crypto/testmgr.h
index 62e2485..03320f9 100644
--- a/crypto/testmgr.h
+++ b/crypto/testmgr.h
@@ -49,6 +49,7 @@ struct hash_testvec {
 struct cipher_testvec {
char *key;
char *iv;
+   char *iv_out;
char *input;
char *result;
unsigned short tap[MAX_TAP];
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/2] crypto: testmgr: test IV value after a cipher operation

2015-06-16 Thread Boris Brezillon
The crypto drivers are supposed to update the IV passed to the crypto
request before calling the completion callback.
Test for the IV value before considering the test as successful.

Signed-off-by: Boris Brezillon boris.brezil...@free-electrons.com
---
 crypto/testmgr.c | 12 +++-
 crypto/testmgr.h |  1 +
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index f9bce3d..e6b5f24 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -1013,12 +1013,22 @@ static int __test_skcipher(struct crypto_ablkcipher 
*tfm, int enc,
 
q = data;
if (memcmp(q, template[i].result, template[i].rlen)) {
-   pr_err(alg: skcipher%s: Test %d failed on %s for %s\n,
+   pr_err(alg: skcipher%s: Test %d failed (invalid 
result) on %s for %s\n,
   d, j, e, algo);
hexdump(q, template[i].rlen);
ret = -EINVAL;
goto out;
}
+
+   if (template[i].iv_out 
+   memcmp(iv, template[i].iv_out,
+  crypto_ablkcipher_ivsize(tfm))) {
+   pr_err(alg: skcipher%s: Test %d failed (invalid output 
IV) on %s for %s\n,
+  d, j, e, algo);
+   hexdump(iv, crypto_ablkcipher_ivsize(tfm));
+   ret = -EINVAL;
+   goto out;
+   }
}
 
j = 0;
diff --git a/crypto/testmgr.h b/crypto/testmgr.h
index 62e2485..03320f9 100644
--- a/crypto/testmgr.h
+++ b/crypto/testmgr.h
@@ -49,6 +49,7 @@ struct hash_testvec {
 struct cipher_testvec {
char *key;
char *iv;
+   char *iv_out;
char *input;
char *result;
unsigned short tap[MAX_TAP];
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/