mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-06-27 15:37:21 -04:00
bootstrapper: allow building without cgo dependencies for linting
This commit is contained in:
parent
78085cba68
commit
94758bc392
5 changed files with 210 additions and 129 deletions
50
bootstrapper/internal/diskencryption/diskencryption_cross.go
Normal file
50
bootstrapper/internal/diskencryption/diskencryption_cross.go
Normal file
|
@ -0,0 +1,50 @@
|
|||
//go:build !linux || !cgo
|
||||
|
||||
/*
|
||||
Copyright (c) Edgeless Systems GmbH
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
/*
|
||||
Package diskencryption handles interaction with a node's state disk.
|
||||
|
||||
This package is not thread safe, since libcryptsetup is not thread safe.
|
||||
There should only be one instance using this package per process.
|
||||
*/
|
||||
package diskencryption
|
||||
|
||||
import "errors"
|
||||
|
||||
// Cryptsetup manages the encrypted state mapper device.
|
||||
type Cryptsetup struct{}
|
||||
|
||||
// New creates a new Cryptsetup.
|
||||
// This function panics if CGO is disabled.
|
||||
func New() *Cryptsetup {
|
||||
return &Cryptsetup{}
|
||||
}
|
||||
|
||||
// Open opens the cryptdevice.
|
||||
// This function does nothing if CGO is disabled.
|
||||
func (c *Cryptsetup) Open() error {
|
||||
return errors.New("using cryptsetup requires building with CGO")
|
||||
}
|
||||
|
||||
// Close closes the cryptdevice.
|
||||
// This function errors if CGO is disabled.
|
||||
func (c *Cryptsetup) Close() error {
|
||||
return errors.New("using cryptsetup requires building with CGO")
|
||||
}
|
||||
|
||||
// UUID gets the device's UUID.
|
||||
// This function errors if CGO is disabled.
|
||||
func (c *Cryptsetup) UUID() (string, error) {
|
||||
return "", errors.New("using cryptsetup requires building with CGO")
|
||||
}
|
||||
|
||||
// UpdatePassphrase switches the initial random passphrase of the mapped crypt device to a permanent passphrase.
|
||||
// This function errors if CGO is disabled.
|
||||
func (c *Cryptsetup) UpdatePassphrase(_ string) error {
|
||||
return errors.New("using cryptsetup requires building with CGO")
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue