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
51e45744
Commit
51e45744
authored
Sep 02, 2014
by
Niels Möller
Browse files
Minor changes to curve25519_mul_g. Use local variable ecc.
parent
fd179ede
Changes
2
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
51e45744
...
...
@@ -5,8 +5,10 @@
but which should eventually be eliminted from that function.
* Makefile.in (hogweed_SOURCES): Added curve25519-eh-to-x.c.
* ecc-internal.h (curve25519_eh_to_x): Declare it.
* curve25519-mul.c (curve25519_mul): Use it.
* curve25519-mul-g.c (curve25519_mul_g): Likewise.
* curve25519-mul-g.c (curve25519_mul_g): Likewise. Also introduce
local variable ecc, and use ecc->mul_g_itch.
2014-08-29 Niels Möller <nisse@lysator.liu.se>
...
...
curve25519-mul-g.c
View file @
51e45744
...
...
@@ -44,28 +44,30 @@
void
curve25519_mul_g
(
uint8_t
*
r
,
const
uint8_t
*
n
)
{
const
struct
ecc_curve
*
ecc
=
&
nettle_curve25519
;
uint8_t
t
[
CURVE25519_SIZE
];
mp_limb_t
*
scratch
;
mp_size_t
ecc_size
;
mp_size_t
itch
;
#define p scratch
#define x (scratch + 3*ecc
_
size)
#define scratch_out (scratch + 4*ecc
_
size)
#define x (scratch + 3*ecc
->
size)
#define scratch_out (scratch + 4*ecc
->
size)
memcpy
(
t
,
n
,
sizeof
(
t
));
t
[
0
]
&=
~
7
;
t
[
CURVE25519_SIZE
-
1
]
=
(
t
[
CURVE25519_SIZE
-
1
]
&
0x3f
)
|
0x40
;
ecc_size
=
nettle_curve25519
.
size
;
itch
=
4
*
ecc_size
+
ECC_MUL_G_EH_ITCH
(
ecc_size
);
itch
=
4
*
ecc
->
size
+
ecc
->
mul_g_itch
;
scratch
=
gmp_alloc_limbs
(
itch
);
mpn_set_base256_le
(
x
,
ecc
_
size
,
t
,
CURVE25519_SIZE
);
mpn_set_base256_le
(
x
,
ecc
->
size
,
t
,
CURVE25519_SIZE
);
ecc_mul_g_eh
(
&
nettle_curve25519
,
p
,
x
,
scratch_out
);
ecc_mul_g_eh
(
ecc
,
p
,
x
,
scratch_out
);
curve25519_eh_to_x
(
x
,
p
,
scratch_out
);
mpn_get_base256_le
(
r
,
CURVE25519_SIZE
,
x
,
ecc
_
size
);
mpn_get_base256_le
(
r
,
CURVE25519_SIZE
,
x
,
ecc
->
size
);
gmp_free_limbs
(
scratch
,
itch
);
#undef p
#undef x
#undef scratch_out
}
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