cryptsetup API
Public cryptsetup API
Loading...
Searching...
No Matches
Enumerations | Functions
Crypt and Verity device status

Enumerations

enum  crypt_status_info { CRYPT_INVALID , CRYPT_INACTIVE , CRYPT_ACTIVE , CRYPT_BUSY }
 

Functions

crypt_status_info crypt_status (struct crypt_device *cd, const char *name)
 
int crypt_dump (struct crypt_device *cd)
 
int crypt_dump_json (struct crypt_device *cd, const char **json, uint32_t flags)
 
const char * crypt_get_cipher (struct crypt_device *cd)
 
const char * crypt_get_cipher_mode (struct crypt_device *cd)
 
const char * crypt_get_uuid (struct crypt_device *cd)
 
const char * crypt_get_device_name (struct crypt_device *cd)
 
const char * crypt_get_metadata_device_name (struct crypt_device *cd)
 
uint64_t crypt_get_data_offset (struct crypt_device *cd)
 
uint64_t crypt_get_iv_offset (struct crypt_device *cd)
 
int crypt_get_volume_key_size (struct crypt_device *cd)
 
int crypt_get_sector_size (struct crypt_device *cd)
 
int crypt_header_is_detached (struct crypt_device *cd)
 
int crypt_get_verity_info (struct crypt_device *cd, struct crypt_params_verity *vp)
 
int crypt_get_integrity_info (struct crypt_device *cd, struct crypt_params_integrity *ip)
 

Detailed Description

Enumeration Type Documentation

◆ crypt_status_info

Device status

Enumerator
CRYPT_INVALID 

device mapping is invalid in this context

CRYPT_INACTIVE 

no such mapped device

CRYPT_ACTIVE 

device is active

CRYPT_BUSY 

device is active and has open count > 0

Function Documentation

◆ crypt_dump()

int crypt_dump ( struct crypt_device *  cd)

Dump text-formatted information about crypt or verity device to log output.

Parameters
cdcrypt device handle
Returns
0 on success or negative errno value otherwise.

◆ crypt_dump_json()

int crypt_dump_json ( struct crypt_device *  cd,
const char **  json,
uint32_t  flags 
)

Dump JSON-formatted information about LUKS2 device

Parameters
cdcrypt device handle (only LUKS2 format supported)
jsonbuffer with JSON, if NULL use log callback for output
flagsdump flags (reserved)
Returns
0 on success or negative errno value otherwise.

◆ crypt_get_cipher()

const char * crypt_get_cipher ( struct crypt_device *  cd)

Get cipher used in device.

Parameters
cdcrypt device handle
Returns
used cipher, e.g. "aes" or NULL otherwise
Examples
crypt_luks_usage.c.

◆ crypt_get_cipher_mode()

const char * crypt_get_cipher_mode ( struct crypt_device *  cd)

Get cipher mode used in device.

Parameters
cdcrypt device handle
Returns
used cipher mode e.g. "xts-plain" or otherwise
Examples
crypt_luks_usage.c.

◆ crypt_get_data_offset()

uint64_t crypt_get_data_offset ( struct crypt_device *  cd)

Get device offset in 512-bytes sectors where real data starts (on underlying device).

Parameters
cdcrypt device handle
Returns
device offset in sectors

◆ crypt_get_device_name()

const char * crypt_get_device_name ( struct crypt_device *  cd)

Get path to underlying device.

Parameters
cdcrypt device handle
Returns
path to underlying device name
Examples
crypt_luks_usage.c.

◆ crypt_get_integrity_info()

int crypt_get_integrity_info ( struct crypt_device *  cd,
struct crypt_params_integrity ip 
)

Get device parameters for INTEGRITY device.

Parameters
cdcrypt device handle
ipverity device info

0 on success or negative errno value otherwise.

◆ crypt_get_iv_offset()

uint64_t crypt_get_iv_offset ( struct crypt_device *  cd)

Get IV offset in 512-bytes sectors (skip).

Parameters
cdcrypt device handle
Returns
IV offset

◆ crypt_get_metadata_device_name()

const char * crypt_get_metadata_device_name ( struct crypt_device *  cd)

Get path to detached metadata device or NULL if it is not detached.

Parameters
cdcrypt device handle
Returns
path to underlying device name

◆ crypt_get_sector_size()

int crypt_get_sector_size ( struct crypt_device *  cd)

Get size (in bytes) of encryption sector for crypt device.

Parameters
cdcrypt device handle
Returns
sector size

◆ crypt_get_uuid()

const char * crypt_get_uuid ( struct crypt_device *  cd)

Get device UUID.

Parameters
cdcrypt device handle
Returns
device UUID or NULL if not set
Examples
crypt_luks_usage.c.

◆ crypt_get_verity_info()

int crypt_get_verity_info ( struct crypt_device *  cd,
struct crypt_params_verity vp 
)

Get device parameters for VERITY device.

Parameters
cdcrypt device handle
vpverity device info

0 on success or negative errno value otherwise.

◆ crypt_get_volume_key_size()

int crypt_get_volume_key_size ( struct crypt_device *  cd)

Get size (in bytes) of volume key for crypt device.

Parameters
cdcrypt device handle
Returns
volume key size
Note
For LUKS2, this function can be used only if there is at least one keyslot assigned to data segment.

◆ crypt_header_is_detached()

int crypt_header_is_detached ( struct crypt_device *  cd)

Check if initialized LUKS context uses detached header (LUKS header located on a different device than data.)

Parameters
cdcrypt device handle
Returns
1 if detached header is used, 0 if not or negative errno value otherwise.
Note
This is a runtime attribute, it does not say if a LUKS device requires detached header. This function works only with LUKS devices.

◆ crypt_status()

crypt_status_info crypt_status ( struct crypt_device *  cd,
const char *  name 
)

Get status info about device name.

Parameters
cdcrypt device handle, can be NULL
namecrypt device name
Returns
value defined by crypt_status_info.
Examples
crypt_luks_usage.c.