summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiels Möller <nisse@lysator.liu.se>2014-08-23 23:02:17 +0200
committerNiels Möller <nisse@lysator.liu.se>2014-08-23 23:02:17 +0200
commitb9f98cb7360ddf563419ad236911347ba71a0961 (patch)
tree5c57bc631f55cfe06bfc83790dd98cdded5a5566
parent73dddcc44a85ef901584228ded6c3ea79622ce5f (diff)
downloadnettle-b9f98cb7360ddf563419ad236911347ba71a0961.tar.gz
Reordered struct ecc_curve, moved function pointers before pointers to bignum constants.
-rw-r--r--ChangeLog3
-rw-r--r--ecc-192.c10
-rw-r--r--ecc-224.c10
-rw-r--r--ecc-25519.c10
-rw-r--r--ecc-256.c10
-rw-r--r--ecc-384.c10
-rw-r--r--ecc-521.c10
-rw-r--r--ecc-internal.h10
8 files changed, 44 insertions, 29 deletions
diff --git a/ChangeLog b/ChangeLog
index a4e89d42..31dc3b1e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2014-08-23 Niels Möller <nisse@lysator.liu.se>
+ * ecc-internal.h (struct ecc_curve): Reordered struct, moved
+ function pointers before pointers to bignum constants.
+
* sec-modinv.c (sec_modinv): Document that for a == 0 (mod m), we
should produce the "inverse" 0.
diff --git a/ecc-192.c b/ecc-192.c
index ee898b11..fe624dee 100644
--- a/ecc-192.c
+++ b/ecc-192.c
@@ -117,16 +117,18 @@ const struct ecc_curve nettle_secp_192r1 =
ECC_REDC_SIZE,
ECC_PIPPENGER_K,
ECC_PIPPENGER_C,
+
+ ecc_192_modp,
+ ecc_generic_redc,
+ ecc_192_modp,
+ ecc_generic_modq,
+
ecc_p,
ecc_b,
ecc_q,
ecc_g,
ecc_redc_g,
NULL,
- ecc_192_modp,
- ecc_generic_redc,
- ecc_192_modp,
- ecc_generic_modq,
ecc_Bmodp,
ecc_Bmodp_shifted,
ecc_pp1h,
diff --git a/ecc-224.c b/ecc-224.c
index 15abb248..fb3e4d5f 100644
--- a/ecc-224.c
+++ b/ecc-224.c
@@ -63,16 +63,18 @@ const struct ecc_curve nettle_secp_224r1 =
ECC_REDC_SIZE,
ECC_PIPPENGER_K,
ECC_PIPPENGER_C,
+
+ ecc_224_modp,
+ ecc_generic_redc,
+ USE_REDC ? ecc_generic_redc : ecc_224_modp,
+ ecc_generic_modq,
+
ecc_p,
ecc_b,
ecc_q,
ecc_g,
ecc_redc_g,
NULL,
- ecc_224_modp,
- ecc_generic_redc,
- USE_REDC ? ecc_generic_redc : ecc_224_modp,
- ecc_generic_modq,
ecc_Bmodp,
ecc_Bmodp_shifted,
ecc_pp1h,
diff --git a/ecc-25519.c b/ecc-25519.c
index cd6bc4bf..5b3a7468 100644
--- a/ecc-25519.c
+++ b/ecc-25519.c
@@ -209,16 +209,18 @@ const struct ecc_curve nettle_curve25519 =
0,
ECC_PIPPENGER_K,
ECC_PIPPENGER_C,
+
+ ecc_25519_modp,
+ NULL,
+ ecc_25519_modp,
+ NULL,
+
ecc_p,
ecc_d, /* Use the Edwards curve constant. */
ecc_q,
ecc_g,
ecc_redc_g,
ecc_edwards,
- ecc_25519_modp,
- NULL,
- ecc_25519_modp,
- NULL,
ecc_Bmodp,
ecc_Bmodp_shifted,
ecc_pp1h,
diff --git a/ecc-256.c b/ecc-256.c
index 506c9afa..2ded5b3b 100644
--- a/ecc-256.c
+++ b/ecc-256.c
@@ -228,16 +228,18 @@ const struct ecc_curve nettle_secp_256r1 =
ECC_REDC_SIZE,
ECC_PIPPENGER_K,
ECC_PIPPENGER_C,
+
+ ecc_256_modp,
+ ecc_256_redc,
+ USE_REDC ? ecc_256_redc : ecc_256_modp,
+ ecc_256_modq,
+
ecc_p,
ecc_b,
ecc_q,
ecc_g,
ecc_redc_g,
NULL,
- ecc_256_modp,
- ecc_256_redc,
- USE_REDC ? ecc_256_redc : ecc_256_modp,
- ecc_256_modq,
ecc_Bmodp,
ecc_Bmodp_shifted,
ecc_pp1h,
diff --git a/ecc-384.c b/ecc-384.c
index e5ec87e5..dff0cd01 100644
--- a/ecc-384.c
+++ b/ecc-384.c
@@ -156,16 +156,18 @@ const struct ecc_curve nettle_secp_384r1 =
ECC_REDC_SIZE,
ECC_PIPPENGER_K,
ECC_PIPPENGER_C,
+
+ ecc_384_modp,
+ ECC_REDC_SIZE != 0 ? ecc_generic_redc : NULL,
+ ecc_384_modp,
+ ecc_generic_modq,
+
ecc_p,
ecc_b,
ecc_q,
ecc_g,
ecc_redc_g,
NULL,
- ecc_384_modp,
- ECC_REDC_SIZE != 0 ? ecc_generic_redc : NULL,
- ecc_384_modp,
- ecc_generic_modq,
ecc_Bmodp,
ecc_Bmodp_shifted,
ecc_pp1h,
diff --git a/ecc-521.c b/ecc-521.c
index 821c9645..25fc2b08 100644
--- a/ecc-521.c
+++ b/ecc-521.c
@@ -84,16 +84,18 @@ const struct ecc_curve nettle_secp_521r1 =
ECC_REDC_SIZE,
ECC_PIPPENGER_K,
ECC_PIPPENGER_C,
+
+ ecc_521_modp,
+ ecc_generic_redc,
+ ecc_521_modp,
+ ecc_generic_modq,
+
ecc_p,
ecc_b,
ecc_q,
ecc_g,
ecc_redc_g,
NULL,
- ecc_521_modp,
- ecc_generic_redc,
- ecc_521_modp,
- ecc_generic_modq,
ecc_Bmodp,
ecc_Bmodp_shifted,
ecc_pp1h,
diff --git a/ecc-internal.h b/ecc-internal.h
index 2589eb60..d180122b 100644
--- a/ecc-internal.h
+++ b/ecc-internal.h
@@ -102,6 +102,11 @@ struct ecc_curve
unsigned short pippenger_k;
unsigned short pippenger_c;
+ ecc_mod_func *modp;
+ ecc_mod_func *redc;
+ ecc_mod_func *reduce;
+ ecc_mod_func *modq;
+
/* The prime p. */
const mp_limb_t *p;
const mp_limb_t *b;
@@ -115,11 +120,6 @@ struct ecc_curve
equivalent Edwards curve. */
const mp_limb_t *edwards_root;
- ecc_mod_func *modp;
- ecc_mod_func *redc;
- ecc_mod_func *reduce;
- ecc_mod_func *modq;
-
/* B^size mod p. Expected to have at least 32 leading zeros
(equality for secp_256r1). */
const mp_limb_t *Bmodp;