X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/343509982ee8c88ddafd0129b4dcf97e3c7a672d..ceb3f0c0a3b7bb3fa3250d31b04c382894095e52:/field.h diff --git a/field.h b/field.h index 8096700..ea019c5 100644 --- a/field.h +++ b/field.h @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: field.h,v 1.3.4.1 2004/03/20 00:13:31 mdw Exp $ + * $Id: field.h,v 1.3.4.2 2004/03/21 22:39:46 mdw Exp $ * * Definitions for field arithmetic * @@ -30,6 +30,9 @@ /*----- Revision history --------------------------------------------------* * * $Log: field.h,v $ + * Revision 1.3.4.2 2004/03/21 22:39:46 mdw + * Elliptic curves on binary fields work. + * * Revision 1.3.4.1 2004/03/20 00:13:31 mdw * Projective coordinates for prime curves * @@ -81,6 +84,11 @@ typedef struct field_ops { mp *(*sqr)(field */*f*/, mp */*d*/, mp */*x*/); mp *(*inv)(field */*f*/, mp */*d*/, mp */*x*/); mp *(*reduce)(field */*f*/, mp */*d*/, mp */*x*/); + mp *(*sqrt)(field */*f*/, mp */*d*/, mp */*x*/); + + /* --- Operations for binary fields only --- */ + + mp *(*quadsolve)(field */*f*/, mp */*d*/, mp */*x*/); /* --- Operations for prime fields only --- */ @@ -88,7 +96,6 @@ typedef struct field_ops { mp *(*tpl)(field */*f*/, mp */*d*/, mp */*x*/); mp *(*qdl)(field */*f*/, mp */*d*/, mp */*x*/); mp *(*hlv)(field */*f*/, mp */*d*/, mp */*x*/); - mp *(*sqrt)(field */*f*/, mp */*d*/, mp */*x*/); } field_ops; @@ -105,12 +112,14 @@ typedef struct field_ops { #define F_SQR(f, d, x) (f)->ops->sqr((f), (d), (x)) #define F_INV(f, d, x) (f)->ops->inv((f), (d), (x)) #define F_REDUCE(f, d, x) (f)->ops->reduce((f), (d), (x)) +#define F_SQRT(f, d, x) (f)->ops->sqrt((f), (d), (x)) + +#define F_QUADSOLVE(f, d, x) (f)->ops->quadsolve((f), (d), (x)) #define F_DBL(f, d, x) (f)->ops->dbl((f), (d), (x)) #define F_TPL(f, d, x) (f)->ops->tpl((f), (d), (x)) #define F_QDL(f, d, x) (f)->ops->qdl((f), (d), (x)) #define F_HLV(f, d, x) (f)->ops->hlv((f), (d), (x)) -#define F_SQRT(f, d, x) (f)->ops->sqrt((f), (d), (x)) /*----- Helpful field operations ------------------------------------------*/ @@ -154,20 +163,6 @@ extern field *field_prime(mp */*p*/); extern field *field_binpoly(mp */*p*/); -/* --- @field_binsparsepoly@ --- * - * - * Arguments: @unsigned deg@ = the degree of the field polynomial - * @const unsigned *c@ = degrees of nonzero coefficients - * - * Returns: A pointer to the field. - * - * Use: Creates a field structure for a binary field taking advantage - * of the sparseness of the given polynomial to improve - * reduction performance. - */ - -extern field *field_binsparsepoly(unsigned /*deg*/, const unsigned */*c*/); - /*----- That's all, folks -------------------------------------------------*/ #ifdef __cplusplus