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