Source file src/crypto/internal/fips140/export_test.go

     1  // Copyright 2026 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 fips140
     6  
     7  type TestType struct {
     8  	A, B, C string
     9  }
    10  
    11  type TestType2 struct {
    12  	A, B, C, D, E string
    13  }
    14  
    15  //go:noinline
    16  func DynamicString() string { return "dyn" }
    17  
    18  // This code is in the fips140 package, so it is compiled in
    19  // FIPS mode. In the external test compile_test.go, wantLiterals
    20  // is the same code. Keep them in sync. See TestCompile.
    21  
    22  //go:noinline
    23  func Literals() (a []TestType, b []TestType2) {
    24  	a = append(a, TestType{
    25  		A: "a",
    26  		B: "",
    27  		C: "",
    28  	})
    29  	a = append(a, TestType{
    30  		A: "a",
    31  		B: DynamicString(),
    32  		C: "",
    33  	})
    34  	b = append(b, TestType2{
    35  		A: "a",
    36  		B: "",
    37  		C: "",
    38  		D: "",
    39  		E: "",
    40  	})
    41  	b = append(b, TestType2{
    42  		A: "a",
    43  		B: DynamicString(),
    44  		C: "",
    45  		D: "d",
    46  		E: DynamicString(),
    47  	})
    48  	return a, b
    49  }
    50  

View as plain text