mantlenetworkio / mantle

Mantle | Mass adoption of decentralized & token-governed technologies. With Mantle Network, Mantle Treasury, and token holder-governed products initiatives.

Home Page:https://www.mantle.xyz

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[tss][cs-6.19]: KeySign Message Hash Is Silently Truncated to Curve Order Major

byteflyfunny opened this issue · comments

The function MsgToHashInt checks for an error condition that cannot occur due to the hardcoded nil error value in the called function. Additionally, the function hashToInt silently truncates the msg[] array (essentially a byte[] hash) to the curve order without any checks to ensure that msg[] is well-formed and within the operational bounds of the function, e.g., a minimum or maximum length. This can lead to undesirable behavior.

No matter the length of the msg[] is too large, it will always be truncated to a fixed length in the end.
orderBits := c.Params().N.BitLen() orderBytes := (orderBits + 7) / 8 if len(hash) > orderBytes { hash = hash[:orderBytes] }