chiark / gitweb /
Merge branch '1.3.x' into HEAD
authorMark Wooding <mdw@distorted.org.uk>
Tue, 7 Apr 2020 23:59:00 +0000 (00:59 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Tue, 7 Apr 2020 23:59:00 +0000 (00:59 +0100)
* 1.3.x:
  t/t-rand.py: Set the correct refernce seed value for `dsarand'.
  rand.c: More `Py_ssize_t' fixes.

1  2 
rand.c

diff --combined rand.c
index 37ab5e46cf72af18871b665a0ed165e50aba8c95,841a402bf08a2a5b5b5e44f05c89aefd701b59ad..926eaded536d9985092d98f88aabfd95c8d18351
--- 1/rand.c
--- 2/rand.c
+++ b/rand.c
@@@ -27,9 -27,7 +27,9 @@@
  /*----- Header files ------------------------------------------------------*/
  
  #include "catacomb-python.h"
 +PUBLIC_SYMBOLS;
  #include "algorithms.h"
 +PRIVATE_SYMBOLS;
  
  /*----- Main code ---------------------------------------------------------*/
  
@@@ -56,14 -54,14 +56,14 @@@ PyObject *grand_pywrap(grand *r, unsign
    PyTypeObject *ty = grand_pytype;
    PyObject *ob;
  
 -  if (strcmp(r->ops->name, "rand") == 0) ty = truerand_pytype;
 -  else if (strcmp(r->ops->name, "lcrand") == 0) ty = lcrand_pytype;
 -  else if (strcmp(r->ops->name, "fibrand") == 0) ty = fibrand_pytype;
 -  else if (strcmp(r->ops->name, "dsarand") == 0) ty = dsarand_pytype;
 -  else if (strcmp(r->ops->name, "bbs") == 0) ty = bbs_pytype;
 -  else if (strcmp(r->ops->name, "sslprf") == 0) ty = sslprf_pytype;
 -  else if (strcmp(r->ops->name, "tlsdx") == 0) ty = tlsdx_pytype;
 -  else if (strcmp(r->ops->name, "tlsprf") == 0) ty = tlsprf_pytype;
 +  if (STRCMP(r->ops->name, ==, "rand")) ty = truerand_pytype;
 +  else if (STRCMP(r->ops->name, ==, "lcrand")) ty = lcrand_pytype;
 +  else if (STRCMP(r->ops->name, ==, "fibrand")) ty = fibrand_pytype;
 +  else if (STRCMP(r->ops->name, ==, "dsarand")) ty = dsarand_pytype;
 +  else if (STRCMP(r->ops->name, ==, "bbs")) ty = bbs_pytype;
 +  else if (STRCMP(r->ops->name, ==, "sslprf")) ty = sslprf_pytype;
 +  else if (STRCMP(r->ops->name, ==, "tlsdx")) ty = tlsdx_pytype;
 +  else if (STRCMP(r->ops->name, ==, "tlsprf")) ty = tlsprf_pytype;
    else if ((ob = PyDict_GetItemString(gccrands_dict, r->ops->name)) != 0)
      ty = (PyTypeObject *)ob;
    return (grand_dopywrap(ty, r, f));
@@@ -940,7 -938,7 +940,7 @@@ static PyTypeObject gclatinrand_pytype_
  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 -955,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 -972,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 -1138,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 };