Skip to content

Commit 7d3fd86

Browse files
committed
fix TinySig
1 parent 3d77a4f commit 7d3fd86

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/Curta/3_TinySig/Exploit.t.sol

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,15 @@ contract ExploitTest is Test {
4141
}
4242

4343
contract Exploit {
44-
fallback(bytes calldata /* input */ ) external returns (bytes memory output) {
45-
bytes32 h = hex"bd8dced7bc30310eaf6c4532178481e51b3234d90e4da270c3dcdf5aa694ce6b";
46-
uint8 v = 27;
47-
bytes32 r = hex"00000000000000000000003b78ce563f89a0ed9414f5aa28ad0d96d6795f9c63";
48-
return abi.encode(h, v, r);
44+
fallback(bytes calldata /* input */ ) external returns (bytes memory) {
45+
assembly {
46+
let ptr := mload(0x40)
47+
48+
mstore(ptr, 0xbd8dced7bc30310eaf6c4532178481e51b3234d90e4da270c3dcdf5aa694ce6b) // h
49+
mstore(add(ptr, 0x20), 27) // v
50+
mstore(add(ptr, 0x40), 0x3b78ce563f89a0ed9414f5aa28ad0d96d6795f9c63) // r
51+
52+
return(ptr, 96)
53+
}
4954
}
5055
}

0 commit comments

Comments
 (0)