Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Stephan Mueller <smueller@chronox.de>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Boris Brezillon <boris.brezillon@free-electrons.com>,
	"David S. Miller" <davem@davemloft.net>,
	linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] crypto: testmgr: test IV value after a cipher operation
Date: Tue, 08 Sep 2015 05:23:59 +0200	[thread overview]
Message-ID: <43689867.jVbFUkvrcd@tauon.atsec.com> (raw)
In-Reply-To: <1434448007-9537-2-git-send-email-boris.brezillon@free-electrons.com>

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 <boris.brezillon@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];


Ciao
Stephan

  reply	other threads:[~2015-09-08  3:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-16  9:46 [PATCH 0/2] crypto: testmgr: test IV value after a cipher operation Boris Brezillon
2015-06-16  9:46 ` [PATCH 1/2] " Boris Brezillon
2015-09-08  3:23   ` Stephan Mueller [this message]
2015-09-08  5:32     ` Herbert Xu
2015-10-15 13:18   ` Herbert Xu
2015-06-16  9:46 ` [PATCH 2/2] crypto: testmgr: add iv_out information for all CBC testvec Boris Brezillon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=43689867.jVbFUkvrcd@tauon.atsec.com \
    --to=smueller@chronox.de \
    --cc=boris.brezillon@free-electrons.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox