Bypass encrypt and decrypt data in dm-crypt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



All:


We are using dm-crypt for Android device encryption.  However, we need reserve some sectors in block device for status and integration check and do not want to encrypt/decrypt some sectors when using dm-crypt.
 
So in crypt_convert_block()
 
When 
offset sector of ctx +  sector number of bio_in  is the range of bypass sector list.
 
 
instead call 
if (bio_data_dir(ctx->bio_in) == WRITE)
 r = crypt_copy_write_data(bv_in, bv_out, offset, 1 << SECTOR_SHIFT);
else
 r = crypt_copy_read_data(bv_in, bv_out, offset, 1 << SECTOR_SHIFT);
 
I want to call another function to copy data of a sector from 
ctx->bio_in to 
ctx->bio_out directly.
 
 
I tried the following implementation 
 
struct bio_vec *bv_in = bio_iovec_idx(ctx->bio_in, ctx->idx_in);
struct bio_vec *bv_out = bio_iovec_idx(ctx->bio_out, ctx->idx_out);
struct page * page_in = bv_in->bv_page;
struct page * page_out = bv_out->bv_page;
 
void * addr1 = kmap_atomic(page_in, KM_USER0);
void * addr2 = kmap_atomic(page_out, KM_USER1);
 
unsigned int offset = ctx->offset_in;
 
memcpy(addr2 + offset, addr1 + offset, 1 << SECTOR_SHIFT);
 
kunmap_atomic(addr2, KM_USER1);
kunmap_atomic(addr1, KM_USER0);
 
but above implementation does not work.
 
Could you give me a kint to reslove this issue?
 
 
Thanks
 
Fan
 
 
 
 
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux