Comments (4)
FTR, according to the following commands, other syscalls are missing:
monero-app$ ledger-app-monero (master)$ grep 'SVC_Call(' debug/app.asm | cut -d '(' -f 2 | cut -d ',' -f 1 | sed 's/^SYSCALL_//' | sed 's/_ID_IN$//' | sort -u > /tmp/1
speculos $ grep -r 'SYSCALL.*(.*' src/ | grep -v define | cut -d '(' -f 2 | cut -d ',' -f 1 | cut -d ')' -f 1 | sort -u >/tmp/2
$ comm -2 -3 /tmp/1 /tmp/2 | while read l; do grep "<$l>:" debug/app.asm; done | cut -d '<' -f 2 | cut -d '>' -f 1
cx_ecfp_add_point
cx_edward_compress_point
cx_edward_decompress_point
cx_math_invprimem
cx_math_powm
cx_math_sub
cx_math_subm
halt
os_perso_seed_cookie
from speculos.
The main issue with adding point operations to Ed25519 curve is that OpenSSL does not expose the raw operations. Functions like ED25519_sign
, ED25519_verify
and ED25519_public_from_private
all use static functions in https://github.com/openssl/openssl/blob/OpenSSL_1_1_1g/crypto/ec/curve25519.c that are not exported.
Therefore implementing cx_ecfp_scalar_mult
requires either using another library that implements Ed25519 operations, or copy/pasting OpenSSL code in a proper way (if OpenSSL's license allows it). What are your thoughts on this?
from speculos.
Some other suggestions that do not work:
- Using
EC_KEY *key = EC_KEY_new_by_curve_name(NID_X25519);
and OpenSSL operations. This does not work (this function returnsNULL
, because OpenSSL did not implement X25519 key exchange using its low-level EC API) - Using OpenSSL's
X25519()
(that performs a scalar multiplication). But converting points from Ed25519 to Curve25519 still needs to be done, and it not trivial. - Using NaCl, as it only provides a high-level API to Ed25519 (like OpenSSL)
A suggestion that could work:
- Copy a reference implementation like OpenSSL's one or SUPERCOP's one, which is actually what Monero did in https://github.com/monero-project/monero/tree/77a008f71454ce4dd4bce033bc0319a49e2cec51/src/crypto/crypto_ops_builder/ :
- https://github.com/monero-project/monero/tree/77a008f71454ce4dd4bce033bc0319a49e2cec51/src/crypto/crypto_ops_builder/ref10 contains the reference implementation
- https://github.com/monero-project/monero/tree/77a008f71454ce4dd4bce033bc0319a49e2cec51/src/crypto/crypto_ops_builder/ref10CommentedCombined contains the same implementation, with horrible Python scripts that glue the code to Monero (like https://github.com/monero-project/monero/blob/77a008f71454ce4dd4bce033bc0319a49e2cec51/src/crypto/crypto_ops_builder/ref10CommentedCombined/test.py and https://github.com/monero-project/monero/blob/77a008f71454ce4dd4bce033bc0319a49e2cec51/src/crypto/crypto_ops_builder/ref10CommentedCombined/MakeCryptoOps.py#L144-L147 -- have you ever seen Python code that calls
awk
,grep
andsed
while concatenating strings intoos.system()
? Now you have.)
from speculos.
I hope that every missing syscall is now supported (at least for ed25519, and os_perso_seed_cookie
and halt
aren't used by the Monero app.) The Monero app now launches successfully and the command echo '0321000011' | LEDGER_PROXY_ADDRESS=127.0.0.1 LEDGER_PROXY_PORT=9999 ledgerctl send -
displays an address.
Feel free to re-open this issue if I'm wrong.
from speculos.
Related Issues (20)
- Speculos support for new Ledger Stax wallet HOT 1
- ECDSA verify syscall not working
- Any plan to add the BN_MONT_CTX family of functions? HOT 2
- Possible issue using cx_crc32_hw() when testing on Speculos HOT 1
- Support BLS signatures for Chia (XCH) app development
- Visual glitches on web view
- New Stax OCR does not insert spaces into strings HOT 1
- event text is missing spaces HOT 2
- Build fails on M2 Pro HOT 3
- os_lib_call implementation is different from BOLOS' one
- Tron app signature Error HOT 4
- Support openssl 3.0.x
- compile error with test_environment.c HOT 1
- Implementation of cx_bn_cnt_bits function is broken?
- Error building speculos - Preparing metadata (pyproject.toml): finished with status 'error' - M1 max - ARM64 HOT 1
- OCR issue if element are not displayed from top to bottom HOT 1
- ubuntu20.04 cmake -B build/ -S . failed
- Touch (and soon swipe) is not available through the WUI
- Incorrect value returned from `cx_bn_cnt_bits` HOT 3
- Docker build fails on MacOS HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from speculos.