X-Git-Url: http://andersk.mit.edu/gitweb/openssh.git/blobdiff_plain/5881cd602cf8b58856359c0d7a30c2a15d6ef9f8..4d19544715ea43252fa1dc6ddfbfd8979506968f:/mpaux.c diff --git a/mpaux.c b/mpaux.c index c17df9e7..fbc986cf 100644 --- a/mpaux.c +++ b/mpaux.c @@ -14,7 +14,6 @@ precision integers. */ -#include "config.h" #include "includes.h" RCSID("$Id$"); @@ -34,15 +33,15 @@ RCSID("$Id$"); void compute_session_id(unsigned char session_id[16], unsigned char cookie[8], - unsigned int host_key_bits, BIGNUM *host_key_n, - unsigned int session_key_bits, BIGNUM *session_key_n) { + unsigned int host_key_bits = BN_num_bits(host_key_n); + unsigned int session_key_bits = BN_num_bits(session_key_n); unsigned int bytes = (host_key_bits + 7) / 8 + (session_key_bits + 7) / 8 + 8; unsigned char *buf = xmalloc(bytes); MD5_CTX md; - + BN_bn2bin(host_key_n, buf); BN_bn2bin(session_key_n, buf + (host_key_bits + 7 ) / 8); memcpy(buf + (host_key_bits + 7) / 8 + (session_key_bits + 7) / 8, @@ -50,5 +49,6 @@ compute_session_id(unsigned char session_id[16], MD5_Init(&md); MD5_Update(&md, buf, bytes); MD5_Final(session_id, &md); + memset(buf, 0, bytes); xfree(buf); }