From f7c725ea5722959145db51847214897bad8e8b01 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Sun, 22 Nov 2026 18:12:06 +0900 Subject: 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 --- container/seccomp/libseccomp_test.go | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'container/seccomp/libseccomp_test.go') 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 } -- cgit v1.3.1