* 1.3.x: (101 commits)
rand.c: Show keyword argument as optional.
mp.c: Fix punctuation error in docstrings.
t/t-*.py: Use the `WriteBuffer.contents' property.
t/t-bytes.py: Check that indexing, slicing, etc. return `C.ByteString'.
t/t-algorithms.py: Add a simple test for `Keccak1600.copy'.
t/t-algorithms.py: Add tests for other HSalsa20 and HChaCha key sizes.
t/t-algorithms.py: Add AEAD tests.
t/t-algorithms.py: Add tests for the new `KeySZ.pad' method.
catacomb/__init__.py (KeySZRange.pad): Return correct value.
algorithms.c: Propagate `AEADF_NOAAD' to `aad' objects.
algorithms.c (
AEADAAD.copy): Propagate the hashed length to the copy.
t/: Add a test suite.
ec.c: Don't lose error status when constructing points from a sequence.
ec.c: Free partially constructed points coordinatewise.
*.c: Be more careful about `PySequence_Size'.
key.c: Reformat the rest of the `KeyError' constructor.
key.c: Parse `KeyError' constructor arguments by hand.
catacomb-python.h: Add a macro for raising `OverflowError'.
key.c: Collect `KeyError' argument count as a separate step.
key.c: Use tuple functions on `KeyError' argument tuple.
...
/*----- Header files ------------------------------------------------------*/
#include "catacomb-python.h"
+PUBLIC_SYMBOLS;
#include "algorithms.h"
+PRIVATE_SYMBOLS;
/*----- Key sizes ---------------------------------------------------------*/
unsigned n;
} kxvik_pyobj;
-static PyObject *kxvik_pynew(PyTypeObject *ty,
- PyObject *arg, PyObject *kw)
+static PyObject *kxvik_pynew(PyTypeObject *ty, PyObject *arg, PyObject *kw)
{
unsigned n = 24;
kxvik_pyobj *rc = 0;
#include <catacomb/share.h>
#include <catacomb/gfshare.h>
+/*----- Other preliminaries -----------------------------------------------*/
+
+#define GOBBLE_SEMI extern int notexist
+#if defined(__GNUC__) && defined(__ELF__)
+# define PRIVATE_SYMBOLS _Pragma("GCC visibility push(hidden)") GOBBLE_SEMI
+# define PUBLIC_SYMBOLS _Pragma("GCC visibility pop") GOBBLE_SEMI
+# define EXPORT __attribute__((__visibility__("default")))
+#else
+# define PRIVATE_SYMBOLS GOBBLE_SEMI
+# define PUBLIC_SYMBOLS GOBBLE_SEMI
+# define EXPORT
+#endif
+
+PRIVATE_SYMBOLS;
+
/*----- Utility macros ----------------------------------------------------*/
#define RETURN_OBJ(obj) do { Py_INCREF(obj); return (obj); } while (0)
char *argv0;
if (!PyArg_ParseTuple(arg, "s:_ego", &argv0))
return (0);
- if (strcmp(QUIS, "<UNNAMED>") == 0)
+ if (STRCMP(QUIS, ==, "<UNNAMED>"))
ego(argv0);
RETURN_NONE;
}
if (!Py_HashRandomizationFlag) return;
seed = getenv("PYTHONHASHSEED");
- if (!seed || strcmp(seed, "random") == 0) r = GR_WORD(&rand_global);
+ if (!seed || STRCMP(seed, ==, "random")) r = GR_WORD(&rand_global);
else r = strtoul(seed, 0, 0);
if (!r) r = 0xe011f220; /* zero doesn't work well */
unihash_setkey(&unihash_global, r);
#endif
}
-void init_base(void)
+EXPORT void init_base(void)
{
PyObject *mod;
addmethods(methods);
+catacomb-python (1.3.99~) experimental; urgency=medium
+
+ * (placeholder for next release)
+
+ -- Mark Wooding <mdw@distorted.org.uk> Tue, 01 Oct 2019 12:57:58 +0100
+
catacomb-python (1.3.0.1) experimental; urgency=medium
* Fix required Catacomb version in `setup.py' script. Only affects the
Priority: extra
XS-Python-Version: >= 2.6, << 2.8
Maintainer: Mark Wooding <mdw@distorted.org.uk>
-Build-Depends: debhelper (>= 9), dh-python, pkg-config,
+Build-Depends: debhelper (>= 10), dh-python, pkg-config,
python (>= 2.6.6-3~), python-all-dev,
- mlib-dev (>= 2.2.2.1), catacomb-dev (>= 2.5.0)
+ mlib-dev (>= 2.4.99~), catacomb-dev (>= 2.5.0)
Standards-Version: 3.8.0
Package: python-catacomb
return (0);
a = F_OUT(f, MP_NEW, c->a);
b = F_OUT(f, MP_NEW, c->b);
- if (strcmp(EC_NAME(c), "prime") == 0)
+ if (STRCMP(EC_NAME(c), ==, "prime"))
c = ec_prime(f, a, b);
- else if (strcmp(EC_NAME(c), "primeproj") == 0)
+ else if (STRCMP(EC_NAME(c), ==, "primeproj"))
c = ec_primeproj(f, a, b);
- else if (strcmp(EC_NAME(c), "bin") == 0)
+ else if (STRCMP(EC_NAME(c), ==, "bin"))
c = ec_bin(f, a, b);
- else if (strcmp(EC_NAME(c), "binproj") == 0)
+ else if (STRCMP(EC_NAME(c), ==, "binproj"))
c = ec_binproj(f, a, b);
else
c = 0;
else
Py_INCREF(fobj);
assert(FIELD_F(fobj) == c->f);
- if (strcmp(EC_NAME(c), "prime") == 0)
+ if (STRCMP(EC_NAME(c), ==, "prime"))
ty = ecprimecurve_pytype;
- else if (strcmp(EC_NAME(c), "primeproj") == 0)
+ else if (STRCMP(EC_NAME(c), ==, "primeproj"))
ty = ecprimeprojcurve_pytype;
- else if (strcmp(EC_NAME(c), "bin") == 0)
+ else if (STRCMP(EC_NAME(c), ==, "bin"))
ty = ecbincurve_pytype;
- else if (strcmp(EC_NAME(c), "binproj") == 0)
+ else if (STRCMP(EC_NAME(c), ==, "binproj"))
ty = ecbinprojcurve_pytype;
else
abort();
{
PyTypeObject *ty;
- if (strcmp(F_NAME(f), "prime") == 0) ty = primefield_pytype;
- else if (strcmp(F_NAME(f), "niceprime") == 0) ty = niceprimefield_pytype;
- else if (strcmp(F_NAME(f), "binpoly") == 0) ty = binpolyfield_pytype;
- else if (strcmp(F_NAME(f), "binnorm") == 0) ty = binnormfield_pytype;
+ if (STRCMP(F_NAME(f), ==, "prime")) ty = primefield_pytype;
+ else if (STRCMP(F_NAME(f), ==, "niceprime")) ty = niceprimefield_pytype;
+ else if (STRCMP(F_NAME(f), ==, "binpoly")) ty = binpolyfield_pytype;
+ else if (STRCMP(F_NAME(f), ==, "binnorm")) ty = binnormfield_pytype;
else abort();
return (field_dopywrap(ty, f));
}
field *field_copy(field *f)
{
- if (strcmp(F_NAME(f), "prime") == 0)
+ if (STRCMP(F_NAME(f), ==, "prime"))
f = field_prime(f->m);
- else if (strcmp(F_NAME(f), "niceprime") == 0)
+ else if (STRCMP(F_NAME(f), ==, "niceprime"))
f = field_niceprime(f->m);
- else if (strcmp(F_NAME(f), "binpoly") == 0)
+ else if (STRCMP(F_NAME(f), ==, "binpoly"))
f = field_binpoly(f->m);
- else if (strcmp(F_NAME(f), "binnorm") == 0) {
+ else if (STRCMP(F_NAME(f), ==, "binnorm")) {
fctx_binnorm *fc = (fctx_binnorm *)f;
f = field_binnorm(f->m, fc->ntop.r[fc->ntop.n - 1]);
} else
group *group_copy(group *g)
{
- if (strcmp(G_NAME(g), "prime") == 0) {
+ if (STRCMP(G_NAME(g), ==, "prime")) {
gctx_prime *gc = (gctx_prime *)g;
gprime_param gp;
gp.g = G_TOINT(g, MP_NEW, g->g);
gp.q = gc->g.r;
g = group_prime(&gp);
MP_DROP(gp.g);
- } else if (strcmp(G_NAME(g), "bin") == 0) {
+ } else if (STRCMP(G_NAME(g), ==, "bin")) {
gctx_bin *gc = (gctx_bin *)g;
gbin_param gb;
gb.g = G_TOINT(g, MP_NEW, g->g);
gb.q = gc->g.r;
g = group_binary(&gb);
MP_DROP(gb.g);
- } else if (strcmp(G_NAME(g), "ec") == 0) {
+ } else if (STRCMP(G_NAME(g), ==, "ec")) {
gctx_ec *gc = (gctx_ec *)g;
ec_info ei;
if ((ei.c = eccurve_copy(gc->ei.c)) == 0)
{
PyTypeObject *ty;
- if (strcmp(G_NAME(g), "prime") == 0) ty = primegroup_pytype;
- else if (strcmp(G_NAME(g), "bin") == 0) ty = bingroup_pytype;
- else if (strcmp(G_NAME(g), "ec") == 0) ty = ecgroup_pytype;
+ if (STRCMP(G_NAME(g), ==, "prime")) ty = primegroup_pytype;
+ else if (STRCMP(G_NAME(g), ==, "bin")) ty = bingroup_pytype;
+ else if (STRCMP(G_NAME(g), ==, "ec")) ty = ecgroup_pytype;
else abort();
return (group_dopywrap(ty, g));
}
if (!PyType_Check(cty) || !PyType_IsSubtype(cty, ecpt_pytype))
TYERR("want subtype of catacomb.ECPt");
Py_INCREF((PyObject *)cty);
- } else if (strcmp(G_NAME(g), "ec") == 0) {
+ } else if (STRCMP(G_NAME(g), ==, "ec")) {
c = eccurve_copy(((gctx_ec *)g)->ei.c);
cty = (PyTypeObject *)eccurve_pywrap(0, c);
} else {
/*----- Header files ------------------------------------------------------*/
#include "catacomb-python.h"
+PUBLIC_SYMBOLS;
#include "algorithms.h"
+PRIVATE_SYMBOLS;
/*----- Main code ---------------------------------------------------------*/
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));
import mdwsetup as MS
MS.pkg_config('catacomb', '2.5.0')
-MS.pkg_config('mLib', '2.2.2.1')
+MS.pkg_config('mLib', '2.4.99~')
cat = DC.Extension('catacomb._base',
['catacomb.c', 'bytestring.c', 'buffer.c',