/* -*-c-*-
- *
- * $Id$
*
* Public-key cryptography
*
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of the Python interface to Catacomb.
*
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* Catacomb/Python is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with Catacomb/Python; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
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; Py_INCREF(p);
- rng = g->rng; Py_INCREF(rng); g->hash = hash; Py_INCREF(hash);
+ g->rng = rng; Py_INCREF(rng); g->hash = hash; Py_INCREF(hash);
return ((PyObject *)g);
end:
FREEOBJ(g);
PyObject *rc = 0;
char *kwlist[] = { "G", "p", "u", "hash", "rng", 0 };
- if (!PyArg_ParseTupleAndKeywords(arg, kw, "O!O!O!|OO!:new", kwlist,
+ if (!PyArg_ParseTupleAndKeywords(arg, kw, "O!O!|OO!O!:new", kwlist,
group_pytype, &G,
ge_pytype, &p,
&u,
goto end;
if (n != DSA_D(me)->h->hashsz)
VALERR("bad message length (doesn't match hash size)");
- rc = getbool(gdsa_verify(DSA_D(me), &s, p));
+ rc = getbool(!gdsa_verify(DSA_D(me), &s, p));
end:
mp_drop(s.r);
mp_drop(s.s);
PyObject *rc = 0;
char *kwlist[] = { "G", "p", "u", "hash", "rng", 0 };
- if (!PyArg_ParseTupleAndKeywords(arg, kw, "O!O!|O!OO!:new", kwlist,
+ if (!PyArg_ParseTupleAndKeywords(arg, kw, "O!O!O|O!O!:new", kwlist,
group_pytype, &G,
ge_pytype, &p,
&u,
gchash_pytype, &hash,
grand_pytype, &rng) ||
- (rc = dsa_setup(dsapriv_pytype, G, p, u, rng, hash)) == 0)
+ (rc = dsa_setup(dsapriv_pytype, G, u, p, rng, hash)) == 0)
goto end;
end:
return (rc);
MEMBER(G, T_OBJECT, READONLY, "D.G -> group to work in")
MEMBER(p, T_OBJECT, READONLY, "D.p -> public key (group element")
MEMBER(rng, T_OBJECT, READONLY, "D.rng -> random number generator")
- MEMBER(hash, T_OBJECT, READONLY, "D.hash -> hash class")
+ MEMBER(hash, T_OBJECT, READONLY, "D.hash -> hash class")
#undef MEMBERSTRUCT
{ 0 }
};
PyObject *rc = 0;
char *kwlist[] = { "G", "p", "u", "hash", "rng", 0 };
- if (!PyArg_ParseTupleAndKeywords(arg, kw, "O!O!O!|OO!:new", kwlist,
+ if (!PyArg_ParseTupleAndKeywords(arg, kw, "O!O!O|O!O!:new", kwlist,
group_pytype, &G,
ge_pytype, &p,
&u,
gchash_pytype, &hash,
grand_pytype, &rng) ||
- (rc = dsa_setup(kcdsapub_pytype, G, p, u, rng, hash)) == 0)
+ (rc = dsa_setup(kcdsapub_pytype, G, u, p, rng, hash)) == 0)
goto end;
end:
return (rc);
PyObject *rc = 0;
char *kwlist[] = { "G", "p", "u", "hash", "rng", 0 };
- if (!PyArg_ParseTupleAndKeywords(arg, kw, "O!O!|O!OO!:new", kwlist,
+ if (!PyArg_ParseTupleAndKeywords(arg, kw, "O!O!|OO!O!:new", kwlist,
group_pytype, &G,
ge_pytype, &p,
&u,
gchash_pytype, &hash,
grand_pytype, &rng) ||
- (rc = dsa_setup(kcdsapriv_pytype, G, p, u, rng, hash)) == 0)
+ (rc = dsa_setup(kcdsapriv_pytype, G, u, p, rng, hash)) == 0)
goto end;
end:
return (rc);
r = bytestring_pywrap(0, DSA_D(me)->h->hashsz);
s.r = (octet *)PyString_AS_STRING(r);
gkcdsa_sign(DSA_D(me), &s, p, k);
- rc = Py_BuildValue("(NN)", r, mp_pywrap(s.s));
+ rc = Py_BuildValue("(ON)", r, mp_pywrap(s.s));
end:
Py_XDECREF(r);
mp_drop(k);
VALERR("bad message length (doesn't match hash size)");
if (rn != DSA_D(me)->h->hashsz)
VALERR("bad signature `r' length (doesn't match hash size)");
- rc = getbool(gkcdsa_verify(DSA_D(me), &s, p));
+ rc = getbool(!gkcdsa_verify(DSA_D(me), &s, p));
end:
mp_drop(s.s);
return (rc);