mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-23 23:08:14 +00:00
build(deps): drop curve25519-donna and ed25519 from deps
[no changelog]
This commit is contained in:
parent
90afd9c96a
commit
caa3c035e7
@ -5,9 +5,9 @@ import hashlib
|
|||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
|
|
||||||
import curve25519
|
|
||||||
import ecdsa
|
import ecdsa
|
||||||
import pytest
|
import pytest
|
||||||
|
from cryptography.hazmat.primitives.asymmetric.x25519 import X25519PrivateKey
|
||||||
|
|
||||||
|
|
||||||
def bytes2num(s):
|
def bytes2num(s):
|
||||||
@ -344,17 +344,17 @@ def test_validate_pubkey_direct(point):
|
|||||||
def test_curve25519(r):
|
def test_curve25519(r):
|
||||||
sec1 = bytes(bytearray(r.randbytes(32)))
|
sec1 = bytes(bytearray(r.randbytes(32)))
|
||||||
sec2 = bytes(bytearray(r.randbytes(32)))
|
sec2 = bytes(bytearray(r.randbytes(32)))
|
||||||
pub1 = curve25519.Private(sec1).get_public()
|
pub1 = X25519PrivateKey.from_private_bytes(sec1).public_key()
|
||||||
pub2 = curve25519.Private(sec2).get_public()
|
pub2 = X25519PrivateKey.from_private_bytes(sec2).public_key()
|
||||||
|
|
||||||
session1 = r.randbytes(32)
|
session1 = r.randbytes(32)
|
||||||
lib.curve25519_scalarmult(session1, sec2, pub1.public)
|
lib.curve25519_scalarmult(session1, sec2, pub1.public_bytes_raw())
|
||||||
session2 = r.randbytes(32)
|
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)
|
assert bytearray(session1) == bytearray(session2)
|
||||||
|
|
||||||
shared1 = curve25519.Private(sec2).get_shared_key(pub1, hashfunc=lambda x: x)
|
shared1 = X25519PrivateKey.from_private_bytes(sec2).exchange(pub1)
|
||||||
shared2 = curve25519.Private(sec1).get_shared_key(pub2, hashfunc=lambda x: x)
|
shared2 = X25519PrivateKey.from_private_bytes(sec1).exchange(pub2)
|
||||||
assert shared1 == shared2
|
assert shared1 == shared2
|
||||||
assert bytearray(session1) == shared1
|
assert bytearray(session1) == shared1
|
||||||
assert bytearray(session2) == shared2
|
assert bytearray(session2) == shared2
|
||||||
@ -362,10 +362,10 @@ def test_curve25519(r):
|
|||||||
|
|
||||||
def test_curve25519_pubkey(r):
|
def test_curve25519_pubkey(r):
|
||||||
sec = bytes(bytearray(r.randbytes(32)))
|
sec = bytes(bytearray(r.randbytes(32)))
|
||||||
pub = curve25519.Private(sec).get_public()
|
pub = X25519PrivateKey.from_private_bytes(sec).public_key()
|
||||||
res = r.randbytes(32)
|
res = r.randbytes(32)
|
||||||
lib.curve25519_scalarmult_basepoint(res, sec)
|
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):
|
def test_curve25519_scalarmult_from_gpg(r):
|
||||||
|
22
poetry.lock
generated
22
poetry.lock
generated
@ -370,16 +370,6 @@ ssh = ["bcrypt (>=3.1.5)"]
|
|||||||
test = ["certifi", "pretend", "pytest (>=6.2.0)", "pytest-benchmark", "pytest-cov", "pytest-xdist"]
|
test = ["certifi", "pretend", "pytest (>=6.2.0)", "pytest-benchmark", "pytest-cov", "pytest-xdist"]
|
||||||
test-randomorder = ["pytest-randomly"]
|
test-randomorder = ["pytest-randomly"]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "curve25519-donna"
|
|
||||||
version = "1.3"
|
|
||||||
description = "Python wrapper for the Curve25519 cryptographic library"
|
|
||||||
optional = false
|
|
||||||
python-versions = "*"
|
|
||||||
files = [
|
|
||||||
{file = "curve25519-donna-1.3.tar.gz", hash = "sha256:1818a9d5356a05c022cd504f44fe1d2f641a5c020f8a4c51b2294e02bd9c1bf0"},
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "demjson3"
|
name = "demjson3"
|
||||||
version = "3.0.5"
|
version = "3.0.5"
|
||||||
@ -445,16 +435,6 @@ six = ">=1.9.0"
|
|||||||
gmpy = ["gmpy"]
|
gmpy = ["gmpy"]
|
||||||
gmpy2 = ["gmpy2"]
|
gmpy2 = ["gmpy2"]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "ed25519"
|
|
||||||
version = "1.5"
|
|
||||||
description = "Ed25519 public-key signatures"
|
|
||||||
optional = false
|
|
||||||
python-versions = "*"
|
|
||||||
files = [
|
|
||||||
{file = "ed25519-1.5.tar.gz", hash = "sha256:02053ee019ceef0df97294be2d4d5a8fc120fc86e81e08bec1245fc0f9403358"},
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "execnet"
|
name = "execnet"
|
||||||
version = "1.9.0"
|
version = "1.9.0"
|
||||||
@ -1824,4 +1804,4 @@ testing = ["func-timeout", "jaraco.itertools", "pytest (>=6)", "pytest-black (>=
|
|||||||
[metadata]
|
[metadata]
|
||||||
lock-version = "2.0"
|
lock-version = "2.0"
|
||||||
python-versions = "^3.8.1"
|
python-versions = "^3.8.1"
|
||||||
content-hash = "aee23e80ff37c84f73fad88ed177b3459cafb34202e6d1ecf8bf99446d43a401"
|
content-hash = "c1a5ee4dda4cbbfd897232da06ce54e8e9047669d23f825ade8fc395f68a10cd"
|
||||||
|
@ -50,14 +50,12 @@ graphviz = "*"
|
|||||||
|
|
||||||
## cointool
|
## cointool
|
||||||
click = "^8"
|
click = "^8"
|
||||||
ed25519 = "^1.4"
|
|
||||||
requests = "^2.31"
|
requests = "^2.31"
|
||||||
termcolor = "*"
|
termcolor = "*"
|
||||||
Pillow = ">=10.0.1"
|
Pillow = ">=10.0.1"
|
||||||
|
|
||||||
# crypto
|
# crypto
|
||||||
ecdsa = "^0.16"
|
ecdsa = "^0.16"
|
||||||
curve25519-donna = "*"
|
|
||||||
pyasn1 = "*"
|
pyasn1 = "*"
|
||||||
|
|
||||||
# legacy
|
# legacy
|
||||||
|
Loading…
Reference in New Issue
Block a user