ums

package
v0.0.0-...-55e27cd Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2023 License: GPL-3.0-only Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// p65, 3. Direct Access Block commands (SPC-5 and SBC-4), SCSI Commands Reference Manual, Rev. J
	TEST_UNIT_READY  = 0x00
	REQUEST_SENSE    = 0x03
	INQUIRY          = 0x12
	MODE_SENSE_6     = 0x1a
	START_STOP_UNIT  = 0x1b
	MODE_SENSE_10    = 0x5a
	READ_CAPACITY_10 = 0x25
	READ_10          = 0x28
	WRITE_10         = 0x2a
	REPORT_LUNS      = 0xa0

	// service actions
	SERVICE_ACTION   = 0x9e
	READ_CAPACITY_16 = 0x10

	// 04-349r1 SPC-3 MMC-5 Merge PREVENT ALLOW MEDIUM REMOVAL commands
	PREVENT_ALLOW_MEDIUM_REMOVAL = 0x1e

	// p33, 4.10, USB Mass Storage Class – UFI Command Specification Rev. 1.0
	READ_FORMAT_CAPACITIES = 0x23

	// To speed up FDE it is beneficial to report a larger block size, to
	// reduce the number of encryption/decryption iterations caused by
	// per-block IV computation.
	BLOCK_SIZE_MULTIPLIER = 8

	// These parameters control how many blocks are read/written before
	// being offloaded to DCP for decryption/encryption in a goroutine.
	//
	// Values should be tuned for optimum pipeline performance, to minimize
	// overhead while the DCP works in parallel with the next batch of
	// uSDHC read/write.
	READ_PIPELINE_SIZE  = 12
	WRITE_PIPELINE_SIZE = 20
)
View Source
const (
	// exactly 8 bytes required
	VendorID = "F-Secure"
	// exactly 16 bytes required
	ProductID = "USB armory Mk II"
	// exactly 4 bytes required
	ProductRevision = "1.00"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Card

type Card interface {
	Detect() error
	Info() usdhc.CardInfo
	ReadBlocks(int, []byte) error
	WriteBlocks(int, []byte) error
}

type Drive

type Drive struct {
	// Cipher controls whether FDE should be applied
	Cipher bool

	// Keyring instance
	Keyring *crypto.Keyring

	// Ready represents the logical device status
	Ready bool

	// PairingComplete signals pairing completion
	PairingComplete chan bool

	// Mult is the block multiplier
	Mult int
	// contains filtered or unexported fields
}

Drive represents an encrypted drive instance.

func (*Drive) Capacity

func (d *Drive) Capacity() uint64

func (*Drive) ConfigureUSB

func (d *Drive) ConfigureUSB() (device *usb.Device)

func (*Drive) Init

func (d *Drive) Init(card Card) (err error)

func (*Drive) Lock

func (d *Drive) Lock() (err error)

type MBR

type MBR struct {
	Bootstrap     [446]byte
	Partitions    [4]Partition
	BootSignature uint16
}

func (*MBR) Bytes

func (mbr *MBR) Bytes() []byte

type PairingDisk

type PairingDisk struct {
	Data []byte
}

func Pairing

func Pairing(code []byte, keyring *crypto.Keyring) (card *PairingDisk)

func (*PairingDisk) Detect

func (q *PairingDisk) Detect() error

func (*PairingDisk) Info

func (q *PairingDisk) Info() (info usdhc.CardInfo)

func (*PairingDisk) ReadBlocks

func (q *PairingDisk) ReadBlocks(lba int, buf []byte) (err error)

func (*PairingDisk) WriteBlocks

func (q *PairingDisk) WriteBlocks(lba int, buf []byte) (err error)

type Partition

type Partition struct {
	Status   byte
	FirstCHS [3]byte
	Type     byte
	LastCHS  [3]byte
	FirstLBA [4]byte
	Sectors  [4]byte
}

Jump to

Keyboard shortcuts

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