mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-19 03:10:48 +00:00
Fix curve (#429)
* update secp256k1 library from go-eth code * cast deprecated functions to use new BitCurve type * add IsOnCurve checks and tests * add test outcome check * fix test
This commit is contained in:
parent
bbd7d00068
commit
b272e7418c
1 changed files with 4 additions and 10 deletions
|
|
@ -231,7 +231,7 @@ func TestOnCurveDeserialize(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCurveScalarMult(t *testing.T) {
|
func TestCurveScalarMult(t *testing.T) {
|
||||||
curve := crypto.S256()
|
curve := crypto.S256().(*secp256k1.BitCurve)
|
||||||
|
|
||||||
x, y := curve.ScalarBaseMult(curve.Params().N.Bytes())
|
x, y := curve.ScalarBaseMult(curve.Params().N.Bytes())
|
||||||
if x == nil && y == nil {
|
if x == nil && y == nil {
|
||||||
|
|
@ -262,13 +262,7 @@ func TestNilPointerDereferencePanic(t *testing.T) {
|
||||||
t.Error("Failed to Serialize input Ring signature")
|
t.Error("Failed to Serialize input Ring signature")
|
||||||
}
|
}
|
||||||
|
|
||||||
deserializedSig, err := Deserialize(sig)
|
_ , err = Deserialize(sig)
|
||||||
if err != nil {
|
// Should failed to verify Ring signature as the signature is invalid
|
||||||
t.Error("Failed to Deserialize Ring signature")
|
assert.EqualError(t, err, "failed to deserialize, invalid ring signature")
|
||||||
}
|
|
||||||
|
|
||||||
verified := Verify(deserializedSig, false)
|
|
||||||
if verified {
|
|
||||||
t.Error("Should failed to verify Ring signature as the signature is invalid")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue