package seccomp_test import ( "crypto/sha512" "encoding/base64" "fmt" "hakurei.app/container/seccomp" "hakurei.app/container/std" ) type ( // bpfPreset represents a preset to validate. bpfPreset = struct { seccomp.ExportFlag std.FilterPreset } // bpfLookup are bpf presets and their corresponding filter checksum. bpfLookup = map[bpfPreset][sha512.Size384]byte ) // mustParse parses [base64.StdEncoding] representations of a sha512 checksum. func mustParse(s string) [sha512.Size384]byte { if v, err := base64.StdEncoding.DecodeString(s); err != nil { panic(err) } else if len(v) != sha512.Size384 { panic(fmt.Sprintf("bad checksum of %d bytes", len(v))) } else { return ([sha512.Size384]byte)(v) } }