diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-11-22 18:12:06 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-11-22 18:12:06 +0900 |
| commit | f7c725ea5722959145db51847214897bad8e8b01 (patch) | |
| tree | c08cbe634d2e8ee025309bb6b1ae082265b8e03c /container/seccomp/libseccomp_test.go | |
| parent | ee51069e4756492f445069e39cc13715c6b19f0d (diff) | |
container/seccomp: use sha384 for validation
This also replaces hex encoding with base64 for more manageable string
representations, and removes targets with build-only support.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'container/seccomp/libseccomp_test.go')
| -rw-r--r-- | container/seccomp/libseccomp_test.go | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/container/seccomp/libseccomp_test.go b/container/seccomp/libseccomp_test.go index f46c36db..3e7de27c 100644 --- a/container/seccomp/libseccomp_test.go +++ b/container/seccomp/libseccomp_test.go @@ -2,6 +2,7 @@ package seccomp_test import ( "crypto/sha512" + "encoding/base64" "errors" "syscall" "testing" @@ -98,11 +99,21 @@ func TestExport(t *testing.T) { t.Parallel() want := bpfExpected[bpfPreset{tc.flags, tc.presets}] - if data, err := Export(Preset(tc.presets, tc.flags), tc.flags); (err != nil) != tc.wantErr { - t.Errorf("Export: error = %v, wantErr %v", err, tc.wantErr) + if data, err := Export( + Preset(tc.presets, tc.flags), + tc.flags, + ); (err != nil) != tc.wantErr { + t.Errorf( + "Export: error = %v, wantErr %v", + err, tc.wantErr, + ) return - } else if got := sha512.Sum512(data); got != want { - t.Fatalf("Export: hash = %x, want %x", got, want) + } else if got := sha512.Sum384(data); got != want { + t.Fatalf( + "Export: hash = %s, want %s", + base64.StdEncoding.EncodeToString(got[:]), + base64.StdEncoding.EncodeToString(want[:]), + ) return } }) @@ -121,7 +132,7 @@ func BenchmarkExport(b *testing.B) { if err != nil { b.Fatalf("Export: error = %v", err) } - if got := sha512.Sum512(data); got != want { + if got := sha512.Sum384(data); got != want { b.Fatalf("Export: hash = %x, want %x", got, want) return } |
