gparted/include
Mike Fleetwood 317e444056 Add loading of LUKS mapping offset and length (#760080)
Also load the starting offset and length of the active dm-crypt mapping
into the LUKS_Info module from the dmsetup output.  This provides the
location and size of the encrypted data within the underlying block
device.

Note that dmsetup reports in units of 512 bytes sectors [1], the GParted
LUKS_Info module uses bytes and GParted Partition objects work in device
sector size units.  However the actual sector size of a dm-crypt mapping
[2] is the same as that of the underlying block device [3].

    # modprobe scsi_debug dev_size_mb=128 sector_size=4096
    # fgrep scsi_debug /sys/block/*/device/model
    /sys/block/sdd/device/model:scsi_debug
    # parted /dev/sde print
    Error: /dev/sde: unrecognised disk label
    Model: Linux scsi_debug (scsi)
    Disk /dev/sde: 134MB
[3] Sector size (logical/physical): 4096B/4096B
    Partition Table: unknown

    # cryptsetup luksFormat /dev/sde
    # cryptsetup luksOpen /dev/sde sde_crypt
    # parted /dev/mapper/sde_crypt print
    Error: /dev/mapper/sde_crypt: unrecognised disk label
    Model: Linux device-mapper (crypt) (dm)
    Disk /dev/mapper/sde_crypt: 132MB
[2] Sector size (logical/physical): 4096B/4096B
    Partition Table: unknown

    # cryptsetup status sde_crypt
    /dev/mapper/sde_crypt is active.
      type:  LUKS1
      cipher:  aes-cbc-essiv:sha256
      keysize: 256 bits
      device:  /dev/sde
      offset:  4096 sectors
      size:    258048 sectors
      mode:    read/write
    # dmsetup table --target crypt
    ...
    sde_crypt: 0 258048 crypt aes-cbc-essiv:sha256 0000000000000000000000000000000000000000000000000000000000000000 0 8:64 4096

[1] Both cryptsetup and dmsetup report the offset as 4096 and the size/
length as 258048.  128 MiB / (4096+258048) = 512 byte units, even on a
4096 byte sector size device.

Update debugging of LUKS to this:

    # ./gpartedbin
    ======================
    libparted : 2.4
    ======================
    DEBUG: /dev/sdb5: LUKS closed
    DEBUG: /dev/sdb6: LUKS open mapping /dev/mapper/sdb6_crypt, offset=2097152, length=534773760
    /dev/sde: unrecognised disk label
    DEBUG: /dev/sde: LUKS open mapping /dev/mapper/sde_crypt, offset=2097152, length=132120576

Bug 760080 - Implement read-only LUKS support
2016-01-29 13:41:40 -07:00
..
.cvsignore added *.swp some modifications to pass 'make distcheck' minor cleanups 2005-11-25 12:59:47 +00:00
Copy_Blocks.h Replace obsolete FSF postal address in copyright notices (#721565) 2014-01-26 10:53:23 +00:00
DMRaid.h Move DEV_MAPPER_PATH from DMRaid.h to Utils.h (#760080) 2016-01-29 13:41:40 -07:00
Device.h Use PartitionVector class throughout the code (#759726) 2016-01-26 10:11:35 -07:00
DialogFeatures.h Make the File System Support dialog resizable (#342682) 2014-01-27 10:54:48 -07:00
DialogManageFlags.h Stop copying selected partition object in Manage Flags dialog (#750168) 2015-06-10 10:44:33 -06:00
Dialog_Base_Partition.h Remove unnecessary sector_size parameter from Get_New_Partition methods 2016-01-26 10:11:35 -07:00
Dialog_Disklabel.h Replace obsolete FSF postal address in copyright notices (#721565) 2014-01-26 10:53:23 +00:00
Dialog_FileSystem_Label.h Rename class to Dialog_FileSystem_Label (#741424) 2015-02-01 10:08:23 -07:00
Dialog_Partition_Copy.h Remove unnecessary sector_size parameter from Get_New_Partition methods 2016-01-26 10:11:35 -07:00
Dialog_Partition_Info.h Stop copying selected partition object in Information dialog (#750168) 2015-06-10 10:43:43 -06:00
Dialog_Partition_Name.h Make support of naming for other partition table types possible (#746214) 2015-03-25 10:02:42 -06:00
Dialog_Partition_New.h Remove unnecessary sector_size parameter from Get_New_Partition methods 2016-01-26 10:11:35 -07:00
Dialog_Partition_Resize_Move.h Use pointer to Partition in Dialog_Base_Partition and derived classes (#759726) 2016-01-26 10:11:35 -07:00
Dialog_Progress.h Change OperationDetail to not store complex objects in STL containers (#729139) 2014-05-18 10:07:45 -06:00
Dialog_Rescue_Data.h Use PartitionVector class throughout the code (#759726) 2016-01-26 10:11:35 -07:00
DrawingAreaVisualDisk.h Use PartitionVector class throughout the code (#759726) 2016-01-26 10:11:35 -07:00
FS_Info.h Workaround older blkid not distinguishing between FAT16 and FAT32 (#743181) 2015-03-09 11:04:13 -06:00
FileSystem.h Include Partition.h header everywhere it's used 2016-01-26 10:11:35 -07:00
Frame_Resizer_Base.h Replace obsolete FSF postal address in copyright notices (#721565) 2014-01-26 10:53:23 +00:00
Frame_Resizer_Extended.h Replace obsolete FSF postal address in copyright notices (#721565) 2014-01-26 10:53:23 +00:00
GParted_Core.h Add initial loading of LUKS mapping details (#760080) 2016-01-29 13:41:40 -07:00
HBoxOperations.h Replace obsolete FSF postal address in copyright notices (#721565) 2014-01-26 10:53:23 +00:00
LUKS_Info.h Add loading of LUKS mapping offset and length (#760080) 2016-01-29 13:41:40 -07:00
LVM2_PV_Info.h Display list of Logical Volumes in the Partition Information dialog (754649) 2015-09-15 20:12:12 +01:00
Makefile.am Add busy detection of LUKS mapping (#760080) 2016-01-29 13:41:40 -07:00
Operation.h Use pointers to Partitions in Operation classes (#759726) 2016-01-26 10:11:35 -07:00
OperationChangeUUID.h Add virtual qualifier to derived Operation class destructors 2016-01-26 10:11:36 -07:00
OperationCheck.h Add virtual qualifier to derived Operation class destructors 2016-01-26 10:11:36 -07:00
OperationCopy.h Add virtual qualifier to derived Operation class destructors 2016-01-26 10:11:36 -07:00
OperationCreate.h Add virtual qualifier to derived Operation class destructors 2016-01-26 10:11:36 -07:00
OperationDelete.h Add virtual qualifier to derived Operation class destructors 2016-01-26 10:11:36 -07:00
OperationDetail.h Change OperationDetail to not store complex objects in STL containers (#729139) 2014-05-18 10:07:45 -06:00
OperationFormat.h Add virtual qualifier to derived Operation class destructors 2016-01-26 10:11:36 -07:00
OperationLabelFileSystem.h Add virtual qualifier to derived Operation class destructors 2016-01-26 10:11:36 -07:00
OperationNamePartition.h Add virtual qualifier to derived Operation class destructors 2016-01-26 10:11:36 -07:00
OperationResizeMove.h Add virtual qualifier to derived Operation class destructors 2016-01-26 10:11:36 -07:00
Partition.h Remove unused Partition(path) constructor 2016-01-26 10:11:36 -07:00
PartitionVector.h Replace all Partition object copy assignment (#759726) 2016-01-26 10:11:35 -07:00
PipeCapture.h Prevent cross thread write after free in _OnReadable() (#731752) 2014-07-06 10:22:40 -06:00
Proc_Partitions_Info.h Replace obsolete FSF postal address in copyright notices (#721565) 2014-01-26 10:53:23 +00:00
SWRaid_Info.h Ensure SWRaid_Info cache is loaded at least once (#756829) 2015-11-02 10:03:45 -07:00
TreeView_Detail.h Use PartitionVector class throughout the code (#759726) 2016-01-26 10:11:35 -07:00
Utils.h Add busy detection of LUKS mapping (#760080) 2016-01-29 13:41:40 -07:00
Win_GParted.h Change copied_partition into a pointer (#759726) 2016-01-26 10:11:35 -07:00
btrfs.h Include Partition.h header everywhere it's used 2016-01-26 10:11:35 -07:00
exfat.h Replace obsolete FSF postal address in copyright notices (#721565) 2014-01-26 10:53:23 +00:00
ext2.h Include Partition.h header everywhere it's used 2016-01-26 10:11:35 -07:00
f2fs.h Include Partition.h header everywhere it's used 2016-01-26 10:11:35 -07:00
fat16.h Include Partition.h header everywhere it's used 2016-01-26 10:11:35 -07:00
hfs.h Include Partition.h header everywhere it's used 2016-01-26 10:11:35 -07:00
hfsplus.h Include Partition.h header everywhere it's used 2016-01-26 10:11:35 -07:00
i18n.h Make include guards unique (#539297) 2013-06-05 10:57:39 -06:00
jfs.h Include Partition.h header everywhere it's used 2016-01-26 10:11:35 -07:00
linux_swap.h Include Partition.h header everywhere it's used 2016-01-26 10:11:35 -07:00
luks.h Add busy detection of LUKS mapping (#760080) 2016-01-29 13:41:40 -07:00
lvm2_pv.h Include Partition.h header everywhere it's used 2016-01-26 10:11:35 -07:00
nilfs2.h Include Partition.h header everywhere it's used 2016-01-26 10:11:35 -07:00
ntfs.h Include Partition.h header everywhere it's used 2016-01-26 10:11:35 -07:00
reiser4.h Include Partition.h header everywhere it's used 2016-01-26 10:11:35 -07:00
reiserfs.h Include Partition.h header everywhere it's used 2016-01-26 10:11:35 -07:00
ufs.h Replace obsolete FSF postal address in copyright notices (#721565) 2014-01-26 10:53:23 +00:00
xfs.h Include Partition.h header everywhere it's used 2016-01-26 10:11:35 -07:00