From: mdw Date: Sat, 16 Jun 2001 12:57:43 +0000 (+0000) Subject: Move the @mpmont_factor@ structure and rename it now that it's used for X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/commitdiff_plain/3bc0a0fe99df4fe55f702045d2c0ea9a5c07f3d8 Move the @mpmont_factor@ structure and rename it now that it's used for Barrett simultaneous exponentiation too. --- diff --git a/mp.h b/mp.h index dcf4349..71092fd 100644 --- a/mp.h +++ b/mp.h @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: mp.h,v 1.11 2001/04/03 19:36:05 mdw Exp $ + * $Id: mp.h,v 1.12 2001/06/16 12:57:43 mdw Exp $ * * Simple multiprecision arithmetic * @@ -30,6 +30,10 @@ /*----- Revision history --------------------------------------------------* * * $Log: mp.h,v $ + * Revision 1.12 2001/06/16 12:57:43 mdw + * Move the @mpmont_factor@ structure and rename it now that it's used for + * Barrett simultaneous exponentiation too. + * * Revision 1.11 2001/04/03 19:36:05 mdw * Add some simple bitwise operations so that Perl can use them. * @@ -98,19 +102,31 @@ /*----- Data structures ---------------------------------------------------*/ +/* --- A multiprecision integer --- */ + typedef struct mp { - mpw *v, *vl; - size_t sz; - mparena *a; - unsigned f; - unsigned ref; + mpw *v, *vl; /* Vector of digits, current limit */ + size_t sz; /* Size of digit buffer in words */ + mparena *a; /* Arena for buffer allocation */ + unsigned f; /* Flags (see below) */ + unsigned ref; /* Reference counter */ } mp; -#define MP_NEG 1u -#define MP_BURN 2u -#define MP_CONST 4u -#define MP_UNDEF 8u -#define MP_DESTROYED 16u +#define MP_NEG 1u /* Negative (signed magnitude) */ +#define MP_BURN 2u /* Secret (viral flag) */ +#define MP_CONST 4u /* Uses strange memory allocation */ +#define MP_UNDEF 8u /* Contains nothing interesting */ +#define MP_DESTROYED 16u /* Has been destroyed */ + +/* --- A factor for simultaneous exponentation --- * + * + * Used by the Montgomery and Barrett exponentiators. + */ + +typedef struct mp_expfactor { + mp *base; + mp *exp; +} mp_expfactor; /*----- Useful constants --------------------------------------------------*/