crypto: testmgr - white space fix-ups on test_aead

This patch inverts two if conditions and allows removal of one
tab-stop in their code-blocks. Only white-space clean-up follows.

Signed-off-by: Cristian Stoica <cristian.stoica@freescale.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
Cristian Stoica 2014-07-28 13:11:23 +03:00 committed by Herbert Xu
parent 6d9529c586
commit 05b1d3386f

View file

@ -492,7 +492,9 @@ static int __test_aead(struct crypto_aead *tfm, int enc,
tcrypt_complete, &result); tcrypt_complete, &result);
for (i = 0, j = 0; i < tcount; i++) { for (i = 0, j = 0; i < tcount; i++) {
if (!template[i].np) { if (template[i].np)
continue;
j++; j++;
/* some templates have no input data but they will /* some templates have no input data but they will
@ -516,8 +518,7 @@ static int __test_aead(struct crypto_aead *tfm, int enc,
crypto_aead_clear_flags(tfm, ~0); crypto_aead_clear_flags(tfm, ~0);
if (template[i].wk) if (template[i].wk)
crypto_aead_set_flags( crypto_aead_set_flags(tfm, CRYPTO_TFM_REQ_WEAK_KEY);
tfm, CRYPTO_TFM_REQ_WEAK_KEY);
if (template[i].klen > MAX_KEYLEN) { if (template[i].klen > MAX_KEYLEN) {
pr_err("alg: aead%s: setkey failed on test %d for %s: key size %d > %d\n", pr_err("alg: aead%s: setkey failed on test %d for %s: key size %d > %d\n",
@ -528,8 +529,7 @@ static int __test_aead(struct crypto_aead *tfm, int enc,
} }
memcpy(key, template[i].key, template[i].klen); memcpy(key, template[i].key, template[i].klen);
ret = crypto_aead_setkey(tfm, key, ret = crypto_aead_setkey(tfm, key, template[i].klen);
template[i].klen);
if (!ret == template[i].fail) { if (!ret == template[i].fail) {
pr_err("alg: aead%s: setkey failed on test %d for %s: flags=%x\n", pr_err("alg: aead%s: setkey failed on test %d for %s: flags=%x\n",
d, j, algo, crypto_aead_get_flags(tfm)); d, j, algo, crypto_aead_get_flags(tfm));
@ -549,12 +549,10 @@ static int __test_aead(struct crypto_aead *tfm, int enc,
output = xoutbuf[0]; output = xoutbuf[0];
output += align_offset; output += align_offset;
sg_init_one(&sg[0], input, template[i].ilen); sg_init_one(&sg[0], input, template[i].ilen);
sg_init_one(&sgout[0], output, sg_init_one(&sgout[0], output, template[i].rlen);
template[i].rlen);
} else { } else {
sg_init_one(&sg[0], input, sg_init_one(&sg[0], input,
template[i].ilen + template[i].ilen + (enc ? authsize : 0));
(enc ? authsize : 0));
output = input; output = input;
} }
@ -565,9 +563,7 @@ static int __test_aead(struct crypto_aead *tfm, int enc,
aead_request_set_assoc(req, asg, template[i].alen); aead_request_set_assoc(req, asg, template[i].alen);
ret = enc ? ret = enc ? crypto_aead_encrypt(req) : crypto_aead_decrypt(req);
crypto_aead_encrypt(req) :
crypto_aead_decrypt(req);
switch (ret) { switch (ret) {
case 0: case 0:
@ -608,14 +604,15 @@ static int __test_aead(struct crypto_aead *tfm, int enc,
goto out; goto out;
} }
} }
}
for (i = 0, j = 0; i < tcount; i++) { for (i = 0, j = 0; i < tcount; i++) {
/* alignment tests are only done with continuous buffers */ /* alignment tests are only done with continuous buffers */
if (align_offset != 0) if (align_offset != 0)
break; break;
if (template[i].np) { if (!template[i].np)
continue;
j++; j++;
if (template[i].iv) if (template[i].iv)
@ -625,12 +622,10 @@ static int __test_aead(struct crypto_aead *tfm, int enc,
crypto_aead_clear_flags(tfm, ~0); crypto_aead_clear_flags(tfm, ~0);
if (template[i].wk) if (template[i].wk)
crypto_aead_set_flags( crypto_aead_set_flags(tfm, CRYPTO_TFM_REQ_WEAK_KEY);
tfm, CRYPTO_TFM_REQ_WEAK_KEY);
if (template[i].klen > MAX_KEYLEN) { if (template[i].klen > MAX_KEYLEN) {
pr_err("alg: aead%s: setkey failed on test %d for %s: key size %d > %d\n", pr_err("alg: aead%s: setkey failed on test %d for %s: key size %d > %d\n",
d, j, algo, template[i].klen, d, j, algo, template[i].klen, MAX_KEYLEN);
MAX_KEYLEN);
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;
} }
@ -655,12 +650,8 @@ static int __test_aead(struct crypto_aead *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, template[i].tap[k]);
memcpy(q, template[i].input + temp,
template[i].tap[k]);
sg_set_buf(&sg[k], q, template[i].tap[k]); sg_set_buf(&sg[k], q, template[i].tap[k]);
if (diff_dst) { if (diff_dst) {
@ -669,8 +660,7 @@ static int __test_aead(struct crypto_aead *tfm, int enc,
memset(q, 0, template[i].tap[k]); memset(q, 0, template[i].tap[k]);
sg_set_buf(&sgout[k], q, sg_set_buf(&sgout[k], q, template[i].tap[k]);
template[i].tap[k]);
} }
n = template[i].tap[k]; n = template[i].tap[k];
@ -724,9 +714,7 @@ static int __test_aead(struct crypto_aead *tfm, int enc,
aead_request_set_assoc(req, asg, template[i].alen); aead_request_set_assoc(req, asg, template[i].alen);
ret = enc ? ret = enc ? crypto_aead_encrypt(req) : crypto_aead_decrypt(req);
crypto_aead_encrypt(req) :
crypto_aead_decrypt(req);
switch (ret) { switch (ret) {
case 0: case 0:
@ -787,8 +775,7 @@ static int __test_aead(struct crypto_aead *tfm, int enc,
else else
n = 0; n = 0;
} else { } else {
for (n = 0; offset_in_page(q + n) && for (n = 0; offset_in_page(q + n) && q[n]; n++)
q[n]; n++)
; ;
} }
if (n) { if (n) {
@ -801,7 +788,6 @@ static int __test_aead(struct crypto_aead *tfm, int enc,
temp += template[i].tap[k]; temp += template[i].tap[k];
} }
} }
}
ret = 0; ret = 0;