[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [stem/master] Fix refactoring regressions
commit cea4f76279f79a65198743e90e300d7b0e1f6a97
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date: Sun Aug 26 13:12:25 2018 -0700
Fix refactoring regressions
Ok, unsurprisingly I buggered this up in a few spots. Mostly regressions from
when I tweaked method argument orderings.
Unfortunatley our Circuit class doesn't have much in terms of test coverage
(... we should really fix that), so exercised these changes by fetching
moria1's descriptor...
>>> import stem.descriptor.remote
>>> print(stem.descriptor.remote.their_server_descriptor(endpoints = (stem.ORPort('128.31.0.34', 9101),)).run()[0])
---
stem/client/__init__.py | 4 ++--
stem/client/cell.py | 6 +++---
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/stem/client/__init__.py b/stem/client/__init__.py
index 486ff0a6..aaa62f5b 100644
--- a/stem/client/__init__.py
+++ b/stem/client/__init__.py
@@ -237,7 +237,7 @@ class Circuit(object):
# successfully sent.
cell = stem.client.cell.RelayCell(self.id, command, data, stream_id = stream_id)
- payload, forward_digest, forward_key = cell.encrypt(self.relay.link_protocol, self.forward_key, self.forward_digest)
+ payload, forward_key, forward_digest = cell.encrypt(self.relay.link_protocol, self.forward_key, self.forward_digest)
self.relay._orport.send(payload)
self.forward_digest = forward_digest
@@ -254,7 +254,7 @@ class Circuit(object):
while reply:
encrypted_cell, reply = split(reply, self.relay.link_protocol.fixed_cell_length)
- decrypted_cell, backward_key, backward_digest = stem.client.cell.RelayCell.decrypt(encrypted_cell, self.backward_key, self.backward_digest)
+ decrypted_cell, backward_key, backward_digest = stem.client.cell.RelayCell.decrypt(self.relay.link_protocol, encrypted_cell, self.backward_key, self.backward_digest)
if self.id != decrypted_cell.circ_id:
raise stem.ProtocolError('Response should be for circuit id %i, not %i' % (self.id, decrypted_cell.circ_id))
diff --git a/stem/client/cell.py b/stem/client/cell.py
index d7053eaf..91dec143 100644
--- a/stem/client/cell.py
+++ b/stem/client/cell.py
@@ -383,7 +383,7 @@ class RelayCell(CircuitCell):
return RelayCell._pack(link_protocol, bytes(payload), self.unused, self.circ_id)
- @classmethod
+ @staticmethod
def decrypt(link_protocol, content, key, digest):
"""
Decrypts content as a relay cell addressed to us. This provides back a
@@ -428,7 +428,7 @@ class RelayCell(CircuitCell):
# # Our updated digest is calculated based on this cell with a blanked
# # digest field.
#
- # digest_cell = RelayCell(self.id, self.command, self.data, 0, self.stream_id, self.recognized, self.unused)
+ # digest_cell = RelayCell(self.circ_id, self.command, self.data, 0, self.stream_id, self.recognized, self.unused)
# new_digest.update(digest_cell.pack(link_protocol))
#
# is_encrypted == cell.recognized != 0 or self.digest == new_digest
@@ -468,7 +468,7 @@ class RelayCell(CircuitCell):
# Pack a copy of ourselves with our newly calculated digest, and encrypt
# the payload. Header remains plaintext.
- cell = RelayCell(self.id, self.command, self.data, new_digest, self.stream_id, self.recognized, self.unused)
+ cell = RelayCell(self.circ_id, self.command, self.data, new_digest, self.stream_id, self.recognized, self.unused)
header, payload = split(cell.pack(link_protocol), header_size)
return header + new_key.update(payload), new_key, new_digest
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits