Browse Source

sqrt(-d)

master
Michael Hamburg 10 years ago
parent
commit
8e3ed52dd3
4 changed files with 64 additions and 0 deletions
  1. +5
    -0
      src/include/magic.h
  2. +19
    -0
      src/p448/magic.c
  3. +12
    -0
      src/p480/magic.c
  4. +28
    -0
      src/p521/magic.c

+ 5
- 0
src/include/magic.h View File

@@ -47,6 +47,11 @@
*/ */
extern const struct field_t sqrt_d_minus_1; extern const struct field_t sqrt_d_minus_1;


/**
* @brief sqrt(-d), used for point formats and twisting.
*/
extern const struct field_t sqrt_minus_d;

/** /**
* @brief The base point for Goldilocks. * @brief The base point for Goldilocks.
*/ */


+ 19
- 0
src/p448/magic.c View File

@@ -79,3 +79,22 @@ sqrt_d_minus_1 = {{
U56LE(0x12fec0c0b25b7a) U56LE(0x12fec0c0b25b7a)
#endif #endif
}}; }};

const struct field_t
sqrt_minus_d = {{
#ifdef USE_NEON_PERM
0x5572736,0x4a2d780,0x42ef0f4,0xb8d54b6,
0x0ce5296,0x1a7b8a5,0x7bf6aa2,0x6aa0a1f,
0xed26033,0xd722fa2,0xf4fd6ed,0x683bf68,
0xa839a66,0xbeb24f7,0x968c14b,0x22d962f
#else
U56LE(0x42ef0f45572736),
U56LE(0x7bf6aa20ce5296),
U56LE(0xf4fd6eded26033),
U56LE(0x968c14ba839a66),
U56LE(0xb8d54b64a2d780),
U56LE(0x6aa0a1f1a7b8a5),
U56LE(0x683bf68d722fa2),
U56LE(0x22d962fbeb24f7)
#endif
}};

+ 12
- 0
src/p480/magic.c View File

@@ -66,3 +66,15 @@ const struct field_t
sqrt_d_minus_1 = {{ sqrt_d_minus_1 = {{
232 /* Whoa, it comes out even. */ 232 /* Whoa, it comes out even. */
}}; }};

const struct field_t
sqrt_minus_d = {{
U60LE(0xf098fba8d880ec0),
U60LE(0x9d6ea1b2774d3e9),
U60LE(0x1a52c44c0154b38),
U60LE(0x9a7d2310c583efd),
U60LE(0xb548ed7aec18f2d),
U60LE(0xb9d4b5edcfee721),
U60LE(0x65275d687c7215d),
U60LE(0x3458ffa5bbfdea5)
}};

+ 28
- 0
src/p521/magic.c View File

@@ -109,3 +109,31 @@ sqrt_d_minus_1 = {{
U58LE(0x0a9ea3ac10d6aed) U58LE(0x0a9ea3ac10d6aed)
#endif #endif
}}; }};

const struct field_t
sqrt_minus_d = {{
#ifdef USE_P521_3x3_TRANSPOSE
U58LE(0x375d668ef98910e),
U58LE(0x2e033a89e955dfc),
U58LE(0x11539170515b2da),
0,
U58LE(0x1d88a078877dc00),
U58LE(0x38dac4db4b0312c),
U58LE(0x009993c0e8ee528),
0,
U58LE(0x34829cd5d7c1584),
U58LE(0x2c688534aa9c317),
U58LE(0x0d07656ee612ae6),
0
#else
U58LE(0x375d668ef98910e),
U58LE(0x1d88a078877dc00),
U58LE(0x34829cd5d7c1584),
U58LE(0x2e033a89e955dfc),
U58LE(0x38dac4db4b0312c),
U58LE(0x2c688534aa9c317),
U58LE(0x11539170515b2da),
U58LE(0x009993c0e8ee528),
U58LE(0x0d07656ee612ae6)
#endif
}};

Loading…
Cancel
Save