mirror of
https://github.com/emmansun/gmsm.git
synced 2025-04-26 20:26:19 +08:00
tolerate zero-padded scalars in generic implementation
This commit is contained in:
parent
bfdb74af01
commit
dc34e17797
@ -57,7 +57,7 @@ func p256GetScalar(out *[32]byte, in []byte) {
|
||||
n := new(big.Int).SetBytes(in)
|
||||
var scalarBytes []byte
|
||||
|
||||
if n.Cmp(p256.N) >= 0 {
|
||||
if n.Cmp(p256.N) >= 0 || len(in) > len(out) {
|
||||
n.Mod(n, p256.N)
|
||||
scalarBytes = n.Bytes()
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user