Skip to content

Random point has known discrete log (under some conditions) #1140

@lleoha

Description

@lleoha

This one is subtle.

By taking a look at the random point implementation:

    fn random(mut rng: impl RngCore) -> Self {
        Self::GENERATOR * Scalar::random(&mut rng)
    }

This is technically correct (it is uniform).
One potential problem I have with this that knowing the state of PRNG the caller would know the discrete log of the point and this is also technically fine, but taking into account the context and how this crate can be used it is easy to make a mistake to use this function to create a point nobody is supposed to know dlog of. Imagine the case where some PRNG is seeded with transcript state (I know, far stretched but still).
Another argument would be that many academia papers when just say "sample a random point" they usually meant a point you're not supposed to know dlog of (otherwise they state explicitly to sample scalar s, and do G * s). It is easy to make a mistake if the implementor is not fully aware or blindly follows what the paper says.
I am aware that it is easy to work around and use map to curve or hash to curve on randomly generated data.

Not sure what would be the proposed solution but at least document the proper use cases for it would be nice if changing the implementation itself is too much.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions