X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/b04a7659918367dcc8570e1c7b4246a97e88288d..22bab86c9df047bdd258283c6567821319ba7a6f:/dsa.h diff --git a/dsa.h b/dsa.h index e8dee83..dfd04db 100644 --- a/dsa.h +++ b/dsa.h @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: dsa.h,v 1.4 1999/12/22 15:52:44 mdw Exp $ + * $Id: dsa.h,v 1.7 2000/07/29 09:59:44 mdw Exp $ * * Digital Signature Algorithm * @@ -30,6 +30,15 @@ /*----- Revision history --------------------------------------------------* * * $Log: dsa.h,v $ + * Revision 1.7 2000/07/29 09:59:44 mdw + * Share data structures with Diffie-Hellman stuff. + * + * Revision 1.6 2000/07/01 11:20:51 mdw + * New functions for freeing public and private keys. + * + * Revision 1.5 2000/06/17 10:53:42 mdw + * Minor changes for key fetching. Typesetting fixes. + * * Revision 1.4 1999/12/22 15:52:44 mdw * Reworking for new prime-search system. * @@ -62,6 +71,14 @@ /*----- Header files ------------------------------------------------------*/ +#ifndef CATACOMB_DH_H +# include "dh.h" +#endif + +#ifndef CATACOMB_KEY_H +# include "key.h" +#endif + #ifndef CATACOMB_MP_H # include "mp.h" #endif @@ -72,16 +89,11 @@ /*----- Data structures ---------------------------------------------------*/ -/* --- DSA parameter structure --- * - * - * These parameters can, and probably should, be shared among a group of - * users. - */ +/* --- The parameters and keys are the same as for Diffie-Hellman --- */ -typedef struct dsa_param { - mp *p, *q; /* Prime numbers %$p$% and %$q$% */ - mp *g; /* Generates order-%$q$% subgroup */ -} dsa_param; +typedef dh_param dsa_param; +typedef dh_pub dsa_pub; +typedef dh_priv dsa_priv; /* --- DSA signature structure --- * * @@ -97,6 +109,20 @@ typedef struct dsa_sig { octet s[DSA_SIGLEN]; /* 160-bit @s@ value */ } dsa_sig; +/*----- Key fetching ------------------------------------------------------*/ + +#define dsa_paramfetch dh_paramfetch +#define dsa_pubfetch dh_pubfetch +#define dsa_privfetch dh_privfetch + +#define DSA_PARAMFETCHSZ DH_PARAMFETCHSZ +#define DSA_PUBFETCHSZ DH_PUBFETCHSZ +#define DSA_PRIVFETCHSZ DH_PRIVFETCHSZ + +#define dsa_paramfree dh_paramfree +#define dsa_pubfree dh_pubfree +#define dsa_privfree dh_privfree + /*----- DSA stepper -------------------------------------------------------*/ typedef struct dsa_stepctx { @@ -120,7 +146,7 @@ extern int dsa_step(int /*rq*/, pgen_event */*ev*/, void */*p*/); /*----- Functions provided ------------------------------------------------*/ -/* --- @dsa_seed@ --- * +/* --- @dsa_gen@ --- * * * Arguments: @dsa_param *dp@ = where to store parameters * @unsigned ql@ = length of @q@ in bits @@ -143,9 +169,9 @@ extern int dsa_step(int /*rq*/, pgen_event */*ev*/, void */*p*/); * %$l$%. Neither limitation applies to this implementation. */ -extern int dsa_seed(dsa_param */*dp*/, unsigned /*ql*/, unsigned /*pl*/, - unsigned /*steps*/, const void */*k*/, size_t /*sz*/, - pgen_proc */*event*/, void */*ectx*/); +extern int dsa_gen(dsa_param */*dp*/, unsigned /*ql*/, unsigned /*pl*/, + unsigned /*steps*/, const void */*k*/, size_t /*sz*/, + pgen_proc */*event*/, void */*ectx*/); /* --- @dsa_mksig@ --- * * @@ -221,9 +247,9 @@ extern int dsa_vrfy(const dsa_param */*dp*/, mp */*y*/, */ extern int dsa_verify(const dsa_param */*dp*/, mp */*y*/, - const void */*m*/, size_t /*msz*/, - const void */*r*/, size_t /*rsz*/, - const void */*s*/, size_t /*ssz*/); + const void */*m*/, size_t /*msz*/, + const void */*r*/, size_t /*rsz*/, + const void */*s*/, size_t /*ssz*/); /*----- That's all, folks -------------------------------------------------*/