Date: Tuesday, September 12, 2017 @ 17:56:02 Author: anthraxx Revision: 257154
addpkg: python-axolotl 0.1.39-2 Added: python-axolotl/ python-axolotl/repos/ python-axolotl/trunk/ python-axolotl/trunk/PKGBUILD python-axolotl/trunk/python-axolotl-don-t-pass-IV-in-CTR-mode.patch ------------------------------------------------+ PKGBUILD | 62 +++++++++++++++++++++++ python-axolotl-don-t-pass-IV-in-CTR-mode.patch | 30 +++++++++++ 2 files changed, 92 insertions(+) Added: python-axolotl/trunk/PKGBUILD =================================================================== --- python-axolotl/trunk/PKGBUILD (rev 0) +++ python-axolotl/trunk/PKGBUILD 2017-09-12 17:56:02 UTC (rev 257154) @@ -0,0 +1,62 @@ +# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org> +# Contributor: Alexandre Bouvier <contact AT amb DOT tf> +# Contributor: Ivan Shapovalov <inte...@intelfx.name> +# Contributor: Tommaso Sardelli <lacapannadelloziotom AT gmail DOT com> +# Contributor: Philipp Joram <phijor AT t-online DOT de> + +pkgbase=python-axolotl +pkgname=('python-axolotl' 'python2-axolotl') +pkgver=0.1.39 +pkgrel=2 +pkgdesc='Python port of libaxolotl' +url='https://github.com/tgalal/python-axolotl' +arch=('any') +license=('GPL3') +makedepends=('python-setuptools' 'python-protobuf' 'python-crypto' 'python-axolotl-curve25519' + 'python2-setuptools' 'python2-protobuf' 'python2-crypto' 'python2-axolotl-curve25519') +checkdepends=('python-pytest' 'python2-pytest') +source=(${pkgbase}-${pkgver}.tar.gz::https://github.com/tgalal/python-axolotl/archive/${pkgver}.tar.gz + python-axolotl-don-t-pass-IV-in-CTR-mode.patch) +sha256sums=('f59b3e0a202648c3187b756fafc941f15ea69e74fa77eb311c3982ffe6d34d2d' + '4289d3c07593c2c4241898b179dbcd040b52adea7ff824cb28e459803d84f628') +sha512sums=('b117c7f5417c624b020ba8f488b9f61d3ce359a3e3132cb98e637a40ae6c2ebb52d55d62a40736340c6352e0249d349b3555e8e7a52479c2d77ad4907ea211ae' + '0c6f631404e9057e521ed8219463a8ed0ca018b68945f579b1b8d8f1ea3b0afb407830f83fa39d54d3fbc628542190b24fb48f33eacb7eac6b3307caa593bb7a') + +prepare() { + patch -d ${pkgbase}-${pkgver} -p1 < "${srcdir}/python-axolotl-don-t-pass-IV-in-CTR-mode.patch" + cp -a ${pkgbase}-${pkgver}{,-py2} +} + +build() { + (cd ${pkgbase}-${pkgver} + python setup.py build + ) + (cd ${pkgbase}-${pkgver}-py2 + python2 setup.py build + ) +} + +check() { + (cd ${pkgbase}-${pkgver} + py.test + ) + (cd ${pkgbase}-${pkgver}-py2 + py.test2 + ) +} + +package_python-axolotl() { + depends=('python-protobuf' 'python-crypto' 'python-axolotl-curve25519') + + cd "${pkgbase}-${pkgver}" + python setup.py install --root="${pkgdir}" --optimize=1 --skip-build +} + +package_python2-axolotl() { + depends=('python2-protobuf' 'python2-crypto' 'python2-axolotl-curve25519') + + cd "${pkgbase}-${pkgver}-py2" + python2 setup.py install --root="${pkgdir}" --optimize=1 --skip-build +} + +# vim: ts=2 sw=2 et: Added: python-axolotl/trunk/python-axolotl-don-t-pass-IV-in-CTR-mode.patch =================================================================== --- python-axolotl/trunk/python-axolotl-don-t-pass-IV-in-CTR-mode.patch (rev 0) +++ python-axolotl/trunk/python-axolotl-don-t-pass-IV-in-CTR-mode.patch 2017-09-12 17:56:02 UTC (rev 257154) @@ -0,0 +1,30 @@ +From bd4938bd943bc3810dc95ef7ced92674bcfe9797 Mon Sep 17 00:00:00 2001 +From: anthraxx <leve...@leventepolyak.net> +Date: Tue, 12 Sep 2017 19:45:51 +0200 +Subject: [PATCH] don't pass IV in pycrypto CTR mode as counter must be + exclusive + +--- + axolotl/sessioncipher.py | 6 +----- + 1 file changed, 1 insertion(+), 5 deletions(-) + +diff --git a/axolotl/sessioncipher.py b/axolotl/sessioncipher.py +index 3b80ccb..6f41cea 100644 +--- a/axolotl/sessioncipher.py ++++ b/axolotl/sessioncipher.py +@@ -229,11 +229,7 @@ class SessionCipher: + # counterint = int.from_bytes(counterbytes, byteorder='big') + ctr = Counter.new(128, initial_value=counter) + +- # cipher = AES.new(key, AES.MODE_CTR, counter=ctr) +- ivBytes = bytearray(16) +- ByteUtil.intToByteArray(ivBytes, 0, counter) +- +- cipher = AES.new(key, AES.MODE_CTR, IV=bytes(ivBytes), counter=ctr) ++ cipher = AES.new(key, AES.MODE_CTR, counter=ctr) + + return cipher + +-- +2.14.1 +