Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(deps): drop curve25519-donna and ed25519 from deps #3730

Merged
merged 1 commit into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions crypto/tests/test_curves.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import os
import random

import curve25519
import ecdsa
import pytest
from cryptography.hazmat.primitives.asymmetric.x25519 import X25519PrivateKey


def bytes2num(s):
Expand Down Expand Up @@ -344,28 +344,28 @@ def test_validate_pubkey_direct(point):
def test_curve25519(r):
sec1 = bytes(bytearray(r.randbytes(32)))
sec2 = bytes(bytearray(r.randbytes(32)))
pub1 = curve25519.Private(sec1).get_public()
pub2 = curve25519.Private(sec2).get_public()
pub1 = X25519PrivateKey.from_private_bytes(sec1).public_key()
pub2 = X25519PrivateKey.from_private_bytes(sec2).public_key()

session1 = r.randbytes(32)
lib.curve25519_scalarmult(session1, sec2, pub1.public)
lib.curve25519_scalarmult(session1, sec2, pub1.public_bytes_raw())
session2 = r.randbytes(32)
lib.curve25519_scalarmult(session2, sec1, pub2.public)
lib.curve25519_scalarmult(session2, sec1, pub2.public_bytes_raw())
assert bytearray(session1) == bytearray(session2)

shared1 = curve25519.Private(sec2).get_shared_key(pub1, hashfunc=lambda x: x)
shared2 = curve25519.Private(sec1).get_shared_key(pub2, hashfunc=lambda x: x)
shared1 = X25519PrivateKey.from_private_bytes(sec2).exchange(pub1)
shared2 = X25519PrivateKey.from_private_bytes(sec1).exchange(pub2)
assert shared1 == shared2
assert bytearray(session1) == shared1
assert bytearray(session2) == shared2


def test_curve25519_pubkey(r):
sec = bytes(bytearray(r.randbytes(32)))
pub = curve25519.Private(sec).get_public()
pub = X25519PrivateKey.from_private_bytes(sec).public_key()
res = r.randbytes(32)
lib.curve25519_scalarmult_basepoint(res, sec)
assert bytearray(res) == pub.public
assert bytearray(res) == pub.public_bytes_raw()


def test_curve25519_scalarmult_from_gpg(r):
Expand Down
22 changes: 1 addition & 21 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,12 @@ graphviz = "*"

## cointool
click = "^8"
ed25519 = "^1.4"
requests = "^2.31"
termcolor = "*"
Pillow = ">=10.0.1"

# crypto
ecdsa = "^0.16"
curve25519-donna = "*"
pyasn1 = "*"

# legacy
Expand Down
Loading