X-Git-Url: https://git.distorted.org.uk/~mdw/catacomb-python/blobdiff_plain/54ae5879b39214704112ecfebd410a9ea57b6e6c..be8a85f8129a9ea2cdecabf97d00461cb04a6894:/catacomb.c diff --git a/catacomb.c b/catacomb.c index b596b5e..a856104 100644 --- a/catacomb.c +++ b/catacomb.c @@ -31,11 +31,13 @@ /*----- Main code ---------------------------------------------------------*/ static const struct nameval consts[] = { -#define C(x) { #x, x } +#define CF(f, x) { #x, f, x } +#define C(x) { #x, 0, x } C(FTY_PRIME), C(FTY_BINARY), C(PGEN_PASS), C(PGEN_FAIL), C(PGEN_BEGIN), C(PGEN_TRY), C(PGEN_DONE), C(PGEN_ABORT), C(MPW_MAX), + C(RAND_IBITS), C(PMODE_READ), C(PMODE_VERIFY), C(KOPEN_READ), C(KOPEN_WRITE), C(KOPEN_NOFILE), C(KEXP_FOREVER), C(KEXP_EXPIRE), @@ -52,10 +54,11 @@ static const struct nameval consts[] = { C(ED448_KEYSZ), C(ED448_PUBSZ), C(ED448_SIGSZ), C(ED448_MAXPERSOSZ), C(AEADF_PCHSZ), C(AEADF_PCMSZ), C(AEADF_PCTSZ), C(AEADF_AADNDEP), C(AEADF_AADFIRST), C(AEADF_NOAAD), -#define ENTRY(tag, val, str) C(KERR_##tag), +#define ENTRY(tag, val, str) CF(CF_SIGNED, KERR_##tag), KEY_ERRORS(ENTRY) #undef ENTRY #undef C +#undef CF { 0 } }; @@ -75,7 +78,8 @@ PyObject *mexp_common(PyObject *me, PyObject *arg, arg = PyTuple_GetItem(arg, 0); Py_INCREF(arg); if (!PySequence_Check(arg)) TYERR("not a sequence"); - n = PySequence_Size(arg); if (!n) { z = id(me); goto end; } + n = PySequence_Size(arg); if (n < 0) goto end; + if (!n) { z = id(me); goto end; } x = PySequence_GetItem(arg, 0); if (PySequence_Check(x)) flat = 0;