diff options
author | Colin Watson <cjwatson@debian.org> | 2014-02-10 00:18:28 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2014-02-10 00:18:28 +0000 |
commit | 9a975a9faed7c4f334e8c8490db3e77e102f2b21 (patch) | |
tree | 764a885ec9a963f6a8b15de6e1765f16b9ac4738 /kexdh.c | |
parent | ee196dab7c5f97f0b80c8099343a375bead92010 (diff) | |
parent | cdb6c90811caa5df2df856be9b0b16db020fe31d (diff) |
Import openssh_6.5p1.orig.tar.gz
Diffstat (limited to 'kexdh.c')
-rw-r--r-- | kexdh.c | 17 |
1 files changed, 8 insertions, 9 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: kexdh.c,v 1.23 2006/08/03 03:34:42 deraadt Exp $ */ | 1 | /* $OpenBSD: kexdh.c,v 1.24 2014/01/09 23:20:00 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2001 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2001 Markus Friedl. All rights reserved. |
4 | * | 4 | * |
@@ -36,6 +36,8 @@ | |||
36 | #include "key.h" | 36 | #include "key.h" |
37 | #include "cipher.h" | 37 | #include "cipher.h" |
38 | #include "kex.h" | 38 | #include "kex.h" |
39 | #include "digest.h" | ||
40 | #include "log.h" | ||
39 | 41 | ||
40 | void | 42 | void |
41 | kex_dh_hash( | 43 | kex_dh_hash( |
@@ -50,9 +52,7 @@ kex_dh_hash( | |||
50 | u_char **hash, u_int *hashlen) | 52 | u_char **hash, u_int *hashlen) |
51 | { | 53 | { |
52 | Buffer b; | 54 | Buffer b; |
53 | static u_char digest[EVP_MAX_MD_SIZE]; | 55 | static u_char digest[SSH_DIGEST_MAX_LENGTH]; |
54 | const EVP_MD *evp_md = EVP_sha1(); | ||
55 | EVP_MD_CTX md; | ||
56 | 56 | ||
57 | buffer_init(&b); | 57 | buffer_init(&b); |
58 | buffer_put_cstring(&b, client_version_string); | 58 | buffer_put_cstring(&b, client_version_string); |
@@ -74,15 +74,14 @@ kex_dh_hash( | |||
74 | #ifdef DEBUG_KEX | 74 | #ifdef DEBUG_KEX |
75 | buffer_dump(&b); | 75 | buffer_dump(&b); |
76 | #endif | 76 | #endif |
77 | EVP_DigestInit(&md, evp_md); | 77 | if (ssh_digest_buffer(SSH_DIGEST_SHA1, &b, digest, sizeof(digest)) != 0) |
78 | EVP_DigestUpdate(&md, buffer_ptr(&b), buffer_len(&b)); | 78 | fatal("%s: ssh_digest_buffer failed", __func__); |
79 | EVP_DigestFinal(&md, digest, NULL); | ||
80 | 79 | ||
81 | buffer_free(&b); | 80 | buffer_free(&b); |
82 | 81 | ||
83 | #ifdef DEBUG_KEX | 82 | #ifdef DEBUG_KEX |
84 | dump_digest("hash", digest, EVP_MD_size(evp_md)); | 83 | dump_digest("hash", digest, ssh_digest_bytes(SSH_DIGEST_SHA1)); |
85 | #endif | 84 | #endif |
86 | *hash = digest; | 85 | *hash = digest; |
87 | *hashlen = EVP_MD_size(evp_md); | 86 | *hashlen = ssh_digest_bytes(SSH_DIGEST_SHA1); |
88 | } | 87 | } |