Browse Source

fix tls1.0 protocol

dev
BreakWa11 9 years ago
parent
commit
8fb3cc3394
  1. 12
      shadowsocks/obfsplugin/obfs_tls.py

12
shadowsocks/obfsplugin/obfs_tls.py

@ -206,20 +206,20 @@ class tls_auth(plain.plain):
verify_len = 44 - 10 verify_len = 44 - 10
if len(buf) < 44: if len(buf) < 44:
logging.error('server_decode data error') logging.error('server_decode data error')
return decode_error_return(b'') return self.decode_error_return(b'')
if not match_begin(buf, b"\x14" + self.tls_version + "\x00\x01\x01"): #ChangeCipherSpec if not match_begin(buf, b"\x14" + self.tls_version + "\x00\x01\x01"): #ChangeCipherSpec
logging.error('server_decode data error') logging.error('server_decode data error')
return decode_error_return(b'') return self.decode_error_return(b'')
buf = buf[6:] buf = buf[6:]
if not match_begin(buf, b"\x16" + self.tls_version + "\x00\x01\x20"): #Finished if not match_begin(buf, b"\x16" + self.tls_version + "\x00\x20"): #Finished
logging.error('server_decode data error') logging.error('server_decode data error')
return decode_error_return(b'') return self.decode_error_return(b'')
if hmac.new(self.server_info.key + self.client_id, verify[:verify_len], hashlib.sha1).digest()[:10] != verify[verify_len:verify_len+10]: if hmac.new(self.server_info.key + self.client_id, verify[:verify_len], hashlib.sha1).digest()[:10] != verify[verify_len:verify_len+10]:
logging.error('server_decode data error') logging.error('server_decode data error')
return decode_error_return(b'') return self.decode_error_return(b'')
if len(buf) < 38: if len(buf) < 38:
logging.error('server_decode data error') logging.error('server_decode data error')
return decode_error_return(b'') return self.decode_error_return(b'')
buf = buf[38:] buf = buf[38:]
self.raw_trans_recv = True self.raw_trans_recv = True
return (buf, True, False) return (buf, True, False)

Loading…
Cancel
Save