bug discovered while porting to jaramiko: old-style gex wasn't creating the proper hash. fixed.
This commit is contained in:
parent
e3d9b90ea1
commit
758c18a28b
1
Makefile
1
Makefile
|
@ -65,3 +65,4 @@ test:
|
||||||
# transport.py
|
# transport.py
|
||||||
#
|
#
|
||||||
# POST md5sum on website!
|
# POST md5sum on website!
|
||||||
|
# RUN setup.py
|
||||||
|
|
|
@ -64,6 +64,7 @@ class KexGex (object):
|
||||||
# only used for unit tests: we shouldn't ever send this
|
# only used for unit tests: we shouldn't ever send this
|
||||||
m.add_byte(chr(_MSG_KEXDH_GEX_REQUEST_OLD))
|
m.add_byte(chr(_MSG_KEXDH_GEX_REQUEST_OLD))
|
||||||
m.add_int(self.preferred_bits)
|
m.add_int(self.preferred_bits)
|
||||||
|
self.old_style = True
|
||||||
else:
|
else:
|
||||||
m.add_byte(chr(_MSG_KEXDH_GEX_REQUEST))
|
m.add_byte(chr(_MSG_KEXDH_GEX_REQUEST))
|
||||||
m.add_int(self.min_bits)
|
m.add_int(self.min_bits)
|
||||||
|
@ -228,9 +229,11 @@ class KexGex (object):
|
||||||
hm.add(self.transport.local_version, self.transport.remote_version,
|
hm.add(self.transport.local_version, self.transport.remote_version,
|
||||||
self.transport.local_kex_init, self.transport.remote_kex_init,
|
self.transport.local_kex_init, self.transport.remote_kex_init,
|
||||||
host_key)
|
host_key)
|
||||||
hm.add_int(self.min_bits)
|
if not self.old_style:
|
||||||
|
hm.add_int(self.min_bits)
|
||||||
hm.add_int(self.preferred_bits)
|
hm.add_int(self.preferred_bits)
|
||||||
hm.add_int(self.max_bits)
|
if not self.old_style:
|
||||||
|
hm.add_int(self.max_bits)
|
||||||
hm.add_mpint(self.p)
|
hm.add_mpint(self.p)
|
||||||
hm.add_mpint(self.g)
|
hm.add_mpint(self.g)
|
||||||
hm.add_mpint(self.e)
|
hm.add_mpint(self.e)
|
||||||
|
|
|
@ -179,7 +179,7 @@ class KexTest (unittest.TestCase):
|
||||||
msg.add_string('fake-sig')
|
msg.add_string('fake-sig')
|
||||||
msg.rewind()
|
msg.rewind()
|
||||||
kex.parse_next(paramiko.kex_gex._MSG_KEXDH_GEX_REPLY, msg)
|
kex.parse_next(paramiko.kex_gex._MSG_KEXDH_GEX_REPLY, msg)
|
||||||
H = 'A265563F2FA87F1A89BF007EE90D58BE2E4A4BD0'
|
H = '807F87B269EF7AC5EC7E75676808776A27D5864C'
|
||||||
self.assertEquals(self.K, transport._K)
|
self.assertEquals(self.K, transport._K)
|
||||||
self.assertEquals(H, hexlify(transport._H).upper())
|
self.assertEquals(H, hexlify(transport._H).upper())
|
||||||
self.assertEquals(('fake-host-key', 'fake-sig'), transport._verify)
|
self.assertEquals(('fake-host-key', 'fake-sig'), transport._verify)
|
||||||
|
|
Loading…
Reference in New Issue