X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/a9fcea0e5ef17bab8eaca2236016e109ab62488e..0f3faccdf5f2f0cfa40bd9bec495c4930052a51f:/group.h diff --git a/group.h b/group.h index d099a8f..0e32de6 100644 --- a/group.h +++ b/group.h @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: group.h,v 1.2 2004/04/03 03:32:05 mdw Exp $ + * $Id: group.h,v 1.3 2004/04/04 19:04:11 mdw Exp $ * * General cyclic group abstraction * @@ -30,6 +30,9 @@ /*----- Revision history --------------------------------------------------* * * $Log: group.h,v $ + * Revision 1.3 2004/04/04 19:04:11 mdw + * Raw I/O of elliptic curve points and group elements. + * * Revision 1.2 2004/04/03 03:32:05 mdw * General robustification. * @@ -82,7 +85,7 @@ typedef struct group_ { const struct group_ops *ops; /* Operations table */ size_t nbits; /* Size of an element in bits */ - size_t noctets; /* Size of an element in octets */ + size_t noctets; /* Size of raw element in octets */ ge *i; /* Identity element */ ge *g; /* Generator element */ mp *r; /* Order of the generator */ @@ -140,6 +143,8 @@ typedef struct group_ops { int (*fromec)(group */*g*/, ge */*d*/, 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*/); + int (*fromraw)(group */*h*/, buf */*b*/, ge */*d*/); } group_ops; @@ -177,6 +182,8 @@ enum { #define G_FROMEC(g, d, p) (g)->ops->fromec((g), (d), (p)) #define G_TOBUF(g, b, x) (g)->ops->tobuf((g), (b), (x)) #define G_FROMBUF(g, b, d) (g)->ops->frombuf((g), (b), (d)) +#define G_TORAW(g, b, x) (g)->ops->toraw((g), (b), (x)) +#define G_FROMRAW(g, b, d) (g)->ops->fromraw((g), (b), (d)) /*----- Handy functions ---------------------------------------------------*/