Source file src/crypto/internal/boring/notboring.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 && linux && (amd64 || arm64) && !android && !msan && cgo)
     6  
     7  package boring
     8  
     9  import (
    10  	"crypto"
    11  	"crypto/cipher"
    12  	"crypto/internal/boring/sig"
    13  	"hash"
    14  )
    15  
    16  const available = false
    17  
    18  // Unreachable marks code that should be unreachable
    19  // when BoringCrypto is in use. It is a no-op without BoringCrypto.
    20  func Unreachable() {
    21  	// Code that's unreachable when using BoringCrypto
    22  	// is exactly the code we want to detect for reporting
    23  	// standard Go crypto.
    24  	sig.StandardCrypto()
    25  }
    26  
    27  // UnreachableExceptTests marks code that should be unreachable
    28  // when BoringCrypto is in use. It is a no-op without BoringCrypto.
    29  func UnreachableExceptTests() {}
    30  
    31  type randReader int
    32  
    33  func (randReader) Read(b []byte) (int, error) { panic("boringcrypto: not available") }
    34  
    35  const RandReader = randReader(0)
    36  
    37  func NewSHA1() hash.Hash   { panic("boringcrypto: not available") }
    38  func NewSHA224() hash.Hash { panic("boringcrypto: not available") }
    39  func NewSHA256() hash.Hash { panic("boringcrypto: not available") }
    40  func NewSHA384() hash.Hash { panic("boringcrypto: not available") }
    41  func NewSHA512() hash.Hash { panic("boringcrypto: not available") }
    42  
    43  func SHA1([]byte) [20]byte   { panic("boringcrypto: not available") }
    44  func SHA224([]byte) [28]byte { panic("boringcrypto: not available") }
    45  func SHA256([]byte) [32]byte { panic("boringcrypto: not available") }
    46  func SHA384([]byte) [48]byte { panic("boringcrypto: not available") }
    47  func SHA512([]byte) [64]byte { panic("boringcrypto: not available") }
    48  
    49  func NewHMAC(h func() hash.Hash, key []byte) hash.Hash { panic("boringcrypto: not available") }
    50  
    51  func NewAESCipher(key []byte) (cipher.Block, error) { panic("boringcrypto: not available") }
    52  func NewGCMTLS(cipher.Block) (cipher.AEAD, error)   { panic("boringcrypto: not available") }
    53  func NewGCMTLS13(cipher.Block) (cipher.AEAD, error) { panic("boringcrypto: not available") }
    54  
    55  type PublicKeyECDSA struct{ _ int }
    56  type PrivateKeyECDSA struct{ _ int }
    57  
    58  func GenerateKeyECDSA(curve string) (X, Y, D BigInt, err error) {
    59  	panic("boringcrypto: not available")
    60  }
    61  func NewPrivateKeyECDSA(curve string, X, Y, D BigInt) (*PrivateKeyECDSA, error) {
    62  	panic("boringcrypto: not available")
    63  }
    64  func NewPublicKeyECDSA(curve string, X, Y BigInt) (*PublicKeyECDSA, error) {
    65  	panic("boringcrypto: not available")
    66  }
    67  func SignMarshalECDSA(priv *PrivateKeyECDSA, hash []byte) ([]byte, error) {
    68  	panic("boringcrypto: not available")
    69  }
    70  func VerifyECDSA(pub *PublicKeyECDSA, hash []byte, sig []byte) bool {
    71  	panic("boringcrypto: not available")
    72  }
    73  
    74  type PublicKeyRSA struct{ _ int }
    75  type PrivateKeyRSA struct{ _ int }
    76  
    77  func DecryptRSAOAEP(h, mgfHash hash.Hash, priv *PrivateKeyRSA, ciphertext, label []byte) ([]byte, error) {
    78  	panic("boringcrypto: not available")
    79  }
    80  func DecryptRSAPKCS1(priv *PrivateKeyRSA, ciphertext []byte) ([]byte, error) {
    81  	panic("boringcrypto: not available")
    82  }
    83  func DecryptRSANoPadding(priv *PrivateKeyRSA, ciphertext []byte) ([]byte, error) {
    84  	panic("boringcrypto: not available")
    85  }
    86  func EncryptRSAOAEP(h, mgfHash hash.Hash, pub *PublicKeyRSA, msg, label []byte) ([]byte, error) {
    87  	panic("boringcrypto: not available")
    88  }
    89  func EncryptRSAPKCS1(pub *PublicKeyRSA, msg []byte) ([]byte, error) {
    90  	panic("boringcrypto: not available")
    91  }
    92  func EncryptRSANoPadding(pub *PublicKeyRSA, msg []byte) ([]byte, error) {
    93  	panic("boringcrypto: not available")
    94  }
    95  func GenerateKeyRSA(bits int) (N, E, D, P, Q, Dp, Dq, Qinv BigInt, err error) {
    96  	panic("boringcrypto: not available")
    97  }
    98  func NewPrivateKeyRSA(N, E, D, P, Q, Dp, Dq, Qinv BigInt) (*PrivateKeyRSA, error) {
    99  	panic("boringcrypto: not available")
   100  }
   101  func NewPublicKeyRSA(N, E BigInt) (*PublicKeyRSA, error) { panic("boringcrypto: not available") }
   102  func SignRSAPKCS1v15(priv *PrivateKeyRSA, h crypto.Hash, hashed []byte) ([]byte, error) {
   103  	panic("boringcrypto: not available")
   104  }
   105  func SignRSAPSS(priv *PrivateKeyRSA, h crypto.Hash, hashed []byte, saltLen int) ([]byte, error) {
   106  	panic("boringcrypto: not available")
   107  }
   108  func VerifyRSAPKCS1v15(pub *PublicKeyRSA, h crypto.Hash, hashed, sig []byte) error {
   109  	panic("boringcrypto: not available")
   110  }
   111  func VerifyRSAPSS(pub *PublicKeyRSA, h crypto.Hash, hashed, sig []byte, saltLen int) error {
   112  	panic("boringcrypto: not available")
   113  }
   114  
   115  type PublicKeyECDH struct{}
   116  type PrivateKeyECDH struct{}
   117  
   118  func ECDH(*PrivateKeyECDH, *PublicKeyECDH) ([]byte, error)      { panic("boringcrypto: not available") }
   119  func GenerateKeyECDH(string) (*PrivateKeyECDH, []byte, error)   { panic("boringcrypto: not available") }
   120  func NewPrivateKeyECDH(string, []byte) (*PrivateKeyECDH, error) { panic("boringcrypto: not available") }
   121  func NewPublicKeyECDH(string, []byte) (*PublicKeyECDH, error)   { panic("boringcrypto: not available") }
   122  func (*PublicKeyECDH) Bytes() []byte                            { panic("boringcrypto: not available") }
   123  func (*PrivateKeyECDH) PublicKey() (*PublicKeyECDH, error)      { panic("boringcrypto: not available") }
   124  

View as plain text