aboutsummaryrefslogtreecommitdiffhomepage
path: root/container/seccomp/presets_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'container/seccomp/presets_test.go')
-rw-r--r--container/seccomp/presets_test.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/container/seccomp/presets_test.go b/container/seccomp/presets_test.go
new file mode 100644
index 00000000..b86d49ba
--- /dev/null
+++ b/container/seccomp/presets_test.go
@@ -0,0 +1,30 @@
+package seccomp_test
+
+import (
+ "crypto/sha512"
+ "encoding/hex"
+
+ "hakurei.app/container/seccomp"
+ "hakurei.app/container/std"
+)
+
+type (
+ bpfPreset = struct {
+ seccomp.ExportFlag
+ std.FilterPreset
+ }
+ bpfLookup map[bpfPreset][sha512.Size]byte
+)
+
+func toHash(s string) [sha512.Size]byte {
+ if len(s) != sha512.Size*2 {
+ panic("bad sha512 string length")
+ }
+ if v, err := hex.DecodeString(s); err != nil {
+ panic(err.Error())
+ } else if len(v) != sha512.Size {
+ panic("unreachable")
+ } else {
+ return ([sha512.Size]byte)(v)
+ }
+}