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
()
| 54 | // structs containing the relevant info. More information available here: |
| 55 | // https://kernel.readthedocs.io/en/sphinx-samples/crypto-API.html |
| 56 | func (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. |
| 73 | func parseCrypto(r io.Reader) ([]Crypto, error) { |