From: Mark Wooding Date: Tue, 7 Apr 2020 23:59:00 +0000 (+0100) Subject: Merge branch '1.3.x' into HEAD X-Git-Url: https://git.distorted.org.uk/~mdw/catacomb-python/commitdiff_plain/9e947555194b0e435f39e6882e36e5b3639e3203?hp=f062eeb647668edb376f6ddcce1332113c8825cb Merge branch '1.3.x' into HEAD * 1.3.x: t/t-rand.py: Set the correct refernce seed value for `dsarand'. rand.c: More `Py_ssize_t' fixes. --- diff --git a/rand.c b/rand.c index 37ab5e4..926eade 100644 --- a/rand.c +++ b/rand.c @@ -940,7 +940,7 @@ static PyTypeObject gclatinrand_pytype_skel = { static PyObject *sslprf_pynew(PyTypeObject *ty, PyObject *arg, PyObject *kw) { char *k, *s; - int ksz, ssz; + Py_ssize_t ksz, ssz; const gchash *hco = &md5, *hci = &sha; PyObject *rc = 0; static const char *const kwlist[] = { "key", "seed", "ohash", "ihash", 0 }; @@ -957,7 +957,7 @@ end: static PyObject *tlsdx_pynew(PyTypeObject *ty, PyObject *arg, PyObject *kw) { char *k, *s; - int ksz, ssz; + Py_ssize_t ksz, ssz; const gcmac *mc = &sha_hmac; PyObject *rc = 0; static const char *const kwlist[] = { "key", "seed", "mac", 0 }; @@ -974,7 +974,7 @@ end: static PyObject *tlsprf_pynew(PyTypeObject *ty, PyObject *arg, PyObject *kw) { char *k, *s; - int ksz, ssz; + Py_ssize_t ksz, ssz; const gcmac *mcl = &md5_hmac, *mcr = &sha_hmac; PyObject *rc = 0; static const char *const kwlist[] = { "key", "seed", "lmac", "rmac", 0 }; @@ -1140,7 +1140,7 @@ static PyTypeObject tlsprf_pytype_skel = { static PyObject *dsarand_pynew(PyTypeObject *ty, PyObject *arg, PyObject *kw) { char *p; - int sz; + Py_ssize_t sz; PyObject *rc = 0; static const char *const kwlist[] = { "seed", 0 }; diff --git a/t/t-rand.py b/t/t-rand.py index d8d7b00..a45c1d5 100644 --- a/t/t-rand.py +++ b/t/t-rand.py @@ -121,7 +121,10 @@ class TestRandomGenerator (U.TestCase): n = C.MP.loadb(seed) rng = C.DSARand(seed) me.check_rand(rng) - me.assertEqual(rng.seed, (n + 153 + 3).storeb(16)) + if T.MAXFIXNUM == (1 << 31) - 1: steps = 153 + 3 + elif T.MAXFIXNUM == (1 << 63) - 1: steps = 153 + else: steps = None + if steps is not None: me.assertEqual(rng.seed, (n + steps).storeb(16)) def test_bbs(me): ev = T.EventRecorder()