'curve' parameter not affecting generated pub key
Closed this issue · 4 comments
In Makefile
if I change line 24 to: APP_LOAD_PARAMS = --curve ed25519
and run the python unit test suite via pytest -s tests/speculos/
and print out the pub_key
variable in tests/speculos/test_pubkey_cmd.py
, I get the same thing as when the secp256k1
curve is selected. I would expect a different pub key given a different curve param. Am I doing something wrong?
Bonus question: where is the mnemonic phrase set and how can I change it?
Bonus question: where is the mnemonic phrase set and how can I change it?
It is set as an argument to Speculos : https://github.com/LedgerHQ/speculos/blob/master/speculos/main.py#L193
Hello @tim-eucalyptus ,
In Makefile if I change line 24 to: APP_LOAD_PARAMS = --curve ed25519 and run the python unit test suite via pytest -s tests/speculos/ and print out the pub_key variable in tests/speculos/test_pubkey_cmd.py, I get the same thing as when the secp256k1 curve is selected. I would expect a different pub key given a different curve param. Am I doing something wrong?
There are two things that controls the derivation curve:
- First the part you found on the
Makefile
which allow to enforce the curve list that can be used. But regarding this:- there was a bug that has been solved recently: #30
- and Speculos doesn't enforce the curve list, only the Bolos OS on real device does.
- Second, the real curve used (or tryed to be used in case the OS denies it) is the one passed as an argument to
os_perso_derive_node_bip32()
call here: https://github.com/LedgerHQ/stax-boilerplate/blob/d071ee3c602caece33495b1fc6df9347aa6bbe56/src/crypto.c#L35
So eventually if you want to cleanly change the derivation curve, and you want it to work on Speculos and on real devices, you should change both parts.
Bonus question: where is the mnemonic phrase set and how can I change it?
It is set as an argument to Speculos : https://github.com/LedgerHQ/speculos/blob/master/speculos/main.py#L193
And you can change it by using the --seed
parameter when launching speculos: https://github.com/LedgerHQ/speculos/blob/master/speculos/main.py#L193
You can see that the default value is the one pointed by @apaillier-ledger .
Hello @tim-eucalyptus
I'll close the issue as I think your question is answered, please feel free to comment or create a new issue if you feel that this is not the case