Commit a1aa44a2 authored by Cristian Stoica's avatar Cristian Stoica Committed by Herbert Xu

crypto: testmgr - white space removal on __test_skcipher

This patch inverts two if conditions to remove code blocks
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 5f2b424e
......@@ -966,12 +966,13 @@ static int __test_skcipher(struct crypto_ablkcipher *tfm, int enc,
else
memset(iv, 0, MAX_IVLEN);
if (!(template[i].np) || (template[i].also_non_np)) {
if (template[i].np && !template[i].also_non_np)
continue;
j++;
ret = -EINVAL;
if (WARN_ON(align_offset + template[i].ilen >
PAGE_SIZE))
if (WARN_ON(align_offset + template[i].ilen > PAGE_SIZE))
goto out;
data = xbuf[0];
......@@ -980,15 +981,13 @@ static int __test_skcipher(struct crypto_ablkcipher *tfm, int enc,
crypto_ablkcipher_clear_flags(tfm, ~0);
if (template[i].wk)
crypto_ablkcipher_set_flags(
tfm, CRYPTO_TFM_REQ_WEAK_KEY);
crypto_ablkcipher_set_flags(tfm, CRYPTO_TFM_REQ_WEAK_KEY);
ret = crypto_ablkcipher_setkey(tfm, template[i].key,
template[i].klen);
if (!ret == template[i].fail) {
pr_err("alg: skcipher%s: setkey failed on test %d for %s: flags=%x\n",
d, j, algo,
crypto_ablkcipher_get_flags(tfm));
d, j, algo, crypto_ablkcipher_get_flags(tfm));
goto out;
} else if (ret)
continue;
......@@ -1000,11 +999,9 @@ static int __test_skcipher(struct crypto_ablkcipher *tfm, int enc,
sg_init_one(&sgout[0], data, template[i].ilen);
}
ablkcipher_request_set_crypt(req, sg,
(diff_dst) ? sgout : sg,
ablkcipher_request_set_crypt(req, sg, (diff_dst) ? sgout : sg,
template[i].ilen, iv);
ret = enc ?
crypto_ablkcipher_encrypt(req) :
ret = enc ? crypto_ablkcipher_encrypt(req) :
crypto_ablkcipher_decrypt(req);
switch (ret) {
......@@ -1034,7 +1031,6 @@ static int __test_skcipher(struct crypto_ablkcipher *tfm, int enc,
goto out;
}
}
}
j = 0;
for (i = 0; i < tcount; i++) {
......@@ -1047,20 +1043,20 @@ static int __test_skcipher(struct crypto_ablkcipher *tfm, int enc,
else
memset(iv, 0, MAX_IVLEN);
if (template[i].np) {
if (!template[i].np)
continue;
j++;
crypto_ablkcipher_clear_flags(tfm, ~0);
if (template[i].wk)
crypto_ablkcipher_set_flags(
tfm, CRYPTO_TFM_REQ_WEAK_KEY);
crypto_ablkcipher_set_flags(tfm, CRYPTO_TFM_REQ_WEAK_KEY);
ret = crypto_ablkcipher_setkey(tfm, template[i].key,
template[i].klen);
if (!ret == template[i].fail) {
pr_err("alg: skcipher%s: setkey failed on chunk test %d for %s: flags=%x\n",
d, j, algo,
crypto_ablkcipher_get_flags(tfm));
d, j, algo, crypto_ablkcipher_get_flags(tfm));
goto out;
} else if (ret)
continue;
......@@ -1075,14 +1071,11 @@ static int __test_skcipher(struct crypto_ablkcipher *tfm, int enc,
template[i].tap[k] > PAGE_SIZE))
goto out;
q = xbuf[IDX[k] >> PAGE_SHIFT] +
offset_in_page(IDX[k]);
q = xbuf[IDX[k] >> PAGE_SHIFT] + offset_in_page(IDX[k]);
memcpy(q, template[i].input + temp,
template[i].tap[k]);
memcpy(q, template[i].input + temp, template[i].tap[k]);
if (offset_in_page(q) + template[i].tap[k] <
PAGE_SIZE)
if (offset_in_page(q) + template[i].tap[k] < PAGE_SIZE)
q[template[i].tap[k]] = 0;
sg_set_buf(&sg[k], q, template[i].tap[k]);
......@@ -1090,8 +1083,7 @@ static int __test_skcipher(struct crypto_ablkcipher *tfm, int enc,
q = xoutbuf[IDX[k] >> PAGE_SHIFT] +
offset_in_page(IDX[k]);
sg_set_buf(&sgout[k], q,
template[i].tap[k]);
sg_set_buf(&sgout[k], q, template[i].tap[k]);
memset(q, 0, template[i].tap[k]);
if (offset_in_page(q) +
......@@ -1102,12 +1094,10 @@ static int __test_skcipher(struct crypto_ablkcipher *tfm, int enc,
temp += template[i].tap[k];
}
ablkcipher_request_set_crypt(req, sg,
(diff_dst) ? sgout : sg,
ablkcipher_request_set_crypt(req, sg, (diff_dst) ? sgout : sg,
template[i].ilen, iv);
ret = enc ?
crypto_ablkcipher_encrypt(req) :
ret = enc ? crypto_ablkcipher_encrypt(req) :
crypto_ablkcipher_decrypt(req);
switch (ret) {
......@@ -1158,7 +1148,6 @@ static int __test_skcipher(struct crypto_ablkcipher *tfm, int enc,
temp += template[i].tap[k];
}
}
}
ret = 0;
......
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