Re: [PATCH 2/2] crypto: testmgr - make test_aead also test 'dst != src' code paths

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 9/21/2012 10:26 AM, Jussi Kivilinna wrote:
Currrently test_aead uses same buffer for destination and source. However
in any places, 'dst != src' take different path than 'dst == src' case.

Therefore make test_aead also run tests with destination buffer being
different than source buffer.

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@xxxxxxxx>
---
  crypto/testmgr.c |  153 +++++++++++++++++++++++++++++++++++++-----------------
  1 file changed, 105 insertions(+), 48 deletions(-)

diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index 00f54d5..941d75c 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c

@@ -442,18 +460,26 @@ static int test_aead(struct crypto_aead *tfm, int enc,
  			authsize = abs(template[i].rlen - template[i].ilen);
  			ret = crypto_aead_setauthsize(tfm, authsize);
  			if (ret) {
-				printk(KERN_ERR "alg: aead: Failed to set "
-				       "authsize to %u on test %d for %s\n",
-				       authsize, j, algo);
+				pr_err("alg: aead%s: Failed to set authsize to %u on test %d for %s\n",
+				       d, authsize, j, algo);
  				goto out;
  			}
sg_init_one(&sg[0], input,
  				    template[i].ilen + (enc ? authsize : 0));
+ if (diff_dst) {
+				output = xoutbuf[0];
+				sg_init_one(&sgout[0], output,
+					    template[i].ilen +
+						(enc ? authsize : 0));
+			} else {
+				output = input;
+			}

In case of diff_dst (src != dst), is there any assumption / convention regarding allocation length of req->src and req->dst - are they supposed be equal, even if it's not needed? For example, in case of diff_dst && encryption, currently both req->src and req->dst have then length = template[i].ilen + authsize. Shouldn't length of req->src be template[i].ilen, i.e. no space allocated for ICV?

Thanks,
Horia



--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux