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