/* -*-c-*-
*
- * $Id: mpcrt.h,v 1.1 1999/11/22 20:50:57 mdw Exp $
+ * $Id: mpcrt.h,v 1.3 2004/04/08 01:36:15 mdw Exp $
*
* Chinese Remainder Theorem computations (Gauss's algorithm)
*
* MA 02111-1307, USA.
*/
-/*----- Revision history --------------------------------------------------*
- *
- * $Log: mpcrt.h,v $
- * Revision 1.1 1999/11/22 20:50:57 mdw
- * Add support for solving Chinese Remainder Theorem problems.
- *
- */
-
-#ifndef MPCRT_H
-#define MPCRT_H
+#ifndef CATACOMB_MPCRT_H
+#define CATACOMB_MPCRT_H
#ifdef __cplusplus
extern "C" {
#include <stddef.h>
-#ifndef MP_H
+#ifndef CATACOMB_MP_H
# include "mp.h"
#endif
-#ifndef MPMONT_H
-# include "mpmont.h"
+#ifndef CATACOMB_MPBARRETT_H
+# include "mpbarrett.h"
#endif
/*----- Data structures ---------------------------------------------------*/
mp *m; /* %$n_i$% -- the modulus */
mp *n; /* %$N_i = n / n_i$% */
mp *ni; /* %$M_i = N_i^{-1} \bmod n_i$% */
- mp *nnir; /* %$N_i M_i R \bmod m$% */
+ mp *nni; /* %$N_i M_i \bmod m$% */
} mpcrt_mod;
typedef struct mpcrt {
size_t k; /* Number of distinct moduli */
- mpmont mm; /* Montgomery context for product */
+ mpbarrett mb; /* Barrett context for product */
mpcrt_mod *v; /* Vector of information for each */
} mpcrt;
/* --- @mpcrt_solve@ --- *
*
* Arguments: @mpcrt *c@ = pointer to CRT context
+ * @mp *d@ = fake destination
* @mp **v@ = array of residues
*
* Returns: The unique solution modulo the product of the individual
* exponentiation.
*/
-extern mp *mpcrt_solve(mpcrt */*c*/, mp **/*v*/);
+extern mp *mpcrt_solve(mpcrt */*c*/, mp */*d*/, mp **/*v*/);
/*----- That's all, folks -------------------------------------------------*/