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: Allow RSA key generation with user-chosen public exponent.
[catacomb-python]
/
pubkey.c
diff --git
a/pubkey.c
b/pubkey.c
index f94108f54b29d138221cb5c7ebd6d5ca6bff0c75..e0e8dc95b72577b832890fb1a92baa722e680d6e 100644
(file)
--- a/
pubkey.c
+++ b/
pubkey.c
@@
-728,19
+728,24
@@
static PyObject *meth__RSAPriv_generate(PyObject *me,
unsigned nbits;
unsigned n = 0;
rsa_priv rp;
unsigned nbits;
unsigned n = 0;
rsa_priv rp;
+ mp *e = 0;
pgev evt = { 0 };
pgev evt = { 0 };
- char *kwlist[] = { "class", "nbits", "event", "rng", "nsteps", 0 };
+ char *kwlist[] = { "class", "nbits", "event", "rng", "nsteps",
"e",
0 };
PyObject *rc = 0;
PyObject *rc = 0;
- if (!PyArg_ParseTupleAndKeywords(arg, kw, "OO&|O&O&O&:generate", kwlist,
+ if (!PyArg_ParseTupleAndKeywords(arg, kw, "OO&|O&O&O&
O&
:generate", kwlist,
&me, convuint, &nbits, convpgev, &evt,
&me, convuint, &nbits, convpgev, &evt,
- convgrand, &r, convuint, &n))
+ convgrand, &r, convuint, &n,
+ convmp, &e))
goto end;
goto end;
- if (rsa_gen(&rp, nbits, r, n, evt.proc, evt.ctx))
+ if (e) MP_COPY(e);
+ else e = mp_fromulong(MP_NEW, 65537);
+ if (rsa_gen_e(&rp, nbits, e, r, n, evt.proc, evt.ctx))
PGENERR;
rc = rsapriv_pywrap(&rp);
end:
droppgev(&evt);
PGENERR;
rc = rsapriv_pywrap(&rp);
end:
droppgev(&evt);
+ mp_drop(e);
return (rc);
}
return (rc);
}