summaryrefslogtreecommitdiff
path: root/sshd.c
diff options
context:
space:
mode:
Diffstat (limited to 'sshd.c')
-rw-r--r--sshd.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/sshd.c b/sshd.c
index 25380c911..25583576d 100644
--- a/sshd.c
+++ b/sshd.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshd.c,v 1.414 2014/01/09 23:26:48 djm Exp $ */ 1/* $OpenBSD: sshd.c,v 1.415 2014/01/27 19:18:54 markus Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -74,7 +74,6 @@
74 74
75#include <openssl/dh.h> 75#include <openssl/dh.h>
76#include <openssl/bn.h> 76#include <openssl/bn.h>
77#include <openssl/md5.h>
78#include <openssl/rand.h> 77#include <openssl/rand.h>
79#include "openbsd-compat/openssl-compat.h" 78#include "openbsd-compat/openssl-compat.h"
80 79
@@ -96,6 +95,7 @@
96#include "uidswap.h" 95#include "uidswap.h"
97#include "compat.h" 96#include "compat.h"
98#include "cipher.h" 97#include "cipher.h"
98#include "digest.h"
99#include "key.h" 99#include "key.h"
100#include "kex.h" 100#include "kex.h"
101#include "dh.h" 101#include "dh.h"
@@ -2360,19 +2360,25 @@ do_ssh1_kex(void)
2360 if (rsafail) { 2360 if (rsafail) {
2361 int bytes = BN_num_bytes(session_key_int); 2361 int bytes = BN_num_bytes(session_key_int);
2362 u_char *buf = xmalloc(bytes); 2362 u_char *buf = xmalloc(bytes);
2363 MD5_CTX md; 2363 struct ssh_digest_ctx *md;
2364 2364
2365 logit("do_connection: generating a fake encryption key"); 2365 logit("do_connection: generating a fake encryption key");
2366 BN_bn2bin(session_key_int, buf); 2366 BN_bn2bin(session_key_int, buf);
2367 MD5_Init(&md); 2367 if ((md = ssh_digest_start(SSH_DIGEST_MD5)) == NULL ||
2368 MD5_Update(&md, buf, bytes); 2368 ssh_digest_update(md, buf, bytes) < 0 ||
2369 MD5_Update(&md, sensitive_data.ssh1_cookie, SSH_SESSION_KEY_LENGTH); 2369 ssh_digest_update(md, sensitive_data.ssh1_cookie,
2370 MD5_Final(session_key, &md); 2370 SSH_SESSION_KEY_LENGTH) < 0 ||
2371 MD5_Init(&md); 2371 ssh_digest_final(md, session_key, sizeof(session_key)) < 0)
2372 MD5_Update(&md, session_key, 16); 2372 fatal("%s: md5 failed", __func__);
2373 MD5_Update(&md, buf, bytes); 2373 ssh_digest_free(md);
2374 MD5_Update(&md, sensitive_data.ssh1_cookie, SSH_SESSION_KEY_LENGTH); 2374 if ((md = ssh_digest_start(SSH_DIGEST_MD5)) == NULL ||
2375 MD5_Final(session_key + 16, &md); 2375 ssh_digest_update(md, session_key, 16) < 0 ||
2376 ssh_digest_update(md, sensitive_data.ssh1_cookie,
2377 SSH_SESSION_KEY_LENGTH) < 0 ||
2378 ssh_digest_final(md, session_key + 16,
2379 sizeof(session_key) - 16) < 0)
2380 fatal("%s: md5 failed", __func__);
2381 ssh_digest_free(md);
2376 memset(buf, 0, bytes); 2382 memset(buf, 0, bytes);
2377 free(buf); 2383 free(buf);
2378 for (i = 0; i < 16; i++) 2384 for (i = 0; i < 16; i++)