diff options
Diffstat (limited to 'roaming_common.c')
-rw-r--r-- | roaming_common.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/roaming_common.c b/roaming_common.c index 50d6177d0..787bef04a 100644 --- a/roaming_common.c +++ b/roaming_common.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: roaming_common.c,v 1.10 2013/07/12 00:19:59 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; |
@@ -49,7 +50,7 @@ int roaming_enabled = 0; | |||
49 | int resume_in_progress = 0; | 50 | int resume_in_progress = 0; |
50 | 51 | ||
51 | int | 52 | int |
52 | get_snd_buf_size() | 53 | get_snd_buf_size(void) |
53 | { | 54 | { |
54 | int fd = packet_get_connection_out(); | 55 | int fd = packet_get_connection_out(); |
55 | int optval; | 56 | int optval; |
@@ -61,7 +62,7 @@ get_snd_buf_size() | |||
61 | } | 62 | } |
62 | 63 | ||
63 | int | 64 | int |
64 | get_recv_buf_size() | 65 | get_recv_buf_size(void) |
65 | { | 66 | { |
66 | int fd = packet_get_connection_in(); | 67 | int fd = packet_get_connection_in(); |
67 | int optval; | 68 | int optval; |
@@ -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 | } |