X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/827e6c999a4a94c217b7138bb7e46f36f7644dab..298182ad446aaced14dea7ed0e7c968946787288:/dsa.h diff --git a/dsa.h b/dsa.h index dfd04db..48ed07d 100644 --- a/dsa.h +++ b/dsa.h @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: dsa.h,v 1.7 2000/07/29 09:59:44 mdw Exp $ + * $Id: dsa.h,v 1.9 2004/04/08 01:36:15 mdw Exp $ * * Digital Signature Algorithm * @@ -27,32 +27,6 @@ * MA 02111-1307, USA. */ -/*----- 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. - * - * Revision 1.3 1999/12/10 23:29:48 mdw - * Change header file guard names. - * - * Revision 1.2 1999/11/20 22:23:48 mdw - * Allow event handler to abort the search process. - * - * Revision 1.1 1999/11/19 19:28:00 mdw - * Implementation of the Digital Signature Algorithm. - * - */ - #ifndef CATACOMB_DSA_H #define CATACOMB_DSA_H @@ -79,6 +53,10 @@ # include "key.h" #endif +#ifndef CATACOMB_KEYCHECK_H +# include "keycheck.h" +#endif + #ifndef CATACOMB_MP_H # include "mp.h" #endif @@ -95,6 +73,14 @@ typedef dh_param dsa_param; typedef dh_pub dsa_pub; typedef dh_priv dsa_priv; +/* --- DSA key seed structure --- */ + +typedef struct dsa_seed { + void *p; /* Pointer to seed material */ + size_t sz; /* Size of seed material */ + unsigned count; /* Iterations to find @p@ */ +} dsa_seed; + /* --- DSA signature structure --- * * * This is the recommended structure for a DSA signature. The actual signing @@ -133,6 +119,8 @@ typedef struct dsa_stepctx { mp *q; /* Force @p@ to be a multiple */ size_t bits; /* Number of bits in the result */ unsigned or; /* OR mask for low order bits */ + unsigned count; /* Counts the number of steps made */ + void *seedbuf; /* Pointer to seed buffer */ } dsa_stepctx; /* --- @dsa_step@ --- * @@ -142,7 +130,7 @@ typedef struct dsa_stepctx { * divisibility by small primes. */ -extern int dsa_step(int /*rq*/, pgen_event */*ev*/, void */*p*/); +extern pgen_proc dsa_step; /*----- Functions provided ------------------------------------------------*/ @@ -154,6 +142,7 @@ extern int dsa_step(int /*rq*/, pgen_event */*ev*/, void */*p*/); * @unsigned steps@ = number of steps to find @q@ * @const void *k@ = pointer to key material * @size_t sz@ = size of key material + * @dsa_seed *sd@ = optional pointer for output seed information * @pgen_proc *event@ = event handler function * @void *ectx@ = argument for event handler * @@ -171,7 +160,21 @@ extern int dsa_step(int /*rq*/, pgen_event */*ev*/, void */*p*/); 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_seed */*sd*/, pgen_proc */*event*/, void */*ectx*/); + +/* --- @dsa_checkparam@ --- * + * + * Arguments: @keycheck *kc@ = keycheck state + * @const dsa_param *dp@ = pointer to the parameter set + * @const dsa_seed *ds@ = pointer to seed information + * + * Returns: Zero if all OK, or return status from function. + * + * Use: Checks a set of DSA parameters for consistency and security. + */ + +extern int dsa_checkparam(keycheck */*kc*/, const dsa_param */*dp*/, + const dsa_seed */*ds*/); /* --- @dsa_mksig@ --- * *