-
Notifications
You must be signed in to change notification settings - Fork 1.1k
chore(deps): bump rand in identity and core #6092
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -78,13 +78,13 @@ libp2p = { version = "0.56.0", path = "libp2p" } | |
| libp2p-allow-block-list = { version = "0.6.0", path = "misc/allow-block-list" } | ||
| libp2p-autonat = { version = "0.15.0", path = "protocols/autonat" } | ||
| libp2p-connection-limits = { version = "0.6.0", path = "misc/connection-limits" } | ||
| libp2p-core = { version = "0.43.1", path = "core" } | ||
| libp2p-core = { version = "0.43.2", path = "core" } | ||
| libp2p-dcutr = { version = "0.14.0", path = "protocols/dcutr" } | ||
| libp2p-dns = { version = "0.44.0", path = "transports/dns" } | ||
| libp2p-floodsub = { version = "0.47.0", path = "protocols/floodsub" } | ||
| libp2p-gossipsub = { version = "0.49.0", path = "protocols/gossipsub" } | ||
| libp2p-identify = { version = "0.47.0", path = "protocols/identify" } | ||
| libp2p-identity = { version = "0.2.12" } | ||
| libp2p-identity = { version = "0.2.13" } | ||
| libp2p-kad = { version = "0.48.1", path = "protocols/kad" } | ||
| libp2p-mdns = { version = "0.48.0", path = "protocols/mdns" } | ||
| libp2p-memory-connection-limits = { version = "0.5.0", path = "misc/memory-connection-limits" } | ||
|
|
@@ -124,15 +124,17 @@ futures = "0.3.30" | |
| futures-bounded = { version = "0.2.4" } | ||
| futures-rustls = { version = "0.26.0", default-features = false } | ||
| getrandom = "0.2" | ||
| if-watch = "3.2.1" | ||
| hashlink = "0.9.0" | ||
| hickory-proto = { version = "0.25.2", default-features = false } | ||
| hickory-resolver = { version = "0.25.2", default-features = false } | ||
| if-watch = "3.2.1" | ||
| multiaddr = "0.18.1" | ||
| multihash = "0.19.1" | ||
| multistream-select = { version = "0.13.0", path = "misc/multistream-select" } | ||
| prometheus-client = "0.23" | ||
| quick-protobuf-codec = { version = "0.3.1", path = "misc/quick-protobuf-codec" } | ||
| quickcheck = { package = "quickcheck-ext", path = "misc/quickcheck-ext" } | ||
| rand = { version = "0.9", default-features = false } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might as well specify the patch version. |
||
| rcgen = "0.13" | ||
| ring = "0.17.12" | ||
| rw-stream-sink = { version = "0.4.0", path = "misc/rw-stream-sink" } | ||
|
|
@@ -142,7 +144,6 @@ tracing = "0.1.41" | |
| tracing-subscriber = "0.3.19" | ||
| unsigned-varint = { version = "0.8.0" } | ||
| web-time = "1.1.0" | ||
| hashlink = "0.9.0" | ||
|
|
||
| [patch.crates-io] | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -96,7 +96,25 @@ impl SecretKey { | |
| /// Generate a new random ECDSA secret key. | ||
| #[cfg(feature = "rand")] | ||
| pub fn generate() -> SecretKey { | ||
| SecretKey(SigningKey::random(&mut rand::thread_rng())) | ||
| use k256::elliptic_curve::PrimeField as _; | ||
| use rand::RngCore as _; | ||
|
|
||
| let mut rng = rand::rng(); | ||
| let non_zero_scalar = loop { | ||
| let scalar: p256::Scalar = { | ||
| let mut bytes = k256::FieldBytes::default(); | ||
| loop { | ||
| rng.fill_bytes(&mut bytes); | ||
| if let Some(scalar) = p256::Scalar::from_repr(bytes).into() { | ||
| break scalar; | ||
| } | ||
| } | ||
| }; | ||
| if let Some(non_zero_scalar) = p256::NonZeroScalar::new(scalar).into_option() { | ||
| break non_zero_scalar; | ||
| } | ||
| }; | ||
| SecretKey(non_zero_scalar.into()) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| } | ||
|
|
||
| /// Sign a message with this secret key, producing a DER-encoded ECDSA signature. | ||
|
|
||
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.
I think it we can modify it in-place without reordering