Makefile.m4: Remove mplimits.[ch] on clean.
[u/mdw/catacomb] / dsarand.c
index 146a20f..5372b3f 100644 (file)
--- a/dsarand.c
+++ b/dsarand.c
@@ -1,13 +1,13 @@
 /* -*-c-*-
  *
- * $Id: dsarand.c,v 1.2 2000/06/17 10:54:00 mdw Exp $
+ * $Id: dsarand.c,v 1.4 2004/04/08 01:36:15 mdw Exp $
  *
  * Random number generator for DSA
  *
  * (c) 1999 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,
  * MA 02111-1307, USA.
  */
 
-/*----- Revision history --------------------------------------------------* 
- *
- * $Log: dsarand.c,v $
- * Revision 1.2  2000/06/17 10:54:00  mdw
- * Typesetting fixes.  Arena support.
- *
- * Revision 1.1  1999/12/22 15:53:12  mdw
- * Random number generator for finding DSA parameters.
- *
- */
-
 /*----- Header files ------------------------------------------------------*/
 
 #include <stdarg.h>
@@ -277,6 +266,8 @@ static int gmisc(grand *r, unsigned op, ...)
        case GRAND_SEEDBLOCK:
        case GRAND_SEEDRAND:
        case DSARAND_PASSES:
+       case DSARAND_SEEDSZ:
+       case DSARAND_GETSEED:
          rc = 1;
          break;
        default:
@@ -296,6 +287,12 @@ static int gmisc(grand *r, unsigned op, ...)
     case DSARAND_PASSES:
       g->d.passes = va_arg(ap, unsigned);
       break;
+    case DSARAND_SEEDSZ:
+      rc = g->d.sz;
+      break;
+    case DSARAND_GETSEED:
+      memcpy(va_arg(ap, void *), g->d.p, g->d.sz);
+      break;
     default:
       GRAND_BADOP;
       break;