Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Brian Smith
nettle
Commits
0276b45a
Commit
0276b45a
authored
Aug 28, 2014
by
Niels Möller
Browse files
ecc_25519_modq: Access q via the ecc struct.
parent
1e14955a
Changes
2
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
0276b45a
2014-08-28 Niels Möller <nisse@lysator.liu.se>
* ecc-25519.c (ecc_25519_modq): Access q via the ecc struct.
* ecc-eh-to-a.c (ecc_eh_to_a): Analogous change as for ecc_j_to_a.
The modulo q case (op == 2) is hardcoded for curve25519.
...
...
ecc-25519.c
View file @
0276b45a
...
...
@@ -86,20 +86,18 @@ ecc_25519_modq (const struct ecc_curve *ecc, mp_limb_t *rp)
/* n is the offset where we add in the next term */
for
(
n
=
ECC_LIMB_SIZE
;
n
--
>
0
;)
{
mp_limb_t
cy
;
cy
=
mpn_submul_1
(
rp
+
n
,
ecc
->
Bmodq_shifted
,
ECC_LIMB_SIZE
,
rp
[
n
+
ECC_LIMB_SIZE
]);
/* Top limb of mBmodq_shifted is zero, so we get cy == 0 or 1 */
assert
(
cy
<
2
);
cnd_add_n
(
cy
,
rp
+
n
,
ecc
_
q
,
ECC_LIMB_SIZE
);
cnd_add_n
(
cy
,
rp
+
n
,
ecc
->
q
,
ECC_LIMB_SIZE
);
}
cy
=
mpn_submul_1
(
rp
,
ecc
_
q
,
ECC_LIMB_SIZE
,
cy
=
mpn_submul_1
(
rp
,
ecc
->
q
,
ECC_LIMB_SIZE
,
rp
[
ECC_LIMB_SIZE
-
1
]
>>
(
GMP_NUMB_BITS
-
QHIGH_BITS
));
assert
(
cy
<
2
);
cnd_add_n
(
cy
,
rp
,
ecc
_
q
,
ECC_LIMB_SIZE
);
cnd_add_n
(
cy
,
rp
,
ecc
->
q
,
ECC_LIMB_SIZE
);
}
/* Needs 2*ecc->size limbs at rp, and 2*ecc->size additional limbs of
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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