key-flags.c, key-pack.c, key-pass.c: Don't use the `key.h' machinery.
[u/mdw/catacomb] / f-binpoly.c
index 23d9984..5f6a527 100644 (file)
@@ -7,7 +7,7 @@
  * (c) 2004 Straylight/Edgeware
  */
 
-/*----- Licensing notice --------------------------------------------------* 
+/*----- Licensing notice --------------------------------------------------*
  *
  * This file is part of Catacomb.
  *
  * it under the terms of the GNU Library General Public License as
  * published by the Free Software Foundation; either version 2 of the
  * License, or (at your option) any later version.
- * 
+ *
  * Catacomb is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU Library General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU Library General Public
  * License along with Catacomb; if not, write to the Free
  * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
@@ -41,7 +41,7 @@
 
 static void fdestroy(field *ff) {
   fctx_binpoly *f = (fctx_binpoly *)ff;
-  gfreduce_destroy(&f->r);
+  gfreduce_destroy(&f->r); MP_DROP(f->f.q);
   DESTROY(f);
 }
 
@@ -114,6 +114,7 @@ field *field_binpoly(mp *p)
   f->f.noctets = (f->f.nbits + 7) >> 3;
   gfreduce_create(&f->r, p);
   f->f.m = f->r.p;
+  f->f.q = mp_lsl(MP_NEW, MP_ONE, f->f.nbits);
   return (&f->f);
 }
 
@@ -123,7 +124,7 @@ field *field_binpoly(mp *p)
 
 static void fndestroy(field *ff) {
   fctx_binnorm *f = (fctx_binnorm *)ff; gfreduce_destroy(&f->f.r);
-  gfn_destroy(&f->ntop); gfn_destroy(&f->pton);
+  gfn_destroy(&f->ntop); gfn_destroy(&f->pton); MP_DROP(f->f.f.q);
   DESTROY(f);
 }
 
@@ -175,6 +176,7 @@ field *field_binnorm(mp *p, mp *beta)
   f->f.f.noctets = (f->f.f.nbits + 7) >> 3;
   gfreduce_create(&f->f.r, p);
   f->f.f.m = f->f.r.p;
+  f->f.f.q = mp_lsl(MP_NEW, MP_ONE, f->f.f.nbits);
   gfn_create(p, beta, &f->ntop, &f->pton);
   return (&f->f.f);
 }