mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-11-30 13:01:23 +03:00
packet: Check if set_*_key functions exists before calling it
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
committed by
Andreas Schneider
parent
201fd66176
commit
239eef6322
@@ -1969,6 +1969,7 @@ ssh_packet_set_newkeys(ssh_session session,
|
|||||||
session->opts.rekey_time/1000);
|
session->opts.rekey_time/1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (in_cipher->set_decrypt_key) {
|
||||||
/* Initialize the encryption and decryption keys in next_crypto */
|
/* Initialize the encryption and decryption keys in next_crypto */
|
||||||
rc = in_cipher->set_decrypt_key(in_cipher,
|
rc = in_cipher->set_decrypt_key(in_cipher,
|
||||||
session->next_crypto->decryptkey,
|
session->next_crypto->decryptkey,
|
||||||
@@ -1978,7 +1979,9 @@ ssh_packet_set_newkeys(ssh_session session,
|
|||||||
session->next_crypto->used = 0;
|
session->next_crypto->used = 0;
|
||||||
return SSH_ERROR;
|
return SSH_ERROR;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (out_cipher->set_encrypt_key) {
|
||||||
rc = out_cipher->set_encrypt_key(out_cipher,
|
rc = out_cipher->set_encrypt_key(out_cipher,
|
||||||
session->next_crypto->encryptkey,
|
session->next_crypto->encryptkey,
|
||||||
session->next_crypto->encryptIV);
|
session->next_crypto->encryptIV);
|
||||||
@@ -1987,6 +1990,7 @@ ssh_packet_set_newkeys(ssh_session session,
|
|||||||
session->next_crypto->used = 0;
|
session->next_crypto->used = 0;
|
||||||
return SSH_ERROR;
|
return SSH_ERROR;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return SSH_OK;
|
return SSH_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user