Commit 5f2b424e authored by Cristian Stoica's avatar Cristian Stoica Committed by Herbert Xu

crypto: testmgr - white space removal on __test_hash

This patch inverts one if condition to remove code block indentation.
Several white space clean-ups follow.
Signed-off-by: default avatarCristian Stoica <cristian.stoica@freescale.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 05b1d338
...@@ -311,78 +311,75 @@ static int __test_hash(struct crypto_ahash *tfm, struct hash_testvec *template, ...@@ -311,78 +311,75 @@ static int __test_hash(struct crypto_ahash *tfm, struct hash_testvec *template,
if (align_offset != 0) if (align_offset != 0)
break; break;
if (template[i].np) { if (!template[i].np)
j++; continue;
memset(result, 0, MAX_DIGEST_SIZE);
temp = 0; j++;
sg_init_table(sg, template[i].np); memset(result, 0, MAX_DIGEST_SIZE);
ret = -EINVAL;
for (k = 0; k < template[i].np; k++) {
if (WARN_ON(offset_in_page(IDX[k]) +
template[i].tap[k] > PAGE_SIZE))
goto out;
sg_set_buf(&sg[k],
memcpy(xbuf[IDX[k] >> PAGE_SHIFT] +
offset_in_page(IDX[k]),
template[i].plaintext + temp,
template[i].tap[k]),
template[i].tap[k]);
temp += template[i].tap[k];
}
if (template[i].ksize) { temp = 0;
if (template[i].ksize > MAX_KEYLEN) { sg_init_table(sg, template[i].np);
pr_err("alg: hash: setkey failed on test %d for %s: key size %d > %d\n", ret = -EINVAL;
j, algo, template[i].ksize, for (k = 0; k < template[i].np; k++) {
MAX_KEYLEN); if (WARN_ON(offset_in_page(IDX[k]) +
ret = -EINVAL; template[i].tap[k] > PAGE_SIZE))
goto out; goto out;
} sg_set_buf(&sg[k],
crypto_ahash_clear_flags(tfm, ~0); memcpy(xbuf[IDX[k] >> PAGE_SHIFT] +
memcpy(key, template[i].key, template[i].ksize); offset_in_page(IDX[k]),
ret = crypto_ahash_setkey(tfm, key, template[i].plaintext + temp,
template[i].ksize); template[i].tap[k]),
template[i].tap[k]);
temp += template[i].tap[k];
}
if (ret) { if (template[i].ksize) {
printk(KERN_ERR "alg: hash: setkey " if (template[i].ksize > MAX_KEYLEN) {
"failed on chunking test %d " pr_err("alg: hash: setkey failed on test %d for %s: key size %d > %d\n",
"for %s: ret=%d\n", j, algo, j, algo, template[i].ksize, MAX_KEYLEN);
-ret); ret = -EINVAL;
goto out; goto out;
}
} }
crypto_ahash_clear_flags(tfm, ~0);
memcpy(key, template[i].key, template[i].ksize);
ret = crypto_ahash_setkey(tfm, key, template[i].ksize);
ahash_request_set_crypt(req, sg, result, if (ret) {
template[i].psize); printk(KERN_ERR "alg: hash: setkey "
ret = crypto_ahash_digest(req); "failed on chunking test %d "
switch (ret) { "for %s: ret=%d\n", j, algo, -ret);
case 0:
break;
case -EINPROGRESS:
case -EBUSY:
ret = wait_for_completion_interruptible(
&tresult.completion);
if (!ret && !(ret = tresult.err)) {
reinit_completion(&tresult.completion);
break;
}
/* fall through */
default:
printk(KERN_ERR "alg: hash: digest failed "
"on chunking test %d for %s: "
"ret=%d\n", j, algo, -ret);
goto out; goto out;
} }
}
if (memcmp(result, template[i].digest, ahash_request_set_crypt(req, sg, result, template[i].psize);
crypto_ahash_digestsize(tfm))) { ret = crypto_ahash_digest(req);
printk(KERN_ERR "alg: hash: Chunking test %d " switch (ret) {
"failed for %s\n", j, algo); case 0:
hexdump(result, crypto_ahash_digestsize(tfm)); break;
ret = -EINVAL; case -EINPROGRESS:
goto out; case -EBUSY:
ret = wait_for_completion_interruptible(
&tresult.completion);
if (!ret && !(ret = tresult.err)) {
reinit_completion(&tresult.completion);
break;
} }
/* fall through */
default:
printk(KERN_ERR "alg: hash: digest failed "
"on chunking test %d for %s: "
"ret=%d\n", j, algo, -ret);
goto out;
}
if (memcmp(result, template[i].digest,
crypto_ahash_digestsize(tfm))) {
printk(KERN_ERR "alg: hash: Chunking test %d "
"failed for %s\n", j, algo);
hexdump(result, crypto_ahash_digestsize(tfm));
ret = -EINVAL;
goto out;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment