MCPcopy Create free account
hub / github.com/prometheus/procfs / Crypto

Method Crypto

crypto.go:56–70  ·  view source on GitHub ↗

Crypto parses an crypto-file (/proc/crypto) and returns a slice of structs containing the relevant info. More information available here: https://kernel.readthedocs.io/en/sphinx-samples/crypto-API.html

()

Source from the content-addressed store, hash-verified

54// structs containing the relevant info. More information available here:
55// https://kernel.readthedocs.io/en/sphinx-samples/crypto-API.html
56func (fs FS) Crypto() ([]Crypto, error) {
57 path := fs.proc.Path(cryptoFile)
58 b, err := parsers.ReadFileNoStat(path)
59 if err != nil {
60 return nil, fmt.Errorf("%w: Cannot read file %v: %w", ErrFileRead, b, err)
61
62 }
63
64 crypto, err := parseCrypto(bytes.NewReader(b))
65 if err != nil {
66 return nil, fmt.Errorf("%w: Cannot parse %v: %w", ErrFileParse, crypto, err)
67 }
68
69 return crypto, nil
70}
71
72// parseCrypto parses a /proc/crypto stream into Crypto elements.
73func parseCrypto(r io.Reader) ([]Crypto, error) {

Callers 2

TestFS_CryptoFunction · 0.80
TestFS_CryptoCorruptedFunction · 0.80

Calls 3

ReadFileNoStatFunction · 0.92
parseCryptoFunction · 0.85
PathMethod · 0.45

Tested by 2

TestFS_CryptoFunction · 0.64
TestFS_CryptoCorruptedFunction · 0.64