status-im / nim-blscurve

Nim implementation of BLS signature scheme (Boneh-Lynn-Shacham) over Barreto-Lynn-Scott (BLS) curve BLS12-381
Apache License 2.0
26 stars 11 forks source link

Update keygen for BLS v2 #59

Closed mratsim closed 4 years ago

mratsim commented 4 years ago

The HKDF info parameter was changed in the BLS draft v2 as mentioned in https://github.com/ethereum/EIPs/issues/2337#issuecomment-624384934

Current

1. PRK = HKDF-Extract("BLS-SIG-KEYGEN-SALT-", IKM)
2. OKM = HKDF-Expand(PRK, "", L)
3. SK = OS2IP(OKM) mod r
4. return SK

https://github.com/status-im/nim-blscurve/blob/4f87e747d8c1310be5660d3e61674392206a91ea/blscurve/bls_signature_scheme.nim#L546-L549

Target

1. PRK = HKDF-Extract("BLS-SIG-KEYGEN-SALT-", IKM || I2OSP(0, 1))
2. OKM = HKDF-Expand(PRK, key_info || I2OSP(L, 2), L)
3. SK = OS2IP(OKM) mod r
4. return SK
mratsim commented 4 years ago

Closed by #65