1 // -*- C++ -*- 2 //============================================================================================== 3 // 4 // This file is part of LiDIA --- a library for computational number theory 5 // 6 // Copyright (c) 1994--2001 the LiDIA Group. All rights reserved. 7 // 8 // See http://www.informatik.tu-darmstadt.de/TI/LiDIA/ 9 // 10 //---------------------------------------------------------------------------------------------- 11 // 12 // $Id$ 13 // 14 // Author : Volker Mueller (VM), Markus Maurer (MM), Andrea Rau (AR) 15 // Changes : See CVS log 16 // 17 //============================================================================================== 18 19 20 #ifndef LIDIA_EC_DOMAIN_PARAMETERS_P1363_H_GUARD_ 21 #define LIDIA_EC_DOMAIN_PARAMETERS_P1363_H_GUARD_ 22 23 24 25 #ifndef LIDIA_BIGMOD_H_GUARD_ 26 # include "LiDIA/bigmod.h" 27 #endif 28 #ifndef LIDIA_POINT_H_GUARD_ 29 # include "LiDIA/point.h" 30 #endif 31 #ifndef LIDIA_GF_ELEMENT_H_GUARD_ 32 # include "LiDIA/gf_element.h" 33 #endif 34 #ifndef LIDIA_BIGINT_H_GUARD_ 35 # include "LiDIA/bigint.h" 36 #endif 37 #ifndef LIDIA_TIMER_H_GUARD_ 38 # include "LiDIA/timer.h" 39 #endif 40 41 42 43 #ifdef LIDIA_NAMESPACE 44 namespace LiDIA { 45 # define IN_NAMESPACE_LIDIA 46 #endif 47 48 49 50 const int MUCH_INFO = 2; 51 const int LITTLE_INFO = 1; 52 const int NO_INFO = 0; 53 54 55 56 class EC_domain_parameters_P1363 57 { 58 // 59 // q Size of the finite field. 60 // a, b Coefficients of the elliptic curve E. 61 // r The prime divisor of #E. 62 // k The cofactor #E / r. 63 // x x-coordinate of point on E over GF(q) of order r. 64 // y x-coordinate of point on E over GF(q) of order r. 65 // 66 67 private: 68 static lidia_size_t defaultBitsize_; 69 static lidia_size_t defaultPercentage_; 70 71 gf_element a, b; 72 bigint k, r, q; 73 point< gf_element > G; 74 bool initialized; // true, iff generate_parameters 75 // has been called. 76 public: 77 static int GF2N; 78 static int GFP; 79 80 // 81 // constructor / destructor 82 // 83 EC_domain_parameters_P1363(); 84 ~EC_domain_parameters_P1363(); 85 86 // 87 // Access 88 // 89 // Error, if initialized == false 90 // 91 const bigint & get_q () const; 92 const gf_element & get_a () const; 93 const gf_element & get_b () const; 94 const bigint & get_k () const; 95 const bigint & get_r () const; 96 const point< gf_element > & get_G () const; 97 98 lidia_size_t default_bitsize(); 99 lidia_size_t default_percentage(); 100 101 // 102 // Assignments 103 // 104 void assign(const EC_domain_parameters_P1363 & I); 105 EC_domain_parameters_P1363 & operator = (const EC_domain_parameters_P1363 & I); 106 107 // 108 // High level functions 109 // 110 void generate_parameters(int field, int bitsize_factor, int info); 111 112 void generate_parameters(int field, int info); 113 114 void generate_parameters(int field, //GF2N oder GFP 115 int bitsize_factor, 116 int percentage, 117 int info); 118 119 private: 120 bool is_strong_curve(rational_factorization & rf_order, 121 const bigint & order, 122 const bigint & co_factor, 123 const bigint & p, 124 int info) const; 125 126 void get_twist_coeff(gf_element & new_a, gf_element & new_b); 127 }; 128 129 130 131 #ifdef LIDIA_NAMESPACE 132 } // end of namespace LiDIA 133 # undef IN_NAMESPACE_LIDIA 134 #endif 135 136 137 138 #endif // LIDIA_EC_DOMAIN_PARAMETERS_P1363_H_GUARD_ 139