aboutsummaryrefslogtreecommitdiff
path: root/libssh
diff options
context:
space:
mode:
Diffstat (limited to 'libssh')
-rw-r--r--libssh/dh.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libssh/dh.c b/libssh/dh.c
index 08988c6..8ad80a0 100644
--- a/libssh/dh.c
+++ b/libssh/dh.c
@@ -835,8 +835,11 @@ int ssh_get_pubkey_hash(ssh_session session, unsigned char **hash) {
if (session == NULL || hash == NULL) {
return -1;
}
-
*hash = NULL;
+ if (session->current_crypto == NULL ||
+ session->current_crypto->server_pubkey == NULL){
+ ssh_set_error(session,SSH_FATAL,"No current cryptographic context");
+ }
h = malloc(sizeof(unsigned char *) * MD5_DIGEST_LEN);
if (h == NULL) {