parameters.c 5.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. //#ifndef NEW_PARAMETERS
  2. /*
  3. * File: dclxvi-20130329/parameters.c
  4. * Author: Ruben Niederhagen, Peter Schwabe
  5. * Public Domain
  6. */
  7. #include "fpe.h"
  8. #include "fp2e.h"
  9. #include "fp6e.h"
  10. #include "fp12e.h"
  11. #include "curvepoint_fp.h"
  12. #include "twistpoint_fp2.h"
  13. #include "scalar.h"
  14. //#include "scalar_512.h"
  15. #ifdef __cplusplus
  16. #define EXTERN extern
  17. #else
  18. #define EXTERN
  19. #endif
  20. //EXTERN const scalar_t bn_6uplus2 = {0x1EC817A18A131208ULL,2,0,0};
  21. #define BN_6UPLUS2_NAFLEN 66
  22. EXTERN const unsigned long bn_naflen_6uplus2 = BN_6UPLUS2_NAFLEN;
  23. EXTERN const signed char bn_6uplus2_naf[BN_6UPLUS2_NAFLEN] = {0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, -1, 0, 1, 0, 0, 0, 1, 0, -1, 0, 0, 0, -1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, -1, 0, 0, 0, 0, 1, 0, 0, 0, 1};
  24. //EXTERN const scalar_t bn_u = {0x5BBC1015F02AC17DULL, 0x0000000000000000ULL, 0x0000000000000000ULL, 0x0000000000000000ULL};
  25. EXTERN const scalar_t bn_n = {0x1A2EF45B57AC7261ULL, 0x2E8D8E12F82B3924ULL, 0xAA6FECB86184DC21ULL, 0x8FB501E34AA387F9ULL};
  26. EXTERN const scalar_t bn_pminus2 = {0x185CAC6C5E089665ULL, 0xEE5B88D120B5B59EULL, 0xAA6FECB86184DC21ULL, 0x8FB501E34AA387F9ULL};
  27. //EXTERN const unsigned long bn_u_bitsize = 63;
  28. EXTERN const double bn_v = 1868033.;
  29. EXTERN const double bn_v6 = 11208198.;
  30. const char * bn_pstr = "65000549695646603732796438742359905742825358107623003571877145026864184071783";
  31. EXTERN const scalar_t bn_v_scalar = {1868033,0,0,0};
  32. EXTERN const fpe_t bn_zeta = {{{ -5604098, -934016, -934016, 2, 0, 0, -5604096, -934016, -934016, 1, 0, 0}}}; /* zeta */
  33. EXTERN const fpe_t bn_zeta2 = {{{ 5604097, 934016, 934016, -2, 0, 0, -5604102, -934016, -934016, 0, 0, 0}}}; /* zeta^2 */
  34. EXTERN const curvepoint_fp_t bn_curvegen = {{{{{1.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.}}},
  35. {{{ -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}},
  36. {{{1.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.}}},
  37. {{{0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.}}}}};
  38. EXTERN const twistpoint_fp2_t bn_twistgen = {{{{{490313, 4260028, -821156, -818020, 106592, -171108, 757738, 545601, 597403,
  39. 366066, -270886, -169528, 3101279, 2043941, -726481, 382478, -650880, -891316,
  40. -13923, 327200, -110487, 473555, -7301, 608340}}},
  41. {{{-4628877, 3279202, 431044, 459682, -606446, -924615, -927454, 90760, 13692,
  42. -225706, -430013, -373196, 3004032, 4097571, 380900, 919715, -640623, -402833,
  43. -729700, -163786, -332478, -440873, 510935, 593941}}},
  44. {{{1.,0.,0.,0.,0.,0., 0.,0.,0.,0.,0.,0., 0.,0.,0.,0.,0.,0., 0.,0.,0.,0.,0.,0.}}},
  45. {{{0.,0.,0.,0.,0.,0., 0.,0.,0.,0.,0.,0., 0.,0.,0.,0.,0.,0., 0.,0.,0.,0.,0.,0.}}}}};
  46. EXTERN const fp2e_t bn_z2p = {{{-3981901, -4468327, 248857, -740622, 900229, -562222,
  47. 260246, -632491, -928317, -38527, 838674, 36774, -2702081, 3668149,
  48. -873042, 304894, 876721, 213663,
  49. 562599, -128685, -325465, 518143, 457851, 750024 }}}; /* Z^(2p) */
  50. EXTERN const fp2e_t bn_z3p = {{{-1220868, -3662603, -18020, -54060, 771971, 447880,
  51. -925219, -907622, 808438, 557280, -170086, -510257, -548011, -1644029,
  52. 332930, -869243, -918612,
  53. -887802, -656367, -101068, 599384, -69882, -756823, -402435 }}}; /* Z^(3p) */
  54. EXTERN const fp2e_t bn_ypminus1 = {{{-3981901, -4468327, 248857, -740622, 900229,
  55. -562222, 260246, -632491, -928317, -38527, 838674, 36774, -2702081,
  56. 3668149, -873042, 304894, 876721,
  57. 213663, 562599, -128685, -325465, 518143, 457851, 750024 }}}; // Y^{p-1} lies in F_{p^2}
  58. EXTERN const fp2e_t bn_zpminus1 = {{{-127312, 512442, -137362, 859841, -693124, 477483,
  59. -456715, 571378, -391523, 771884, -684646, 729153, 4294836, 3621570,
  60. -839768, -538090, -213833,
  61. -814642, -240945, -172644, 308331, -116810, 574718, 249147 }}}; // Z^{p-1}, lies in F_{p^2}
  62. EXTERN const fp2e_t bn_ypminus1_squ = {{{1555911, 5331252, -776828, 226463,
  63. 691213, -261413, -410662, -394138, -432410, -178831, -475754,
  64. 92316, -5497403, -1697028, 207147, -413437,
  65. -291878, 77064, 214666, 415072, -853656, 644193, 622068, 571473 }}}; // (Y^{p-1})^2 i F_{p^2}
  66. #undef EXTERN
  67. //#endif