-
-
Notifications
You must be signed in to change notification settings - Fork 665
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
Poetry install: broken dependencies #3687
Comments
Going with nixos is the safe bet. You can install nix on your Mac and then enter |
PyYAML issue fixed here: #3720 |
iiiiii don't think we even need the |
curve25519-donna is used in crypto tests -- and in some strange manner too, i'm having trouble replacing it with any other library. but I don't think breaking the whole env just for two test cases is the right thing to do @onvej-sl you're probably the person who can best look at |
This doesn't work because _ed225519.py implements ed25519 instead of curve25519. Nevertheless, both the curves are birationally equivalent. This means the underlying groups are isomorphic and the isomorphism is easily computable.
I think we can use the package cryptography which is already used in device tests. |
See the diff:--- a/crypto/tests/test_curves.py
+++ b/crypto/tests/test_curves.py
@@ -5,9 +5,9 @@ import hashlib
import os
import random
-import curve25519
import ecdsa
import pytest
+from cryptography.hazmat.primitives.asymmetric.x25519 import X25519PrivateKey
def bytes2num(s):
@@ -344,17 +344,17 @@ 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
@@ -362,10 +362,10 @@ def test_curve25519(r):
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): |
Perfect. Let's do this and drop both curve-donna and ed25519 from pyproject.toml -> #3730 |
Describe the bug
After cloning the main branch poetry won't install pyyaml depenency with python version
3.12.2
and older (see bellow).Firmware version and revision
main
branch. Just clonedgit clone --recurse-submodules https://github.com/trezor/trezor-firmware.git
poetry install
Desktop setup:
macOS Sonoma 14.4.1 (23E224)
3.12.2
also occurs on3.11.9
,3.8.1
and3.8.2
To Reproduce
Steps to reproduce the behavior just follow the build instructions from docs:
git clone --recurse-submodules https://github.com/trezor/trezor-firmware.git
cd trezor-firmware
poetry install
Expected behavior
No error. I can proceed to
4.
cd core
Screenshots
Additional context
The problem is caused by pyyaml version 6.0 as described here. The problem is fixed in pyyaml version 6.0.1 which, for some reason, is not installed during the poetry installation process.
I suspect some dependency requires exactly 6.0.0 version. I have tried to install the pyyaml in an empty dummy project with the exact dependency from trezor-firmware/poetry.lock :
and the latest version
6.0.1
was installed without problems.As a workaround I have tried to remove the
poetry.lock
file and add pyyaml version6.0.1
as the project dependency in pyproject.toml:Which installs the pyyaml correctly but throws another error. The ed25519 installation now failing:
The problem with
ed25519
could be caused by changing the configparser API in python3.12
as described here. The problem seems to be with packageversioneer
in particular which does not seem to be supporting the latest python as described hereSo, I tried several python environments older than 3.12 (
3.11.9
,3.8.1
and3.8.2
).With these older version I got error when installing
curve25519-donna
package:In sum, it is very nice dependency hell and I wonder if there is anyone who could confirm this bug and/or tell me what is the working python version setup on mac OS for the current
master
branch.The text was updated successfully, but these errors were encountered: