-
Notifications
You must be signed in to change notification settings - Fork 120
Use zeroize
crate for SigningKey.
#735
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
base: master
Are you sure you want to change the base?
Use zeroize
crate for SigningKey.
#735
Conversation
`fn secret_scalar` returns a reference to the secret scalar so the value is still zeroed on drop Update `starknet-types-core` version to `0.1.8` everywhere to use the `zeroize` feature
In case this is needed I will create a PR for |
@@ -13,7 +13,7 @@ Stark curve | |||
keywords = ["ethereum", "starknet", "web3", "no_std"] | |||
|
|||
[dependencies] | |||
starknet-types-core = { version = "0.1.7", default-features = false, features = ["curve"] } | |||
starknet-types-core = { version = "0.1.8", default-features = false, features = ["curve"] } |
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.
Latest version of starknet-types-core
support operations on EC points as well starknet-io/types-rs@e0eff28
@@ -100,8 +101,8 @@ impl SigningKey { | |||
} | |||
|
|||
/// Gets the secret scalar in the signing key. | |||
pub const fn secret_scalar(&self) -> Felt { | |||
self.secret_scalar | |||
pub const fn secret_scalar(&self) -> &Felt { |
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.
What motivated a change to &
when Felt
is copiable? Most usage takes a Felt
as argument which would lead to a copy while dereferencing.
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.
What motivated a change to
&
whenFelt
is copiable? Most usage takes aFelt
as argument which would lead to a copy while dereferencing.
For this case, the motivation is to avoid creating another copy of a Felt
that will not be zeroized on drop and stay in memory. Returning just a reference to the internal value will solve this problem, the value will still be zeroized at the end.
… takes a `Felt` as a value but `Felt` is copied and the initial value is left on the stack at the end. New method `fn from_secret` use `SecretString` that implement zeroize and will not leak. Add `test_keystore` test for the keystore Fix tests and examples
fn secret_scalar
returns a reference to the secret scalar so the value is still zeroed on dropUpdate
starknet-types-core
version to0.1.8
everywhere to use thezeroize
feature starknet-io/types-rs@67468ff