Standard curves and curve checking.
[u/mdw/catacomb] / field.h
diff --git a/field.h b/field.h
index 21ac7dd..7af9b4f 100644 (file)
--- a/field.h
+++ b/field.h
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: field.h,v 1.7 2004/03/27 00:04:46 mdw Exp $
+ * $Id: field.h,v 1.8 2004/03/27 17:54:11 mdw Exp $
  *
  * Definitions for field arithmetic
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: field.h,v $
+ * Revision 1.8  2004/03/27 17:54:11  mdw
+ * Standard curves and curve checking.
+ *
  * Revision 1.7  2004/03/27 00:04:46  mdw
  * Implement efficient reduction for pleasant-looking primes.
  *
 #  include "mp.h"
 #endif
 
+#ifndef CATACOMB_QDPARSE_H
+#  include "qdparse.h"
+#endif
+
 /*----- Data structures ---------------------------------------------------*/
 
 typedef struct field {
   const struct field_ops *ops;         /* Field operations */
   mp *zero, *one;                      /* Identities in the field */
+  mp *m;                               /* Modulus (prime and binary) */
+  unsigned long nbits;                 /* Length of field element in bits */
+  size_t noctets;                      /* Length of element in octets */
 } field;
 
 enum {
@@ -206,6 +216,21 @@ extern field *field_niceprime(mp */*p*/);
 
 extern field *field_binpoly(mp */*p*/);
 
+/* --- @field_parse@ --- *
+ *
+ * Arguments:  @qd_parse *qd@ = parser context
+ *
+ * Returns:    Field pointer if OK, or null.
+ *
+ * Use:                Parses a field description, which has the form
+ *
+ *               * `prime', `niceprime' or `binpoly'
+ *               * an optional `:'
+ *               * the field modulus
+ */
+
+extern field *field_parse(qd_parse */*qd*/);
+
 /*----- That's all, folks -------------------------------------------------*/
 
 #ifdef __cplusplus