diff options
Diffstat (limited to 'roaming_common.c')
-rw-r--r-- | roaming_common.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/roaming_common.c b/roaming_common.c index 86b3372ef..787bef04a 100644 --- a/roaming_common.c +++ b/roaming_common.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: roaming_common.c,v 1.11 2013/11/03 10:37:19 djm Exp $ */ | 1 | /* $OpenBSD: roaming_common.c,v 1.12 2014/01/09 23:20:00 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2004-2009 AppGate Network Security AB | 3 | * Copyright (c) 2004-2009 AppGate Network Security AB |
4 | * | 4 | * |
@@ -36,6 +36,7 @@ | |||
36 | #include "cipher.h" | 36 | #include "cipher.h" |
37 | #include "buffer.h" | 37 | #include "buffer.h" |
38 | #include "roaming.h" | 38 | #include "roaming.h" |
39 | #include "digest.h" | ||
39 | 40 | ||
40 | static size_t out_buf_size = 0; | 41 | static size_t out_buf_size = 0; |
41 | static char *out_buf = NULL; | 42 | static char *out_buf = NULL; |
@@ -225,9 +226,7 @@ resend_bytes(int fd, u_int64_t *offset) | |||
225 | void | 226 | void |
226 | calculate_new_key(u_int64_t *key, u_int64_t cookie, u_int64_t challenge) | 227 | calculate_new_key(u_int64_t *key, u_int64_t cookie, u_int64_t challenge) |
227 | { | 228 | { |
228 | const EVP_MD *md = EVP_sha1(); | 229 | u_char hash[SSH_DIGEST_MAX_LENGTH]; |
229 | EVP_MD_CTX ctx; | ||
230 | u_char hash[EVP_MAX_MD_SIZE]; | ||
231 | Buffer b; | 230 | Buffer b; |
232 | 231 | ||
233 | buffer_init(&b); | 232 | buffer_init(&b); |
@@ -235,12 +234,11 @@ calculate_new_key(u_int64_t *key, u_int64_t cookie, u_int64_t challenge) | |||
235 | buffer_put_int64(&b, cookie); | 234 | buffer_put_int64(&b, cookie); |
236 | buffer_put_int64(&b, challenge); | 235 | buffer_put_int64(&b, challenge); |
237 | 236 | ||
238 | EVP_DigestInit(&ctx, md); | 237 | if (ssh_digest_buffer(SSH_DIGEST_SHA1, &b, hash, sizeof(hash)) != 0) |
239 | EVP_DigestUpdate(&ctx, buffer_ptr(&b), buffer_len(&b)); | 238 | fatal("%s: digest_buffer failed", __func__); |
240 | EVP_DigestFinal(&ctx, hash, NULL); | ||
241 | 239 | ||
242 | buffer_clear(&b); | 240 | buffer_clear(&b); |
243 | buffer_append(&b, hash, EVP_MD_size(md)); | 241 | buffer_append(&b, hash, ssh_digest_bytes(SSH_DIGEST_SHA1)); |
244 | *key = buffer_get_int64(&b); | 242 | *key = buffer_get_int64(&b); |
245 | buffer_free(&b); | 243 | buffer_free(&b); |
246 | } | 244 | } |