Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
b9f144c
Implement RSA verification
Amxx Mar 12, 2024
41949e6
up
Amxx Mar 12, 2024
0abe46b
simplify
Amxx Mar 13, 2024
0a1691c
test directly from the SigVer15-186-3.rsp
Amxx Mar 13, 2024
1189ae7
update
Amxx Mar 13, 2024
d98a3f9
fix lint
Amxx Mar 13, 2024
2ef35d1
update todo
Amxx Mar 13, 2024
f110d43
up
Amxx Mar 13, 2024
6dcc26d
simplify parser
Amxx Mar 13, 2024
1b2ba49
add RSA to mocks/Stateless.sol
Amxx Mar 13, 2024
fe0927f
Merge branch 'master' into feature/RSA
Amxx Apr 5, 2024
78301ea
Merge branch 'master' into feature/RSA
ernestognw Jun 4, 2024
74d667c
Improve documentation
ernestognw Jun 4, 2024
b6334ea
Add changeset
ernestognw Jun 4, 2024
5379609
Improve comments
ernestognw Jun 4, 2024
667c8b2
Fix
ernestognw Jun 4, 2024
d3eb6a5
Fix test
ernestognw Jun 4, 2024
fbd2130
Nits
ernestognw Jun 4, 2024
cc37629
Improve tests
ernestognw Jun 4, 2024
0127de3
Improve tests 2
ernestognw Jun 4, 2024
445d6fa
Do fix tests
ernestognw Jun 4, 2024
52fdb34
Update .changeset/curvy-crabs-repeat.md
Amxx Jun 4, 2024
f007a74
Add result to test description
ernestognw Jun 4, 2024
d07fb84
Add considerations to _unsafeReadBytes32
ernestognw Jun 4, 2024
b3e56ec
remove extra unsafeReadBytes
Amxx Jun 6, 2024
7596e4d
Merge remote-tracking branch 'amxx/feature/RSA' into feature/RSA
Amxx Jun 6, 2024
5ceb396
doc
Amxx Jun 6, 2024
abe598d
check s < n
Amxx Jun 6, 2024
70a9dea
fix
Amxx Jun 6, 2024
d4096aa
refactor
Amxx Jun 6, 2024
413916f
fix
Amxx Jun 6, 2024
aff3b81
Add replayability warning
ernestognw Jun 6, 2024
84ae125
nit
Amxx Jun 6, 2024
28c8271
Update comment
ernestognw Jun 6, 2024
219100b
Merge remote-tracking branch 'amxx/feature/RSA' into feature/RSA
Amxx Jun 6, 2024
95233b5
test s >= n
Amxx Jun 6, 2024
56eac45
use normal modExp
Amxx Jun 7, 2024
63969dc
Add docs
ernestognw Jun 11, 2024
f50d89a
add replay protection notice in note
cairoeth Jun 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test directly from the SigVer15-186-3.rsp
  • Loading branch information
Amxx committed Mar 13, 2024
commit 0a1691ceff50755b8d184b30d64e4a53dac13b5c
9 changes: 2 additions & 7 deletions contracts/utils/cryptography/RSA.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
pragma solidity ^0.8.20;

import {Math} from "../math/Math.sol";
import {console} from "forge-std/Test.sol";

/**
* TODO:
Expand All @@ -11,10 +10,6 @@ import {console} from "forge-std/Test.sol";
* - Update (refactor/add) tests
*
* Inspired by Adrià Massanet's work: https://github.com/adria0/SolRsaVerify
*
* Checked results with FIPS test vectors
* https://csrc.nist.gov/CSRC/media/Projects/Cryptographic-Algorithm-Validation-Program/documents/dss/186-2rsatestvectors.zip
* file SigVer15_186-3.rsp
*/
library RSA {
/**
Expand All @@ -29,7 +24,7 @@ library RSA {
bytes memory sig,
bytes memory exp,
bytes memory mod
) public view returns (bool) {
) internal view returns (bool) {
return pkcs1Sha256(sha256(data), sig, exp, mod);
}

Expand All @@ -45,7 +40,7 @@ library RSA {
bytes memory sig,
bytes memory exp,
bytes memory mod
) public view returns (bool) {
) internal view returns (bool) {
unchecked {
// cache and check length
uint256 length = mod.length;
Expand Down
Loading