* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
/*----- Header files ------------------------------------------------------*/
+#include "dsa.h"
#include "gdsa.h"
#include "group.h"
#include "ghash.h"
* Returns: ---
*
* Use: Does any final thing that DSA wants to do when hashing a
- * message. (Actually, there's nothing.) The hashing context
+ * message. (Actually, there's nothing.) The hashing context
* isn't finalized.
*/
-void gdsa_endhash(gdsa *c, ghash *h) { ; }
+void gdsa_endhash(const gdsa *c, ghash *h) { ; }
/* --- @gdsa_sign@ --- *
*
void gdsa_sign(const gdsa *c, gdsa_sig *s, const void *m, mp *k)
{
group *g = c->g;
- mp *mr = mp_loadb(MP_NEW, m, c->h->hashsz);
+ mp *mr = dsa_h2n(MP_NEW, g->r, m, c->h->hashsz);
ge *z = G_CREATE(g);
mp *sr = s->r, *ss = s->s;
mpbarrett b;
return (-1);
mpbarrett_create(&b, g->r); h = mp_modinv(MP_NEW, s->s, g->r);
e[0].base = g->g; e[1].base = c->p;
- t = mp_loadb(MP_NEW, m, c->h->hashsz); mp_div(0, &t, t, g->r);
+ t = dsa_h2n(MP_NEW, g->r, m, c->h->hashsz); mp_div(0, &t, t, g->r);
t = mp_mul(t, t, h); e[0].exp = t = mpbarrett_reduce(&b, t, t);
h = mp_mul(h, s->r, h); e[1].exp = h = mpbarrett_reduce(&b, h, h);
w = G_CREATE(g); G_MEXP(g, w, e, 2);
}
static void showmp(const char *p, mp *x, int r) {
- fprintf(stderr, "*** %s = ", p); mp_writefile(x, stderr, r);
+ fprintf(stderr, "*** %s = ", p); mp_writefile(x, stderr, r);
putc('\n', stderr);
}