/* -*-c-*-
*
- * $Id: group.h,v 1.4 2004/04/08 01:36:15 mdw Exp $
+ * $Id$
*
* General cyclic group abstraction
*
} group_expfactor;
typedef struct group_ops {
+
+ /* --- General information --- */
+
unsigned ty; /* Type of this group */
+ const char *name; /* Textual name string */
/* --- Memory management --- */
mp *(*toint)(group */*g*/, mp */*d*/, ge */*x*/);
int (*fromint)(group */*g*/, ge */*d*/, mp */*x*/);
int (*toec)(group */*g*/, ec */*d*/, ge */*x*/);
- int (*fromec)(group */*g*/, ge */*d*/, ec */*p*/);
+ int (*fromec)(group */*g*/, ge */*d*/, const ec */*p*/);
int (*tobuf)(group */*h*/, buf */*b*/, ge */*x*/);
int (*frombuf)(group */*h*/, buf */*b*/, ge */*d*/);
int (*toraw)(group */*h*/, buf */*b*/, ge */*x*/);
GTY_EC /* Elliptic curve group */
};
+#define G_NAME(g) (g)->ops->name
+#define G_TYPE(g) (g)->ops->ty
+
#define G_DESTROYGROUP(g) (g)->ops->destroygroup((g))
#define G_CREATE(g) (g)->ops->create((g))
#define G_COPY(g, d, x) (g)->ops->copy((g), (d), (x))
*
* Arguments: @group *g@ = abstract group
* @ge *d@ = destination pointer
- * @ec *p@ = elliptic curve point
+ * @const ec *p@ = elliptic curve point
*
* Returns: Zero for success, @-1@ on failure.
*
* coordinate.
*/
-extern int group_stdfromec(group */*g*/, ge */*d*/, ec */*p*/);
+extern int group_stdfromec(group */*g*/, ge */*d*/, const ec */*p*/);
/*----- Prime field subgroups ---------------------------------------------*/
group *group_prime(const gprime_param */*gp*/);
+/*----- Binary field subgroups --------------------------------------------*/
+
+typedef gprime_param gbin_param;
+
+/* --- @group_binary@ --- *
+ *
+ * Arguments: @const gbin_param *gb@ = group parameters
+ *
+ * Returns: A pointer to the group, or null.
+ *
+ * Use: Constructs an abstract group interface for a subgroup of a
+ * prime field. Group elements are @mp *@ pointers.
+ */
+
+group *group_binary(const gbin_param */*gp*/);
+
/*----- Elliptic curve groups ---------------------------------------------*/
/* --- @group_ec@ --- *