github.com/JimmyHuang454/JLS-go@v0.0.0-20230831150107-90d536585ba0/boring/notboring.go (about)

     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 && !cmd_go_bootstrap && !msan && cgo)
     6  
     7  package boring
     8  
     9  import (
    10  	"crypto"
    11  	"crypto/cipher"
    12  	"github.com/JimmyHuang454/JLS-go/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  
    54  type PublicKeyECDSA struct{ _ int }
    55  type PrivateKeyECDSA struct{ _ int }
    56  
    57  func GenerateKeyECDSA(curve string) (X, Y, D BigInt, err error) {
    58  	panic("boringcrypto: not available")
    59  }
    60  func NewPrivateKeyECDSA(curve string, X, Y, D BigInt) (*PrivateKeyECDSA, error) {
    61  	panic("boringcrypto: not available")
    62  }
    63  func NewPublicKeyECDSA(curve string, X, Y BigInt) (*PublicKeyECDSA, error) {
    64  	panic("boringcrypto: not available")
    65  }
    66  func SignMarshalECDSA(priv *PrivateKeyECDSA, hash []byte) ([]byte, error) {
    67  	panic("boringcrypto: not available")
    68  }
    69  func VerifyECDSA(pub *PublicKeyECDSA, hash []byte, sig []byte) bool {
    70  	panic("boringcrypto: not available")
    71  }
    72  
    73  type PublicKeyRSA struct{ _ int }
    74  type PrivateKeyRSA struct{ _ int }
    75  
    76  func DecryptRSAOAEP(h, mgfHash hash.Hash, priv *PrivateKeyRSA, ciphertext, label []byte) ([]byte, error) {
    77  	panic("boringcrypto: not available")
    78  }
    79  func DecryptRSAPKCS1(priv *PrivateKeyRSA, ciphertext []byte) ([]byte, error) {
    80  	panic("boringcrypto: not available")
    81  }
    82  func DecryptRSANoPadding(priv *PrivateKeyRSA, ciphertext []byte) ([]byte, error) {
    83  	panic("boringcrypto: not available")
    84  }
    85  func EncryptRSAOAEP(h, mgfHash hash.Hash, pub *PublicKeyRSA, msg, label []byte) ([]byte, error) {
    86  	panic("boringcrypto: not available")
    87  }
    88  func EncryptRSAPKCS1(pub *PublicKeyRSA, msg []byte) ([]byte, error) {
    89  	panic("boringcrypto: not available")
    90  }
    91  func EncryptRSANoPadding(pub *PublicKeyRSA, msg []byte) ([]byte, error) {
    92  	panic("boringcrypto: not available")
    93  }
    94  func GenerateKeyRSA(bits int) (N, E, D, P, Q, Dp, Dq, Qinv BigInt, err error) {
    95  	panic("boringcrypto: not available")
    96  }
    97  func NewPrivateKeyRSA(N, E, D, P, Q, Dp, Dq, Qinv BigInt) (*PrivateKeyRSA, error) {
    98  	panic("boringcrypto: not available")
    99  }
   100  func NewPublicKeyRSA(N, E BigInt) (*PublicKeyRSA, error) { panic("boringcrypto: not available") }
   101  func SignRSAPKCS1v15(priv *PrivateKeyRSA, h crypto.Hash, hashed []byte) ([]byte, error) {
   102  	panic("boringcrypto: not available")
   103  }
   104  func SignRSAPSS(priv *PrivateKeyRSA, h crypto.Hash, hashed []byte, saltLen int) ([]byte, error) {
   105  	panic("boringcrypto: not available")
   106  }
   107  func VerifyRSAPKCS1v15(pub *PublicKeyRSA, h crypto.Hash, hashed, sig []byte) error {
   108  	panic("boringcrypto: not available")
   109  }
   110  func VerifyRSAPSS(pub *PublicKeyRSA, h crypto.Hash, hashed, sig []byte, saltLen int) error {
   111  	panic("boringcrypto: not available")
   112  }
   113  
   114  type PublicKeyECDH struct{}
   115  type PrivateKeyECDH struct{}
   116  
   117  func ECDH(*PrivateKeyECDH, *PublicKeyECDH) ([]byte, error)      { panic("boringcrypto: not available") }
   118  func GenerateKeyECDH(string) (*PrivateKeyECDH, []byte, error)   { panic("boringcrypto: not available") }
   119  func NewPrivateKeyECDH(string, []byte) (*PrivateKeyECDH, error) { panic("boringcrypto: not available") }
   120  func NewPublicKeyECDH(string, []byte) (*PublicKeyECDH, error)   { panic("boringcrypto: not available") }
   121  func (*PublicKeyECDH) Bytes() []byte                            { panic("boringcrypto: not available") }
   122  func (*PrivateKeyECDH) PublicKey() (*PublicKeyECDH, error)      { panic("boringcrypto: not available") }