1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-12-14 04:18:54 +03:00

crytpo: Make sure we check return of ssh_get_random() correctly

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
Andreas Schneider
2018-07-05 10:47:49 +02:00
parent 36a727e656
commit c503bb572e
9 changed files with 64 additions and 16 deletions

View File

@@ -90,9 +90,15 @@ static int server_set_kex(ssh_session session) {
char hostkeys[64] = {0};
enum ssh_keytypes_e keytype;
size_t len;
int ok;
ZERO_STRUCTP(server);
ssh_get_random(server->cookie, 16, 0);
ok = ssh_get_random(server->cookie, 16, 0);
if (!ok) {
ssh_set_error(session, SSH_FATAL, "PRNG error");
return -1;
}
if (session->srv.ed25519_key != NULL) {
snprintf(hostkeys,