From d2120d6da1a93dcdb443d0b13a9a3817363db320 Mon Sep 17 00:00:00 2001 From: Josh Billings Date: Mon, 6 Jul 2015 12:43:30 -0400 Subject: [PATCH 1/2] two bugfixes: 1. nist256p1.c was not included in setup.py, causing import errors when using TrezorCrypto.so in Python. 2. if you attempted a hardened derivation in python using the compiled TrezorCrypto module, an IntegerOverflowError would occur because Python ints are always signed. one-line fix by changing int to unsigned int in the pyx file --- TrezorCrypto.pyx | 3 +-- setup.py | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/TrezorCrypto.pyx b/TrezorCrypto.pyx index 64903ff38..2babddb32 100644 --- a/TrezorCrypto.pyx +++ b/TrezorCrypto.pyx @@ -1,6 +1,5 @@ cimport c cimport cython - cdef class HDNode: cdef c.HDNode node @@ -34,7 +33,7 @@ cdef class HDNode: c.hdnode_public_ckd(cython.address(x.node), i) return x - def private_ckd(self, int i): + def private_ckd(self, unsigned int i): x = HDNode(copyfrom=self) c.hdnode_private_ckd(cython.address(x.node), i) return x diff --git a/setup.py b/setup.py index 106171681..0aadea8e2 100755 --- a/setup.py +++ b/setup.py @@ -5,6 +5,7 @@ from Cython.Build import cythonize from Cython.Distutils import build_ext srcs = [ + 'nist256p1', 'base58', 'bignum', 'bip32', From cb0b5169c5aa82d3e62416cf041d7485b9e2405b Mon Sep 17 00:00:00 2001 From: Josh Billings Date: Mon, 6 Jul 2015 12:48:11 -0400 Subject: [PATCH 2/2] whitespace --- TrezorCrypto.pyx | 1 + setup.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/TrezorCrypto.pyx b/TrezorCrypto.pyx index 2babddb32..71490f8f9 100644 --- a/TrezorCrypto.pyx +++ b/TrezorCrypto.pyx @@ -1,5 +1,6 @@ cimport c cimport cython + cdef class HDNode: cdef c.HDNode node diff --git a/setup.py b/setup.py index 0aadea8e2..a06f57cb1 100755 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ from Cython.Build import cythonize from Cython.Distutils import build_ext srcs = [ - 'nist256p1', + 'nist256p1', 'base58', 'bignum', 'bip32',