// ***** // * PROJECT: ECC ( Elliptic Curve Cryptosystem ) // * FILENAME: ecc.h // * AUTHOR: Feng Zhu // * // * // * // * DESCRIPTION: ECC library functionality interface implementation. // * // * HISTORY: // * 01/12/2003 Feng ZHU - Version 0.1 // * // * COPYRIGHT: // * // * Note: // * The Koblitz curve over GF(2^163); // * The field F(2^163) is generated by the irreducible polynomial // * f (x) = x^163+x^7+x^6+x^3 +1 // * // * The curve E: y2+xy = x3+ax2+b over F(2^163) is defined by: // * a = 00 00000000 00000000 00000000 00000000 00000001 // * b = 00 00000000 00000000 00000000 00000000 00000001 // * // * The base point G is: // * G = 0402FE 13C0537B BC11ACAA 07D793DE 4E6D5E5C 94EEE802 89070FB0 // * 5D38FF58 321F2E80 0536D538 CCDAA3D9 // * // * The order n of G and the cofactor are: // * n = 04 00000000 00000000 00020108 A2E0CC0D 99F8A5EF // * h = 02 // * // * Ref: SEC 2: Recommended Elliptic Curve Domain Parameters, Certicom Research, // * September 20, 2000, Version 1.0 // ***** #ifndef _ECC_H_ #define _ECC_H_ #define True 1 #define False 0 typedef unsigned long word; /* 32 bit */ #define BitLengthOfPoly 192 #define wordLengthOfPoly BitLengthOfPoly/(sizeof(word)*8) #define DegreeOfModPoly 163 typedef struct { word Poly[ wordLengthOfPoly ]; } gf2nPoint; typedef struct { gf2nPoint ModPoly; word SquTab[16]; } GFBASE; typedef struct { gf2nPoint X, Y; int IsInfinity; } eccPoint; #define a_IS_ONE #define b_IS_ONE typedef struct { eccPoint G; /* Generating Point */ GFBASE gfBase; word k[wordLengthOfPoly]; int u[BitLengthOfPoly]; } ECCBASE; #endif /* #ifndef _ECC_H_ */