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

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