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

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