Lines Matching refs:dmreq

114 			 struct dm_crypt_request *dmreq);
116 struct dm_crypt_request *dmreq);
362 struct dm_crypt_request *dmreq) in crypt_iv_plain_gen() argument
365 *(__le32 *)iv = cpu_to_le32(dmreq->iv_sector & 0xffffffff); in crypt_iv_plain_gen()
371 struct dm_crypt_request *dmreq) in crypt_iv_plain64_gen() argument
374 *(__le64 *)iv = cpu_to_le64(dmreq->iv_sector); in crypt_iv_plain64_gen()
380 struct dm_crypt_request *dmreq) in crypt_iv_plain64be_gen() argument
384 *(__be64 *)&iv[cc->iv_size - sizeof(u64)] = cpu_to_be64(dmreq->iv_sector); in crypt_iv_plain64be_gen()
390 struct dm_crypt_request *dmreq) in crypt_iv_essiv_gen() argument
397 *(__le64 *)iv = cpu_to_le64(dmreq->iv_sector); in crypt_iv_essiv_gen()
438 struct dm_crypt_request *dmreq) in crypt_iv_benbi_gen() argument
444 val = cpu_to_be64(((u64)dmreq->iv_sector << cc->iv_gen_private.benbi.shift) + 1); in crypt_iv_benbi_gen()
451 struct dm_crypt_request *dmreq) in crypt_iv_null_gen() argument
521 struct dm_crypt_request *dmreq, u8 *data) in crypt_iv_lmk_one() argument
536 buf[0] = cpu_to_le32(dmreq->iv_sector & 0xFFFFFFFF); in crypt_iv_lmk_one()
537 buf[1] = cpu_to_le32((((u64)dmreq->iv_sector >> 32) & 0x00FFFFFF) | 0x80000000); in crypt_iv_lmk_one()
548 struct dm_crypt_request *dmreq) in crypt_iv_lmk_gen() argument
553 if (bio_data_dir(dmreq->ctx->bio_in) == WRITE) { in crypt_iv_lmk_gen()
554 sg = crypt_get_sg_data(cc, dmreq->sg_in); in crypt_iv_lmk_gen()
556 crypt_iv_lmk_one(cc, iv, dmreq, src + sg->offset); in crypt_iv_lmk_gen()
564 struct dm_crypt_request *dmreq) in crypt_iv_lmk_post() argument
569 if (bio_data_dir(dmreq->ctx->bio_in) == WRITE) in crypt_iv_lmk_post()
572 sg = crypt_get_sg_data(cc, dmreq->sg_out); in crypt_iv_lmk_post()
574 crypt_iv_lmk_one(cc, iv, dmreq, dst + sg->offset); in crypt_iv_lmk_post()
642 struct dm_crypt_request *dmreq, u8 *data) in crypt_iv_tcw_whitening() argument
645 __le64 sector = cpu_to_le64(dmreq->iv_sector); in crypt_iv_tcw_whitening()
666 struct dm_crypt_request *dmreq) in crypt_iv_tcw_gen() argument
670 __le64 sector = cpu_to_le64(dmreq->iv_sector); in crypt_iv_tcw_gen()
674 if (bio_data_dir(dmreq->ctx->bio_in) != WRITE) { in crypt_iv_tcw_gen()
675 sg = crypt_get_sg_data(cc, dmreq->sg_in); in crypt_iv_tcw_gen()
677 crypt_iv_tcw_whitening(cc, dmreq, src + sg->offset); in crypt_iv_tcw_gen()
691 struct dm_crypt_request *dmreq) in crypt_iv_tcw_post() argument
696 if (bio_data_dir(dmreq->ctx->bio_in) != WRITE) in crypt_iv_tcw_post()
700 sg = crypt_get_sg_data(cc, dmreq->sg_out); in crypt_iv_tcw_post()
702 crypt_iv_tcw_whitening(cc, dmreq, dst + sg->offset); in crypt_iv_tcw_post()
709 struct dm_crypt_request *dmreq) in crypt_iv_random_gen() argument
733 struct dm_crypt_request *dmreq) in crypt_iv_eboiv_gen() argument
754 *(__le64 *)buf = cpu_to_le64(dmreq->iv_sector * cc->sector_size); in crypt_iv_eboiv_gen()
938 static int crypt_iv_elephant(struct crypt_config *cc, struct dm_crypt_request *dmreq) in crypt_iv_elephant() argument
956 *(__le64 *)es = cpu_to_le64(dmreq->iv_sector * cc->sector_size); in crypt_iv_elephant()
974 sg = crypt_get_sg_data(cc, dmreq->sg_out); in crypt_iv_elephant()
979 if (bio_data_dir(dmreq->ctx->bio_in) == WRITE) { in crypt_iv_elephant()
980 sg2 = crypt_get_sg_data(cc, dmreq->sg_in); in crypt_iv_elephant()
986 if (bio_data_dir(dmreq->ctx->bio_in) != WRITE) { in crypt_iv_elephant()
996 if (bio_data_dir(dmreq->ctx->bio_in) == WRITE) { in crypt_iv_elephant()
1012 struct dm_crypt_request *dmreq) in crypt_iv_elephant_gen() argument
1016 if (bio_data_dir(dmreq->ctx->bio_in) == WRITE) { in crypt_iv_elephant_gen()
1017 r = crypt_iv_elephant(cc, dmreq); in crypt_iv_elephant_gen()
1022 return crypt_iv_eboiv_gen(cc, iv, dmreq); in crypt_iv_elephant_gen()
1026 struct dm_crypt_request *dmreq) in crypt_iv_elephant_post() argument
1028 if (bio_data_dir(dmreq->ctx->bio_in) != WRITE) in crypt_iv_elephant_post()
1029 return crypt_iv_elephant(cc, dmreq); in crypt_iv_elephant_post()
1230 static void *req_of_dmreq(struct crypt_config *cc, struct dm_crypt_request *dmreq) in req_of_dmreq() argument
1232 return (void *)((char *)dmreq - cc->dmreq_start); in req_of_dmreq()
1236 struct dm_crypt_request *dmreq) in iv_of_dmreq() argument
1239 return (u8 *)ALIGN((unsigned long)(dmreq + 1), in iv_of_dmreq()
1242 return (u8 *)ALIGN((unsigned long)(dmreq + 1), in iv_of_dmreq()
1247 struct dm_crypt_request *dmreq) in org_iv_of_dmreq() argument
1249 return iv_of_dmreq(cc, dmreq) + cc->iv_size; in org_iv_of_dmreq()
1253 struct dm_crypt_request *dmreq) in org_sector_of_dmreq() argument
1255 u8 *ptr = iv_of_dmreq(cc, dmreq) + cc->iv_size + cc->iv_size; in org_sector_of_dmreq()
1261 struct dm_crypt_request *dmreq) in org_tag_of_dmreq() argument
1263 u8 *ptr = iv_of_dmreq(cc, dmreq) + cc->iv_size + in org_tag_of_dmreq()
1270 struct dm_crypt_request *dmreq) in tag_from_dmreq() argument
1272 struct convert_context *ctx = dmreq->ctx; in tag_from_dmreq()
1275 return &io->integrity_metadata[*org_tag_of_dmreq(cc, dmreq) * in tag_from_dmreq()
1280 struct dm_crypt_request *dmreq) in iv_tag_from_dmreq() argument
1282 return tag_from_dmreq(cc, dmreq) + cc->integrity_tag_size; in iv_tag_from_dmreq()
1292 struct dm_crypt_request *dmreq; in crypt_convert_block_aead() local
1303 dmreq = dmreq_of_req(cc, req); in crypt_convert_block_aead()
1304 dmreq->iv_sector = ctx->cc_sector; in crypt_convert_block_aead()
1306 dmreq->iv_sector >>= cc->sector_shift; in crypt_convert_block_aead()
1307 dmreq->ctx = ctx; in crypt_convert_block_aead()
1309 *org_tag_of_dmreq(cc, dmreq) = tag_offset; in crypt_convert_block_aead()
1311 sector = org_sector_of_dmreq(cc, dmreq); in crypt_convert_block_aead()
1314 iv = iv_of_dmreq(cc, dmreq); in crypt_convert_block_aead()
1315 org_iv = org_iv_of_dmreq(cc, dmreq); in crypt_convert_block_aead()
1316 tag = tag_from_dmreq(cc, dmreq); in crypt_convert_block_aead()
1317 tag_iv = iv_tag_from_dmreq(cc, dmreq); in crypt_convert_block_aead()
1324 sg_init_table(dmreq->sg_in, 4); in crypt_convert_block_aead()
1325 sg_set_buf(&dmreq->sg_in[0], sector, sizeof(uint64_t)); in crypt_convert_block_aead()
1326 sg_set_buf(&dmreq->sg_in[1], org_iv, cc->iv_size); in crypt_convert_block_aead()
1327 sg_set_page(&dmreq->sg_in[2], bv_in.bv_page, cc->sector_size, bv_in.bv_offset); in crypt_convert_block_aead()
1328 sg_set_buf(&dmreq->sg_in[3], tag, cc->integrity_tag_size); in crypt_convert_block_aead()
1330 sg_init_table(dmreq->sg_out, 4); in crypt_convert_block_aead()
1331 sg_set_buf(&dmreq->sg_out[0], sector, sizeof(uint64_t)); in crypt_convert_block_aead()
1332 sg_set_buf(&dmreq->sg_out[1], org_iv, cc->iv_size); in crypt_convert_block_aead()
1333 sg_set_page(&dmreq->sg_out[2], bv_out.bv_page, cc->sector_size, bv_out.bv_offset); in crypt_convert_block_aead()
1334 sg_set_buf(&dmreq->sg_out[3], tag, cc->integrity_tag_size); in crypt_convert_block_aead()
1341 r = cc->iv_gen_ops->generator(cc, org_iv, dmreq); in crypt_convert_block_aead()
1354 aead_request_set_crypt(req, dmreq->sg_in, dmreq->sg_out, in crypt_convert_block_aead()
1361 aead_request_set_crypt(req, dmreq->sg_in, dmreq->sg_out, in crypt_convert_block_aead()
1379 r = cc->iv_gen_ops->post(cc, org_iv, dmreq); in crypt_convert_block_aead()
1395 struct dm_crypt_request *dmreq; in crypt_convert_block_skcipher() local
1404 dmreq = dmreq_of_req(cc, req); in crypt_convert_block_skcipher()
1405 dmreq->iv_sector = ctx->cc_sector; in crypt_convert_block_skcipher()
1407 dmreq->iv_sector >>= cc->sector_shift; in crypt_convert_block_skcipher()
1408 dmreq->ctx = ctx; in crypt_convert_block_skcipher()
1410 *org_tag_of_dmreq(cc, dmreq) = tag_offset; in crypt_convert_block_skcipher()
1412 iv = iv_of_dmreq(cc, dmreq); in crypt_convert_block_skcipher()
1413 org_iv = org_iv_of_dmreq(cc, dmreq); in crypt_convert_block_skcipher()
1414 tag_iv = iv_tag_from_dmreq(cc, dmreq); in crypt_convert_block_skcipher()
1416 sector = org_sector_of_dmreq(cc, dmreq); in crypt_convert_block_skcipher()
1420 sg_in = &dmreq->sg_in[0]; in crypt_convert_block_skcipher()
1421 sg_out = &dmreq->sg_out[0]; in crypt_convert_block_skcipher()
1434 r = cc->iv_gen_ops->generator(cc, org_iv, dmreq); in crypt_convert_block_skcipher()
1456 r = cc->iv_gen_ops->post(cc, org_iv, dmreq); in crypt_convert_block_skcipher()
2204 struct dm_crypt_request *dmreq = data; in kcryptd_async_done() local
2205 struct convert_context *ctx = dmreq->ctx; in kcryptd_async_done()
2220 error = cc->iv_gen_ops->post(cc, org_iv_of_dmreq(cc, dmreq), dmreq); in kcryptd_async_done()
2223 sector_t s = le64_to_cpu(*org_sector_of_dmreq(cc, dmreq)); in kcryptd_async_done()
2236 crypt_free_req(cc, req_of_dmreq(cc, dmreq), io->base_bio); in kcryptd_async_done()