commit:     be02695b284d77b4820bc536e549145077a9106f
Author:     Hans de Graaff <graaff <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 15 08:40:41 2017 +0000
Commit:     Hans de Graaff <graaff <AT> gentoo <DOT> org>
CommitDate: Sat Jul 15 08:41:50 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=be02695b

x11-misc/revelation: patch to use pycryptodome, bug 611648

Package-Manager: Portage-2.3.6, Repoman-2.3.2

 .../files/revelation-0.4.14-random.patch           | 73 ++++++++++++++++++++++
 .../revelation/files/revelation-0.4.14-xor.patch   | 59 +++++++++++++++++
 x11-misc/revelation/revelation-0.4.14-r2.ebuild    | 49 +++++++++++++++
 3 files changed, 181 insertions(+)

diff --git a/x11-misc/revelation/files/revelation-0.4.14-random.patch 
b/x11-misc/revelation/files/revelation-0.4.14-random.patch
new file mode 100644
index 00000000000..e54ac2bf066
--- /dev/null
+++ b/x11-misc/revelation/files/revelation-0.4.14-random.patch
@@ -0,0 +1,73 @@
+--- src/bundle/AfSplitter.py.~1~       2012-05-26 14:19:34.000000000 +0200
++++ src/bundle/AfSplitter.py   2017-07-15 10:10:57.817775246 +0200
+@@ -42,7 +42,7 @@
+ 
+ # will need changed to use Crypto.Random (now in python-crypt git)
+ # see: http://lists.dlitz.net/pipermail/pycrypto/2008q3/000020.html
+-from Crypto.Util.randpool import RandomPool
++from Crypto import Random
+ from Crypto.Cipher import XOR
+ 
+ def _xor(a, b):
+@@ -81,7 +81,7 @@
+ 
+       blockSize = len(data)
+ 
+-      rand = RandomPool()
++      rand = Random.new()
+ 
+       bufblock = "\x00" * blockSize
+ 
+@@ -89,12 +89,7 @@
+       for i in range(0, stripes-1):
+ 
+               # Get some random data
+-              rand.randomize()
+-              rand.stir()
+-              r = rand.get_bytes(blockSize)
+-              if rand.entropy < 0:
+-                      print "Warning: RandomPool entropy dropped below 0"
+-
++              r = rand.rand(blockSize)
+               ret += r
+               bufblock = _xor(r, bufblock)
+               bufblock = _diffuse(bufblock, blockSize, digesttype)
+--- src/bundle/luks.py.~1~     2012-05-26 14:19:34.000000000 +0200
++++ src/bundle/luks.py 2017-07-15 10:10:08.735052052 +0200
+@@ -65,7 +65,7 @@
+ 
+ # will need changed to use Crypto.Random (now in python-crypt git)
+ # see: http://lists.dlitz.net/pipermail/pycrypto/2008q3/000020.html
+-from Crypto.Util.randpool import RandomPool
++from Crypto import Random
+ from Crypto.Cipher import *
+ import PBKDFv2, AfSplitter
+ 
+@@ -178,13 +178,13 @@
+               self.keyBytes = masterSize
+               self.hashSpec = hashSpec
+ 
+-              rand = RandomPool(self.SALT_SIZE + 16 + masterSize)
++              rand = Random.new()
+ 
+               # Generate the salt
+-              self.mkDigestSalt = rand.get_bytes(self.SALT_SIZE)
++              self.mkDigestSalt = rand.read(self.SALT_SIZE)
+ 
+               # Generate a random master key
+-              self.masterKey = rand.get_bytes(self.keyBytes)
++              self.masterKey = rand.read(self.keyBytes)
+               self.ivGen.set_key(self.masterKey)
+ 
+               # generate the master key digest
+@@ -263,8 +263,8 @@
+               key.passwordIterations = iterations
+ 
+               # Generate a random salt for this key
+-              rand = RandomPool(self.SALT_SIZE)
+-              key.passwordSalt = rand.get_bytes(self.SALT_SIZE)
++              rand = Random.new()
++              key.passwordSalt = rand.read(self.SALT_SIZE)
+ 
+               # Hash the key using PBKDFv2
+               pbkdf = PBKDFv2.PBKDFv2()

diff --git a/x11-misc/revelation/files/revelation-0.4.14-xor.patch 
b/x11-misc/revelation/files/revelation-0.4.14-xor.patch
new file mode 100644
index 00000000000..bac45c68b18
--- /dev/null
+++ b/x11-misc/revelation/files/revelation-0.4.14-xor.patch
@@ -0,0 +1,59 @@
+--- src/bundle/AfSplitter.py.~1~       2017-07-15 10:25:21.503324481 +0200
++++ src/bundle/AfSplitter.py   2017-07-15 10:26:39.589273253 +0200
+@@ -43,13 +43,7 @@
+ # will need changed to use Crypto.Random (now in python-crypt git)
+ # see: http://lists.dlitz.net/pipermail/pycrypto/2008q3/000020.html
+ from Crypto import Random
+-from Crypto.Cipher import XOR
+-
+-def _xor(a, b):
+-      """Internal function to performs XOR on two strings a and b"""
+-
+-      xor = XOR.new(a)
+-      return xor.encrypt(b)
++from Crypto import Util
+ 
+ def _diffuse(block, size, digest):
+       """Internal function to diffuse information inside a buffer"""
+@@ -91,11 +85,11 @@
+               # Get some random data
+               r = rand.rand(blockSize)
+               ret += r
+-              bufblock = _xor(r, bufblock)
++              bufblock = strxor(r, bufblock)
+               bufblock = _diffuse(bufblock, blockSize, digesttype)
+               rand.add_event(bufblock)
+ 
+-      ret += _xor(bufblock, data)
++      ret += strxor(bufblock, data)
+       return ret
+ 
+ def AFMerge(data, stripes, digesttype='sha1'):
+@@ -108,7 +102,7 @@
+ 
+       bufblock = "\x00" * blockSize
+       for i in range(0, stripes - 1):
+-              bufblock = _xor(data[i*blockSize:(i+1)*blockSize], bufblock)
++              bufblock = strxor(data[i*blockSize:(i+1)*blockSize], bufblock)
+               bufblock = _diffuse(bufblock, blockSize, digesttype)
+ 
+-      return _xor(data[(stripes-1)*blockSize:], bufblock)
++      return strxor(data[(stripes-1)*blockSize:], bufblock)
+--- src/bundle/PBKDFv2.py.~1~  2012-05-26 14:19:34.000000000 +0200
++++ src/bundle/PBKDFv2.py      2017-07-15 10:31:27.009731785 +0200
+@@ -32,7 +32,7 @@
+ """
+ 
+ import struct, string, math, hashlib, hmac # RFC2104
+-from Crypto.Cipher import XOR
++from Crypto import Util
+ 
+ ################ PBKDFv2
+ class PBKDFv2:
+@@ -145,5 +145,4 @@
+         if len(a) != len(b):
+             raise ValueError("ERROR: Strings are of different size! %s %s" % 
(len(a), len(b)))
+ 
+-      xor = XOR.new(a)
+-      return xor.encrypt(b)
++      return strxor(a, b)

diff --git a/x11-misc/revelation/revelation-0.4.14-r2.ebuild 
b/x11-misc/revelation/revelation-0.4.14-r2.ebuild
new file mode 100644
index 00000000000..0d8989e0b82
--- /dev/null
+++ b/x11-misc/revelation/revelation-0.4.14-r2.ebuild
@@ -0,0 +1,49 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+PYTHON_COMPAT=( python2_7 )
+
+inherit python-single-r1 gnome2
+
+DESCRIPTION="A password manager for GNOME"
+HOMEPAGE="http://revelation.olasagasti.info/";
+SRC_URI="https://www.bitbucket.org/erikg/revelation/downloads/${P}.tar.xz";
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+IUSE=""
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+RESTRICT="test"
+
+RDEPEND="${PYTHON_DEPS}
+       dev-python/pygtk[${PYTHON_USEDEP}]
+       dev-python/pycryptodome[${PYTHON_USEDEP}]
+       dev-python/gconf-python[${PYTHON_USEDEP}]
+       dev-python/libgnome-python[${PYTHON_USEDEP}]
+       dev-python/dbus-python[${PYTHON_USEDEP}]
+       sys-libs/cracklib[python,${PYTHON_USEDEP}]
+"
+
+DEPEND="${RDEPEND}"
+
+src_prepare() {
+       epatch "${FILESDIR}/${P}-random.patch" \
+                  "${FILESDIR}/${P}-xor.patch"
+       eapply_user
+}
+
+src_configure() {
+       gnome2_src_configure \
+               --without-applet \
+               --disable-desktop-update \
+               --disable-mime-update
+}
+
+src_install() {
+       gnome2_src_install
+       python_fix_shebang "${ED}"
+}

Reply via email to