projects
/
u
/
mdw
/
catacomb
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
53cbeae
)
Slightly better factoring.
author
mdw
<mdw>
Thu, 8 Apr 2004 16:27:49 +0000
(16:27 +0000)
committer
mdw
<mdw>
Thu, 8 Apr 2004 16:27:49 +0000
(16:27 +0000)
dsig.c
patch
|
blob
|
blame
|
history
diff --git
a/dsig.c
b/dsig.c
index
6e624c6
..
5a60444
100644
(file)
--- a/
dsig.c
+++ b/
dsig.c
@@
-1,6
+1,6
@@
/* -*-c-*-
*
/* -*-c-*-
*
- * $Id: dsig.c,v 1.1
0 2004/04/08 01:36:15
mdw Exp $
+ * $Id: dsig.c,v 1.1
1 2004/04/08 16:27:49
mdw Exp $
*
* Verify signatures on distribuitions of files
*
*
* Verify signatures on distribuitions of files
*
@@
-266,6
+266,15
@@
typedef struct dsa_sigctx {
gdsa g;
} dsa_sigctx;
gdsa g;
} dsa_sigctx;
+static void dsa_initcommon(dsa_sigctx *ds, const gchash *hc,
+ const char *ktag)
+{
+ ds->g.r = &rand_global;
+ ds->g.h = hc;
+ ds->g.u = MP_NEW;
+ ds->s.h = 0;
+}
+
static dsa_sigctx *dsa_doinit(key *k, const gprime_param *gp,
mp *y, const gchash *hc)
{
static dsa_sigctx *dsa_doinit(key *k, const gprime_param *gp,
mp *y, const gchash *hc)
{
@@
-275,13
+284,10
@@
static dsa_sigctx *dsa_doinit(key *k, const gprime_param *gp,
key_fulltag(k, &t);
if ((ds->g.g = group_prime(gp)) == 0)
die(EXIT_FAILURE, "bad prime group in key `%s'", t.buf);
key_fulltag(k, &t);
if ((ds->g.g = group_prime(gp)) == 0)
die(EXIT_FAILURE, "bad prime group in key `%s'", t.buf);
- ds->g.u = MP_NEW;
ds->g.p = G_CREATE(ds->g.g);
if (G_FROMINT(ds->g.g, ds->g.p, y))
die(EXIT_FAILURE, "bad public key in key `%s'", t.buf);
ds->g.p = G_CREATE(ds->g.g);
if (G_FROMINT(ds->g.g, ds->g.p, y))
die(EXIT_FAILURE, "bad public key in key `%s'", t.buf);
- ds->g.r = &rand_global;
- ds->g.h = hc;
- ds->s.h = 0;
+ dsa_initcommon(ds, hc, t.buf);
dstr_destroy(&t);
return (ds);
}
dstr_destroy(&t);
return (ds);
}
@@
-298,13
+304,10
@@
static dsa_sigctx *ecdsa_doinit(key *k, const char *cstr,
if ((e = ec_getinfo(&ei, cstr)) != 0)
die(EXIT_FAILURE, "bad curve in key `%s': %s", t.buf, e);
ds->g.g = group_ec(&ei);
if ((e = ec_getinfo(&ei, cstr)) != 0)
die(EXIT_FAILURE, "bad curve in key `%s': %s", t.buf, e);
ds->g.g = group_ec(&ei);
- ds->g.u = MP_NEW;
ds->g.p = G_CREATE(ds->g.g);
if (G_FROMEC(ds->g.g, ds->g.p, y))
die(EXIT_FAILURE, "bad public key in key `%s'", t.buf);
ds->g.p = G_CREATE(ds->g.g);
if (G_FROMEC(ds->g.g, ds->g.p, y))
die(EXIT_FAILURE, "bad public key in key `%s'", t.buf);
- ds->g.r = &rand_global;
- ds->g.h = hc;
- ds->s.h = 0;
+ dsa_initcommon(ds, hc, t.buf);
dstr_destroy(&t);
return (ds);
}
dstr_destroy(&t);
return (ds);
}