You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

69 lines
2.0 KiB

  1. /* Copyright (c) 2014 Cryptography Research, Inc.
  2. * Released under the MIT License. See LICENSE.txt for license information.
  3. */
  4. #include "field.h"
  5. #include "magic.h"
  6. #include "barrett_field.h"
  7. /* FUTURE: automatically generate this file? */
  8. const uint8_t FIELD_MODULUS[FIELD_BYTES] = {
  9. 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
  10. 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
  11. /*!*/ 0xfe, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
  12. 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
  13. };
  14. const word_t SCALARMUL_FIXED_WINDOW_ADJUSTMENT[2*SCALAR_WORDS] = {
  15. U64LE(0x58b51bc56ea8f0c4),
  16. U64LE(0xd361f6a2348b50c9),
  17. U64LE(0x08089c139c0002ae),
  18. U64LE(0x0001d2ac3d9503a0),
  19. U64LE(0x0000000000000000),
  20. U64LE(0x0000000000000000),
  21. U64LE(0x0000000000000000),
  22. 0x40000000,
  23. U64LE(0xcb9c25073e36965b),
  24. U64LE(0x6f2d48d8460f1661),
  25. U64LE(0x0ab6256f7aaaae3e),
  26. U64LE(0x00026e3afcc6af80),
  27. U64LE(0x0000000000000000),
  28. U64LE(0x0000000000000000),
  29. U64LE(0x0000000000000000),
  30. 0x00000000
  31. };
  32. const struct affine_t goldilocks_base_point = {
  33. {{
  34. U60LE(0x849ff7f845c30d3),
  35. U60LE(0x7dda488553a4c5b),
  36. U60LE(0x1d3a2d9844831ea),
  37. U60LE(0xb33ecf6ade470a2),
  38. U60LE(0x8b3cb95210bd3c3),
  39. U60LE(0xfc955e59aeefa65),
  40. U60LE(0x3ab247cd530013c),
  41. U60LE(0x7ca42af3d564280)
  42. }},
  43. {{ 5 }}
  44. };
  45. static const word_t curve_prime_order_lo[(240+WORD_BITS-1)/WORD_BITS] = {
  46. U64LE(0x72e70941cf8da597),
  47. U64LE(0x9bcb52361183c598),
  48. U64LE(0x02ad895bdeaaab8f),
  49. U64LE(0x9b8ebf31abe0)
  50. };
  51. const struct barrett_prime_t curve_prime_order = {
  52. GOLDI_FIELD_WORDS,
  53. 30 % WORD_BITS,
  54. sizeof(curve_prime_order_lo)/sizeof(curve_prime_order_lo[0]),
  55. curve_prime_order_lo
  56. };
  57. const struct field_t
  58. sqrt_d_minus_1 = {{
  59. 232 /* Whoa, it comes out even. */
  60. }};