Skip to content

Commit

Permalink
Merge pull request #390 from lukpueh/ed25519-update
Browse files Browse the repository at this point in the history
ed25519: Adopt update from upstream
  • Loading branch information
lukpueh authored Feb 10, 2022
2 parents c660a86 + 802ee7f commit 96c95fb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions securesystemslib/_vendor/ed25519/ed25519.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ def intlist2bytes(l):


b = 256
q = 2 ** 255 - 19
l = 2 ** 252 + 27742317777372353535851937790883648493
q = 2**255 - 19
l = 2**252 + 27742317777372353535851937790883648493


def H(m):
Expand Down Expand Up @@ -230,14 +230,14 @@ def publickey_unsafe(sk):
See module docstring. This function should be used for testing only.
"""
h = H(sk)
a = 2 ** (b - 2) + sum(2 ** i * bit(h, i) for i in range(3, b - 2))
a = 2 ** (b - 2) + sum(2**i * bit(h, i) for i in range(3, b - 2))
A = scalarmult_B(a)
return encodepoint(A)


def Hint(m):
h = H(m)
return sum(2 ** i * bit(h, i) for i in range(2 * b))
return sum(2**i * bit(h, i) for i in range(2 * b))


def signature_unsafe(m, sk, pk):
Expand All @@ -247,7 +247,7 @@ def signature_unsafe(m, sk, pk):
See module docstring. This function should be used for testing only.
"""
h = H(sk)
a = 2 ** (b - 2) + sum(2 ** i * bit(h, i) for i in range(3, b - 2))
a = 2 ** (b - 2) + sum(2**i * bit(h, i) for i in range(3, b - 2))
r = Hint(
intlist2bytes([indexbytes(h, j) for j in range(b // 8, b // 4)]) + m
)
Expand All @@ -266,11 +266,11 @@ def isoncurve(P):


def decodeint(s):
return sum(2 ** i * bit(s, i) for i in range(0, b))
return sum(2**i * bit(s, i) for i in range(0, b))


def decodepoint(s):
y = sum(2 ** i * bit(s, i) for i in range(0, b - 1))
y = sum(2**i * bit(s, i) for i in range(0, b - 1))
x = xrecover(y)
if x & 1 != bit(s, b - 1):
x = q - x
Expand Down
2 changes: 1 addition & 1 deletion securesystemslib/_vendor/test-ed25519-upstream.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ set -eu
# This commit matches our securesystemslib/_vendor/ed25519/ content.
# If upstream changes, we should review the changes, vendor them,
# and update the hash here
pyca_ed25519_expected="533416699331674a02ec586916b78bf7f515c052"
pyca_ed25519_expected="7d7a33ea320775ee4a00932bbca702e9b7dbcb78"
pyca_ed25519_git_url="https://github.com/pyca/ed25519.git"

pyca_ed25519_main_head=$(git ls-remote "$pyca_ed25519_git_url" main | cut -f1)
Expand Down

0 comments on commit 96c95fb

Please sign in to comment.