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