[#319] crypto: Fix signing in go v1.19

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2022-08-18 13:10:18 +03:00 committed by fyrchik
parent 737e690482
commit 7578b54fac
3 changed files with 15 additions and 5 deletions

View file

@ -31,7 +31,16 @@ func (x Signer) Sign(data []byte) ([]byte, error) {
return nil, err
}
return elliptic.Marshal(elliptic.P256(), r, s), nil
params := elliptic.P256().Params()
curveOrderByteSize := params.P.BitLen() / 8
buf := make([]byte, 1+curveOrderByteSize*2)
buf[0] = 4
_ = r.FillBytes(buf[1 : 1+curveOrderByteSize])
_ = s.FillBytes(buf[1+curveOrderByteSize:])
return buf, nil
}
// Public initializes PublicKey and returns it as neofscrypto.PublicKey.