kilic/bls12-381

Outdated and incompatible hash_to_curve

mratsim opened this issue · 1 comments

The library is currently using the hash_to_curve draft 6 scheme.

It is incompatible with what is used in Ethereum Consensus layer (H2C draft 7 minimum), in particular due to the changes in sgn0 introduced in https://github.com/cfrg/draft-irtf-cfrg-hash-to-curve/pull/230/files

See vectors: https://github.com/ethereum/bls12-381-tests

There shouldn't be any impact on the execution layer because there is no hash-to-curve precompile (yet) but EIP2537 will be added soon: https://arachnid.github.io/EIPs/EIPS/eip-2537

Actually scratch that, I read the wrong "sign" function and got confused after reading #30

bls12-381/field_element.go

Lines 160 to 171 in 3a0f255

func (e *fe) signBE() bool {
negZ, z := new(fe), new(fe)
fromMont(z, e)
neg(negZ, z)
return negZ.cmp(z) > -1
}
func (e *fe) sign() bool {
r := new(fe)
fromMont(r, e)
return r[0]&1 == 0
}