chiark
/
gitweb
/
~mdw
/
catacomb-python
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
mp.c: Factor out and export `mphash'.
[catacomb-python]
/
pubkey.c
diff --git
a/pubkey.c
b/pubkey.c
index 90a29b3df5e5a5e8144d003644f52f37a116ea7e..5167a973791f1930f18b4b7831a6ce6d4aa240ea 100644
(file)
--- a/
pubkey.c
+++ b/
pubkey.c
@@
-65,8
+65,12
@@
static PyObject *dsa_setup(PyTypeObject *ty, PyObject *G, PyObject *u,
if (!u) {
g->d.u = 0;
u = Py_None;
if (!u) {
g->d.u = 0;
u = Py_None;
- } else if ((g->d.u = getmp(u)) == 0)
- goto end;
+ } else {
+ if ((g->d.u = getmp(u)) == 0)
+ goto end;
+ if (MP_PYCHECK(u)) Py_INCREF(u);
+ else u = mp_pywrap(g->d.u);
+ }
if (!p) {
assert(g->d.u); assert(calcpub);
pp = G_CREATE(GROUP_G(G));
if (!p) {
assert(g->d.u); assert(calcpub);
pp = G_CREATE(GROUP_G(G));
@@
-78,7
+82,7
@@
static PyObject *dsa_setup(PyTypeObject *ty, PyObject *G, PyObject *u,
g->d.p = GE_X(p);
g->d.r = GRAND_R(rng);
g->d.h = GCHASH_CH(hash);
g->d.p = GE_X(p);
g->d.r = GRAND_R(rng);
g->d.h = GCHASH_CH(hash);
- g->G = G; Py_INCREF(G); g->u = u;
Py_INCREF(u);
g->p = p;
+ g->G = G; Py_INCREF(G); g->u = u; g->p = p;
g->rng = rng; Py_INCREF(rng); g->hash = hash; Py_INCREF(hash);
return ((PyObject *)g);
end:
g->rng = rng; Py_INCREF(rng); g->hash = hash; Py_INCREF(hash);
return ((PyObject *)g);
end: