mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-05-04 07:15:05 -04:00
disk-mapper: set LUKS2 token to allow reusing unintialized state disks (#2083)
Signed-off-by: Daniel Weiße <dw@edgeless.systems>
This commit is contained in:
parent
dc373971b2
commit
6a40c73ff7
10 changed files with 161 additions and 31 deletions
|
@ -52,7 +52,12 @@ func (c *DiskEncryption) UpdatePassphrase(passphrase string) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return c.device.KeyslotChangeByPassphrase(keyslot, keyslot, initialPassphrase, passphrase)
|
||||
if err := c.device.KeyslotChangeByPassphrase(keyslot, keyslot, initialPassphrase, passphrase); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Set token as initialized.
|
||||
return c.device.SetConstellationStateDiskToken(cryptsetup.SetDiskInitialized)
|
||||
}
|
||||
|
||||
// getInitialPassphrase retrieves the initial passphrase used on first boot.
|
||||
|
@ -68,4 +73,5 @@ type cryptdevice interface {
|
|||
InitByName(name string) (func(), error)
|
||||
GetUUID() (string, error)
|
||||
KeyslotChangeByPassphrase(currentKeyslot int, newKeyslot int, currentPassphrase string, newPassphrase string) error
|
||||
SetConstellationStateDiskToken(bool) error
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue