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

* Avoid assembly in signature V and S decomposition

* Update ECDSA.sol
pull/3063/head^2
Anton Bukov 3 years ago committed by GitHub
parent e3391cd65f
commit da3a9ae18b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      contracts/utils/cryptography/ECDSA.sol

@ -117,12 +117,8 @@ library ECDSA {
bytes32 r,
bytes32 vs
) internal pure returns (address, RecoverError) {
bytes32 s;
uint8 v;
assembly {
s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)
v := add(shr(255, vs), 27)
}
bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
uint8 v = uint8((uint256(vs) >> 255) + 27);
return tryRecover(hash, v, r, s);
}

Loading…
Cancel
Save