disk: new type LUKSContainer

Representation for the encrypted storage container of the same name.

Implements the following disk interfaces:
- Entity
- Container

Co-Authored-By: Christian Kellner <christian@kellner.me>
This commit is contained in:
Achilleas Koutsou 2022-02-07 20:07:28 +01:00 committed by Tom Gundersen
parent 250116638c
commit ef2fdf16a7

40
internal/disk/luks.go Normal file
View file

@ -0,0 +1,40 @@
package disk
import "fmt"
type Argon2id struct {
Iterations uint
Memory uint
Parallelism uint
}
type LUKSContainer struct {
Passphrase string
UUID string
Cipher string
Label string
Subsystem string
SectorSize uint64
// password-based key derivation function
PBKDF Argon2id
Payload Entity
}
func (lc *LUKSContainer) IsContainer() bool {
return true
}
func (lc *LUKSContainer) GetItemCount() uint {
if lc.Payload == nil {
return 0
}
return 1
}
func (lc *LUKSContainer) GetChild(n uint) Entity {
if n != 0 {
panic(fmt.Sprintf("invalid child index for LUKSContainer: %d != 0", n))
}
return lc.Payload
}