mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-09 09:54:25 +09:00
dh-gex: Check return value of ssh_get_random()
CID #1422162
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
(cherry picked from commit d2f0d3270a)
This commit is contained in:
@@ -366,8 +366,13 @@ static bool dhgroup_better_size(uint32_t pmin,
|
|||||||
*/
|
*/
|
||||||
static bool invn_chance(int n)
|
static bool invn_chance(int n)
|
||||||
{
|
{
|
||||||
uint32_t nounce;
|
uint32_t nounce = 0;
|
||||||
ssh_get_random(&nounce, sizeof(nounce), 0);
|
int ok;
|
||||||
|
|
||||||
|
ok = ssh_get_random(&nounce, sizeof(nounce), 0);
|
||||||
|
if (!ok) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return (nounce % n) == 0;
|
return (nounce % n) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user