diff options
author | Michał Lisowski | 2018-09-02 22:39:00 +0200 |
---|---|---|
committer | Michał Lisowski | 2018-09-02 22:39:00 +0200 |
commit | 9cdcb9fd83a890e45a3ad1d45f80f9307218ebca (patch) | |
tree | 26c1180f6b8f3fad1ee604224a005b864fb13e42 | |
parent | 6676630937298506df7a98ae8ac8f0753fecf3ba (diff) | |
download | aur-9cdcb9fd83a890e45a3ad1d45f80f9307218ebca.tar.gz |
Patch to use python2-crypto
-rw-r--r-- | .SRCINFO | 8 | ||||
-rw-r--r-- | PKGBUILD | 14 | ||||
-rw-r--r-- | crypto.patch | 142 |
3 files changed, 155 insertions, 9 deletions
@@ -1,9 +1,7 @@ -# Generated by mksrcinfo v8 -# Mon Feb 13 18:08:22 UTC 2017 pkgbase = revelation pkgdesc = A password manager for the GNOME desktop pkgver = 0.4.14 - pkgrel = 6 + pkgrel = 7 url = http://revelation.olasagasti.info/ install = revelation.install arch = i686 @@ -11,7 +9,7 @@ pkgbase = revelation license = GPL makedepends = intltool depends = gnome-python>=2.10 - depends = pycrypto>=1.9 + depends = python2-crypto depends = python2-crack depends = desktop-file-utils depends = python2 @@ -21,9 +19,11 @@ pkgbase = revelation source = https://bitbucket.org/erikg/revelation/downloads/revelation-0.4.14.tar.bz2 source = cracklib.patch source = gnome-python.patch + source = crypto.patch sha256sums = 2ab3d1d8bcc2f441feb58122ee6a0fe4070412228194843a180a7b1c9e910019 sha256sums = f5cebe215115cb5a78f470da9753be3c5ff99095f28ab57ae45d2d03b3a686d6 sha256sums = b2803f3f0ab344453fc4f82c90c8eefe99e1b23f77de09bf598741c73458a044 + sha256sums = 6ed410e83810a6cb44ac0e4828ba686fe8ee1a9a7743d7240dcdc038ad15927c pkgname = revelation @@ -1,27 +1,31 @@ -# Maintainer: Thomas Hebb <tommyhebb@gmail.com> +# Maintainer: Michał Lisowski <lisu@riseup.net> +# Contributor: Thomas Hebb <tommyhebb@gmail.com> # Contributor: Jan de Groot <jgc@archlinux.org> pkgname=revelation pkgver=0.4.14 -pkgrel=6 +pkgrel=7 pkgdesc="A password manager for the GNOME desktop" arch=('i686' 'x86_64') license=('GPL') -depends=('gnome-python>=2.10' 'pycrypto>=1.9' 'python2-crack' 'desktop-file-utils' 'python2' 'hicolor-icon-theme' 'pkg-config' 'python2-dbus') +depends=('gnome-python>=2.10' 'python2-crypto' 'python2-crack' 'desktop-file-utils' 'python2' 'hicolor-icon-theme' 'pkg-config' 'python2-dbus') makedepends=('intltool') install=revelation.install url="http://revelation.olasagasti.info/" source=("https://bitbucket.org/erikg/revelation/downloads/revelation-${pkgver}.tar.bz2" 'cracklib.patch' - 'gnome-python.patch') + 'gnome-python.patch' + 'crypto.patch') sha256sums=('2ab3d1d8bcc2f441feb58122ee6a0fe4070412228194843a180a7b1c9e910019' 'f5cebe215115cb5a78f470da9753be3c5ff99095f28ab57ae45d2d03b3a686d6' - 'b2803f3f0ab344453fc4f82c90c8eefe99e1b23f77de09bf598741c73458a044') + 'b2803f3f0ab344453fc4f82c90c8eefe99e1b23f77de09bf598741c73458a044' + '6ed410e83810a6cb44ac0e4828ba686fe8ee1a9a7743d7240dcdc038ad15927c') prepare() { cd "${srcdir}/${pkgname}-${pkgver}" patch -uNp1 -i "${srcdir}/cracklib.patch" patch -uNp1 -i "${srcdir}/gnome-python.patch" + patch -uNp1 -i "${srcdir}/crypto.patch" ./autogen.sh } diff --git a/crypto.patch b/crypto.patch new file mode 100644 index 000000000000..987370afdfd6 --- /dev/null +++ b/crypto.patch @@ -0,0 +1,142 @@ +diff -Naur revelation.orig/src/bundle/AfSplitter.py revelation/src/bundle/AfSplitter.py +--- revelation.orig/src/bundle/AfSplitter.py 2018-09-01 12:38:17.702662965 +0200 ++++ revelation/src/bundle/AfSplitter.py 2018-09-01 12:30:00.584871451 +0200 +@@ -42,14 +42,8 @@ + + # 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.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.Random import get_random_bytes ++from Crypto.Util.strxor import strxor + + def _diffuse(block, size, digest): + """Internal function to diffuse information inside a buffer""" +@@ -81,26 +75,19 @@ + + blockSize = len(data) + +- rand = RandomPool() +- + bufblock = "\x00" * blockSize + + ret = "" + 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 = get_random_bytes(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'): +@@ -113,7 +100,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) +diff -Naur revelation.orig/src/bundle/luks.py revelation/src/bundle/luks.py +--- revelation.orig/src/bundle/luks.py 2018-09-01 12:38:17.702662965 +0200 ++++ revelation/src/bundle/luks.py 2018-09-01 12:47:42.047084845 +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.Random import get_random_bytes + from Crypto.Cipher import * + import PBKDFv2, AfSplitter + +@@ -178,13 +178,11 @@ + self.keyBytes = masterSize + self.hashSpec = hashSpec + +- rand = RandomPool(self.SALT_SIZE + 16 + masterSize) +- + # Generate the salt +- self.mkDigestSalt = rand.get_bytes(self.SALT_SIZE) ++ self.mkDigestSalt = get_random_bytes(self.SALT_SIZE) + + # Generate a random master key +- self.masterKey = rand.get_bytes(self.keyBytes) ++ self.masterKey = get_random_bytes(self.keyBytes) + self.ivGen.set_key(self.masterKey) + + # generate the master key digest +@@ -210,7 +208,7 @@ + self.payloadOffset = currentSector + + # Generate a UUID for this file +- self._uuidgen(rand) ++ self._uuidgen() + + # Create a new file, and save the header into it + self.file = file +@@ -263,8 +261,7 @@ + key.passwordIterations = iterations + + # Generate a random salt for this key +- rand = RandomPool(self.SALT_SIZE) +- key.passwordSalt = rand.get_bytes(self.SALT_SIZE) ++ key.passwordSalt = get_random_bytes(self.SALT_SIZE) + + # Hash the key using PBKDFv2 + pbkdf = PBKDFv2.PBKDFv2() +@@ -594,13 +591,13 @@ + self.cipherName = cipherName + self.cipherMode = cipherMode + +- def _uuidgen(self, rand): ++ def _uuidgen(self): + """Internal function to generate a UUID""" + + # I copied this code (and slightly modified it) from a module written + # by Denys Duchier http://ofxsuite.berlios.de/uuid.py (which is under the GPL) + +- buf = rand.get_bytes(16) ++ buf = get_random_bytes(16) + low,mid,hi_and_version,seq,node = struct.unpack(">IHHH6s",buf) + seq = (seq & 0x3FFF) | 0x8000 + hi_and_version = (hi_and_version & 0x0FFF) | 0x4000 +diff -Naur revelation.orig/src/bundle/PBKDFv2.py revelation/src/bundle/PBKDFv2.py +--- revelation.orig/src/bundle/PBKDFv2.py 2018-09-01 12:38:17.702662965 +0200 ++++ revelation/src/bundle/PBKDFv2.py 2018-09-01 12:35:22.345594877 +0200 +@@ -32,7 +32,7 @@ + """ + + import struct, string, math, hashlib, hmac # RFC2104 +-from Crypto.Cipher import XOR ++from Crypto.Util.strxor import strxor + + ################ 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) |