gparted/include/luks.h

38 lines
1.0 KiB
C
Raw Normal View History

/* Copyright (C) 2015 Mike Fleetwood
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GPARTED_LUKS_H
#define GPARTED_LUKS_H
#include "FileSystem.h"
#include "Partition.h"
namespace GParted
{
class luks : public FileSystem
{
public:
FS get_filesystem_support();
bool is_busy( const Glib::ustring & path );
Populate LUKS partition usage (#760080) Populate the used, unused and unallocated figures in the Partition object for a LUKS formatted partition. See comment in luks::set_used_sectors() for the rational of what is used, unused and unallocated. As that rational mentions, a LUKS header does not store the size of the encrypted data and is assumed to extend to the end of the partition by the tools which start the mapping. An underlying block device of 128 MiB (131072 KiB). # sfdisk -s /dev/sde 131072 An active LUKS mapping at offset 2 MiB (4096 512-byte sectors) and length 126 MiB (129024 KiB, 258048 512-byte sectors). # sfdisk -s /dev/mapper/sde_crypt 129024 # 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 No size/length reported when dumping the LUKS header, just (payload) offset. # cryptsetup luksDump /dev/sde LUKS header information for /dev/sde Version: 1 Cipher name: aes Cipher mode: cbc-essiv:sha256 Hash spec: sha1 Payload offset: 4096 MK bits: 256 MK digest: 7f fb ba 40 7e ba e4 3b 2f c6 d0 93 7b f7 05 49 7b 72 d4 ad MK salt: 4a 5b 54 f9 7b 67 af 6e ef 16 31 0a fe d9 7e 5f c3 66 dc 8a ed e0 07 f4 45 c3 7c 1a 8d 7d ac f4 MK iterations: 37750 UUID: 0a337705-434a-4994-a842-5b4351cb3778 ... Shrink the LUKS mapping to 64 MiB (65536 KiB, 131072 512-byte sectors). # cryptsetup resize --size 131072 sde_crypt # sfdisk -s /dev/mapper/sde_crypt 65536 # 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: 131072 sectors mode: read/write Stop and start the LUKS mapping. # cryptsetup luksClose sde_crypt # cryptsetup luksOpen /dev/sde sde_crypt The size of the LUKS mapping is back to 126 MiB (129024 KiB, 258048 512-byte sectors), extending to the end of the partition. # sfdisk -s /dev/mapper/sde_crypt 129024 # 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 Bug 760080 - Implement read-only LUKS support
2015-11-15 06:14:54 -07:00
void set_used_sectors( Partition & partition );
};
} //GParted
#endif /* GPARTED_LUKS_H */