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
a287f1a9
Commit
a287f1a9
authored
Nov 25, 2018
by
Niels Möller
Browse files
testutils.c: Fix high bits of the mpz_urandomb used with mini-gmp.
parent
f0136f46
Changes
2
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
a287f1a9
2018-11-25 Niels Möller <nisse@lysator.liu.se>
* testsuite/testutils.c (mpz_urandomb) [NETTLE_USE_MINI_GMP]: Fix
masking of most significant bits.
* rsa-decrypt-tr.c (rsa_decrypt_tr): Use
NETTLE_OCTET_SIZE_TO_LIMB_SIZE.
...
...
testsuite/testutils.c
View file @
a287f1a9
...
...
@@ -818,7 +818,7 @@ mpz_urandomb (mpz_t r, struct knuth_lfib_ctx *ctx, mp_bitcnt_t bits)
uint8_t
*
buf
=
xalloc
(
bytes
);
knuth_lfib_random
(
ctx
,
bytes
,
buf
);
buf
[
bytes
-
1
]
&=
0xff
>>
(
8
*
bytes
-
bits
);
buf
[
0
]
&=
0xff
>>
(
8
*
bytes
-
bits
);
nettle_mpz_set_str_256_u
(
r
,
bytes
,
buf
);
free
(
buf
);
}
...
...
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