mirror of
https://github.com/emmansun/gmsm.git
synced 2025-04-26 04:06:18 +08:00
Test Issue 52075 - generic impl panic when scalar has too many leading zeroes
This commit is contained in:
parent
6450e27784
commit
fc6fce3bbf
@ -277,3 +277,17 @@ func TestP256CombinedMult(t *testing.T) {
|
|||||||
t.Errorf("1×G + (-1)×G = (%d, %d), should be ∞", x, y)
|
t.Errorf("1×G + (-1)×G = (%d, %d), should be ∞", x, y)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestIssue52075(t *testing.T) {
|
||||||
|
Gx, Gy := P256().Params().Gx, P256().Params().Gy
|
||||||
|
scalar := make([]byte, 33)
|
||||||
|
scalar[32] = 1
|
||||||
|
x, y := P256().ScalarBaseMult(scalar)
|
||||||
|
if x.Cmp(Gx) != 0 || y.Cmp(Gy) != 0 {
|
||||||
|
t.Errorf("unexpected output (%v,%v)", x, y)
|
||||||
|
}
|
||||||
|
x, y = P256().ScalarMult(Gx, Gy, scalar)
|
||||||
|
if x.Cmp(Gx) != 0 || y.Cmp(Gy) != 0 {
|
||||||
|
t.Errorf("unexpected output (%v,%v)", x, y)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user