Blame SOURCES/009-patch-unused-backend-crypto.patch

897738
diff --git a/vendor/golang.org/x/crypto/openpgp/elgamal/elgamal.go b/vendor/golang.org/x/crypto/openpgp/elgamal/elgamal.go
897738
new file mode 100644
897738
index 0000000..871e612
897738
--- /dev/null
897738
+++ b/vendor/golang.org/x/crypto/openpgp/elgamal/elgamal.go
897738
@@ -0,0 +1,25 @@
897738
+package elgamal
897738
+
897738
+import (
897738
+	"io"
897738
+	"math/big"
897738
+)
897738
+
897738
+// PublicKey represents an ElGamal public key.
897738
+type PublicKey struct {
897738
+	G, P, Y *big.Int
897738
+}
897738
+
897738
+// PrivateKey represents an ElGamal private key.
897738
+type PrivateKey struct {
897738
+	PublicKey
897738
+	X *big.Int
897738
+}
897738
+
897738
+func Encrypt(random io.Reader, pub *PublicKey, msg []byte) (c1, c2 *big.Int, err error) {
897738
+	panic("ElGamal encryption not available")
897738
+}
897738
+
897738
+func Decrypt(priv *PrivateKey, c1, c2 *big.Int) (msg []byte, err error) {
897738
+	panic("ElGamal encryption not available")
897738
+}
897738
diff --git a/vendor/golang.org/x/crypto/openpgp/packet/packet.go b/vendor/golang.org/x/crypto/openpgp/packet/packet.go
897738
index 9728d61..9f04c2d 100644
897738
--- a/vendor/golang.org/x/crypto/openpgp/packet/packet.go
897738
+++ b/vendor/golang.org/x/crypto/openpgp/packet/packet.go
897738
@@ -16,7 +16,6 @@ import (
897738
 	"math/big"
897738
 	"math/bits"
897738
 
897738
-	"golang.org/x/crypto/cast5"
897738
 	"golang.org/x/crypto/openpgp/errors"
897738
 )
897738
 
897738
@@ -487,7 +486,7 @@ func (cipher CipherFunction) KeySize() int {
897738
 	case Cipher3DES:
897738
 		return 24
897738
 	case CipherCAST5:
897738
-		return cast5.KeySize
897738
+		panic("cast5 cipher not available")
897738
 	case CipherAES128:
897738
 		return 16
897738
 	case CipherAES192:
897738
@@ -517,7 +516,7 @@ func (cipher CipherFunction) new(key []byte) (block cipher.Block) {
897738
 	case Cipher3DES:
897738
 		block, _ = des.NewTripleDESCipher(key)
897738
 	case CipherCAST5:
897738
-		block, _ = cast5.NewCipher(key)
897738
+		panic("cast5 cipher not available")
897738
 	case CipherAES128, CipherAES192, CipherAES256:
897738
 		block, _ = aes.NewCipher(key)
897738
 	}
897738
diff --git a/vendor/golang.org/x/crypto/openpgp/packet/symmetrically_encrypted.go b/vendor/golang.org/x/crypto/openpgp/packet/symmetrically_encrypted.go
897738
index 6126030..3a54c5f 100644
897738
--- a/vendor/golang.org/x/crypto/openpgp/packet/symmetrically_encrypted.go
897738
+++ b/vendor/golang.org/x/crypto/openpgp/packet/symmetrically_encrypted.go
897738
@@ -5,13 +5,12 @@
897738
 package packet
897738
 
897738
 import (
897738
-	"crypto/cipher"
897738
 	"crypto/sha1"
897738
 	"crypto/subtle"
897738
-	"golang.org/x/crypto/openpgp/errors"
897738
 	"hash"
897738
 	"io"
897738
-	"strconv"
897738
+
897738
+	"golang.org/x/crypto/openpgp/errors"
897738
 )
897738
 
897738
 // SymmetricallyEncrypted represents a symmetrically encrypted byte string. The
897738
@@ -45,46 +44,7 @@ func (se *SymmetricallyEncrypted) parse(r io.Reader) error {
897738
 // packet can be read. An incorrect key can, with high probability, be detected
897738
 // immediately and this will result in a KeyIncorrect error being returned.
897738
 func (se *SymmetricallyEncrypted) Decrypt(c CipherFunction, key []byte) (io.ReadCloser, error) {
897738
-	keySize := c.KeySize()
897738
-	if keySize == 0 {
897738
-		return nil, errors.UnsupportedError("unknown cipher: " + strconv.Itoa(int(c)))
897738
-	}
897738
-	if len(key) != keySize {
897738
-		return nil, errors.InvalidArgumentError("SymmetricallyEncrypted: incorrect key length")
897738
-	}
897738
-
897738
-	if se.prefix == nil {
897738
-		se.prefix = make([]byte, c.blockSize()+2)
897738
-		_, err := readFull(se.contents, se.prefix)
897738
-		if err != nil {
897738
-			return nil, err
897738
-		}
897738
-	} else if len(se.prefix) != c.blockSize()+2 {
897738
-		return nil, errors.InvalidArgumentError("can't try ciphers with different block lengths")
897738
-	}
897738
-
897738
-	ocfbResync := OCFBResync
897738
-	if se.MDC {
897738
-		// MDC packets use a different form of OCFB mode.
897738
-		ocfbResync = OCFBNoResync
897738
-	}
897738
-
897738
-	s := NewOCFBDecrypter(c.new(key), se.prefix, ocfbResync)
897738
-	if s == nil {
897738
-		return nil, errors.ErrKeyIncorrect
897738
-	}
897738
-
897738
-	plaintext := cipher.StreamReader{S: s, R: se.contents}
897738
-
897738
-	if se.MDC {
897738
-		// MDC packets have an embedded hash that we need to check.
897738
-		h := sha1.New()
897738
-		h.Write(se.prefix)
897738
-		return &seMDCReader{in: plaintext, h: h}, nil
897738
-	}
897738
-
897738
-	// Otherwise, we just need to wrap plaintext so that it's a valid ReadCloser.
897738
-	return seReader{plaintext}, nil
897738
+	panic("OCFB cipher not available")
897738
 }
897738
 
897738
 // seReader wraps an io.Reader with a no-op Close method.
897738
@@ -254,37 +214,5 @@ func (c noOpCloser) Close() error {
897738
 // written.
897738
 // If config is nil, sensible defaults will be used.
897738
 func SerializeSymmetricallyEncrypted(w io.Writer, c CipherFunction, key []byte, config *Config) (contents io.WriteCloser, err error) {
897738
-	if c.KeySize() != len(key) {
897738
-		return nil, errors.InvalidArgumentError("SymmetricallyEncrypted.Serialize: bad key length")
897738
-	}
897738
-	writeCloser := noOpCloser{w}
897738
-	ciphertext, err := serializeStreamHeader(writeCloser, packetTypeSymmetricallyEncryptedMDC)
897738
-	if err != nil {
897738
-		return
897738
-	}
897738
-
897738
-	_, err = ciphertext.Write([]byte{symmetricallyEncryptedVersion})
897738
-	if err != nil {
897738
-		return
897738
-	}
897738
-
897738
-	block := c.new(key)
897738
-	blockSize := block.BlockSize()
897738
-	iv := make([]byte, blockSize)
897738
-	_, err = config.Random().Read(iv)
897738
-	if err != nil {
897738
-		return
897738
-	}
897738
-	s, prefix := NewOCFBEncrypter(block, iv, OCFBNoResync)
897738
-	_, err = ciphertext.Write(prefix)
897738
-	if err != nil {
897738
-		return
897738
-	}
897738
-	plaintext := cipher.StreamWriter{S: s, W: ciphertext}
897738
-
897738
-	h := sha1.New()
897738
-	h.Write(iv)
897738
-	h.Write(iv[blockSize-2:])
897738
-	contents = &seMDCWriter{w: plaintext, h: h}
897738
-	return
897738
+	panic("OCFB cipher not available")
897738
 }