rpms/kernel/F-12 crypto-add-async-hash-testing.patch, NONE, 1.1 kernel.spec, 1.2106, 1.2107

Chuck Ebbert cebbert at fedoraproject.org
Wed Jul 21 12:19:02 UTC 2010


Author: cebbert

Update of /cvs/pkgs/rpms/kernel/F-12
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv26838

Modified Files:
	kernel.spec 
Added Files:
	crypto-add-async-hash-testing.patch 
Log Message:
crypto-add-async-hash-testing.patch: fix the rest of the errors
  reported during crypto testing (#571577)

crypto-add-async-hash-testing.patch:
 testmgr.c |   67 ++++++++++++++++++++++++++++++++++++++++++++------------------
 1 file changed, 48 insertions(+), 19 deletions(-)

--- NEW FILE crypto-add-async-hash-testing.patch ---
>From e45009229be6a7fae49bdfa3459905668c0b0fb1 Mon Sep 17 00:00:00 2001
From: David S. Miller <davem at davemloft.net>
Date: Wed, 19 May 2010 14:12:03 +1000
Subject: crypto: testmgr - Add testing for async hashing and update/final

Extend testmgr such that it tests async hash algorithms,
and that for both sync and async hashes it tests both
->digest() and ->update()/->final() sequences.

Signed-off-by: David S. Miller <davem at davemloft.net>
Signed-off-by: Herbert Xu <herbert at gondor.apana.org.au>
---
 crypto/testmgr.c |   66 +++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 48 insertions(+), 18 deletions(-)

diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index c494d76..5c8aaa0 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -153,8 +153,21 @@ static void testmgr_free_buf(char *buf[XBUFSIZE])
 		free_page((unsigned long)buf[i]);
 }
 
+static int do_one_async_hash_op(struct ahash_request *req,
+				struct tcrypt_result *tr,
+				int ret)
+{
+	if (ret == -EINPROGRESS || ret == -EBUSY) {
+		ret = wait_for_completion_interruptible(&tr->completion);
+		if (!ret)
+			ret = tr->err;
+		INIT_COMPLETION(tr->completion);
+	}
+	return ret;
+}
+
 static int test_hash(struct crypto_ahash *tfm, struct hash_testvec *template,
-		     unsigned int tcount)
+		     unsigned int tcount, bool use_digest)
 {
 	const char *algo = crypto_tfm_alg_driver_name(crypto_ahash_tfm(tfm));
 	unsigned int i, j, k, temp;
@@ -206,23 +219,36 @@ static int test_hash(struct crypto_ahash *tfm, struct hash_testvec *template,
 		}
 
 		ahash_request_set_crypt(req, sg, result, template[i].psize);
-		ret = crypto_ahash_digest(req);
-		switch (ret) {
-		case 0:
-			break;
-		case -EINPROGRESS:
-		case -EBUSY:
-			ret = wait_for_completion_interruptible(
-				&tresult.completion);
-			if (!ret && !(ret = tresult.err)) {
-				INIT_COMPLETION(tresult.completion);
-				break;
+		if (use_digest) {
+			ret = do_one_async_hash_op(req, &tresult,
+						   crypto_ahash_digest(req));
+			if (ret) {
+				pr_err("alg: hash: digest failed on test %d "
+				       "for %s: ret=%d\n", j, algo, -ret);
+				goto out;
+			}
+		} else {
+			ret = do_one_async_hash_op(req, &tresult,
+						   crypto_ahash_init(req));
+			if (ret) {
+				pr_err("alt: hash: init failed on test %d "
+				       "for %s: ret=%d\n", j, algo, -ret);
+				goto out;
+			}
+			ret = do_one_async_hash_op(req, &tresult,
+						   crypto_ahash_update(req));
+			if (ret) {
+				pr_err("alt: hash: update failed on test %d "
+				       "for %s: ret=%d\n", j, algo, -ret);
+				goto out;
+			}
+			ret = do_one_async_hash_op(req, &tresult,
+						   crypto_ahash_final(req));
+			if (ret) {
+				pr_err("alt: hash: final failed on test %d "
+				       "for %s: ret=%d\n", j, algo, -ret);
+				goto out;
 			}
-			/* fall through */
-		default:
-			printk(KERN_ERR "alg: hash: digest failed on test %d "
-			       "for %s: ret=%d\n", j, algo, -ret);
-			goto out;
 		}
 
 		if (memcmp(result, template[i].digest,
@@ -1402,7 +1428,11 @@ static int alg_test_hash(const struct alg_test_desc *desc, const char *driver,
 		return PTR_ERR(tfm);
 	}
 
-	err = test_hash(tfm, desc->suite.hash.vecs, desc->suite.hash.count);
+	err = test_hash(tfm, desc->suite.hash.vecs,
+			desc->suite.hash.count, true);
+	if (!err)
+		err = test_hash(tfm, desc->suite.hash.vecs,
+				desc->suite.hash.count, false);
 
 	crypto_free_ahash(tfm);
 	return err;
-- 
1.7.0.1



Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-12/kernel.spec,v
retrieving revision 1.2106
retrieving revision 1.2107
diff -u -p -r1.2106 -r1.2107
--- kernel.spec	21 Jul 2010 04:28:55 -0000	1.2106
+++ kernel.spec	21 Jul 2010 12:19:01 -0000	1.2107
@@ -842,6 +842,7 @@ Patch14020: inotify-fix-inotify-oneshot-
 Patch14030: inotify-send-IN_UNMOUNT-events.patch
 
 Patch14040: crypto-testmgr-add-null-test-for-aesni.patch
+Patch14050: crypto-add-async-hash-testing.patch
 
 # ==============================================================================
 %endif
@@ -1539,8 +1540,10 @@ ApplyPatch ethtool-fix-buffer-overflow.p
 ApplyPatch inotify-fix-inotify-oneshot-support.patch
 ApplyPatch inotify-send-IN_UNMOUNT-events.patch
 
-# add tests for aesni module
+# add tests for aesni module (#571577)
 ApplyPatch crypto-testmgr-add-null-test-for-aesni.patch
+# add tests for crypto async hashing (#571577)
+ApplyPatch crypto-add-async-hash-testing.patch
 
 # END OF PATCH APPLICATIONS ====================================================
 %endif
@@ -2191,6 +2194,10 @@ fi
 %kernel_variant_files -k vmlinux %{with_kdump} kdump
 
 %changelog
+* Wed Jul 21 2010 Chuck Ebbert <cebbert at redhat.com>  2.6.32.16-145
+- crypto-add-async-hash-testing.patch: fix the rest of the errors
+  reported during crypto testing (#571577)
+
 * Wed Jul 21 2010 Chuck Ebbert <cebbert at redhat.com>  2.6.32.16-144
 - Fix inotify-oneshot-support patch so it builds.
 - crypto-testmgr-add-null-test-for-aesni.patch:



More information about the scm-commits mailing list