Skip to content

Commit

Permalink
About to refactor final destination
Browse files Browse the repository at this point in the history
  • Loading branch information
gdanezis committed Oct 15, 2017
1 parent 2326369 commit 32e73d6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions sphinxmix/UltrixClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ def create_header(params, nodelist, keys, assoc=None, secrets = None, gamma=None
original_gamma = gamma
new_keys = []
for beta_i, k in zip(beta_all, asbtuples):
gamma = p.mu(p.hmu(k.aes), gamma + beta_i)
gamma2 = p.mu(p.hmu(k.aes), b"XXX"+gamma + beta_i)
gamma = p.mu(p.hmu(k.aes), beta_i)
gamma2 = p.mu(p.hmu(k.aes), b"XXX" + beta_i)
gamma_K += [ gamma2 ]
new_keys += [p.derive_key(k.aes, gamma)]

Expand All @@ -141,7 +141,7 @@ def create_header(params, nodelist, keys, assoc=None, secrets = None, gamma=None
dest_key = p.small_perm_inv(gK, dest_key)

assert len(beta) == (max_len - 32)
return (asbtuples[0].alpha, beta, original_gamma, dest_key), new_keys
return (asbtuples[0].alpha, beta, dest_key), new_keys


def create_forward_message(params, nodelist, keys, dest, msg, assoc=None):
Expand Down Expand Up @@ -216,7 +216,7 @@ def package_surb(params, nymtuple, message):
def receive_forward(params, header, mac_key, delta):
""" Decodes the body of a forward message, and checks its MAC tag."""

_,_,_, dest_key = header
_,_, dest_key = header

delta = params.pii(dest_key, delta)

Expand Down
6 changes: 3 additions & 3 deletions sphinxmix/UltrixNode.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def ultrix_process(params, secret, header, delta, assoc=b''):
"""
p = params
group = p.group
alpha, beta, gamma, dest_key = header
alpha, beta, dest_key = header
original_beta = beta

if params.assoc_len != len(assoc):
Expand Down Expand Up @@ -62,14 +62,14 @@ def ultrix_process(params, secret, header, delta, assoc=b''):
alpha = group.expon(alpha, [ b ])
beta = rest[:(p.max_len - 32)]

gamma = p.mu(p.hmu(aes_s), gamma + original_beta)
gamma = p.mu(p.hmu(aes_s), original_beta)
gamma2 = p.mu(p.hmu(aes_s), b"XXX" + original_beta)
K = p.derive_key(aes_s, gamma)
# delta = p.pii(p.hpi(K), delta)
dest_key = p.small_perm(gamma2, dest_key)
delta = p.xor_rho(p.hpi(K), delta)

mac_key = p.hpi(K)
ret = (tag, routing, ((alpha, beta, gamma, dest_key), delta), mac_key)
ret = (tag, routing, ((alpha, beta, dest_key), delta), mac_key)
return ret

0 comments on commit 32e73d6

Please sign in to comment.