cryptsetup API
Public cryptsetup API
Volume Key manipulation


int crypt_volume_key_get (struct crypt_device *cd, int keyslot, char *volume_key, size_t *volume_key_size, const char *passphrase, size_t passphrase_size)
int crypt_volume_key_verify (struct crypt_device *cd, const char *volume_key, size_t volume_key_size)

Detailed Description

Function Documentation

◆ crypt_volume_key_get()

int crypt_volume_key_get ( struct crypt_device *  cd,
int  keyslot,
char *  volume_key,
size_t *  volume_key_size,
const char *  passphrase,
size_t  passphrase_size 

Get volume key from crypt device.

cdcrypt device handle
keyslotuse this keyslot or CRYPT_ANY_SLOT
volume_keybuffer for volume key
volume_key_sizeon input, size of buffer volume_key, on output size of volume_key
passphrasepassphrase used to unlock volume key
passphrase_sizesize of passphrase
unlocked key slot number or negative errno otherwise.
For TCRYPT cipher chain is the volume key concatenated for all ciphers in chain.
For VERITY the volume key means root hash used for activation.

◆ crypt_volume_key_verify()

int crypt_volume_key_verify ( struct crypt_device *  cd,
const char *  volume_key,
size_t  volume_key_size 

Verify that provided volume key is valid for crypt device.

cdcrypt device handle
volume_keyprovided volume key
volume_key_sizesize of volume_key
0 on success or negative errno value otherwise.