File: simulator_disabled.go

package info (click to toggle)
golang-github-smallstep-crypto 0.57.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,284 kB
  • sloc: sh: 53; makefile: 36
file content (39 lines) | stat: -rw-r--r-- 875 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//go:build !tpmsimulator
// +build !tpmsimulator

package simulator

import (
	"errors"
	"io"
)

type NoSimulator struct {
}

func New() (Simulator, error) {
	return &NoSimulator{}, errors.New("no simulator available")
}

func (s *NoSimulator) Open() error {
	return errors.New("cannot open: no simulator available")
}

func (s *NoSimulator) Close() error {
	return errors.New("cannot close: no simulator available")
}

func (s *NoSimulator) MeasurementLog() ([]byte, error) {
	return nil, errors.New("cannot get measurement log: no simulator available")
}

func (s *NoSimulator) Read([]byte) (int, error) {
	return -1, errors.New("cannot read: no simulator available")
}

func (s *NoSimulator) Write([]byte) (int, error) {
	return -1, errors.New("cannot write: no simulator available")
}

var _ Simulator = (*NoSimulator)(nil)
var _ io.ReadWriteCloser = (*NoSimulator)(nil)