-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from eum602/falcon_precompiled
add falcon interface to test both, precompiled and solidity implement…
- Loading branch information
Showing
6 changed files
with
135 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.7.0; | ||
|
||
import "./Falcon.sol"; | ||
|
||
contract FalconWrap is Falcon { | ||
function verify( | ||
bytes calldata signature, | ||
bytes calldata publicKey, | ||
bytes calldata message | ||
) public returns (int16) { | ||
uint8 signatureType = (uint8(signature[0]) >> 5) & 0x03; | ||
return | ||
verify( | ||
signatureType, | ||
signature, | ||
uint16(signature.length), | ||
message, | ||
uint16(message.length), | ||
publicKey, | ||
uint16(publicKey.length) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
//SPDX-License-Identifier: APACHE2 | ||
pragma solidity ^0.7.0; | ||
|
||
contract FalconInterface { | ||
function verify( | ||
bytes calldata signature, | ||
bytes calldata publicKey, | ||
bytes calldata message, | ||
address falconVerifier | ||
) public returns (bool isValid) { | ||
(bool success, bytes memory verifies) = address(falconVerifier).call( | ||
abi.encodeWithSignature( | ||
"verify(bytes,bytes,bytes)", | ||
signature, | ||
publicKey, | ||
message | ||
) | ||
); | ||
require(success && verifies.length == 32, "Invalid signature"); | ||
return verifies[31] == 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters