X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/b817bfc642225b8c3c0b6a7e42d1fb949b61a606..f94b972d1c0389e4e9203cc9919ceaadbe655b61:/group.h diff --git a/group.h b/group.h index 9211a58..aae0e60 100644 --- a/group.h +++ b/group.h @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: group.h,v 1.4 2004/04/08 01:36:15 mdw Exp $ + * $Id$ * * General cyclic group abstraction * @@ -80,7 +80,11 @@ typedef struct group_expfactor { } group_expfactor; typedef struct group_ops { + + /* --- General information --- */ + unsigned ty; /* Type of this group */ + const char *name; /* Textual name string */ /* --- Memory management --- */ @@ -122,7 +126,7 @@ typedef struct group_ops { 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*/); @@ -136,6 +140,9 @@ enum { 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)) @@ -305,7 +312,7 @@ extern int group_stdtoec(group */*g*/, ec */*d*/, ge */*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. * @@ -313,7 +320,7 @@ extern int group_stdtoec(group */*g*/, ec */*d*/, ge */*x*/); * 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 ---------------------------------------------*/