chiark
/
gitweb
/
~mdw
/
catacomb-python
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
pubkey.c, catacomb/__init__.py: Add bindings for Hamburg's X448.
[catacomb-python]
/
algorithms.c
diff --git
a/algorithms.c
b/algorithms.c
index 3f9d4b77edb97072288e0b10be5bc841cbeb0ae8..cb594ca31dd604f8297ea964b9457390f52ca89d 100644
(file)
--- a/
algorithms.c
+++ b/
algorithms.c
@@
-1297,7
+1297,7
@@
static PyObject *polymeth_hash(PyObject *me, PyObject *arg)
uint##n x; \
octet b[SZ_##W]; \
if (!PyArg_ParseTuple(arg, "O&:hashu" #w, convu##n, &x)) goto end; \
uint##n x; \
octet b[SZ_##W]; \
if (!PyArg_ParseTuple(arg, "O&:hashu" #w, convu##n, &x)) goto end; \
- STORE##W(b,
n
); poly1305_hash(P1305_CTX(me), b, sizeof(b)); \
+ STORE##W(b,
x
); poly1305_hash(P1305_CTX(me), b, sizeof(b)); \
RETURN_ME; \
end: \
return (0); \
RETURN_ME; \
end: \
return (0); \
@@
-1312,7
+1312,7
@@
DOUINTCONV(POLYMETH_HASHU_)
octet b[SZ_##W]; \
if (!PyArg_ParseTuple(arg, "s#:hashbuf" #w, &p, &sz)) goto end; \
if (sz > MASK##n) TYERR("string too long"); \
octet b[SZ_##W]; \
if (!PyArg_ParseTuple(arg, "s#:hashbuf" #w, &p, &sz)) goto end; \
if (sz > MASK##n) TYERR("string too long"); \
- STORE##W(b,
n); poly1305_hash(P1305_CTX(me), b, sizeof(b));
\
+ STORE##W(b,
sz); poly1305_hash(P1305_CTX(me), b, sizeof(b));
\
poly1305_hash(P1305_CTX(me), p, sz); \
RETURN_ME; \
end: \
poly1305_hash(P1305_CTX(me), p, sz); \
RETURN_ME; \
end: \
@@
-1335,6
+1335,13
@@
static PyObject *polymeth_flush(PyObject *me, PyObject *arg)
RETURN_ME;
}
RETURN_ME;
}
+static PyObject *polymeth_flushzero(PyObject *me, PyObject *arg)
+{
+ if (!PyArg_ParseTuple(arg, ":flushzero")) return (0);
+ poly1305_flushzero(P1305_CTX(me));
+ RETURN_ME;
+}
+
static PyObject *polymeth_concat(PyObject *me, PyObject *arg)
{
PyObject *pre, *suff;
static PyObject *polymeth_concat(PyObject *me, PyObject *arg)
{
PyObject *pre, *suff;
@@
-1385,6
+1392,7
@@
static PyMethodDef poly1305hash_pymethods[] = {
#undef METHBUF_
METH (hashstrz, "P.hashstrz(STRING)")
METH (flush, "P.flush()")
#undef METHBUF_
METH (hashstrz, "P.hashstrz(STRING)")
METH (flush, "P.flush()")
+ METH (flushzero, "P.flushzero()")
METH (concat, "P.concat(PREFIX, SUFFIX)")
METH (done, "P.done() -> TAG")
#undef METHNAME
METH (concat, "P.concat(PREFIX, SUFFIX)")
METH (done, "P.done() -> TAG")
#undef METHNAME