Unverified Commit da3a9ae1 by Anton Bukov Committed by GitHub

Avoid assembly in signature V and S decomposition (#3060)

* Avoid assembly in signature V and S decomposition

* Update ECDSA.sol
parent e3391cd6
...@@ -117,12 +117,8 @@ library ECDSA { ...@@ -117,12 +117,8 @@ library ECDSA {
bytes32 r, bytes32 r,
bytes32 vs bytes32 vs
) internal pure returns (address, RecoverError) { ) internal pure returns (address, RecoverError) {
bytes32 s; bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
uint8 v; uint8 v = uint8((uint256(vs) >> 255) + 27);
assembly {
s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)
v := add(shr(255, vs), 27)
}
return tryRecover(hash, v, r, s); return tryRecover(hash, v, r, s);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment