test(bn254, bls12-381): test points intentionally not on sugroups G1/2#658
Conversation
|
This is very useful, thanks! Currently, as far as I can tell this is not exported? t would be highly useful for external callers to be able to use this, to create points that are not in the right subgroups. Ideally using a custom source, so that fuzzing can produce points reproducably. Either maybe something like Alternatively: not expose the full "generate a point not on subgroup" but the individual smaller parts, making it easier for the outer caller to construct it by themselves. But maybe I'm just misunderstanding, and this is already doable? I'm not a cryptographer, this stuff is hard for me :) |
Hey! func GeneratePointInWrongSubgroup() (*G1Jac, error) {
var f fp.Element
var p G1Jac
_, err := f.SetRandom()
if err != nil {
return &p, err
}
p = fuzzCofactorOfG1Jac(f)
return &p, nil
}be sufficient? We can export this method or similar if so. |
|
Iiuc, using SetRandom like that will make it difficult to emit reproducible points.
|
|
How about taking an fp.Element as input?
|
Description
This is useful for geth fuzzer for bn254 and bls12-381. We could also generify the test for other curves but it's not a priority now IMO.
Type of change
How has this been tested?
Last test in
TestIsOnG2generates points (usingfuzzCofactorOfG*Jac) that pass theIsOnCurvetest but notIsInSubGrouptest.How has this been benchmarked?
N/A
Checklist:
golangci-lintdoes not output errors locally