Commit 3fd53533 authored by Yang Yingliang's avatar Yang Yingliang Committed by Mike Snitzer

dm crypt: use crypt_integrity_aead() helper

Replace test_bit(CRYPT_MODE_INTEGRITY_AEAD, XXX) with
crypt_integrity_aead().
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
parent fb33c651
...@@ -230,6 +230,8 @@ static void kcryptd_queue_crypt(struct dm_crypt_io *io); ...@@ -230,6 +230,8 @@ static void kcryptd_queue_crypt(struct dm_crypt_io *io);
static struct scatterlist *crypt_get_sg_data(struct crypt_config *cc, static struct scatterlist *crypt_get_sg_data(struct crypt_config *cc,
struct scatterlist *sg); struct scatterlist *sg);
static bool crypt_integrity_aead(struct crypt_config *cc);
/* /*
* Use this to access cipher attributes that are independent of the key. * Use this to access cipher attributes that are independent of the key.
*/ */
...@@ -346,7 +348,7 @@ static int crypt_iv_benbi_ctr(struct crypt_config *cc, struct dm_target *ti, ...@@ -346,7 +348,7 @@ static int crypt_iv_benbi_ctr(struct crypt_config *cc, struct dm_target *ti,
unsigned bs; unsigned bs;
int log; int log;
if (test_bit(CRYPT_MODE_INTEGRITY_AEAD, &cc->cipher_flags)) if (crypt_integrity_aead(cc))
bs = crypto_aead_blocksize(any_tfm_aead(cc)); bs = crypto_aead_blocksize(any_tfm_aead(cc));
else else
bs = crypto_skcipher_blocksize(any_tfm(cc)); bs = crypto_skcipher_blocksize(any_tfm(cc));
...@@ -712,7 +714,7 @@ static int crypt_iv_random_gen(struct crypt_config *cc, u8 *iv, ...@@ -712,7 +714,7 @@ static int crypt_iv_random_gen(struct crypt_config *cc, u8 *iv,
static int crypt_iv_eboiv_ctr(struct crypt_config *cc, struct dm_target *ti, static int crypt_iv_eboiv_ctr(struct crypt_config *cc, struct dm_target *ti,
const char *opts) const char *opts)
{ {
if (test_bit(CRYPT_MODE_INTEGRITY_AEAD, &cc->cipher_flags)) { if (crypt_integrity_aead(cc)) {
ti->error = "AEAD transforms not supported for EBOIV"; ti->error = "AEAD transforms not supported for EBOIV";
return -EINVAL; return -EINVAL;
} }
......
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