Source file src/crypto/internal/fips140test/fips_test.go

     1  // Copyright 2024 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // Package fipstest collects external tests that would ordinarily live in
     6  // crypto/internal/fips140/... packages. That tree gets snapshot at each
     7  // validation, while we want tests to evolve and still apply to all versions of
     8  // the module. Also, we can't fix failing tests in a module snapshot, so we need
     9  // to either minimize, skip, or remove them. Finally, the module needs to avoid
    10  // importing internal packages like testenv and cryptotest to avoid locking in
    11  // their APIs.
    12  package fipstest
    13  
    14  import (
    15  	"encoding/hex"
    16  	"strings"
    17  	"testing"
    18  )
    19  
    20  func decodeHex(t *testing.T, s string) []byte {
    21  	t.Helper()
    22  	s = strings.ReplaceAll(s, " ", "")
    23  	b, err := hex.DecodeString(s)
    24  	if err != nil {
    25  		t.Fatal(err)
    26  	}
    27  	return b
    28  }
    29  

View as plain text