Source file src/crypto/tls/fipsonly/fipsonly.go

     1  // Copyright 2017 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  //go:build boringcrypto
     6  
     7  // Package fipsonly restricts all TLS configuration to FIPS-approved settings.
     8  //
     9  // The effect is triggered by importing the package anywhere in a program, as in:
    10  //
    11  //	import _ "crypto/tls/fipsonly"
    12  //
    13  // This package only exists when using Go compiled with GOEXPERIMENT=boringcrypto.
    14  package fipsonly
    15  
    16  // This functionality is provided as a side effect of an import to make
    17  // it trivial to add to an existing program. It requires only a single line
    18  // added to an existing source file, or it can be done by adding a whole
    19  // new source file and not modifying any existing source files.
    20  
    21  import (
    22  	"crypto/internal/boring/fipstls"
    23  	"crypto/internal/boring/sig"
    24  )
    25  
    26  func init() {
    27  	fipstls.Force()
    28  	sig.FIPSOnly()
    29  }
    30  

View as plain text