Crate libcryptsetup_rs

Source
Expand description

This is a wrapper library for libcryptsetup. The intention is to provide as much safety as possible when crossing FFI boundaries to the cryptsetup C library.

Modules§

consts

Macros§

c_confirm_callback
Create a C-compatible callback to determine user confirmation which wraps safe Rust code
c_logging_callback
Create a C-compatible logging callback which wraps safe Rust code
c_progress_callback
Create a C-compatible progress callback for wiping a device which wraps safe Rust code
c_str
Create a C-compatible static string with a null byte
c_token_handler_dump
Create a C-compatible callback for compatible with CryptTokenHandler
c_token_handler_free
Create a C-compatible callback for free compatible with CryptTokenHandler
c_token_handler_open
Create a C-compatible open callback compatible with CryptTokenHandler
c_token_handler_validate
Create a C-compatible callback for validate compatible with CryptTokenHandler
from_str_ptr
Convert a *const c_char into a &str type

Structs§

ActiveDevice
Record containing data on the given active device
CryptActivationHandle
Handle for activation options
CryptBackupHandle
Handle for backup operations on a device
CryptContextHandle
Cryptographic context for device
CryptDevice
Data type that is a handle for a crypt device
CryptDeviceStatusHandle
Handle for crypt device status operations
CryptFormatHandle
Handle for format operations on a device
CryptInit
Initialization handle for devices
CryptKeyfileContents
Contents of a keyfile that have been read
CryptKeyfileHandle
Handle for keyfile operations
CryptKeyslotHandle
Handle for keyslot operations
CryptLuks2FlagsHandle
Handle for LUKS2 persistent flag operations
CryptLuks2ReencryptHandle
Handle for reencryption operations
CryptLuks2TokenHandle
Handle for LUKS2 token operations
CryptParamsIntegrity
Parameters for integrity checking
CryptParamsIntegrityRef
A struct representing a reference with a lifetime to a CryptParamsIntegrity struct
CryptParamsLoopaes
Parameters for formatting a loop AES device
CryptParamsLoopaesRef
C-compatible reference to a CryptParamsLoopaes struct
CryptParamsLuks1
A struct representing LUKS1 specific parameters.
CryptParamsLuks2
LUKS2-specific parameters
CryptParamsLuks1Ref
A struct with a lifetime representing a reference to CryptParamsLuks1.
CryptParamsLuks2Ref
A struct representing a reference with a lifetime to a CryptParamsLuks2 struct
CryptParamsPlain
Struct representing plain cryptsetup format parameters
CryptParamsPlainRef
Represents a reference to a CryptParamsPlain struct
CryptParamsReencrypt
Parameters for reencryption operations
CryptParamsReencryptRef
A struct representing a reference with a lifetime to a CryptParamsReencrypt struct
CryptParamsTcrypt
Parameters for tcrypt operations
CryptParamsTcryptRef
Reference to a CryptParamsTcrypt struct
CryptParamsVerity
Parameters specific to Verity
CryptParamsVerityRef
Reference to parameters specific to Verity
CryptPbkdfType
Rust representation of crypt_pbkdf_type
CryptPbkdfTypeRef
A type wrapping a PBKDF type with pointers derived from Rust data types and lifetimes to ensure pointer validity
CryptRuntimeHandle
Handle for runtime attribute options
CryptSettingsHandle
Handle to operate on cryptsetup device settings
CryptVolumeKeyHandle
Handle for volume key operations
CryptWipeHandle
Handle for volume key operations
SafeBorrowedMemZero
Handle for zeroing borrowed memory. “Borrowed” in this context refers to memory that will be cleaned up by some other scope and is not required to be freed by the caller. An example of this would be a char * pointer to kernel memory where the caller can access the memory but is not responsible for its allocation or deallocation.
SafeMemHandle
Handle to allocated memory from libcryptsetup
SafeOwnedMemZero
Handle for zeroing owned memory. “Owned” in this context refers to memory that has been allocated and stored in some kind of char ** argument in the context of C FFI. This means that the memory has been allocated by standard C allocators and needs to be cleaned up by the caller. In the context of Rust, we would consider this owned by the current scope.

Enums§

CryptTokenInfo
Type representing the token status. This type wraps the CRYPT_TOKEN_* values and the optional corresponding token type as a string.
Either
The enum Either with variants Left and Right is a general purpose sum type with two cases.
LibcryptErr
Error returned from any libcryptsetup-rs function
TokenInput
Token input for CryptLuks2Token::json_set

Traits§

SafeMemzero
A trait to be implemented for a segment of memory that can be explicitly zeroed in a way that will not be optimized away by the compiler.

Functions§

get_sector_size
Get size of encryption sectors in bytes
log
Generate a log entry
register
Register token handler
set_debug_level
Set library debug level
set_log_callback
Set the callback to be executed on logging events
status
Get status info from device name

Type Aliases§

Result
Result type to be used with libcryptsetup-rs
c_int
Re-exports libc types in API
c_uint
Re-exports libc types in API
size_t
Re-exports libc types in API