mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-11-13 17:11:08 -05:00
Add state disk volume mounter
Signed-off-by: Daniel Weiße <dw@edgeless.systems>
This commit is contained in:
parent
4b156be15e
commit
0e2025b67c
7 changed files with 269 additions and 1 deletions
33
state/mapper/cryptdevice.go
Normal file
33
state/mapper/cryptdevice.go
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
package mapper
|
||||
|
||||
import cryptsetup "github.com/martinjungblut/go-cryptsetup"
|
||||
|
||||
type cryptDevice interface {
|
||||
// ActivateByPassphrase activates a device by using a passphrase from a specific keyslot.
|
||||
// Returns nil on success, or an error otherwise.
|
||||
// C equivalent: crypt_activate_by_passphrase
|
||||
ActivateByPassphrase(deviceName string, keyslot int, passphrase string, flags int) error
|
||||
// Deactivate deactivates a device.
|
||||
// Returns nil on success, or an error otherwise.
|
||||
// C equivalent: crypt_deactivate
|
||||
Deactivate(deviceName string) error
|
||||
// Format formats a Device, using a specific device type, and type-independent parameters.
|
||||
// Returns nil on success, or an error otherwise.
|
||||
// C equivalent: crypt_format
|
||||
Format(deviceType cryptsetup.DeviceType, genericParams cryptsetup.GenericParams) error
|
||||
// Free releases crypt device context and used memory.
|
||||
// C equivalent: crypt_free
|
||||
Free() bool
|
||||
// Load loads crypt device parameters from the on-disk header.
|
||||
// Returns nil on success, or an error otherwise.
|
||||
// C equivalent: crypt_load
|
||||
Load(cryptsetup.DeviceType) error
|
||||
// KeyslotAddByVolumeKey adds a key slot using a volume key to perform the required security check.
|
||||
// Returns nil on success, or an error otherwise.
|
||||
// C equivalent: crypt_keyslot_add_by_volume_key
|
||||
KeyslotAddByVolumeKey(keyslot int, volumeKey string, passphrase string) error
|
||||
// KeyslotChangeByPassphrase changes a defined a key slot using a previously added passphrase to perform the required security check.
|
||||
// Returns nil on success, or an error otherwise.
|
||||
// C equivalent: crypt_keyslot_change_by_passphrase
|
||||
KeyslotChangeByPassphrase(currentKeyslot int, newKeyslot int, currentPassphrase string, newPassphrase string) error
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue