opal

package module
v0.0.0-...-1dbdc72 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 25, 2020 License: MIT Imports: 5 Imported by: 0

README

OPAL (WIP)

Command line tools and library for controlling Opal disk drives using Linux IOCTLs with sedutil compatibility layer.

Requirements

Different IOCTLs were added in different kernel versions, the most notable in 4.14 so make sure your kernel is not that old.

CONFIG_BLK_SED_OPAL kernel parameter must be enabled:

zcat /proc/config.gz | grep CONFIG_BLK_SED_OPAL

sedutil compatibility

By default opalctl uses password hashing just like sedutil does. Instead of sending a raw password to a device it's PBKDF2'd first.

If you use a sedutil fork (1, 2) that switched to SHA512 password hashing algorithm use -sha512 option.

To use raw passwords pass -raw option with -hex if needed.

Usage

Unlock After Suspend

To enable drive unlocking after a suspend of a device previously encrypted with sedutil:

opalctl save <device> RW

Documentation

Overview

IOCTLs implementation can be found here: https://github.com/torvalds/linux/blob/master/block/sed-opal.c

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func Open

func Open(device string) (*Client, error)

func (*Client) ActivateLSP

func (c *Client) ActivateLSP(key *Key) error

func (*Client) ActivateUser

func (c *Client) ActivateUser(sess *Session) error

func (*Client) AddUserToLR

func (c *Client) AddUserToLR(sess *Session, state LockUnlockState) error

func (*Client) Close

func (c *Client) Close() error

func (*Client) Device

func (c *Client) Device() string

func (*Client) EnableDisableMBR

func (c *Client) EnableDisableMBR(key *Key, enable bool) error

func (*Client) EraseLR

func (c *Client) EraseLR(sess *Session) error

func (*Client) LockUnlock

func (c *Client) LockUnlock(sess *Session, state LockUnlockState) error

func (*Client) MBRDone

func (c *Client) MBRDone(key *Key, done bool) error

func (*Client) MBRWriteShadow

func (c *Client) MBRWriteShadow(key *Key, r io.Reader) error

func (*Client) PSIDRevertTPR

func (c *Client) PSIDRevertTPR(key *Key) error

func (*Client) RevertTPR

func (c *Client) RevertTPR(key *Key) error

func (*Client) Save

func (c *Client) Save(sess *Session, state LockUnlockState) error

func (*Client) SecureEraseLR

func (c *Client) SecureEraseLR(sess *Session) error

func (*Client) SetPassword

func (c *Client) SetPassword(sess, newUserPw *Session) error

func (*Client) SetupLR

func (c *Client) SetupLR(sess *Session, rle, wle bool) error

func (*Client) TakeOwnership

func (c *Client) TakeOwnership(key *Key) error

type Error

type Error struct {
	// contains filtered or unexported fields
}

func (Error) Error

func (e Error) Error() string

type Key

type Key struct {
	// contains filtered or unexported fields
}

func NewKey

func NewKey(passwd []byte, lr uint) (*Key, error)

type LockUnlockState

type LockUnlockState uint
const (
	LockUnlockReadOnly  LockUnlockState = C.OPAL_RO
	LockUnlockReadWrite LockUnlockState = C.OPAL_RW
	LockUnlockLock      LockUnlockState = C.OPAL_LK
)

type Session

type Session struct {
	// contains filtered or unexported fields
}

func NewSession

func NewSession(key *Key, who User, sum bool) (*Session, error)

type User

type User uint
const (
	Admin1 User = C.OPAL_ADMIN1
	User1  User = C.OPAL_USER1
	User2  User = C.OPAL_USER2
	User3  User = C.OPAL_USER3
	User4  User = C.OPAL_USER4
	User5  User = C.OPAL_USER5
	User6  User = C.OPAL_USER6
	User7  User = C.OPAL_USER7
	User8  User = C.OPAL_USER8
	User9  User = C.OPAL_USER9
)

func (User) String

func (u User) String() string

Directories

Path Synopsis
cmd
opalctl command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL