-
Notifications
You must be signed in to change notification settings - Fork 123
remove keystore.c #1719
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
remove keystore.c #1719
Conversation
472a888 to
939adf1
Compare
cedwies
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found no major issues. Nice refactoring. Please consider my comments.
| } | ||
|
|
||
| /// Length of a compressed secp256k1 pubkey. | ||
| const EC_PUBLIC_KEY_LEN: usize = 33; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are you not using bitbox02::secp256k1::EC_PUBLIC_KEY_LEN here? Why did you choose the duplicate value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Removed the constant completely, see added commit.
| /// | ||
| /// # Returns | ||
| /// * `Ok(SignResult)` containing signature in compact format and recoverable id on success | ||
| /// * `Err(())` if the keystore is locked |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doc was moved, but I think this line is incorrect. Does this fn even look at "keystore locked"? Isn't this checked before this fn runs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, see added commit. This used to be true but stopped being true after some refactor in the past.
Fix undefined secp256k1_* symbols when linking firmware. These errors would happen if keystore.c stops referencing the secp256k1 symbols (see later commit). We link libsecp256k1 as a static archive and the linker resolves static libs left-to-right, only pulling in objects that satisfy currently-unresolved symbols. Since the Rust archive introduces the secp256k1_* references, it must appear before the secp256k1 library on the link line (otherwise the linker scans secp256k1 too early and doesn't pull the needed objects).
It has nothing to do with the keystore.
They are not related to the keystore. The keystore.c functions they use will be dealt with in the next commit.
The two remaning functions are unrelated to keystore, and inlined into the Rust C wrappers of secp256k1.
It was a leftover from the time we used libwally-core. The same constant is available in bitcoin::secp256k1::constants::PUBLIC_KEY_SIZE.
keystore locked error used to be the case in the past when this function took the private key from the keystore, but that changed.
cedwies
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for addressing the comments, code review tACK :)
NickeZ
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK
All functions in it are unrelated to the keystore.