libp2p / libp2p/go-libp2p

`GenerateSecp256k1` doesn't use the provided random reader source.

Open
#2,791 15 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
6.9k
Forks
1.3k
Avg merge
13d 21h
Merged PRs (30d)
1

Description

Based on the latest version (33.2).

Currently the [`GenerateSecp256k1Key(src io.Reader)`](https://github.com/libp2p/go-libp2p/blob/a86d94e4084861dafb35ce85af0bd7262324a42d/core/crypto/secp256k1.go#L23) accepts a `io.Reader` parameter to use as its source of random ness to generate the new key, however it doesn't actually use the provided reader, and instead uses the default random reader within the `secp256k1` package.

However, the underlying cryptographic package does support using a provided source of randomness as seen [here](https://pkg.go.dev/github.com/decred/dcrd/dcrec/secp256k1/v4#GeneratePrivateKeyFromRand).

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in core/crypto/secp256k1.go at GenerateSecp256k1Key and compare its behavior with the linked GeneratePrivateKeyFromRand API in the secp256k1 package. Add regression coverage showing that the supplied io.Reader is used, and confirm the existing key-generation behavior remains correct.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cryptography
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.