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
f9e3227f
Commit
f9e3227f
authored
Nov 25, 2018
by
Niels Möller
Browse files
cnd_mpn_zero: Use a volatile-declared mask variable.
parent
dbaf6abb
Changes
2
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
f9e3227f
2018-11-25 Niels Möller <nisse@lysator.liu.se>
* rsa-sign-tr.c (_rsa_sec_compute_root_tr): Renamed, from...
(rsa_sec_compute_root_tr): ... old name. Updated callers.
* rsa.h (rsa_sec_compute_root_tr): Deleted declaration, moved to ...
* rsa-internal.h (_rsa_sec_compute_root_tr): ... new location.
* rsa-sign-tr.c (_rsa_sec_compute_root_tr): Renamed, from...
(rsa_sec_compute_root_tr): ... old name. Updated callers.
(cnd_mpn_zero): Use a volatile-declared mask variable.
* testsuite/testutils.c (mpz_urandomb) [NETTLE_USE_MINI_GMP]: Fix
masking of most significant bits.
...
...
rsa-sign-tr.c
View file @
f9e3227f
...
...
@@ -245,6 +245,7 @@ sec_equal(const mp_limb_t *a, const mp_limb_t *b, size_t limbs)
z
|=
(
a
[
i
]
^
b
[
i
]);
}
/* FIXME: Might compile to a branch instruction on some platforms. */
return
z
==
0
;
}
...
...
@@ -278,11 +279,12 @@ static void
cnd_mpn_zero
(
int
cnd
,
volatile
mp_ptr
rp
,
mp_size_t
n
)
{
volatile
mp_limb_t
c
;
volatile
mp_limb_t
mask
=
(
mp_limb_t
)
cnd
-
1
;
while
(
--
n
>=
0
)
{
c
=
rp
[
n
];
c
&=
((
mp_limb_t
)
cnd
-
1
)
;
c
&=
mask
;
rp
[
n
]
=
c
;
}
}
...
...
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