Test elliptic curves more thoroughly.
[u/mdw/catacomb] / field.h
diff --git a/field.h b/field.h
index 909332f..db27e63 100644 (file)
--- a/field.h
+++ b/field.h
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
 /* -*-c-*-
  *
- * $Id: field.h,v 1.5 2004/03/23 12:08:26 mdw Exp $
+ * $Id: field.h,v 1.6 2004/03/23 15:19:32 mdw Exp $
  *
  * Definitions for field arithmetic
  *
  *
  * Definitions for field arithmetic
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: field.h,v $
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: field.h,v $
+ * Revision 1.6  2004/03/23 15:19:32  mdw
+ * Test elliptic curves more thoroughly.
+ *
  * Revision 1.5  2004/03/23 12:08:26  mdw
  * Random field-element selection.
  *
  * Revision 1.5  2004/03/23 12:08:26  mdw
  * Random field-element selection.
  *
@@ -77,8 +80,18 @@ typedef struct field {
   mp *zero, *one;                      /* Identities in the field */
 } field;
 
   mp *zero, *one;                      /* Identities in the field */
 } field;
 
+enum {
+  FTY_PRIME,
+  FTY_BINARY
+};
+
 typedef struct field_ops {
 
 typedef struct field_ops {
 
+  /* --- General information --- */
+
+  unsigned ty;                         /* What kind of field this is */
+  const char *name;                    /* Human-readable name string */
+
   /* --- Universal operations --- */
 
   void (*destroy)(field */*f*/);
   /* --- Universal operations --- */
 
   void (*destroy)(field */*f*/);
@@ -110,7 +123,11 @@ typedef struct field_ops {
 
 } field_ops;
 
 
 } field_ops;
 
+#define F_TYPE(f)              (f)->ops->ty
+#define F_NAME(f)              (f)->ops->name
+
 #define F_DESTROY(f)           (f)->ops->destroy((f))
 #define F_DESTROY(f)           (f)->ops->destroy((f))
+#define F_RAND(f, d, r)                (f)->ops->rand((f), (d), (r))
 
 #define F_IN(f, d, x)          (f)->ops->in((f), (d), (x))
 #define F_OUT(f, d, x)         (f)->ops->out((f), (d), (x))
 
 #define F_IN(f, d, x)          (f)->ops->in((f), (d), (x))
 #define F_OUT(f, d, x)         (f)->ops->out((f), (d), (x))