Commit d1d7d737 authored by Niels Möller's avatar Niels Möller

Whitespace fixes.

parent 43be59b2
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
void void
ecc_256_redc (const struct ecc_modulo *p, mp_limb_t *rp); ecc_256_redc (const struct ecc_modulo *p, mp_limb_t *rp);
#else /* !HAVE_NATIVE_ecc_256_redc */ #else /* !HAVE_NATIVE_ecc_256_redc */
# if ECC_REDC_SIZE > 0 # if ECC_REDC_SIZE > 0
# define ecc_256_redc ecc_pp1_redc # define ecc_256_redc ecc_pp1_redc
# elif ECC_REDC_SIZE == 0 # elif ECC_REDC_SIZE == 0
# define ecc_256_redc NULL # define ecc_256_redc NULL
...@@ -115,13 +115,13 @@ ecc_256_modp (const struct ecc_modulo *p, mp_limb_t *rp) ...@@ -115,13 +115,13 @@ ecc_256_modp (const struct ecc_modulo *p, mp_limb_t *rp)
/* /*
n-1 n-2 n-3 n-4 n-1 n-2 n-3 n-4
+---+---+---+---+ +---+---+---+---+
| u1| u0| u low | | u1| u0| u low |
+---+---+---+---+ +---+---+---+---+
- | q1(2^96-1)| - | q1(2^96-1)|
+-------+---+ +-------+---+
|q2(2^.)| |q2(2^.)|
+-------+ +-------+
We multiply by two low limbs of p, 2^96 - 1, so we could use We multiply by two low limbs of p, 2^96 - 1, so we could use
shifts rather than mul. shifts rather than mul.
...@@ -161,7 +161,7 @@ ecc_256_modq (const struct ecc_modulo *q, mp_limb_t *rp) ...@@ -161,7 +161,7 @@ ecc_256_modq (const struct ecc_modulo *q, mp_limb_t *rp)
mp_limb_t q2, q1, q0, t, c1, c0; mp_limb_t q2, q1, q0, t, c1, c0;
u0 = rp[n-2]; u0 = rp[n-2];
/* <q2, q1, q0> = v * u2 + <u2,u1>, same method as above. /* <q2, q1, q0> = v * u2 + <u2,u1>, same method as above.
+---+---+ +---+---+
...@@ -183,7 +183,7 @@ ecc_256_modq (const struct ecc_modulo *q, mp_limb_t *rp) ...@@ -183,7 +183,7 @@ ecc_256_modq (const struct ecc_modulo *q, mp_limb_t *rp)
q2 = q1 < t; q2 = q1 < t;
/* Compute candidate remainder, <u1, u0> - <q2, q1> * (2^128 - 2^96 + 2^64 - 1) /* Compute candidate remainder, <u1, u0> - <q2, q1> * (2^128 - 2^96 + 2^64 - 1)
<u1, u0> + 2^64 q2 + (2^96 - 2^64 + 1) q1 (mod 2^128) <u1, u0> + 2^64 q2 + (2^96 - 2^64 + 1) q1 (mod 2^128)
+---+---+ +---+---+
| u1| u0| | u1| u0|
...@@ -194,9 +194,9 @@ ecc_256_modq (const struct ecc_modulo *q, mp_limb_t *rp) ...@@ -194,9 +194,9 @@ ecc_256_modq (const struct ecc_modulo *q, mp_limb_t *rp)
+-+-+-+ +-+-+-+
| q1| | q1|
--+-+-+-+---+ --+-+-+-+---+
| u2| u1| | u2| u1|
+---+---+ +---+---+
*/ */
u2 = u1 + q2 - q1; u2 = u1 + q2 - q1;
u1 = u0 + q1; u1 = u0 + q1;
u2 += (u1 < q1); u2 += (u1 < q1);
...@@ -215,7 +215,7 @@ ecc_256_modq (const struct ecc_modulo *q, mp_limb_t *rp) ...@@ -215,7 +215,7 @@ ecc_256_modq (const struct ecc_modulo *q, mp_limb_t *rp)
t = mpn_submul_1 (rp + n - 4, q->m, 2, q1); t = mpn_submul_1 (rp + n - 4, q->m, 2, q1);
c0 += t; c0 += t;
c1 = c0 < t; c1 = c0 < t;
/* Construct underflow condition. */ /* Construct underflow condition. */
c1 += (u1 < c0); c1 += (u1 < c0);
t = - (mp_limb_t) (u2 < c1); t = - (mp_limb_t) (u2 < c1);
...@@ -234,7 +234,7 @@ ecc_256_modq (const struct ecc_modulo *q, mp_limb_t *rp) ...@@ -234,7 +234,7 @@ ecc_256_modq (const struct ecc_modulo *q, mp_limb_t *rp)
rp[2] = u1; rp[2] = u1;
rp[3] = u2; rp[3] = u2;
} }
#else #else
#error Unsupported parameters #error Unsupported parameters
#endif #endif
...@@ -243,7 +243,7 @@ const struct ecc_curve _nettle_secp_256r1 = ...@@ -243,7 +243,7 @@ const struct ecc_curve _nettle_secp_256r1 =
{ {
{ {
256, 256,
ECC_LIMB_SIZE, ECC_LIMB_SIZE,
ECC_BMODP_SIZE, ECC_BMODP_SIZE,
ECC_REDC_SIZE, ECC_REDC_SIZE,
ECC_MOD_INV_ITCH (ECC_LIMB_SIZE), ECC_MOD_INV_ITCH (ECC_LIMB_SIZE),
...@@ -253,8 +253,8 @@ const struct ecc_curve _nettle_secp_256r1 = ...@@ -253,8 +253,8 @@ const struct ecc_curve _nettle_secp_256r1 =
ecc_Bmodp, ecc_Bmodp,
ecc_Bmodp_shifted, ecc_Bmodp_shifted,
ecc_redc_ppm1, ecc_redc_ppm1,
ecc_pp1h, ecc_pp1h,
ecc_256_modp, ecc_256_modp,
USE_REDC ? ecc_256_redc : ecc_256_modp, USE_REDC ? ecc_256_redc : ecc_256_modp,
ecc_mod_inv, ecc_mod_inv,
...@@ -262,7 +262,7 @@ const struct ecc_curve _nettle_secp_256r1 = ...@@ -262,7 +262,7 @@ const struct ecc_curve _nettle_secp_256r1 =
}, },
{ {
256, 256,
ECC_LIMB_SIZE, ECC_LIMB_SIZE,
ECC_BMODQ_SIZE, ECC_BMODQ_SIZE,
0, 0,
ECC_MOD_INV_ITCH (ECC_LIMB_SIZE), ECC_MOD_INV_ITCH (ECC_LIMB_SIZE),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment