Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Dmitry Baryshkov
nettle
Commits
46bfb297
Commit
46bfb297
authored
Sep 22, 2014
by
Niels Möller
Browse files
Deleted redc function pointer.
parent
89742b68
Changes
11
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
46bfb297
2014-09-22 Niels Möller <nisse@lysator.liu.se>
* ecc-internal.h (struct ecc_curve): Deleted redc function
pointer. Use only reduce pointer, which is redc or modp as
applicable. Updated all users.
* ecc-generic-modp.c (ecc_generic_modp): Deleted file and
function. We no longer need a wrapper around ecc_mod.
* ecc-generic-modq.c (ecc_generic_modq): Likewise deleted.
...
...
ecc-192.c
View file @
46bfb297
...
...
@@ -143,7 +143,6 @@ const struct ecc_curve nettle_secp_192r1 =
ECC_J_TO_A_ITCH
(
ECC_LIMB_SIZE
),
ecc_192_modp
,
ECC_REDC_SIZE
>=
1
?
ecc_pp1_redc
:
NULL
,
ecc_192_modp
,
ecc_mod
,
...
...
ecc-224.c
View file @
46bfb297
...
...
@@ -95,7 +95,6 @@ const struct ecc_curve nettle_secp_224r1 =
ECC_J_TO_A_ITCH
(
ECC_LIMB_SIZE
),
ecc_224_modp
,
ecc_224_redc
,
USE_REDC
?
ecc_224_redc
:
ecc_224_modp
,
ecc_mod
,
...
...
ecc-25519.c
View file @
46bfb297
...
...
@@ -263,7 +263,6 @@ const struct ecc_curve nettle_curve25519 =
ECC_EH_TO_A_ITCH
(
ECC_LIMB_SIZE
),
ecc_25519_modp
,
NULL
,
ecc_25519_modp
,
ecc_25519_modq
,
...
...
ecc-256.c
View file @
46bfb297
...
...
@@ -258,7 +258,6 @@ const struct ecc_curve nettle_secp_256r1 =
ECC_J_TO_A_ITCH
(
ECC_LIMB_SIZE
),
ecc_256_modp
,
ecc_256_redc
,
USE_REDC
?
ecc_256_redc
:
ecc_256_modp
,
ecc_256_modq
,
...
...
ecc-384.c
View file @
46bfb297
...
...
@@ -180,7 +180,6 @@ const struct ecc_curve nettle_secp_384r1 =
ECC_J_TO_A_ITCH
(
ECC_LIMB_SIZE
),
ecc_384_modp
,
ECC_REDC_SIZE
>
0
?
ecc_pp1_redc
:
NULL
,
ecc_384_modp
,
ecc_mod
,
...
...
ecc-521.c
View file @
46bfb297
...
...
@@ -108,7 +108,6 @@ const struct ecc_curve nettle_secp_521r1 =
ECC_J_TO_A_ITCH
(
ECC_LIMB_SIZE
),
ecc_521_modp
,
ECC_REDC_SIZE
>
0
?
ecc_pp1_redc
:
NULL
,
ecc_521_modp
,
ecc_mod
,
...
...
ecc-internal.h
View file @
46bfb297
...
...
@@ -138,7 +138,6 @@ struct ecc_curve
unsigned
short
h_to_a_itch
;
ecc_mod_func
*
modp
;
ecc_mod_func
*
redc
;
ecc_mod_func
*
reduce
;
ecc_mod_func
*
modq
;
...
...
ecc-j-to-a.c
View file @
46bfb297
...
...
@@ -73,16 +73,16 @@ ecc_j_to_a (const struct ecc_curve *ecc,
mpn_copyi
(
up
,
p
+
2
*
ecc
->
p
.
size
,
ecc
->
p
.
size
);
mpn_zero
(
up
+
ecc
->
p
.
size
,
ecc
->
p
.
size
);
ecc
->
red
c
(
&
ecc
->
p
,
up
);
ecc
->
red
uce
(
&
ecc
->
p
,
up
);
mpn_zero
(
up
+
ecc
->
p
.
size
,
ecc
->
p
.
size
);
ecc
->
red
c
(
&
ecc
->
p
,
up
);
ecc
->
red
uce
(
&
ecc
->
p
,
up
);
ecc_modp_inv
(
ecc
,
izp
,
up
,
up
+
ecc
->
p
.
size
);
/* Divide this common factor by B */
mpn_copyi
(
izBp
,
izp
,
ecc
->
p
.
size
);
mpn_zero
(
izBp
+
ecc
->
p
.
size
,
ecc
->
p
.
size
);
ecc
->
red
c
(
&
ecc
->
p
,
izBp
);
ecc
->
red
uce
(
&
ecc
->
p
,
izBp
);
ecc_modp_mul
(
ecc
,
iz2p
,
izp
,
izBp
);
}
...
...
examples/ecc-benchmark.c
View file @
46bfb297
...
...
@@ -154,11 +154,11 @@ bench_modp (void *p)
}
static
void
bench_red
c
(
void
*
p
)
bench_red
uce
(
void
*
p
)
{
struct
ecc_ctx
*
ctx
=
(
struct
ecc_ctx
*
)
p
;
mpn_copyi
(
ctx
->
rp
,
ctx
->
ap
,
2
*
ctx
->
ecc
->
p
.
size
);
ctx
->
ecc
->
red
c
(
&
ctx
->
ecc
->
p
,
ctx
->
rp
);
ctx
->
ecc
->
red
uce
(
&
ctx
->
ecc
->
p
,
ctx
->
rp
);
}
static
void
...
...
@@ -265,7 +265,7 @@ static void
bench_curve
(
const
struct
ecc_curve
*
ecc
)
{
struct
ecc_ctx
ctx
;
double
modp
,
red
c
,
modq
,
modinv
,
modinv_gcd
,
modinv_powm
,
double
modp
,
red
uce
,
modq
,
modinv
,
modinv_gcd
,
modinv_powm
,
dup_jj
,
add_jja
,
add_hhh
,
mul_g
,
mul_a
;
...
...
@@ -299,7 +299,7 @@ bench_curve (const struct ecc_curve *ecc)
ctx
.
bp
[
3
*
ecc
->
p
.
size
-
1
]
&=
mask
;
modp
=
time_function
(
bench_modp
,
&
ctx
);
red
c
=
ecc
->
redc
?
time_function
(
bench_red
c
,
&
ctx
)
:
0
;
red
uce
=
time_function
(
bench_red
uce
,
&
ctx
);
modq
=
time_function
(
bench_modq
,
&
ctx
);
...
...
@@ -335,7 +335,7 @@ bench_curve (const struct ecc_curve *ecc)
free
(
ctx
.
tp
);
printf
(
"%4d %6.4f %6.4f %6.4f %6.2f %6.3f %6.2f %6.3f %6.3f %6.3f %6.1f %6.1f
\n
"
,
ecc
->
p
.
bit_size
,
1e6
*
modp
,
1e6
*
red
c
,
1e6
*
modq
,
ecc
->
p
.
bit_size
,
1e6
*
modp
,
1e6
*
red
uce
,
1e6
*
modq
,
1e6
*
modinv
,
1e6
*
modinv_gcd
,
1e6
*
modinv_powm
,
1e6
*
dup_jj
,
1e6
*
add_jja
,
1e6
*
add_hhh
,
1e6
*
mul_g
,
1e6
*
mul_a
);
...
...
@@ -359,7 +359,7 @@ main (int argc UNUSED, char **argv UNUSED)
time_init
();
printf
(
"%4s %6s %6s %6s %6s %6s %6s %6s %6s %6s %6s %6s (us)
\n
"
,
"size"
,
"modp"
,
"red
c
"
,
"modq"
,
"modinv"
,
"mi_gcd"
,
"mi_pow"
,
"size"
,
"modp"
,
"red
uce
"
,
"modq"
,
"modinv"
,
"mi_gcd"
,
"mi_pow"
,
"dup_jj"
,
"ad_jja"
,
"ad_hhh"
,
"mul_g"
,
"mul_a"
);
for
(
i
=
0
;
i
<
numberof
(
curves
);
i
++
)
...
...
testsuite/ecc-redc-test.c
View file @
46bfb297
...
...
@@ -57,7 +57,7 @@ test_main (void)
{
const
struct
ecc_curve
*
ecc
=
ecc_curves
[
i
];
unsigned
j
;
if
(
!
ecc
->
red
c
)
if
(
ecc
->
red
uce
==
ecc
->
modp
)
continue
;
ASSERT
(
ecc
->
p
.
redc_size
!=
0
);
...
...
@@ -73,13 +73,13 @@ test_main (void)
ref_redc
(
ref
,
a
,
ecc
->
p
.
m
,
ecc
->
p
.
size
);
mpn_copyi
(
m
,
a
,
2
*
ecc
->
p
.
size
);
ecc
->
red
c
(
&
ecc
->
p
,
m
);
ecc
->
red
uce
(
&
ecc
->
p
,
m
);
if
(
mpn_cmp
(
m
,
ecc
->
p
.
m
,
ecc
->
p
.
size
)
>=
0
)
mpn_sub_n
(
m
,
m
,
ecc
->
p
.
m
,
ecc
->
p
.
size
);
if
(
mpn_cmp
(
m
,
ref
,
ecc
->
p
.
size
))
{
fprintf
(
stderr
,
"ecc->red
c
failed: bit_size = %u
\n
"
,
fprintf
(
stderr
,
"ecc->red
uce
failed: bit_size = %u
\n
"
,
ecc
->
p
.
bit_size
);
gmp_fprintf
(
stderr
,
"a = %Nx
\n
"
,
a
,
2
*
ecc
->
p
.
size
);
gmp_fprintf
(
stderr
,
"m = %Nx (bad)
\n
"
,
m
,
ecc
->
p
.
size
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment