aboutsummaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2009-05-29 02:23:12 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2009-06-02 00:05:02 -0400
commita0cfae59f8381c5c670fce2cc3de70b35421f920 (patch)
tree2da53742941cc478b5d04ca3097acf6b55814dd3 /crypto
parentfd57f22a09ae276ca3e9cd11ed99b617d611ba82 (diff)
crypto: testmgr - Allow hash test vectors longer than a page
As it stands we will each test hash vector both linearly and as a scatter list if applicable. This means that we cannot have vectors longer than a page, even with scatter lists. This patch fixes this by skipping test vectors with np != 0 when testing linearly. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto')
-rw-r--r--crypto/testmgr.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index 8fcea70ed267..e9e9d84293b9 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -180,7 +180,12 @@ static int test_hash(struct crypto_ahash *tfm, struct hash_testvec *template,
180 ahash_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG, 180 ahash_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG,
181 tcrypt_complete, &tresult); 181 tcrypt_complete, &tresult);
182 182
183 j = 0;
183 for (i = 0; i < tcount; i++) { 184 for (i = 0; i < tcount; i++) {
185 if (template[i].np)
186 continue;
187
188 j++;
184 memset(result, 0, 64); 189 memset(result, 0, 64);
185 190
186 hash_buff = xbuf[0]; 191 hash_buff = xbuf[0];
@@ -198,7 +203,7 @@ static int test_hash(struct crypto_ahash *tfm, struct hash_testvec *template,
198 template[i].ksize); 203 template[i].ksize);
199 if (ret) { 204 if (ret) {
200 printk(KERN_ERR "alg: hash: setkey failed on " 205 printk(KERN_ERR "alg: hash: setkey failed on "
201 "test %d for %s: ret=%d\n", i + 1, algo, 206 "test %d for %s: ret=%d\n", j, algo,
202 -ret); 207 -ret);
203 goto out; 208 goto out;
204 } 209 }
@@ -220,14 +225,14 @@ static int test_hash(struct crypto_ahash *tfm, struct hash_testvec *template,
220 /* fall through */ 225 /* fall through */
221 default: 226 default:
222 printk(KERN_ERR "alg: hash: digest failed on test %d " 227 printk(KERN_ERR "alg: hash: digest failed on test %d "
223 "for %s: ret=%d\n", i + 1, algo, -ret); 228 "for %s: ret=%d\n", j, algo, -ret);
224 goto out; 229 goto out;
225 } 230 }
226 231
227 if (memcmp(result, template[i].digest, 232 if (memcmp(result, template[i].digest,
228 crypto_ahash_digestsize(tfm))) { 233 crypto_ahash_digestsize(tfm))) {
229 printk(KERN_ERR "alg: hash: Test %d failed for %s\n", 234 printk(KERN_ERR "alg: hash: Test %d failed for %s\n",
230 i + 1, algo); 235 j, algo);
231 hexdump(result, crypto_ahash_digestsize(tfm)); 236 hexdump(result, crypto_ahash_digestsize(tfm));
232 ret = -EINVAL; 237 ret = -EINVAL;
233 goto out; 238 goto out;