// ***** // * 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: // * 1. Ref: SAMPLE TEST VECTORS FOR P1363 // * The field F(2^191) is generated by the irreducible polynomial // * 80000000 00000000 00000000 00000000 00000000 // * 00000201 // * The elliptic curve is E : y^2 + xy = x^3 + ax^2 + b over F(2^191), where // * a = 2866537B 67675263 6A68F565 54E12640 276B649E // * F7526267 // * b = 2E45EF57 1F00786F 67B0081B 9495A3D9 5462F5DE // * 0AA185EC // * Generating point is (without point compression) // * G = 04 36B3DAF8 A23206F9 C4F299D7 B21A9C36 // * 9137F2C8 4AE1AA0D 765BE734 33B3F95E 332932E7 // * 0EA245CA 2418EA0E F98018FB // * // ***** #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 191 typedef struct { word Poly[ wordLengthOfPoly ]; } gf2nPoint; typedef struct { gf2nPoint ModPoly; word SquTab[16]; } GFBASE; typedef struct { gf2nPoint X, Y; int IsInfinity; } eccPoint; typedef struct { gf2nPoint a, b; /* y^2 +xy = x^3 +ax^2 + b and c^2 = b*/ eccPoint G; /* Generating Point */ GFBASE gfBase; } ECCBASE; #endif /* #ifndef _ECC_H_ */