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

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