summaryrefslogtreecommitdiff
path: root/usr.bin/ssh/kexdh.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/ssh/kexdh.c')
-rw-r--r--usr.bin/ssh/kexdh.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/usr.bin/ssh/kexdh.c b/usr.bin/ssh/kexdh.c
index 8e6ae6348e4..f750dc79ac1 100644
--- a/usr.bin/ssh/kexdh.c
+++ b/usr.bin/ssh/kexdh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kexdh.c,v 1.23 2006/08/03 03:34:42 deraadt Exp $ */
+/* $OpenBSD: kexdh.c,v 1.24 2014/01/09 23:20:00 djm Exp $ */
/*
* Copyright (c) 2001 Markus Friedl. All rights reserved.
*
@@ -34,6 +34,8 @@
#include "key.h"
#include "cipher.h"
#include "kex.h"
+#include "digest.h"
+#include "log.h"
void
kex_dh_hash(
@@ -48,9 +50,7 @@ kex_dh_hash(
u_char **hash, u_int *hashlen)
{
Buffer b;
- static u_char digest[EVP_MAX_MD_SIZE];
- const EVP_MD *evp_md = EVP_sha1();
- EVP_MD_CTX md;
+ static u_char digest[SSH_DIGEST_MAX_LENGTH];
buffer_init(&b);
buffer_put_cstring(&b, client_version_string);
@@ -72,15 +72,14 @@ kex_dh_hash(
#ifdef DEBUG_KEX
buffer_dump(&b);
#endif
- EVP_DigestInit(&md, evp_md);
- EVP_DigestUpdate(&md, buffer_ptr(&b), buffer_len(&b));
- EVP_DigestFinal(&md, digest, NULL);
+ if (ssh_digest_buffer(SSH_DIGEST_SHA1, &b, digest, sizeof(digest)) != 0)
+ fatal("%s: ssh_digest_buffer failed", __func__);
buffer_free(&b);
#ifdef DEBUG_KEX
- dump_digest("hash", digest, EVP_MD_size(evp_md));
+ dump_digest("hash", digest, ssh_digest_bytes(SSH_DIGEST_SHA1));
#endif
*hash = digest;
- *hashlen = EVP_MD_size(evp_md);
+ *hashlen = ssh_digest_bytes(SSH_DIGEST_SHA1);
}