Documentation ¶
Overview ¶
Package files contains the utilities for testing file based storage. It is primarily used to test cryptohomed and user's home directory.
Index ¶
- func AppendFile(ctx context.Context, runner hwsec.CmdRunner, path, key string, length int) error
- func CalcSHA256(ctx context.Context, runner hwsec.CmdRunner, path string) (string, error)
- func DeriveOpenSSLAESKeyIV(key string) ([]byte, []byte)
- func ResetFile(ctx context.Context, runner hwsec.CmdRunner, path string) error
- func UpdateHashForIteration(h *hash.Hash, key string, length int) error
- type FileInfo
- func (f *FileInfo) Clear(ctx context.Context) error
- func (f *FileInfo) Iteration() int
- func (f *FileInfo) Path() string
- func (f *FileInfo) Step(ctx context.Context) error
- func (f *FileInfo) StepOverridePath(ctx context.Context, path string) error
- func (f *FileInfo) Verify(ctx context.Context) error
- func (f *FileInfo) VerifyOverridePath(ctx context.Context, path string) error
- type HomedirFiles
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendFile ¶
AppendFile appends to the the file at path, for a size of length bytes. The data written is generated with AES. length should always be multples of 32 bytes. Note that key and path should not contain single quote ('). Note that a block size of 32 is used so that we can test partial pages/sector, while having acceptable performance. (bs=1 can be slow.)
func CalcSHA256 ¶
CalcSHA256 calculates the SHA256 sum of a file on the DUT.
func DeriveOpenSSLAESKeyIV ¶
DeriveOpenSSLAESKeyIV derives the key and IV that was used by OpenSSL when it wrote the test data to the test file.
func UpdateHashForIteration ¶
UpdateHashForIteration updates the given sha256 hash object to reflect the contents written to the test file during the iteration/round. This function mirrors what AppendFile() does. length is the length of the data, it should be in multiples of 32 bytes.
Types ¶
type FileInfo ¶
type FileInfo struct {
// contains filtered or unexported fields
}
FileInfo stores the information related to a file under test that is stored in the DUT. With the information
func NewFileInfo ¶
NewFileInfo create a new FileInfo for testing a file. Note that calling this method only initializes the data structures and doesn't touch anything on disk. To reset the on disk state, call Clear().
func (*FileInfo) Clear ¶
Clear resets the file and the state in data structure back to an empty file.
func (*FileInfo) StepOverridePath ¶
StepOverridePath append to the test file, but assuming the file is located at the given path. This is used to test bind mount.
type HomedirFiles ¶
type HomedirFiles struct {
// contains filtered or unexported fields
}
HomedirFiles stores the test file related to a user's home directory.
func NewHomedirFiles ¶
func NewHomedirFiles(ctx context.Context, util *hwsec.CryptohomeClient, runner hwsec.CmdRunner, username string) (*HomedirFiles, error)
NewHomedirFiles creates a new HomedirFiles for testing the files in the given user's home directory. Note that calling this method only initializes the data structures and doesn't touch anything on disk. To reset the on disk state, call Clear(). Thus, this can be called before the home is mounted.
func (*HomedirFiles) Clear ¶
func (h *HomedirFiles) Clear(ctx context.Context) error
Clear resets the files and their corresponding states in data structure.
func (*HomedirFiles) Step ¶
func (h *HomedirFiles) Step(ctx context.Context) error
Step appends data to all test files in the home directory. It'll only use the first path for each file.
func (*HomedirFiles) StepAll ¶
func (h *HomedirFiles) StepAll(ctx context.Context) error
StepAll appends to data to all test files in the home directory. However, unlike Step(), it'll use all available paths to the same file and Step once for each available paths.