"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/LUKS_Info.cc" between
gparted-1.2.0.tar.gz and gparted-1.3.0.tar.gz

About: GParted is a graphical partition editor for creating, reorganizing, and deleting disk partitions (using GNU libparted).

LUKS_Info.cc  (gparted-1.2.0):LUKS_Info.cc  (gparted-1.3.0)
skipping to change at line 75 skipping to change at line 75
Glib::ustring error; Glib::ustring error;
Utils::execute_command( "dmsetup table --target crypt", output, error, tr ue ); Utils::execute_command( "dmsetup table --target crypt", output, error, tr ue );
// dmsetup output is one line per dm-crypt mapping containing fields: // dmsetup output is one line per dm-crypt mapping containing fields:
// NAME: START LENGTH TARGET CIPHER KEY IVOFFSET DEVPATH OFFSET ... // NAME: START LENGTH TARGET CIPHER KEY IVOFFSET DEVPATH OFFSET ...
// or the text: // or the text:
// No devices found // No devices found
// First 4 fields are defined by the dmsetup program by the print call in the // First 4 fields are defined by the dmsetup program by the print call in the
// _status() function: // _status() function:
// https://git.fedorahosted.org/cgit/lvm2.git/tree/tools/dmsetup.c?id =v2_02_118#n1715 // https://git.fedorahosted.org/cgit/lvm2.git/tree/tools/dmsetup.c?id =v2_02_118#n1715
// Field 5 onwards are called parameters and documented in the kernel sou rce: // Field 5 onwards are called parameters and documented in the kernel sou rce:
// https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tr ee/Documentation/device-mapper/dm-crypt.txt?id=v4.0 // https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tr ee/Documentation/device-mapper/dm-crypt.txt?id=v5.0
std::vector<Glib::ustring> lines; std::vector<Glib::ustring> lines;
Utils::tokenize( output, lines, "\n" ); Utils::tokenize( output, lines, "\n" );
for ( unsigned int i = 0 ; i < lines.size() ; i ++ ) for ( unsigned int i = 0 ; i < lines.size() ; i ++ )
{ {
LUKS_Mapping luks_map; LUKS_Mapping luks_map;
std::vector<Glib::ustring> fields; std::vector<Glib::ustring> fields;
Utils::tokenize( lines[i], fields, " " ); Utils::tokenize( lines[i], fields, " " );
const unsigned DMCRYPT_FIELD_Name = 0; const unsigned DMCRYPT_FIELD_Name = 0;
const unsigned DMCRYPT_FIELD_length = 2; const unsigned DMCRYPT_FIELD_length = 2;
const unsigned DMCRYPT_FIELD_key = 5;
const unsigned DMCRYPT_FIELD_devpath = 7; const unsigned DMCRYPT_FIELD_devpath = 7;
const unsigned DMCRYPT_FIELD_offset = 8; const unsigned DMCRYPT_FIELD_offset = 8;
if ( fields.size() <= DMCRYPT_FIELD_offset ) if ( fields.size() <= DMCRYPT_FIELD_offset )
continue; continue;
// Extract LUKS mapping name // Extract LUKS mapping name
Glib::ustring name = fields[DMCRYPT_FIELD_Name]; Glib::ustring name = fields[DMCRYPT_FIELD_Name];
size_t len = name.length(); size_t len = name.length();
if ( len <= 1 || name[len-1] != ':' ) if ( len <= 1 || name[len-1] != ':' )
skipping to change at line 129 skipping to change at line 130
Byte_Value offset = atoll( fields[DMCRYPT_FIELD_offset].c_str() ) ; Byte_Value offset = atoll( fields[DMCRYPT_FIELD_offset].c_str() ) ;
Byte_Value length = atoll( fields[DMCRYPT_FIELD_length].c_str() ) ; Byte_Value length = atoll( fields[DMCRYPT_FIELD_length].c_str() ) ;
if ( offset > 0LL && length > 0LL ) if ( offset > 0LL && length > 0LL )
{ {
luks_map.offset = offset * 512LL; luks_map.offset = offset * 512LL;
luks_map.length = length * 512LL; luks_map.length = length * 512LL;
} }
else else
continue; continue;
// Extract LUKS mapping master key location. Following the crypt
setup
// implementation method; first character of KEY field is ":" mea
ns the
// master key was stored in the kernel key ring, otherwise it is
stored in
// the Device-Mapper crypt target itself.
// * cryptsetup/v2.3.5/lib/libdevmapper.c:_dm_target_query_crypt(
)
// https://gitlab.com/cryptsetup/cryptsetup/-/blob/v2.3.5/lib/l
ibdevmapper.c#L2031
// * cryptsetup/v2.3.5/src/cryptsetup.c:action_status()
// https://gitlab.com/cryptsetup/cryptsetup/-/blob/v2.3.5/src/c
ryptsetup.c#L839
luks_map.key_loc = (fields[DMCRYPT_FIELD_key][0] == ':') ? KEYLOC
_KeyRing : KEYLOC_DMCrypt;
luks_mapping_cache.push_back( luks_map ); luks_mapping_cache.push_back( luks_map );
} }
} }
// Return LUKS cache entry for the named underlying block device path, // Return LUKS cache entry for the named underlying block device path,
// or not found substitute when no entry exists. // or not found substitute when no entry exists.
const LUKS_Mapping & LUKS_Info::get_cache_entry_internal( const Glib::ustring & path ) const LUKS_Mapping & LUKS_Info::get_cache_entry_internal( const Glib::ustring & path )
{ {
BlockSpecial bs = BlockSpecial( path ); BlockSpecial bs = BlockSpecial( path );
for ( unsigned int i = 0 ; i < luks_mapping_cache.size() ; i ++ ) for ( unsigned int i = 0 ; i < luks_mapping_cache.size() ; i ++ )
 End of changes. 3 change blocks. 
1 lines changed or deleted 19 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)