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